6

I seem to be getting conflict between the eqnarray environment and the tabstackengine package (which is very useful for matrices, column vectors, etc.).

\documentclass{report}
\usepackage{tabstackengine}

\begin{document}

\begin{eqnarray*}
  v &=& \bracketMatrixstack{1 & 2 \\ 3 & 3} \bracketVectorstack{-3 \\ 2} \\
  a &=& b 
\end{eqnarray*}

\end{document}

I get about a million errors if I try to compile this!

2
  • 6
    eqnarrary shouldn't be used any longer any way
    – user31729
    Feb 28, 2018 at 17:08
  • A new version of tabstackengine 2018/03/05 (V2.10) was released earlier this week that fixes this issue and adds some other bells and whistles. Mar 7, 2018 at 15:56

1 Answer 1

10

The error has nothing to do with eqnarray (which should not be used anyway) apart from it being an alignment environment.

The problem is that tabstackengine doesn't protect the internal & from a possible outer alignment.

Just brace the matrix:

\documentclass{report}
\usepackage{amsmath}
\usepackage{tabstackengine}

\begin{document}

\begin{align*}
  v &= {\bracketMatrixstack{1 & 2 \\ 3 & 3}} \bracketVectorstack{-3 \\ 2} \\
  a &= b
\end{align*}

\end{document}

enter image description here

I'm not sure how this is better than

\documentclass{report}
\usepackage{amsmath}

\begin{document}

\begin{align*}
  v &= \begin{bmatrix} 1 & 2 \\ 3 & 3 \end{bmatrix} 
       \begin{bmatrix} -3 \\ 2 \end{bmatrix} \\
  a &= b
\end{align*}

\end{document}

enter image description here

You can fix tabstackengine:

\documentclass{report}
\usepackage{amsmath}
\usepackage{tabstackengine}

\makeatletter
\renewcommand\ensureTABstackMath[1]{%
  {\ifnum`}=\z@\fi
  \let\sv@TABmode\TAB@delim\TABstackMath#1\let\TAB@delim\sv@TABmode
  \ifnum`{=\z@\fi}%
}
\makeatother

\begin{document}

\begin{align*}
  v &= \bracketMatrixstack{1 & 2 \\ 3 & 3} \bracketVectorstack{-3 \\ 2} \\
  v &= \begin{bmatrix} 1 & 2 \\ 3 & 3 \end{bmatrix}
       \begin{bmatrix} -3 \\ 2 \end{bmatrix} \\
  a &= b
\end{align*}

\end{document}

but I still can't see any improvement.

enter image description here

5
  • Well son of a gun...thanks for that suggestion. Not that I understand it yet. Feb 28, 2018 at 18:05
  • 1
    @StevenB.Segletes Brace matching hack.
    – egreg
    Feb 28, 2018 at 18:07
  • 1
    @StevenB.Segletes if you have a texbook that kind of brace is explained in appendix D (\eegroup) Feb 28, 2018 at 19:51
  • @DavidCarlisle I will look into it. Feb 28, 2018 at 19:53
  • @DavidCarlisle pp385-386. Feb 28, 2018 at 20:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .