# multiple equations on same line with \midrule not extending to both equations

Hi I want to solve a system of linear equations where you can see the cancellation and I've done that but I want to know how I can put another equation to the right of what I just solved. This is what I have so far.

\begin{aligned} 6x {\cancel{-5y}} &= 11 && \\ 7x {\cancel{+5y}} &= 2 \\ \midrule 13x &= 13 \\ x &= 1 \end{aligned}


What I want is solve for y by substituting x to the right side of the system I just solved for. I've tried putting it within the steps I did to solve x but with the \midrule the line extends and creates and odd space.

Heres another equation I did that looks weird because of the \midrule. Is there a way to show the separation of the line?

\begin{equation*}
\begin{aligned}
18a+10c &= 376  && & 18a+10c &= 376 && & 18a+10c &= 376\\
a+ c &= 24  && & {\color{red}-18(}a+ c &= 24 {\color{red})} && &  -18a-18c &= -432 \\
\midrule
&& && && && -8c &= -56 \\
&& && && && c &= 7
\end{aligned}
\end{equation*}

• welcome to tex.sx. i'm surprised that \midrule is accepted within aligned; it's defined in booktabs, which doesn't have anything to do with math. we might be able to get a better idea of what's happening if you post a compilable example that starts with your document class and ends with \end{document}, and shows what you've done so far. – barbara beeton Jun 16 '16 at 17:18

While \midrule works in aligned, you get much finer control with array.

\documentclass{article}
\usepackage{amsmath,booktabs,cancel,array,xcolor}

\newcommand{\rs}[1]{\textcolor{red}{#1}}

\begin{document}

$$\renewcommand{\arraystretch}{1.2} \begin{array}{@{}r@{}>{{}}l@{}} 6x\; {\cancel{-\;5y}} &= 11 \\ 7x\; {\cancel{+\;5y}} &= 2 \\ \midrule 13x &= 13 \\ x &= 1 \end{array}$$

\begin{equation*}
\renewcommand{\arraystretch}{1.2}
\begin{array}{
@{}r@{}>{{}}l@{}
}
18a+10c &= 376 & 18a+10c      &= 376       &  18a+10c &= 376  \\
a+ c    &= 24  & \rs{-18(}a+c &= 24 \rs{)} & -18a-18c &= -432 \\
\cmidrule{5-6}
&      &              &            &      -8c &= -56 \\
&      &              &            &        c &= 7
\end{array}
\end{equation*}
\end{document}


You can get separate rules below the three groups by adding columns

\begin{equation*}
\renewcommand{\arraystretch}{1.2}
\setlength{\arraycolsep}{0pt}
\begin{array}{
r@{}>{{}}l c
r@{}>{{}}l c
r@{}>{{}}l
}
18a+10c &= 376 &\sep& 18a+10c      &= 376       &\sep&  18a+10c &= 376  \\
a+ c    &= 24  &      & \rs{-18(}a+c &= 24 \rs{)} &      & -18a-18c &= -432 \\
\cmidrule{1-2} \cmidrule{4-5} \cmidrule{7-8}
&      &    &              &            &    &      -8c &= -56 \\
&      &    &              &            &    &        c &= 7
\end{array}
\end{equation*}


• Oh this is great! But I kind of like the look of a line underneath all 3 equations. Is there a way to do that? – Judy Jun 20 '16 at 16:41
• @Judy Use \midrule` – egreg Jun 20 '16 at 17:00
• is there a way to have underneath all 3 equations but not underneath the same line. Like the first equation have a line underneath it, then space, have a line underneath the second, space, and lastly have a line underneath the 3rd – Judy Jun 27 '16 at 20:40
• @Judy Is the last update what you need? – egreg Jun 27 '16 at 21:19