Dimana \ arraystretch?
setspace.stymenunjukkan bahwa doublespacingberubah baselinestretch, tetapi di manakah hubungan antara baselinestretchdan arraystretch? Saya perlu jumlah pasti arraystretchuntuk mengubah ukuran bmatrixs saya . Perataan vertikal matriks dalam kombinasi dengan spasi ganda menunjukkan baselinestretch= 1/arraystretch, tetapi di mana saya dapat menemukan informasi ini? Tampaknya tidak setspace.styatau amsmath.stymemiliki informasi.
Jawaban
Ketika \setstretchperintah atau turunan seperti \doublespacingdikeluarkan, nilai normal \baselineskipdikalikan dengan yang dinyatakan \baselinestretch.
Ketika arrayatau tabulardimulai, yang saat ini nilai \baselineskipdikalikan dengan \arraystretch. Jadi Anda ingin yang \arraystretchdiatur ke kebalikan dari \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}
Anda dapat menghindari kebutuhan untuk mengeluarkan secara eksplisit \fixstretchdengan mendefinisikan ulang \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}