Using brackets as delimiters for matrix in TikZ-PGF Matrix Library

Use {[} as the argument for left delimiter, and similar for the right.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}
\begin{tikzpicture}
\matrix [matrix of math nodes,left delimiter={[},right delimiter={]}]
{
a_8 & a_1 & a_6 \\
a_3 & a_5 & a_7 \\
a_4 & a_9 & a_2 \\
};
\end{tikzpicture}
\end{document}

The matrix was copied directly from the pgf manual (section 38.3 Delimiters), only the delimiters changed. The reason you have to put the braces there is, I suspect, that the delimiter specification is placed within a set of brackets, and you therefore have to separate the delimiter brackets from the brackets for the matrix options.


Yes Torbjorn T. is right, there is a problem with the brackets. You need to hide the bracket in tex group {...} but another solution is to write right delimiter=\rbrack,left delimiter= \lbrack