mathjax / mathjax/MathJax

A way to detect mathjax: \ifmathjax

Open
#2,180 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.