Is it possible to display matrices using MaTeX? I tried:
MaTeX["\\begin{matrix}c\\\\f\\end{matrix}"]
but it did not display the matrix.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityV12.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]
\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.
$\endgroup$
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.
$\endgroup$