setspace.sty
显示发生了doublespacing
变化,但和baselinestretch
之间的关系在哪里?我需要确切的数字来调整 的大小。baselinestretch
arraystretch
arraystretch
bmatrix
矩阵垂直对齐与双倍行距相结合显示baselinestretch
= 1/arraystretch
,但我在哪里可以找到这些信息?似乎没有setspace.sty
或amsmath.sty
没有这些信息。
答案1
当发出\setstretch
或派生命令时\doublespacing
,的正常值\baselineskip
将乘以规定的\baselinestretch
。
当array
或tabular
开始时,当前的的值\baselineskip
乘以\arraystretch
。因此,您希望\arraystretch
将 设置为 的倒数\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}
\fixstretch
您可以通过重新定义来避免明确发出的需要\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}