有没有办法在做数组时用插入数字的单词标记 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}
,

this other answer 一样,您可以使用命令 \tag{}

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
  x+y\label{eq1}\tag{First one}\\
  x+z\label{eq2}\tag{Second one}\\
  x-y\label{eq3}\tag{Third one}\\
  x-z\nonumber
\end{align}

Then you can cite \eqref{eq1},\eqref{eq2} and \eqref{eq3} separately.

Or you can cite \ref{eq1},\ref{eq2} and \ref{eq3}.
\end{document}

请参阅文本引用的两种样式的输出:

screenshot of output