To illustrate CoCalc issue #4569: "Jupyter markdown cells: newcommand and LaTeX formulas" -- https://github.com/sagemathinc/cocalc/issues/4569
License: OTHER
LaTeX, newcommand, Jupyter markdown cells, CoCalc
LaTeX formulas with newcommand-defined bits in Jupyter markdown cells on CoCalc
author: Samuel Lelièvre (orcid: 0000-0002-7275-0965)
date: 2020-05-04
license: CC0 1.0 Universal (CC0 1.0)
This is to illustrate
Experiment
Two markdown cells with the same bit of math, first not using \newcommand
, then using it.
Cell A
We denote by the span of two vectors and .
Cell B
We denote by the span of two vectors and .
Observations
The formula is text in Cell A but an image in Cell B.
When viewing this Jupyter notebook in one's CoCalc project,
in Cell A
one can select text that includes the formula or part of it
this selection can be done character by character
the selected text gets highlighted in inverted colors (white on blue)
the highlighting applies to the selected part of the formula as well
in Cell B
selecting some text, one can include the whole formula or none of it
no way to select part of it, character by character
highlighting in inverted colors does not apply to the formula if selected
if "denote by span(u,v) the span" is selected, "span(u,v)" stays unhighlighted
If this Jupyter notebook is made public on the CoCalc share server
in Cell A
the formula "span(u,v)" gets rendered
in Cell B
the formula "span(u,v)" is missing
Tentative explanation
Not really sure exactly what goes on but if I had to guess:
KaTeX renders the formula in Cell A as text but the one in Cell B as an image.
this explains the differences in highlighting
this probably also explains the non-rendering on the CoCalc share server
maybe the image lives in some hidden directory
maybe it is not made public when the Jupyter notebook is