5

I am trying to draw a kind of a table to be filled with Rufinni Method in the Spanish outlay. Everything works pretty good, but in order to get a \cline{5-5} in the end i have to type \\ \cline{5-5}, so an extra row is included. As a consequence, the vertical segment between the two first columns is extended.

\documentclass[12pt,a4paper]{article}
\usepackage{eqnarray}

\begin{document}
\begin{equationarray*}{c|cccc}
    &3  &-5 &0  &4  \\
 2  &   &6  &2  &4  \\ \cline{1-5}
    &3  &1  &2  &\multicolumn{1}{|c}{}8 \\ \cline{5-5}
\end{equationarray*}
\end{document}

enter image description here

Is there any easy way to fix it? I mean to shorthen the first vertical line.

I got the next, but, despite it shows what i wanted, i don't like it because the extra line is still there.

 \documentclass[12pt,a4paper]{article}
 \usepackage{eqnarray}

 \begin{document}
 \begin{equationarray*}{c|cccc}
    &3  &-5 &0  &4  \\
 2  &   &6  &2  &4  \\ \cline{1-5}
    &3  &1  &2  &\multicolumn{1}{|c}{}8 \\ \cline{5-5}
\multicolumn{1}{c}{}&&&&\phantom{-} %This is for the last segment not to be showed
\end{equationarray*}
\end{document}

enter image description here

3

I see no reason for using the equationarray environment. You can obtain what you want with a plain array

\documentclass[12pt,a4paper]{article}

\begin{document}
\[
\renewcommand*{\arraystretch}{1.5}
\begin{array}{c|cccc}
    &3  &-5 &0  &4  \\
 2  &   &6  &2  &4  \\ \cline{1-5}
    &3  &1  &2  &\multicolumn{1}{|@{}c}{}8 \\ \cline{5-5}
\end{array}
\]

\end{document}

enter image description here

  • Perfect! Easy and useful. The |@{}cstring is totally unknown for me and i don't know how it works, but i asume that it places the vertical line right where i wanted. I appreciate this. – Aweraka Aug 24 '17 at 11:42
  • There is always an implicit space between columns: the string @{} suppresses it. Without it the 8 wouldn't be aligned with the other figures above it. Replacing centred columns c by right-aligned columns r as in Zarko's answer is another way. – campa Aug 24 '17 at 11:45
4

with array:

enter image description here

\documentclass{article}

\usepackage{lipsum}

\begin{document}
\lipsum[22]
\[\renewcommand\arraystretch{1.5}
\begin{array}{r|rrrr}
    &3  &-5 &0  &4  \\
 2  &   &6  &2  &4  \\ \cline{1-5}
    &3  &1  &2  &\multicolumn{1}{|c}{}8 \\ \cline{5-5}
\end{array}
\]
\lipsum[33]
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.