Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org babel latex: export latex source for html and latex backends #2

Open
matthuszagh opened this issue Sep 2, 2020 · 1 comment
Open

Comments

@matthuszagh
Copy link
Owner

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.

@matthuszagh
Copy link
Owner Author

Updated patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant