# Multiple \cline{x-y} in align environment for subtracting equations

I'm trying to make a solution sheet for a student of mine and want to write it in a similar way as I would do when writing per hand. In this case I wanted to have 4 columns of equations (I know that in reality there are 14 columns in the align environment). My code looks like this:

\begin{alignat*}{14}
12a     &+ 4b       &&+ c   &&={}& -3   &\qquad&    12a     &+ 2b   &&={}& 0    &\\
-27a    &- 6b   &&- c       &&={}& 0    &\qquad&    -15a    &- 2b   &&={}& -3   &\-1.2em] \cline{1-7} \\[-2.5em] -15a &- 2b && &&={}& -3 &\qquad& -3a & &&={}& -3 &\\ & && &&{}& &\qquad& & &a&={}& -1 & \end{alignat*}  \begin{alignat*}{14} 12a &+ 4b &&+ c &&={}& -3 &\qquad& 12a &+ 2b &&={}& 0 &\\ -27a &- 6b &&- c &&={}& 0 &\qquad& -15a &- 2b &&={}& -3 &\\[-1.2em] \cline{1-7} \cline{9-13}\\[-2.5em] -15a &- 2b && &&={}& -3 &\qquad& -3a & &&={}& -3 &\\ & && &&{}& &\qquad& & &a&={}& -1 & \end{alignat*}  I want to have \cline{1-7} \cline{9-13} without a line break, I want them to be in the same line. Is that possible with align or alignat? Furthermore I tried to make a tikz-arrow in a soft S-shape from the end of the last line in column #1 to the start of the second line of column #2, but failed. So if you are skilled with that kind of thing, I'd really appreciate your help! =) ## 2 Answers I'd use a simple array environment: \documentclass{article} \usepackage{amsmath} \begin{document} \[\arraycolsep=1.4pt\def\arraystretch{1.3} \begin{array}{rcr p{1cm} rcr} 12a + 4b + c &=& -3 && 12a + 2b &=& 0 \\ -27a - 6b - c &=& 0 && -15a - 2b &=& -3 \\ \cline{1-3} \cline{5-7} -15a - 2b \phantom{\,-\,c\,} &=& -3 & & -3a \phantom{\,-\,2b\,} &=& -3 \\ & & && a &=& -1 \end{array}

\end{document}


For the arrow you can define two nodes with TikZ or PSTricks.

• Yeah, I thought about using an array but I hoped for an align solution. But I think that's fine! Thank you for your quick response, Herbert! As for the TikZ-Node, I know I need a node, but everytime I try it, it's just a simple straight arrow or it bends over the equation. I couldn't figure out how to make an soft S-like shape... May 4, 2014 at 9:08
• I think you can replace \phantom{\,-\,c\,} and \phantom{\,-\,2b\,} with \phantom{{}-c} and \phantom{{}-2b}, respectively.
– Mico
May 4, 2014 at 10:06
• @Mico: yes, that's makes more sense.
– user2478
May 4, 2014 at 16:10

\cline is not supported by the amsmath environments. \cline ends a line to move back its height. But the ending of the line triggers code in amsmath that is used for measurements etc.

A hacky workaround would be:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand*{\StrutboxHeight}{\ht\strutbox@}
\newcommand*{\StrutboxDepth}{\dp\strutbox@}
\makeatother

\begin{document}
\begin{alignat*}{14}
12a     &+ 4b       &&+ c   &&={}& -3   &\qquad&    12a     &+ 2b
&&={}& 0    &\\
-27a    &- 6b   &&- c       &&={}& 0    &\qquad&    -15a    &- 2b
-&&={}& -3 & \\
\noalign{\vskip-\StrutboxHeight}
\cline{1-7}
\noalign{\vskip\arrayrulewidth\vskip-\baselineskip}
\cline{9-13}
\noalign{\vskip-\StrutboxDepth}
-15a    &- 2b   &&          &&={}& -3   &\qquad&    -3a     &
-&&={}& -3 &\\