
답변1
당신이 사용할 수있는 \intertext
:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{enumerate}\mathtoolsset{above-intertext-sep=-\belowdisplayshortskip}
\item How can I align the equations
\begin{align*}
a &= 2. \\
\intertext{
\item Which appear in various items of \texttt{enumerate}?
}
b &= a + 123.
\end{align*}
\end{enumerate}
\end{document}
답변2
당신이 사용할 수있는 eqparbox
.
\documentclass{article}
\usepackage{amsmath}
\usepackage{eqparbox}
\begin{document}
\begin{enumerate}
\item How can I align the equation
\begin{align*}
\eqmakebox[L][r]{$a$}&=\eqmakebox[R][l]{$2$}
\end{align*}
\item with the equation
\begin{align*}
\eqmakebox[L][r]{$b$}&=\eqmakebox[R][l]{$a+123$}
\end{align*}
\item With \verb|eqparbox|.
\end{enumerate}
You can make it more structured by defining macros for that.
\newcommand{\LHS}[2][pft]{\eqmakebox[L#1][r]{$\displaystyle #2$}}
\newcommand{\RHS}[2][pft]{\eqmakebox[R][l]{$\displaystyle #2$}}
\begin{enumerate}
\item Now you can align the equation
\begin{align*}
\LHS{a}&=\RHS{2}
\end{align*}
\item with the equation
\begin{align*}
\LHS{b+7c}&=\RHS{a+123}
\end{align*}
\item using the macros \verb|\LHS| and \verb|\RHS|.
\end{enumerate}
The optional argument is an identifier. For each new set of mutually aligned
equations you need a distinct identifier. That is, all the left--hand sides and
all the right--hand sides with the same identifier have the same widths,
respectively.
\end{document}
부록: 이 부분은 부록입니다.egreg의 좋은(!) 솔루션. enumitem
(위에 ) 로딩을 고려한다면 mathtools
다음과 같이 하여 작업을 더욱 사용자 친화적으로 만들 수 있습니다.
\setlist[enumerate]{before=\mathtoolsset{above-intertext-sep=-\belowdisplayshortskip}}
enumerate
이렇게 하면 이를 각 환경에 직접 추가할 필요가 없습니다 .
\documentclass{article}
\usepackage{mathtools}
\usepackage{enumitem}
\setlist[enumerate]{before=\mathtoolsset{above-intertext-sep=-\belowdisplayshortskip}}
\begin{document}
\begin{enumerate}
\item How can I align the equations
\begin{align*}
a &= 2 \;,\\
\intertext{
\item which appear in various items of \texttt{enumerate},
}
b &= a + 123\;,\\
\intertext{
\item and without adding something by hand whenever I use \texttt{enumerate}?
}
b &= c + d+\frac{7\pi}{2}\;.
\end{align*}
\end{enumerate}
\begin{align}
a &= 2 \;.\\
\intertext{We're back to normal.}
b &= a + 123\;.
\end{align}
\end{document}
답변3
각 방정식의 왼쪽과 오른쪽에 있는 가장 넓은 요소에 액세스할 수 있어야 하며 \phantom
s와 over lap
ping을 혼합하여 사용해야 합니다. 귀하의 설정에서 는 a
보다 넓고 b
는 a + 123
보다 넓으 2.
므로
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{enumerate}
\item
How can I align the equations
\[
a = \mathrlap{2.}\phantom{a + 123}% Widest RHS is "a + 123"
\]
\item
Which appear in various items of \verb|enumerate|?
\[
\phantom{a}\mathllap{b} = a + 123 % Widest LHS is "a"
\]
\end{enumerate}
\end{document}
위의 프로세스는 다음을 통해 단순화됩니다.eqparbox
(보다다른 대답) 를 통해 LaTeX 시스템을 사용하여 가장 넓은 요소의 너비를 캡처 \label
합니다 .\ref
\eqmakebox[<tag>][<align>]{<stuff>}