4

I have the following code:

$ax = b \Leftrightarrow$

and

\begin{tabbing}
    $a_{11}x_1 + $ \= $a_{12}x_2+\dots +$ \= $a_{1n}x_n$ \= $= b_1$\\
    \> $a_{22}x_2 + \dots +$ \> $a_{2n}x_n$ \> $= b_2$\\
    \> $\ddots$ \> $\vdots$ \> $\vdots$\\
    \> \> $a_{nn}x_n$ \> $= b_n,$
\end{tabbing}

But how can I get, that these two parts are side by side?

Thank you very much!

Troy
  • 13,741
texNewbie
  • 1,211

2 Answers2

4

I would follow the suggestions in the above comments, but just in case you don't want to change your code, you can exploit minipage. Inserting a tabbing inside it causes the minipage to use the width of the tabbing, as egreg suggested in his comments.

MWE

\documentclass{article}

\begin{document}

$ax = b \quad\Leftrightarrow\quad$
\begin{minipage}{\linewidth}
\begin{tabbing}
    $a_{11}x_1 + $ \= $a_{12}x_2+\dots +$ \= $a_{1n}x_n$ \= $= b_1$\\
    \> $a_{22}x_2 + \dots +$ \> $a_{2n}x_n$ \> $= b_2$\\
    \> $\ddots$ \> $\vdots$ \> $\vdots$\\
    \> \> $a_{nn}x_n$ \> $= b_n,$
\end{tabbing}
\end{minipage}

\end{document} 

Output

enter image description here

The same result can be achieved using the varwidth environment from the same package.

MWE

\documentclass{article}

\usepackage{varwidth}

\begin{document}

$ax = b \quad\Leftrightarrow\quad$
\begin{varwidth}{\linewidth}
\begin{tabbing}
    $a_{11}x_1 + $ \= $a_{12}x_2+\dots +$ \= $a_{1n}x_n$ \= $= b_1$\\
    \> $a_{22}x_2 + \dots +$ \> $a_{2n}x_n$ \> $= b_2$\\
    \> $\ddots$ \> $\vdots$ \> $\vdots$\\
    \> \> $a_{nn}x_n$ \> $= b_n,$
\end{tabbing}
\end{varwidth}

\end{document} 
karlkoeller
  • 124,410
4

A simple array can be used instead of tabbing, which also centers itself vertically with the math axis:

enter image description here

\documentclass{article}

\newcommand{\mcr}{\multicolumn{1}{r}}

\begin{document}

\[
  AX = B
  \quad\Leftrightarrow\quad
  \setlength{\arraycolsep}{0pt}% No intercolumn space in array
  \begin{array}{rccl}
    a_{11}x_1 + a_{12}x_2 & {}+ \cdots + a_{1n}x_n & {}={}  & b_1 \\
                a_{22}x_2 & {}+ \cdots + a_{2n}x_n & {}={}  & b_2 \\[\jot]
                   \ddots &      \mcr{\vdots\quad} & \vdots &     \\[\jot]
                          &        \mcr{a_{nn}x_n} & {}={}  & b_n,
  \end{array}
\]

\end{document}
karlkoeller
  • 124,410
Werner
  • 603,163
  • Werner, just in case you are interested, take a look at https://tex.meta.stackexchange.com/a/7303/27635 – karlkoeller May 27 '17 at 08:28
  • Thanks! This is great. I was waiting for a review queue to be established, but in the meantime it's probably best to go ahead and fix what we can. – Werner May 27 '17 at 16:11