When studying systems of linear equations, it's nice to remind people that the last column of the coefficient matrix holds the constants. This is often done in books by putting a vertical line between the last column and the next to last column. What is a good way to do this in LaTex?
|
One way to do this is implemented in the (free, in both senses!) online linear algebra textbook Linear Algebra by Jim Hefferon. It's written in LaTeX and is open-source so one can download the book and its attendant style files. One of them, called
and is used as:
(note that the argument is one less than the total number of columns). I guess that the That style file has several other useful linear algebra macros that may be useful. |
||||
|
|
|
If you build your own environment using array, you're on the safe side. I would extend an internal macro of amsmath using an optional argument. Advantages:
Caution:
Code: Here's the redefinition, just put it in your preamble after loading amsmath:
I had to use
So, there's not much that's been changed. Examples: Simple augmented matrix:
More complex use, with different alignment, spacing and color:
Output:
Just remove the optional argument in brackets and you will get the standard pmatrix or bmatrix. I've used this code and examples in a blog post in 2008: An extension to amsmath matrix environments. If you don't wish to redefine that internal macro, you could give it a different name and build your amatrix environment on it exactly the same way that amsmath does with pmatrix. |
|||
|
|
If you are using an array to input the matrix, you just have to specify something like
|
|||||||
|
|
The Edit: Here's an example. I'm actually not thrilled about the spacing.
|
||||
|
|

