首页 > 解决方案 > 在进行数组时,有没有办法在 Latex 中用插入数字的单词来标记方程式?

问题描述

在进行数组时,有没有办法在 Latex 中用插入数字的单词来标记方程式?

我想说明我的方程式列表中每一行的原因。

标签: latex

解决方案


我有一个临时解决方案,您可以在每行旁边添加文本。

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}

Basic way to add text to each line.

\begin{align}
x &= 4^{2} - 1 && \text{given}\\
  &= 16 - 1    && \text{exponent}\\
  &= 15        && \\  % line without text
  &= 15        && \text{subtraction}
\end{align}

Better way when removing numbers.

\begin{align*}
x &= 4^{2} - 1 && \text{given}\\
  &= 16 - 1    && \text{exponent}\\
  &= 15        && \\
  &= 15        && \text{subtraction}
\end{align*}

Below, this example put less space between equation and text, and parenthesis.

\begin{alignat}{2}
x &= 4^{2} - 1 && \qquad\text{(given)}\\
  &= 16 - 1    && \qquad\text{(exponent)}\\
  &= 15        &&  \\
  &= 15        && \qquad\text{(subtraction)}
\end{alignat}


\end{document}

推荐阅读