4

When a \bordermatrix is placed inside an array, the spacing between rows will be wrong (see the MWE below). What is causing this problem? Is there a solution?

\documentclass{book}

\begin{document}

A simple matrix created with \verb+\bordermatrix+; right spacing between rows:
\[
  \bordermatrix{%
    & 1 & 2 \cr
    1 & x1 & x2 \cr
    2 & x3 & x4 \cr
    3 & x5 & x6}
\]

The same matrix inside an \texttt{array}; wrong spacing between rows:
\[
\begin{array}{c}
  \bordermatrix{%
    & 1 & 2 \cr
    1 & x1 & x2 \cr
    2 & x3 & x4 \cr
    3 & x5 & x6}
\end{array}
\]

\end{document}
6

This is caused because the \bordermatrix uses the \baselineskip for the spacing and array sets this to 0pt.

Restoring the value of \baselineskip in the cell fixes the issue:

\documentclass{book}

\begin{document}

\[
\edef\savedbaselineskip{\the\baselineskip\relax}
\begin{array}{c}
    {\baselineskip=\savedbaselineskip
    \bordermatrix{%
    & 1 & 2 \cr
    1 & x1 & x2 \cr
    2 & x3 & x4 \cr
    3 & x5 & x6}}
\end{array}
\]

\end{document}

This is done inside a group to keep the definition local.

2

An altenative way to restoring \baselineskip, which has been shown by Martin, is using \parbox or minipage for embedding the \bordermatrix, within the array. This would also restore the spacing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.