1

enter image description here

I am trying to write something like that (as shown in the image) but I don't know how...

I'm using this notation:

\begin{equation}
\begin{array}{rrc1c1}
\multicolumn{4}{1}{} \
& s_1 = 6- 2x_1 - 3x_2 \
& s_2 = 3 + 3x_1 - 2x_2 \
& s_3 = 5 + 0x_1 - 2x_2\
& s_4 = 4 - 2x_1 - 1x_2 \
& Z = 0 - 3x_1 - 4x_2 \
\end{array}
\end{equation}

However, I don't know how to draw a line as in a fraction.
Thank you!

1

There are potential complications. For one, the equation is bottom aligned, in its current presentation, so the eq number will appear to the right of the Z= row (to avoid this, wrap the \tabbedShortstack inside a \vcenter{\hbox{...}}).

Inter-row gap can be increased with \setstackgap{S}{<gap size>}.

But without knowing all your use cases, this might work.

\documentclass{article}
\usepackage[TABcline]{tabstackengine}
\TABstackMath
\TABbinary
\begin{document}
\begin{equation}
\tabbedShortstack[r]{
 s_1 =& 6 &- 2x_1 &- 3x_2 \\
 s_2 =& 3 &+ 3x_1 &- 2x_2 \\
 s_3 =& 5 &+ 0x_1 &- 2x_2\\
 s_4 =& 4 &- 2x_1 &- 1x_2 \\
 \TABcline{1-4}
   Z =& 0 &- 3x_1 &- 4x_2 
}
\end{equation}
\end{document}

enter image description here

Here it is again, with eq number centered, and increased row and column gaps:

\documentclass{article}
\usepackage[TABcline]{tabstackengine}
\TABstackMath
\TABbinary
\setstackgap{S}{5pt}
\setstacktabbedgap{1ex}
\begin{document}
\begin{equation}
\vcenter{\hbox{\tabbedShortstack[r]{
 s_1 =& 6 &- 2x_1 &- 3x_2 \\
 s_2 =& 3 &+ 3x_1 &- 2x_2 \\
 s_3 =& 5 &+ 0x_1 &- 2x_2\\
 s_4 =& 4 &- 2x_1 &- 1x_2 \\
 \TABcline{1-4}
   Z =& 0 &- 3x_1 &- 4x_2 
}}}
\end{equation}
\end{document}

enter image description here

  • The first one didn't work, I'll try the second one. Thanks – Jo Olive Sep 18 '18 at 20:00
  • @Rubs You will have to explain what you mean by "did not work". – Steven B. Segletes Sep 18 '18 at 20:01
  • Both are giving me the same output: no line and before the Z letter appears "1 - 4" – Jo Olive Sep 18 '18 at 20:06
  • @Rubs Did you invoke the package with \usepackage[TABcline]{tabstackengine}? Do you have an up to date version tabstackengine 2018/03/05 (V2.10)? ctan.org/pkg/tabstackengine and, if needed ctan.org/pkg/stackengine (V4.01) – Steven B. Segletes Sep 18 '18 at 20:07
  • Yes, I did invoke it. Well I'm using overleaf... – Jo Olive Sep 18 '18 at 20:11

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.