Где \ arraystretch?
setspace.styпоказывает, что doublespacingизменения baselinestretch, но где связь между baselinestretchи arraystretch? Мне нужно точное количество, arraystretchчтобы изменить размер моих bmatrixs. Вертикальное выравнивание матрицы в сочетании с двойным интервалом показывает baselinestretch= 1/arraystretch, но где я могу найти эту информацию? Вроде нет setspace.styи amsmath.styинформации нет.
Ответы
Когда выдается \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}