# Matrices in MaTeX

Is it possible to display matrices using MaTeX? I tried:

 MaTeX["\\begin{matrix}c\\\\f\\end{matrix}"]


but it did not display the matrix.

V12.1 on windows 10.

It works for me

this option setting is not even needed, works without it, but you could try adding it, may be your latex is different.

 SetOptions[MaTeX, "Preamble" -> {"\\usepackage{amsmath}"}];


Now

 MaTeX["\\begin{pmatrix}
1 & 2 & 3\\\\
a & b & c
\\end{pmatrix}", Magnification -> 2]


MaTeX["\\begin{matrix}c\\\\f\\end{matrix}", Magnification -> 2]


MaTeX["\\begin{bmatrix}
1 & 2 & 3\\\\
a & b & c
\\end{bmatrix}", Magnification -> 2]


MaTeX["\\begin{Bmatrix}
1 & 2 & 3\\\\
a & b & c
\\end{Bmatrix}", Magnification -> 2]


MaTeX["\\begin{Vmatrix}
1 & 2 & 3\\\\
a & b & c
\\end{Vmatrix}", Magnification -> 2]


MaTeX["\\begin{vmatrix}
1 & 2 & 3\\\\
a & b & c
\\end{vmatrix}", Magnification -> 2]


Also you can do

 (data = Table[i + j, {i, 3}, {j, 4}]) // MatrixForm


  MaTeX[TeXForm@data, Magnification -> 2]


• Actually, \usepackage{amsmath} is already in the default preamble (in "BasePreamble") because the output of TeXForm sometimes requires it. This is why the setting is not needed. – Szabolcs Apr 8 at 8:26
• @Szabolcs Thanks, this explains why then it worked without needing amsmath explicitly added, since these commands come from this package. Yes, one can not do much math without this package, so having it there by default is a good idea. – Nasser Apr 8 at 8:41