4

This question already has an answer here:

I know the basic matrix syntax in LaTeX but I am having problems with the type I have shown in the image . If anyone can help me with the encircled items it would be great:

enter image description here

So far I have this:

$$(3)(2)(1)\ \begin{vmatrix}
{x}+{y}+ & {z}=33\\
3{x}-8{y} & +7{z}=26\\
5{y} & -3{z}=19
\end{vmatrix}$$

and it gives this result:

enter image description here

marked as duplicate by egreg, Stefan Pinnow, Andrew Swann, Mensch, Schweinebacke Feb 17 '17 at 12:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Welcome to TeX.SX! Please post what you've got so far as MWE. – TeXnician Feb 17 '17 at 6:40
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. If you don't know what a MWE is, see here: minimal working example (MWE). – CarLaTeX Feb 17 '17 at 6:42
  • @TeXnician please check the post now – Aaqib Khan Feb 17 '17 at 6:48
  • I assume you're using some form of MathJax? – Werner Feb 17 '17 at 6:52
  • Sorry i didnot get what you asked? – Aaqib Khan Feb 17 '17 at 6:55
8

two possible solution: with array and with matrix extended with solution in matrix with vertical and horizontal lines :

\documentclass{article}
\usepackage{array}
\usepackage{mathtools}

\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
  \hskip -\arraycolsep
  \let\@ifnextchar\new@ifnextchar
  \array{#1}}
\makeatother

\setlength\arraycolsep{1pt}
\begin{document}
\[
\begin{matrix}
(1) \\  (2) \\  (3)
\end{matrix}
\left|\begin{array}{rr rr}
x   &   y   &  z    & = 33  \\
3x  & -8y   & +7z   & =26   \\
    &  5y   & -3z   & =19
      \end{array}\right|
\]

\[
\begin{matrix}
(1) \\  (2) \\  (3)
\end{matrix}
\begin{vmatrix}[rr rr]
x   &   y   &  z    & = 33  \\
3x  & -8y   & +7z   & =26   \\
    &  5y   & -3z   & =19
\end{vmatrix}
\]
\end{document}

enter image description here

Edit: As egreg notice, above solution treats + and - as unary rather than as binary operators. For later can be obtained with introduction of new columns for math operators in matrix as well as in array:

\[
\begin{matrix}
(1) \\  (2) \\  (3)
\end{matrix}
\left|\begin{array}{rc rc rr}
x   &   & y &  &  z & = 33  \\
3x  & - &8y & +& 7z & =26   \\
    &   &5y & -& 3z & =19
      \end{array}\right|
\]

\[
\begin{matrix}
(1) \\  (2) \\  (3)
\end{matrix}
\begin{vmatrix}[rc rc rr]
x   &   & y &  &  z & = 33  \\
3x  & - &8y & +& 7z & =26   \\
    &   &5y & -& 3z & =19
\end{vmatrix}
\]

enter image description here

  • 1
    Your method treats + and - as unary rather than as binary operators. – Mico Feb 17 '17 at 11:04
2

This case is straightforward with a TABstack and also gets the proper spacing around operators.

\documentclass[a4paper]{article}
\usepackage{tabstackengine}
\stackMath
\setstackgap{L}{1.2\normalbaselineskip}
\begin{document}
\[
\Centerstack{(1)\\(2)\\(3)}\quad
\vertMatrixstack[r]{
 x + &  y + &  z =& 33\\
3x - & 8y + & 7z =& 26\\
     & 5y - & 3z =& 19
}
\]
\[
\Centerstack[r]{-3\cdot(1) + (2)\rightarrow(4)\\(3)}\quad
\vertMatrixstack[r]{
-11y + & 4z =& -73\\
  5y - & 3z =&  19
}\quad
\Centerstack[r]{\cdot3\\\cdot4}
\]
\end{document}

enter image description here

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