\arraystretch 在哪里?

\arraystretch 在哪里?

setspace.sty显示发生了doublespacing变化,但和baselinestretch之间的关系在哪里?我需要确切的数字来调整 的大小。baselinestretcharraystretcharraystretchbmatrix矩阵垂直对齐与双倍行距相结合显示baselinestretch= 1/arraystretch,但我在哪里可以找到这些信息?似乎没有setspace.styamsmath.sty没有这些信息。

答案1

当发出\setstretch或派生命令时\doublespacing,的正常值\baselineskip将乘以规定的\baselinestretch

arraytabular开始时,当前的的值\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}

在此处输入图片描述

相关内容