Où est \ arraystretch?
setspace.stymontre que cela doublespacingchange baselinestretch, mais où est la relation entre baselinestretchet arraystretch? J'ai besoin du nombre exact de arraystretchpour redimensionner mes bmatrixs. L'alignement vertical de la matrice en combinaison avec un double espacement montre baselinestretch= 1/arraystretch, mais où puis-je trouver ces informations? Il ne semble setspace.styni amsmath.styn'a ni information.
Réponses
Lorsqu'une \setstretchcommande ou dérivée telle que \doublespacingest émise, la valeur normale de \baselineskipest multipliée par la valeur indiquée \baselinestretch.
Lorsque arrayou tabularsont démarrés, la valeur actuelle de \baselineskipest multipliée par \arraystretch. Ainsi, vous voulez que ce \arraystretchsoit réglé sur l'inverse 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}
Vous pouvez éviter d'avoir à émettre explicitement \fixstretchen redéfinissant \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}