公式部分(忽略文本)不会水平居中。这是我的代码
\begin{align*}
a_{3k+3} & = a_{3k+2} + 2a_{3k+1} \\
& = a_{3k+1} + 2a_{3k} + 2a_{3k + 1} \\
& = 3a_{3k+1} + 2a_{3k} \\
& = 3a_{3k+1} + 2(3m) \hspace{5mm} \text{(by the Induction Hypothesis)} \\
& = 3(a_{3k+1} + 2m) \\
& = 3d \hspace{5mm} \text{for some integer $d$}
\end{align*}
结果如下
为什么它不能水平居中?
答案1
align
(而不是 TeX 的显示数学设置)将把整个方程作为一个框,并将其水平居中放置在文本区域中。这将包括您使用 插入方程中的文本\text
。
如果您不想\text
在 TeX 测量方程式时考虑到这一点,您可以使用以下命令“隐藏”文本的宽度\rlap
:\rlap
将在当前位置右侧的零宽度框中排版文本(\llap
将排版到左侧),有效地隐藏文本的宽度:
\begin{align*}
a_{3k+3} & = a_{3k+2} + 2a_{3k+1} \\
& = a_{3k+1} + 2a_{3k} + 2a_{3k + 1} \\
& = 3a_{3k+1} + 2a_{3k} \\
& = 3a_{3k+1} + 2(3m) \quad \rlap{(by the Induction Hypothesis)} \\
& = 3(a_{3k+1} + 2m) \\
& = 3d \quad \rlap{for some integer $d$}
\end{align*}
如果你看一下输出,lua-visual-debug
你会发现在数学框中“看不到”该文本:
完整示例:
\documentclass{article}
\usepackage[margin=4cm]{geometry}
\usepackage{amsmath}
% \usepackage{lua-visual-debug}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\begin{align*}
a_{3k+3} & = a_{3k+2} + 2a_{3k+1} \\
& = a_{3k+1} + 2a_{3k} + 2a_{3k + 1} \\
& = 3a_{3k+1} + 2a_{3k} \\
& = 3a_{3k+1} + 2(3m) \quad \rlap{(by the Induction Hypothesis)} \\
& = 3(a_{3k+1} + 2m) \\
& = 3d \quad \rlap{for some integer $d$}
\end{align*}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{document}