Forgot password?
 Register account
View 13081|Reply 5

将 LaTeX 转换成 MathJax

[Copy link]

3153

Threads

7906

Posts

610K

Credits

Credits
64096
QQ

Show all posts

hbghlyj Posted 2021-11-4 05:09 |Read mode
Last edited by hbghlyj 2025-5-29 05:25tex.stackexchange.com/questions/68916/convert … atex-to-mathjax-html
在命令行执行
make4ht filename.tex "mathjax"
发现有一些不足之处:
tikzcd没有转换成svg,而mathjax也不支持...
解决办法...再执行一次,不加"mathjax"这个参数,将得到的svg图逐个手动插入html
tikz画的图里面的\hyperlink转换后丢失
解决办法...在svg代码中逐个手动插入链接
mathjax不支持intertext见github.com/mathjax/MathJax/issues/736
解决办法:手动逐个将\intertext{TEXT}换成\end{xxx} TEXT \begin{xxx}
脚注会放到不同的文件里
解决办法:用脚本批量合并它们
github.com/michal-h21/make4ht
make4ht -u -f html5+mjcli filename.tex "mathjax" "fn-in"
使用"fn-in"这样就可以把脚注放到同一个html文件里了


其他方法:
latexml
lwarp Tutorial and working example for mathematics lecture notes that compile to both PDF and HTML - requiring only minimal changes to the original tex

768

Threads

4685

Posts

310K

Credits

Credits
35004

Show all posts

isee Posted 2021-11-4 08:40
回复 1# hbghlyj

起得真早啊,不过,这是干啥用的哇

3153

Threads

7906

Posts

610K

Credits

Credits
64096
QQ

Show all posts

 Author| hbghlyj Posted 2021-11-4 16:33
Last edited by hbghlyj 2025-5-29 05:05MathJax does NOT implement \lefteqn But you could define your own version
  1. \def\lefteqn#1{\rlap{\displaystyle{#1}}}
Copy the Code
latexref.xyz/eqnarray.html
webhome.phy.duke.edu/~rgb/General/latex/lefteqn.html
eqnarray 环境提供了 \lefteqn 命令,可以在公式的等号左边部分过长时使用。示例:
  1. \begin{eqnarray*}
  2.     \lefteqn{a + b + c + d + e + f + g + h} \\
  3.     & = & i + j + k + l + m \\
  4.     & = & n + o + p + q + r + s
  5. \end{eqnarray*}
  6. \begin{eqnarray*}
  7.     \lefteqn{a + b + c + d + e + f + g + h} \\
  8.     & = & i + j
  9. \end{eqnarray*}
Copy the Code
输出:

等号右边部分过短时公式可能不会居中。

3153

Threads

7906

Posts

610K

Credits

Credits
64096
QQ

Show all posts

 Author| hbghlyj Posted 2021-11-13 01:25
Last edited by hbghlyj 2025-5-29 05:04How to use textup with MathJax?
  1. \let\textup\textrm
Copy the Code
\textnormal command is not supported
Note that \textrm is defined in MathJax as a macro, and it calls on \text internally.
The \textnormal→\textrm does not make much sense for the reasons that \textnormal is more like \text in matching the "surrounding environment" in MathJax.
  1. \let\textnormal\textrm
Copy the Code
using Big operator with Times does not work
  1. \def\bigtimes{\mathop{\vcenter{\huge\times}}}
Copy the Code
Mathjax does not recognize \prescript
MathML has a prescripts mechanism using <mmultiscripts> and <mprescripts> so in MathJaX you also have the possibility of directly accessing those rather than relying on conversion from some "standard" LaTeX package markup. You can generate any MatHML element from the TeX MathJax syntax using \mmlToken
make \sideset more strict
  1. \newcommand{\sideset}[3]{\mathop{\vphantom{#3}}\nolimits#1\!#3\nolimits#2}
Copy the Code
simple stmaryrd extension
  1. \def\mapsfrom{\mathrel{\unicode{8612}}}
Copy the Code

3153

Threads

7906

Posts

610K

Credits

Credits
64096
QQ

Show all posts

 Author| hbghlyj Posted 2021-11-20 18:16
Last edited by hbghlyj 2025-5-29 04:53Macro: arc symbol under, over
  1. \overset{\mmlToken{mo}{&#x23DC;}}{XYZ}
  2. \underset{\mmlToken{mo}{&#x23DD;}}{XYZ}
Copy the Code
左括弧$\lparen$的代码是\lparen
左竖杠$\lvert$的代码是\lvert
左双竖杠$\lVert$的代码是\lVert
左方括号$\lbrack$的代码是\lbrack
左花括号$\lbrace$的代码是\lbrace
左尖括号$\langle$的代码是\langle
左地板号$\lfloor$的代码是\lfloor
左天花板$\lceil$的代码是\lceil
左胡须号$\lmoustache$的代码是\lmoustache
要打出右括号统一把 l 改为 r 即可
$\left<1\over2\right>$的代码是\left<1\over2\right>
$\left/1\over2\right/$的代码是\left/1\over2\right/
还可以用\DeclarePairedDelimiter、\DeclarePairedDelimiterX、\DeclarePairedDelimiterXPP自定义
其中mathtools extension定义了\lparen
Easily change behavior of \DeclarePairedDelimiter
MathJax Issue #2313

3153

Threads

7906

Posts

610K

Credits

Credits
64096
QQ

Show all posts

 Author| hbghlyj Posted 2025-5-29 04:33
回复 2# isee
把latex转换成html啊,然后就可以发布到网上

latex-to-internet/internetmathjax.text.code.tex

Mobile version|Discuz Math Forum

2025-6-5 01:16 GMT+8

Powered by Discuz!

× Quick Reply To Top Edit