
以下に提案されているように、数式モードで水平線を描画できるパッケージはありますか?
\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
を使用した 2 つのソリューションを次に示します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}
与える:
ステファン・モーザーは優れたチュートリアルの上IEEEtrantools
。