astefanutti / decktape

PDF exporter for HTML presentations
MIT License
2.2k stars 177 forks source link

Mathjax / Latex rendering issues with formulas , spacing issue #244

Open hugokoopmans opened 2 years ago

hugokoopmans commented 2 years ago

Hi there,

Love your work really usefull, I have several jupyter notebooks that worj great render fine. Now I have some new ones that have issues with rendering the mathjax formulas. It seems the space after formula is indented so the text after the formula and the formula itself are printed over each other.

CLI output:

$(npm bin)/decktape rise -s 1920x1080 --load-pause=20000 http://localhost:8888/notebooks/programma/P11-statistics-tests-regression-matrices/P11-statistical-tests.ipynb?token=3ce5f5dd615cdbdec7526adfcdb70acc6c25228748f79bca P11-statistical-tests.pdf
Loading page http://localhost:8888/notebooks/programma/P11-statistics-tests-regression-matrices/P11-statistical-tests.ipynb?token=3ce5f5dd615cdbdec7526adfcdb70acc6c25228748f79bca ...
actions jupyter-notebook:find-and-replace does not exist, still binding it in case it will be defined later...
load_extensions { '0': 'rise/main',
  '1': 'nbextensions_configurator/config_menu/main',
  '2': 'contrib_nbextensions_help_item/main',
  '3': 'hide_input/main',
  '4': 'python-markdown/main',
  '5': 'spellchecker/main' }
Loaded moment locale en
Loading extension: nbextensions_configurator/config_menu/main
Session: kernel_created (ba1f17b0-0f54-41e3-965a-cfdee7c6fa7e)
Starting WebSockets: ws://localhost:8888/api/kernels/f1d30021-f182-49a6-8cf9-e79823b091d3
Loading extension: rise/main
Loading extension: contrib_nbextensions_help_item/main
Loading extension: hide_input/main
Loading extension: python-markdown/main
Kernel: kernel_connected (f1d30021-f182-49a6-8cf9-e79823b091d3)
Refused to apply style from 'http://localhost:8888/nbextensions/rise/reveal.js/css/theme/simpel.css?v=20220613085410' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Refused to apply style from 'http://localhost:8888/notebooks/programma/P11-statistics-tests-regression-matrices/P11-statistical-tests.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Kernel: kernel_ready (f1d30021-f182-49a6-8cf9-e79823b091d3)
Loading extension: spellchecker/main
[spellchecker] toggled on
Access to font at 'about:blank' from origin 'http://localhost:8888' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-untrusted, https.

Unable to load resource from URL: about:blank
Failed to load resource: net::ERR_FAILED
Failed to load resource: the server responded with a status of 404 (Not Found)
Widgets are not available.  Please install widgetsnbextension or ipywidgets 4.0
Loading page finished with status: 200
RISE plugin activated
Printing slide #/slide-23-0 (24/24) ...
Printed 24 slides

Strange thing is it is not happening all the time and even on one slide sometimes yes sometimes not... image

hugokoopmans commented 2 years ago

ANalysis Of VAriance : ANOVA

Assumption: $ \overline{X} $ follows a normal distribution with mean $ \mu $ and variance $ \frac{\sigma^2}{n} $

The ANOVA is based on the law of total variance, where the observed variance in a particular variable is partitioned into components attributable to different sources of variation. In its simplest form, ANOVA provides a statistical test of whether two or more population means are equal, and therefore ANOVA generalizes the t-test beyond two means.

hugokoopmans commented 2 years ago

the jupyter notebook renders fine the issue is when converting to PDF

hugokoopmans commented 2 years ago

decktape version 3.4.0

astefanutti commented 2 years ago

It's possible that Decktape starts converting a slide to PDF while MathJax hasn't completed updating it.

I drafted a while back using MathJax signals, but it has to be revived, if that is the actual root cause of the issue.

hugokoopmans commented 2 years ago

That's why i added this option : --load-pause=20000 ? I will review your link asap

astefanutti commented 2 years ago

That's why i added this option : --load-pause=20000 ?

The --load-pause option adds an initial delay, and I'm not sure that's enough to guarantee everything is loaded, depending on how RISE works. Maybe increasing the pause for each slide, with the --pause option, would help.

Another test that would help to identify the root cause would be to export screenshots, with the --screenshots option, and see if the issue also affects the image export.

keflavich commented 2 years ago

Thanks for the --load-pause tip; that solved a problem I was facing (same error).