我想知道在对齐环境中制作多行文本注释的最佳方法是什么。以下是示例代码:
\begin{align*}
\int \left( \frac{x+3}{2}\right) \, dx =& \int \frac{1}{2}(x+3) \, dx & \text{Factoring out a constant.} \\
=& \frac{1}{2} \int (x+3) \, dx & \text{Factoring the constant outside the integral} \\
=& \frac{1}{2}[\frac{1}{2}x^2+3x]+C & \text{Applying the power rule and adding the constant of integration} \\
=& \frac{1}{4}x^2+\frac{3}{2}x+C & \text{Distributing the } \frac{1}{2} \\
=& \frac{x^2+6x}{4}+C& \text{Finding a common denominator} \\
=& \frac{x(x+6)}{4}+C & \text{Factoring out an } x
\end{align*}
我不太喜欢第三行中接近等式的注释,其中写着“应用幂律......”,有没有什么巧妙的方法可以制作出看起来不尴尬的两行注释?
答案1
使用amsmath
包代码:
方法 1:
\begin{align*}
\int \left( \frac{x+3}{2}\right) \, dx
=& \int \frac{1}{2}(x+3) \, dx && \text{Factoring out a constant} \\
=& \frac{1}{2} \int (x+3) \, dx && \text{Factoring the constant outside the integral} \\
=& \frac{1}{2}\left[\frac{1}{2}x^2+3x\right]+C && \text{Applying the power rule and }\\
& && \text{adding the constant of integration} \\
=& \frac{1}{4}x^2+\frac{3}{2}x+C && \text{Distributing the } \frac{1}{2} \\
=& \frac{x^2+6x}{4}+C && \text{Finding a common denominator} \\
=& \frac{x(x+6)}{4}+C && \text{Factoring out an }
\end{align*}
方法 2:采用 Barbara Beeton 的\parbox
建议:
\begin{align*}
\int \left( \frac{x+3}{2}\right) \, dx
=& \int \frac{1}{2}(x+3) \, dx && \text{Factoring out a constant} \\
=& \frac{1}{2} \int (x+3) \, dx && \text{Factoring the constant outside the integral} \\
=& \frac{1}{2} \left[ \frac{1}{2}x^2+3x \right]+C && \parbox{5.5cm}{Applying the power rule and
adding the constant of integration} \\
=& \frac{1}{4}x^2+\frac{3}{2}x+C && \text{Distributing the } \frac{1}{2} \\
=& \frac{x^2+6x}{4}+C && \text{Finding a common denominator} \\
=& \frac{x(x+6)}{4}+C && \text{Factoring out an }
\end{align*}