\ arraystretch는 어디에 있습니까?

Sep 25 2020

setspace.sty것을 보여준다 doublespacing변경 baselinestretch,하지만 사이의 관계이다 baselinestretch와 arraystretch? 내의 arraystretch크기를 조정 하려면 정확한 수가 필요합니다 bmatrix. 이중 간격과 함께 행렬 수직 정렬 은 baselinestretch= 1/arraystretch를 표시하지만이 정보는 어디에서 찾을 수 있습니까? 그것은 둘 다 보인다 setspace.sty이나 amsmath.sty정보를 가지고 있습니다.

답변

2 egreg Sep 25 2020 at 15:06

경우 \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}