[Tex/LaTex] Missing \endcsname inserted, Runaway Argument

errorstikz-pgf

I have no idea what is going wrong here:
The error arose all of a sudden!

\documentclass[12pt,twoside]{report}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{matrix,shadings,arrows,decorations.markings,decorations.pathmorphing}
\tikzset{
    table/.style={
        matrix of nodes,
        row sep=-\pgflinewidth,
        column sep=-\pgflinewidth,
        nodes={
            rectangle,
            draw=black,
            align=center,
                   },


    }
        }


\begin{document}

Hello World...
\begin{table}
\centering
\begin{tikzpicture}
\matrix[table, ampersand replacement=\&] (TabA1)
{
A1 \& A2 \\
B1 \& B2 \\
};
\end{tikzpicture}
\caption{Glossary}
\label{tabA1}
\end{table}



\end{document}

Best Answer

The problem are the empty lines in your \tikzset macro. The following works:

\documentclass[12pt,twoside]{report}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{matrix,shadings,arrows,decorations.markings,decorations.pathmorphing}
\tikzset{
    table/.style={
        matrix of nodes,
        row sep=-\pgflinewidth,
        column sep=-\pgflinewidth,
        nodes={
            rectangle,
            draw=black,
            align=center,
        },
    }
}


\begin{document}

Hello World...
\begin{table}
\centering
\begin{tikzpicture}
\matrix[table, ampersand replacement=\&] (TabA1)
{
A1 \& A2 \\
B1 \& B2 \\
};
\end{tikzpicture}
\caption{Glossary}
\label{tabA1}
\end{table}



\end{document}