如何对齐 MathJax 中的分离方程?
How to align separated equations in MathJax?
例如,考虑这个 .md
文件,其中 $$
符号被处理为 MathJax:
This is the first equation
$ + 1 = 2$$
This is the second equation
$ + 10 = 20$$
This is the third equation
$0 + 100 = 200$$
如果所有三个方程都在一个 $$
对中,我会像往常一样使用 \begin{align}...\end{align}
。但是,我不能在这里这样做。我需要所有三个方程都沿着 =
符号对齐,但文本描述打断了方程的流程。文字描述无法删除,必须放在原处。
所以,我的问题是,如何将所有三个方程式沿 =
符号对齐?
可以用\phantom
将三个方程中的内容等化,使它们排成一行,如下:
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/latest.js?config=TeX-AMS_CHTML"></script>
This is the first equation
$$\phantom{00}1 + 1 = 2$$
This is the second equation
$$\phantom{0}10 + 10 = 20$$
This is the third equation
$0 + 100 = 200$$
但这需要仔细分析公式,对于更复杂的公式,这可能不是一种可行的方法。但它很容易适用于这些特定的方程式。
正如彼得所说,目前还没有通用的方法。
例如,考虑这个 .md
文件,其中 $$
符号被处理为 MathJax:
This is the first equation
$ + 1 = 2$$
This is the second equation
$ + 10 = 20$$
This is the third equation
$0 + 100 = 200$$
如果所有三个方程都在一个 $$
对中,我会像往常一样使用 \begin{align}...\end{align}
。但是,我不能在这里这样做。我需要所有三个方程都沿着 =
符号对齐,但文本描述打断了方程的流程。文字描述无法删除,必须放在原处。
所以,我的问题是,如何将所有三个方程式沿 =
符号对齐?
可以用\phantom
将三个方程中的内容等化,使它们排成一行,如下:
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/latest.js?config=TeX-AMS_CHTML"></script>
This is the first equation
$$\phantom{00}1 + 1 = 2$$
This is the second equation
$$\phantom{0}10 + 10 = 20$$
This is the third equation
$0 + 100 = 200$$
但这需要仔细分析公式,对于更复杂的公式,这可能不是一种可行的方法。但它很容易适用于这些特定的方程式。
正如彼得所说,目前还没有通用的方法。