# Adding vertical line (equal sign) to augmented bmatrix WITHOUT using array

Is there a way to add a vertical line (equal sign) to an augmented bmatrix (4x4) WITHOUT using array? Any help provided would be greatly appreciated.

• Welcome to TeX.SE. Could you post some code, or at least a scan of a hand-drawn sketch of what you're looking to achieve? – Mico Mar 15 '16 at 21:31
• @Mico: See the screenshot below from Steven, that is what I am trying to achieve but because I am using an application that does not support the use of array, I cannot use array to achieve it. – TechEng Mar 17 '16 at 14:25

No, you have to use array, because the amsmath matrix environments don't provide for specifying rules.

\left[\begin{array}{@{}ccc|c@{}}
1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4
\end{array}\right]


The trick for emulating bmatrix (or pmatrix) is having @{} at both ends.

• Can you elaborate on what @{} means? – Eric Feb 15 '17 at 10:18
• @Eric “Don't add the usual padding” – egreg Feb 15 '17 at 10:21
• This still doesn't quite work for me. The one on the left uses bmatrix, the other {array}{@{}c@{}}. \hline seems to behave differently in the two cases – Eric Feb 15 '17 at 10:24
• You actually want \left[\hskip -\arraycolsep ... \hskip -\arraycolsep\right], and to omit the @{} (determined by looking at amsmath.sty) – Eric Feb 15 '17 at 10:27
• @Eric No, why should I? Do you doubt I know the code in amsmath? It's there in order to solve a very different problem. Of course, \hline was not requested. Otherwise, yes, the code like in amsmath can help. But that's partitioned matrices, there are questions about them on the site. – egreg Feb 15 '17 at 10:57

Here I use bmatrix, but have created \aug to be a vertical strut that can be placed between columns.

\documentclass{article}
\usepackage{amsmath}
\newcommand\aug{\fboxsep=-\fboxrule\!\!\!\fbox{\strut}\!\!\!}
\begin{document}
$\begin{bmatrix} 1 & 2 & 3 &\aug& 4 \\ 1 & 2 & 3 &\aug& 4 \\ 1 & 2 & 3 &\aug& 4 \\ 1 & 2 & 3 &\aug& 4 \end{bmatrix}$
\end{document}


• Thank you for responding but the application I am using does not support \aug either. There is not a complete and current list of the items supported by the application so I am going by trial and error. – TechEng Mar 17 '16 at 14:27
• @TechEng Too bad. I gather you are unable to add LaTeX \newcommands to your existing application? – Steven B. Segletes Mar 17 '16 at 14:34
• No, I am not. It is very limited. I can get the matrix using \begin{bmatrix} x & x & x & x\\ \end{bmartix}, I just have not found a way to add the vertical line. – TechEng Mar 18 '16 at 16:43
• @TechEng, Could you use \def\aug instead of \newcommand\aug? – Steven B. Segletes Mar 18 '16 at 16:45
• No, \def\aug does not work either. It is very limited in what will work. I can make it work graphically by adding an image on top but I was hoping to get the equation to work by itself. I appreciate your time. I will just keep trying other things. – TechEng Mar 21 '16 at 14:44

For those who may still be searching for an answer. You can actually make an augmented matrix with two matrices inside delimiters of your choice:

\left[
\begin{matrix}
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
1 & 2 & 3 \\
\end{matrix}
\left|
\,
\begin{matrix}
4  \\
4  \\
4  \\
4  \\
\end{matrix}
\right.
\right]


This code produces a matrix like this:

You can modify space between delimiters by adding \, or other spacers.

• Not my preferred way, but at least it's easy to input. The \left| should better be \;\middle|\; (removing \right.). – egreg Mar 28 '20 at 21:33

Using the package spalign you can get the answer faster with the command \spalignaugmat{}. Here within of this command the blank spaces between the elements of the matrix are important.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{spalign}
\begin{document}
\spalignaugmat{1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 3 4;}
\end{document}