Tremol Imp
2009-06-19
I am trying to get augmented matrices to display using jsMath, using the following syntax:
$$
\left[\begin{array}{rrr|r}
1 & 2 & 3 & 9\\
2 & -1 & 1 & 8\\
3 & 0 & -1 & 3
\end{array} \right]
$$
The matrix displays just fine, except for the line between the last two columns that would denote it as an augmented matrix. I don't suspect it to be a browser issue, as I have tried it using Epiphany, Firefox, and Opera, and all display the same incorrect result. (As for OS, I'm using Debian Lenny.)
Is this feature of arrays (the vertical bars between columns) supported in jsMath? If so, how might I get it to display properly?
Thanks in advance for your help!
Davide P. Cervone
2009-06-19
The matrix and array environments are places where jsMath still needs some more work. The vertical and horizontal lines are not implemented, so you are not having browser problems; it's just not supported.
Here is a hack that can accomplish what you want, however. First, make the following definitions:
\def\Height{\vphantom{\begin{array}{c}a\cr a\cr a\cr\end{array}}}
\def\|{\!\!\smash{\left|\Height\right.}\!\!}
\def\Matrix#1{\left[\;\;\Height\begin{array}{rrrcr}#1\end{array}\;\;\right]}
(You can do these in a separate math block within the page, or just before the first matrix. Or you can use the jsMath.Macro() command to define them and include those definitions in your own customization javascript file. The latter might be useful if you are planning to need them in more than one page.)
Then use
\Matrix{
1 & 2 & 3 & & 9\\
2 & -1 & 1 & \| & 8\\
3 & 0 & -1 & & 3
}
to get your augmented matrix.
Note that the definitions as they stand are only for 3 x n matrices, though they could be adjusted to work for any (odd) size. Even sizes would take a little more work.
Hope that does what you need.
Davide
Tremol Imp
2009-06-19
That does precisely what I need. And conveniently, all the augmented matrices I need to render are 3xn ...
Thank you!