I am trying to write a new environment that takes a matrix and draws it as a matrix of nodes in tikz. This is a minimal example:
\documentclass[a4aper,pagesize]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{matrix}
\newenvironment{diagram}{
\begin{tikzpicture}
\matrix (m) [matrix of math nodes]
}{
\end{tikzpicture}
}
\begin{document}
\begin{diagram}
{
A & B & C \\
D & E & F \\
};
\end{diagram}
\end{document}
However I'd like to be able to write the diagram environment as one would write a tabular and dismiss the { ...};
used inside the environment.
I have tried using a \begingroup ... \endgroup;
, but i think tikz really wants the curly braces and I do not know how to put those in the newenvironment definition without messing up my syntax.
I guess another alternative would be to use a \newcommand
, but then I will have to use an ampersand replacement character, which I do not want either.
{...};
is not necessary, but i think it is pretty ugly.