
Existe um pacote que me permita desenhar uma linha horizontal no modo matemático, como sugerido abaixo?
\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*}
Responder1
Aqui está uma solução que usa um array
ambiente e tem o cuidado de preservar as quantidades apropriadas de espaçamento em torno dos operadores do tipo mathbin ("+" e "-") e mathrel ("="). Ele também usa a macro \midrule
(do booktabs
pacote) para obter um bom espaçamento ao redor da linha horizontal.
\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}
Responder2
Bastante fácil: use 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}
Melhor ainda, use também booktabs
e \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}
Responder3
Use umtabular
\documentclass{article}
\usepackage{amsmath,array}
\begin{document}
\begin{tabular}{>{$}r<{$}@{\,}>{$=}l<{$}}
x + 2 & 3 \\
-2 & -2 \\ \hline
x & 1
\end{tabular}
\end{document}
Responder4
Aqui estão duas soluções usando IEEEtrantools
:
Incorporar IEEEeqnarraybox
dentroequation
\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}
dá:
Para um melhor controle recomendo usar IEEEeqnarray
.
UsandoIEEEeqnarray
\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}
dá:
Stefan Moser escreveu umexcelente tutorialsobre IEEEtrantools
.