Hello,
The other day I wanted to do some additional styling of LaTeX (MathJax)
elements, however, I noticed that none of them were actually captured in any
HTML tag or CSS class, making this a bit cumbersome.
So I spent a bit of time to look things up and see if this could be fixed and
came up with the attached patch, which wraps all LaTeX fragments in a <span
class="equation"> tag. Ideally, one should probably have separate CSS classes
for inline fragments and full environments, but I wasn't really able to figure
out how to separate those.
Also, I don't know if this interferes with anything else, but it seems to work
fine in some pretty big org-mode files for me at least.
Below is also a simple test org-mode file, in case someone wants to try it out
or add more test cases.
#+TITLE: LaTeX to HTML Math Tests
#+OPTIONS:
* Environments
This section should contain some supported MathJax environments.
\begin{equation}
e = mc^{2}
\end{equation}
\begin{equation*}
f = ma
\end{equation*}
* Inline
In this section we are talking about inline math, such as the
equations \(e = mc^{2}\) or $f = ma$, which were proposed by some
famous person.
Best regards,
Gustaf
Emacs : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
of 2023-04-04
Package: Org mode version 9.6.2 (release_9.6.2 @ /home/guswal01/.local/share/emacs/30.0.50/lisp/org/)
current state:
==============
(setq
org-link-elisp-confirm-function 'yes-or-no-p
org-directory "/home/guswal01/.config/emacs/org/"
org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3 "\n\n(fn ENTRY)"]
org-log-into-drawer t
org-latex-images-centered nil
org-persist-after-read-hook '(org-element--cache-persist-after-read)
org-export-before-parsing-hook '(org-attach-expand-links)
org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
org-archive-hook '(org-attach-archive-delete-maybe)
org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"]
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines
org-cycle-optimize-window-after-visibility-change org-cycle-display-inline-images)
org-persist-before-read-hook '(org-element--cache-persist-before-read)
org-modules '(org-tempo ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail
ol-eww)
org-mode-hook '(#[0 " \205