
아래 제안된 것과 같이 수학 모드에서 수평선을 그릴 수 있는 패키지가 있습니까?
\begin{align*}
x + 2 &= 3\\ % First equation
-2 &= -2\\ % Second equation
%% Horizontal line drawn under last equation HERE, with line as wide as
%% first equation
x &= 1
\end{align*}
답변1
array
다음은 환경을 사용하고 mathbin("+" 및 "-") 및 mathrel("=") 유형의 연산자 주위에 적절한 간격을 유지하도록 주의를 기울이는 솔루션입니다 . 또한 \midrule
(패키지의 ) 매크로를 사용하여 booktabs
수평선 주위에 좋은 간격을 둡니다.
\documentclass{article}
\usepackage{array,amsmath,booktabs}
\begin{document}
\[
\begin{array}{ @{} r @{}>{{}}c<{{}}@{} r @{{}={}} r @{} }
x & + & 2 & 3\\
& - & 2 & -2\\
\midrule
& & x & 1\\
\end{array}
\]
\end{document}
답변2
충분히 쉽습니다: 사용 aligned
:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\begin{aligned}
x + 2 &= 3\\ % First equation
-2 &= -2\\ % Second equation
\hline
x &= 1
\end{aligned}
\end{equation*}
\end{document}
더 나은 방법은 다음을 사용하는 것 booktabs
입니다 \midrule
.
\documentclass{article}
\usepackage{amsmath,booktabs}
\begin{document}
\begin{equation*}
\begin{aligned}
x + 2 &= 3\\ % First equation
-2 &= -2\\ % Second equation
\midrule
x &= 1
\end{aligned}
\end{equation*}
\end{document}
답변3
사용tabular
\documentclass{article}
\usepackage{amsmath,array}
\begin{document}
\begin{tabular}{>{$}r<{$}@{\,}>{$=}l<{$}}
x + 2 & 3 \\
-2 & -2 \\ \hline
x & 1
\end{tabular}
\end{document}
답변4
다음은 다음을 사용하는 두 가지 솔루션입니다 IEEEtrantools
.
IEEEeqnarraybox
내부에 삽입equation
\documentclass{article}
\usepackage{amsmath}
\usepackage{IEEEtrantools}
\begin{document}
\begin{equation*}
\begin{IEEEeqnarraybox}{rCr}
x + 2 &=& 3
\\ - 2 &=& -2
\\ \hline
\\ x &=& 1
\end{IEEEeqnarraybox}
\end{equation*}
\end{document}
다음을 제공합니다:
더 나은 제어를 위해 IEEEeqnarray
.
사용IEEEeqnarray
\documentclass{article}
\usepackage{IEEEtrantools}
\usepackage{booktabs}
\begin{document}
\begin{IEEEeqnarray*}{rCr}
x + 2 &=& 3
\\ - 2 &=& -2
\\*[-1.0\normalbaselineskip] \cmidrule{1-3}
\\*[-1.5\normalbaselineskip] x &=& 1
\end{IEEEeqnarray*}
\end{document}
다음을 제공합니다:
스테판 모저(Stefan Moser)는 다음과 같은 글을 썼습니다.훌륭한 튜토리얼에 IEEEtrantools
.