¿Dónde está \ arraystretch?

Sep 25 2020

setspace.stymuestra que doublespacingcambia baselinestretch, pero ¿dónde está la relación entre baselinestretchy arraystretch? Necesito el número exacto de arraystretchpara cambiar el tamaño de mi bmatrixs. La alineación vertical de la matriz en combinación con el espacio doble muestra baselinestretch= 1/arraystretch, pero ¿dónde puedo encontrar esta información? No parece setspace.styni amsmath.stytiene la información.

Respuestas

2 egreg Sep 25 2020 at 15:06

Cuando se emite un \setstretchcomando derivado o como \doublespacing, el valor normal de \baselineskipse multiplica por el indicado \baselinestretch.

Cuando se inician arrayo tabular, el valor actual de \baselineskipse multiplica por \arraystretch. Por lo tanto, desea que \arraystretchse establezca en el recíproco de \baselinestretch.

\documentclass[twocolumn]{article}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{xfp}

\newcommand{\fixstretch}{\edef\arraystretch{\fpeval{1/(\baselinestretch)}}}

\doublespacing

\begin{document}

Some text that should be long enough to be broken across lines
so as to show the interline spacing. But now we show a matrix
\[
\begin{bmatrix}
1 & 0 \\
0 & 1 \\
0 & 0
\end{bmatrix}
\]
The result is really awful. Now we try in a different way.

\fixstretch
Some text that should be long enough to be broken across lines
so as to show the interline spacing. But now we show a matrix
\[
\begin{bmatrix}
1 & 0 \\
0 & 1 \\
0 & 0
\end{bmatrix}
\]
Now the matrix is nice. Of course, the double spaced
text remains as ugly as it can be.

\end{document}

Puede evitar la necesidad de emitir explícitamente \fixstretchredefiniendo \setstretch.

\documentclass[twocolumn]{article}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{xfp}

% fix \setstretch to also act on \arraystretch
\makeatletter
\renewcommand{\setstretch}[1]{%
  \def\baselinestretch{#1}%
  \edef\arraystretch{\fpeval{1/#1}}% <---- added code
  \@currsize
}
\makeatother

\doublespacing

\begin{document}

Some text that should be long enough to be broken across lines
so as to show the interline spacing. But now we show a matrix
\[
\begin{bmatrix}
1 & 0 \\
0 & 1 \\
0 & 0
\end{bmatrix}
\]
Now the matrix is nice. Of course, the double spaced
text remains as ugly as it can be.

\end{document}