Open asmeurer opened 6 years ago
Please note that there are two different but related suggestions:
$\displaystyle ...$
instead of $$...$$
to show equationsYou (@asmeurer) seem to be concentrating on the second point, while for me (@mgeier) the first point is much more important.
The first point actually fixes equations in notebooks converted to LaTeX documents, the second would be just the logical next step, without much impact on users.
The first can be done without the second, doing the second without the first would not be a good idea.
If both are done, the first should be done first.
Not sure this is the right place for this issue or if it has been raised elsewhere - I am a Jupyter consumer rather than developer - recently inline LaTeX in markdown cells is not nicely typeset - it used to be inline as expected, now (as of at least nbformat 4.4.0* - maybe earlier) it introduces either one or two newlines - either after the maths, or before and after the maths. This makes using notebooks as a computable document format rather ugly. My project (MuMoT.readthedocs.io) relies on this quite heavily and the paper describing it is just coming out, so be nice to get this looking good again or figure out if there's a workaround or option somewhere...
Well I recently noticed this. Any possibility that the second can also be done?
I have created PRs for the second point at the Jupyter repo: https://github.com/jupyterlab/jupyterlab/pull/16967 and https://github.com/jupyterlab/jupyterlab/pull/16968.
I guess if merged, these changes will make their way back to the (non-classic) Notebook?
After that, this issue can be closed.
See the discussion at https://github.com/sympy/sympy/pull/15329.
Right now, outputs that are text/latex are left aligned, for instance, from SymPy:
SymPy produces
$$\sqrt{3}$$
, which according to LaTeX, should be centered. Indeed, if you nbconvert the notebook to PDF, it centers it, because it just inserts the LaTeX literally. But the notebook uses CSS to force all text/latex outputs to be non-centered.At https://github.com/sympy/sympy/pull/15329, a change was suggested for SymPy's output to use
$\displaystyle \sqrt{3}$
, which makes no difference in the HTML notebook due to the CSS, but forces left alignment in the PDF output. I argued that nbconvert should be changed instead to left align all math outputs, regardless if they use \displaystyle or not, since nbconvert should try to produce a PDF that matches the HTML as closely as possible.However, @mgeier argues that perhaps it is more correct for the notebook to not force math to be left-aligned, and respect equation style vs. inline style, and for things that output math to choose which one to output appropriately.
I would like input from the notebook devs on what they think is the appropriate fix here. Depending on which fix is decided upon, this is either a notebook issue or an nbconvert issue, but I'm opening this here for maximum visibility.
Relevant issues:
https://github.com/sympy/sympy/pull/15329 https://github.com/ipython/ipython/pull/11357 https://github.com/jupyter/nbconvert/pull/892 https://github.com/jupyter/nbconvert/issues/275 https://github.com/jupyterlab/jupyterlab/issues/3938