Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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