I would like to explicitly write out a n x n matrices in my paper, but once n \geq 11
, I get compiling errors and it refuses to print the matrix. Here is what I have:
\documentclass{standalone}
\usepackage{amsmath,mathtools,amsthm}
\usepackage{array}
\begin{document}
$$\begin{bmatrix*}[r]
1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
-\fract{1}{2} & -\fract{1}{2} & \fract{1}{2}\sqrt{2} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
0 & 0 & -\fract{1}{2}\sqrt{2} & \fract{1}{2}\sqrt{2} & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
0 & 0 & 0 & -\fract{1}{2}\sqrt{2} & \fract{1}{2}\sqrt{2} & 0 & 0 & 0 & 0 & 0 & 0\\
0 & 0 & 0 & 0 & -\fract{1}{2}\sqrt{2} & \fract{1}{2}\sqrt{2}& 0 & 0 & 0 & 0 & 0\\
0 & 0 & 0 & 0 & 0 & -\fract{1}{2}\sqrt{2} & \fract{1}{2}\sqrt{2} & 0 & 0 & 0 & 0\\
0 & 0 & 0 & 0 & 0 & 0 & -\fract{1}{2}\sqrt{2} & \fract{1}{2}\sqrt{2} & 0 & 0 & 0\\
0 & 0 & 0 & 0 & 0 & 0 & 0 & -\fract{1}{2}\sqrt{2} & \fract{1}{2}\sqrt{2} & 0 & 0\\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -\fract{1}{2}\sqrt{2} & \fract{1}{2} & \fract{-1}{2}\\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1
\end{bmatrix*} $$
\end{document}
I do not see any errors for this 11 x 11 matrix. However, when I type this in a blank standalone document, I get an error that says: "Missing $ inserted. $$\begin{bmatrix*}[r]"
Is there another way to write an 11 x 11 (or larger) matrix so that it compiles? Or is it impossible to type matrices this large into LaTeX? (If it helps, I am using writelatex.com to compile my thesis.)
Best Answer
Summarizing some of my earlier comments:
Use the
standalone
package with the optionpreview
in order to avoid getting an error message about a missing$
symbol.Don't use
$$
in a LaTeX document to start and end displaymath mode, as it's quite deprecated. See Why is\[ ... \]
preferable to$$ ... $$
? for more information on this subject.The matrix environments of the
amsmath
andmathtools
environments work with the counter variableMaxMatrixCols
. Its default value is10
; if you have a matrix with, say, 15 columns, issue the instruction\setcounter{MaxMatrixCols}{15}
.There is no
\fract
command; use\frac
instead.For the matrix at hand, I actually wouldn't use any
\frac
instructions. Instead, I'd use inline-style math notation, i.e., I'd write\sqrt{2}/2
, etc. That way, the fractional expressions won't become too tiny to read with ease.