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
Currently, latex source blocks are turned into SVGs and those SVGs are included in LaTeX and HTML exports. For LaTeX export, this behavior is very wrong. Instead, it should be passed the source code so that the LaTeX engine can evaluate it itself. There is a challenge to this: in order for SVG generation to work in org files (and possibly HTML, depending on whether the LaTeX source or SVG is exported), we must provide a full LaTeX source file. However, the exported LaTeX should only be the body (e.g. \begin{equation}...\end{equation}). The current org implementation solves this by adding the preamble and \begin{document}...\end{document} outside of the body, so the body is only the portion that needs to be exported. This is a good solution. However, it's currently hampered by the preamble and the document environment not being sufficiently customizable. I've mostly solved this in my my patch. However, I haven't allowed customization of \begin{document}...\end{document} which means that {\color{fg}...} still must be placed in the block contents. So that patch should be adjusted to allow customizing the document environment.
HTML poses an additional challenge, which is that custom LaTeX commands defined in the preamble (e.g. \norm) won't be visible to latexml when converting the math expressions to mathml. I believe there are two non-exclusive solutions to this: (1) we might be able to explicitly provide these definitions to latexml so that it can use these commands and (2) we could use SVG generation in cases where latexml would otherwise fail. SVG generation should already be used when generating tikz pictures for HTML export, so doing this on a case-by-case basis for LaTeX source blocks is easy.
The text was updated successfully, but these errors were encountered:
Currently, latex source blocks are turned into SVGs and those SVGs are included in LaTeX and HTML exports. For LaTeX export, this behavior is very wrong. Instead, it should be passed the source code so that the LaTeX engine can evaluate it itself. There is a challenge to this: in order for SVG generation to work in org files (and possibly HTML, depending on whether the LaTeX source or SVG is exported), we must provide a full LaTeX source file. However, the exported LaTeX should only be the body (e.g.
\begin{equation}...\end{equation}
). The current org implementation solves this by adding the preamble and\begin{document}...\end{document}
outside of the body, so the body is only the portion that needs to be exported. This is a good solution. However, it's currently hampered by the preamble and the document environment not being sufficiently customizable. I've mostly solved this in my my patch. However, I haven't allowed customization of\begin{document}...\end{document}
which means that{\color{fg}...}
still must be placed in the block contents. So that patch should be adjusted to allow customizing the document environment.HTML poses an additional challenge, which is that custom LaTeX commands defined in the preamble (e.g.
\norm
) won't be visible to latexml when converting the math expressions to mathml. I believe there are two non-exclusive solutions to this: (1) we might be able to explicitly provide these definitions to latexml so that it can use these commands and (2) we could use SVG generation in cases where latexml would otherwise fail. SVG generation should already be used when generating tikz pictures for HTML export, so doing this on a case-by-case basis for LaTeX source blocks is easy.The text was updated successfully, but these errors were encountered: