You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem:
If the output of a cell created with handcalcs is too long, the pdf just truncates it.
I tried to pinpoint where the problem originates, in order to plan a solution, but I don't understand if I can set up correctly handcals, because the creation of the pdf (performed by nbconvert) seems to be limited by the source (thus the NOTEBOOK.ipynb).
I'm sure that I'm not the first person to encounter a truncated line in the pdf, so how do you solve this problem?
More details:
I'm on linux (Arch) and I use a simple command line to create the html (then printed in pdf in the browser) or directly the pdf:
This procedure should be the same of using JupyterLab.
Here are some images to ease the explanation:
Image 1. The cell in vscode with a long line
Image 2. The html file (converted from the notebook)
Image 3. The pdf converted from the html using "Print to pdf" (NB: some lines are not complete)
Image 4. The pdf file (converted from the notebook) (NB: some lines are not complete)
Code:
And here's the code of the example for replicating the problem:
Cell 1:
import handcalcs.render
import forallpeople as si
si.environment('structural', top_level=False)
def sN(a):
return '{:.3e}'.format(a) # to see the result in the scientific notation
Cell 2:
%%render params 2
d = 200*si.mm
b_f = 100*si.mm
t_w = 5.6*si.mm
t_f = 8.5*si.mm
r = 12*si.mm
Cell 3:
%%render
I_y_IShape = (b_f*d**3-(b_f-t_w)*(d-2.0*t_f)**3)/12.0+0.8584*r**2*(0.5*d-t_f-0.4467*r/2.0)**2 # With fillets
I_y_scientificNotation = sN(I_y_IShape)
The text was updated successfully, but these errors were encountered:
Yeah, this has been something that has bothered me for a long time.
The short answer is that it is a problem with the render to PDF engine and I am unsure how to fix it.
It seems to happen both when rendering to HTML in the browser and apparently in LaTeX, as shown by your example.
I have two strategies for managing this in my own calcs:
I break up the calculation into pieces (if there are obvious "components" separated by + or - operators)
I use the browser Print dialog to scale the page until the calculation fits, switching to landscape if it makes sense to.
In an earlier version of handcalcs, I used the /gather environment for the long calcs. However, because this environment was not supported by Katex (at the time, anyway), I switched away from it. The gather environment gives a liiiitle bit of extra room on the line.
For HTML rendering this is an upstream issue for Katex and MathJax to address. In LaTeX, additional layout code or macros would need to be added to the document in order to correct it (I think...).
Problem:
If the output of a cell created with handcalcs is too long, the pdf just truncates it.
I tried to pinpoint where the problem originates, in order to plan a solution, but I don't understand if I can set up correctly handcals, because the creation of the pdf (performed by nbconvert) seems to be limited by the source (thus the NOTEBOOK.ipynb).
I'm sure that I'm not the first person to encounter a truncated line in the pdf, so how do you solve this problem?
More details:
I'm on linux (Arch) and I use a simple command line to create the html (then printed in pdf in the browser) or directly the pdf:
jupyter nbconvert --to html/pdf --no-input NOTEBOOK.ipynb
This procedure should be the same of using JupyterLab.
Here are some images to ease the explanation:
Image 1. The cell in vscode with a long line
Image 2. The html file (converted from the notebook)
Image 3. The pdf converted from the html using "Print to pdf" (NB: some lines are not complete)
Image 4. The pdf file (converted from the notebook) (NB: some lines are not complete)
Code:
And here's the code of the example for replicating the problem:
Cell 1:
Cell 2:
Cell 3:
The text was updated successfully, but these errors were encountered: