A way to detect mathjax: \ifmathjax
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
It is not possible to share symbol definition files between full LaTeX and programs using MathJax as a renderer (e.g. previews in VSCode LaTeX plugins). For example, MathJax chokes up at the following definition of the symbol for weak* convergence:
\makeatletter
\def\weaktostar@sym{\setbox0=\hbox{$\rightharpoonup$}\rlap{\hbox
to\wd0{\hss\raise1ex\hbox{$\scriptscriptstyle{*\,}$}\hss}}\box0}
\def\weaktostar{\mathrel{\weaktostar@sym}}
\makeatother
This is the case even if \makeatother, \makeatletter, and use of @ are removed; in the first case all renderings are full of \makeatother gibberish, in the second case only \weaktostar renders full of gibberish.
For rendering in MathJax it would be sufficient to
\def\weaktostar{\stackrel{\hbox{$\scriptscriptstyle{*\,}$}}{\rightharpoonup}}
However, this is a suboptimal rendering for actual LaTeX output. So it would be good if there was a \ifmathjax{…MathJax content…}{…LaTeX content…} macro, and/or, considering also the use of KaTeX by other applications (which could implement the same mechanism), a more general \iffulllatex macro .
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file, test, or entry point is named in the issue. Start by reviewing the MathJax handling of custom LaTeX macros and the supplied \weaktostar examples; done means a documented conditional mechanism can select MathJax-compatible content while preserving the preferred full-LaTeX rendering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100