# Vertical line in matrix using LaTeXiT [duplicate]

Possible Duplicate:
What's the best way make an “augmented” coefficient matrix?

I am trying to make a vertical line in a matrix in LaTeXiT. I have read that it should be possible using the following:

\begin{bmatrix}{cccc|c}
1 & 0 & 3 & -1 & 0 \\
0 & 1 & 1 & -1 & 0 \\
0 & 0 & 0 & 0 & 0 \\
\end{bmatrix}


But when doing so, this is my output:

The bmatrix environment does not provide this facility (see section 4.1 of the amsmath package documentation). You can use the array environment instead.

$\left[ \begin{array}{cccc|c} 1 & 0 & 3 & -1 & 0 \\ 0 & 1 & 1 & -1 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ \end{array} \right]$

• Possibly adding @{} at the sides: @{}cccc|c@{}, so as to give a similar result to bmatrix. – egreg Nov 3 '11 at 9:33
• Thank you very much. The output of this is just like a bmatrix. – SimonBS Nov 3 '11 at 9:43
• @egreg: Could you explain how the @{} works? I see that it has the effect of reducing the whitespace between the [ and ] and the matrix contents. – user001 Mar 13 '12 at 17:30
• With @{...} you tell LaTeX to put ... in place of the default intercolumn space, which is applied also at the start and end of the tabular. – egreg Mar 13 '12 at 17:37

That won't work with the matrix environment from amsmath, however Stefan Kottwitz wrote about a workaround for this on his blog.

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{#1}}
\makeatother
\begin{document}
$$\begin{bmatrix}[cccc|c] 1 & 0 & 3 & -1 & 0 \\ 0 & 1 & 1 & -1 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ \end{bmatrix}$$
\end{document}


• @barbarabeeton This would be a nice addition for amsmath, wouldn't it? – egreg Nov 3 '11 at 9:36
• @Chou It's up to the person asking the question to decide which answer was most helpful for him or her. It's not always the highest voted answer that is accepted. – Torbjørn T. Jun 21 '15 at 7:37
• I know the rules here. You may take my words as an indirect praise; for your work helped me. :) By the way, I was not aware of the number of votes til your comment coming out. – Megadeth Jun 21 '15 at 9:30
• The double-backslash line-break indicators seem to have morphed into single-backslash spacers. You may want to edit the code a bit. – Mico Jan 23 '17 at 12:18
• @Mico Thanks, will edit. (It's a well known problem as you may know, meta.tex.stackexchange.com/questions/7168/…) – Torbjørn T. Jan 23 '17 at 12:26