# matrix throws “Extra }, or forgotten \endgroup”

I have a simple matrix like this

\matrix
{
16 & 3 & 2 & 13 \\
5 & 10 &|[fill=yellow]| 11 & 8 \\
9 & 6 + 2 & 7 & 12 \\
4 & 15 & 14 & 1 \\
};


My issue is the |[fill=yellow]| which causes the error to appear. Likely there is some conflict with another package (and I use quite some). So, any idea or pointer whether there are know issues with the matrix package and this error? Or is there any alternative to highlight cells in a matrix in a different way?

• Comment out half of your packages. Does the error stay, or go away? Continue until you have identified the conflicting package. Then you can post the additional 10 lines of code to turn this into a minimal working example. – Teepeemm Jan 16 at 22:14
• @Teepeemm Haha. I said "I use quite some" because I use quite some. This would not just make my day. – qwerty_so Jan 16 at 22:16
• You may want to use \matrix[matrix of nodes] instead of \matrix, and load the matrix library, of course. – Schrödinger's cat Jan 16 at 22:29
• @Schrödinger'scat Thanks, I'll give it a try. – qwerty_so Jan 16 at 22:31
• @Teepeemm Admittedly, I had to go through the pain... and found the issue. – qwerty_so Jan 16 at 22:57

Something as this code is it good for you, using circledsteps package?

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,xcolor}
\usepackage{circledsteps}

\begin{document}
\pgfkeys{/csteps/inner color=black}
\pgfkeys{/csteps/outer color=yellow}
\pgfkeys{/csteps/fill color=yellow}
$\begin{matrix} 16 & 3 & 2 & 13 \\ 5 & 10 & \Circled{11} & 8 \\ 9 & 6 + 2 & 7 & 12 \\ 4 & 15 & 14 & 1 \end{matrix}$
\end{document}

• Yeah, that might fix it. Btw. I found the cause. There was a | redefinition in \lstMakeShortInline from the listings package. So I have to die either way or the other ;-) – qwerty_so Jan 16 at 22:50

As for someone running onto the same issue: The cause was a line like

\lstMakeShortInline[
language=CSharp,
columns=fixed,
basicstyle=\ttfamily
,columns=fixed]| % <- that's the cause!

\lstnewenvironment{lstcs}
{\lstset{
language=CSharp,
basicstyle=\ttfamily,
breaklines=true,
columns=fullflexible
}}
{}


which is something from the listings package (my guess, since I did not work on that part of the LaTeX source). This re-defines the | char and makes matrix croak.