\ Arraystretch nerede?

Sep 25 2020

setspace.stydoublespacingdeğiştiğini gösterir baselinestretch, ancak baselinestretchve arasındaki ilişki nerede arraystretch? E arraystretch-postalarımı yeniden boyutlandırmak için tam sayısına ihtiyacım var bmatrix. Çift aralıkla birlikte matris dikey hizalaması gösterir baselinestretch= 1/arraystretch, ancak bu bilgiyi nerede bulabilirim? Görünüşe göre ne bilgi ne setspace.styde amsmath.styvar.

Yanıtlar

2 egreg Sep 25 2020 at 15:06

\setstretchGibi bir veya türetilmiş komut \doublespacingverildiğinde, normal değeri \baselineskipbelirtilen ile çarpılır \baselinestretch.

Başlatıldığında arrayveya tabularbaşlatıldığında, mevcut değeri \baselineskipile çarpılır \arraystretch. Böylece \arraystretchbunun tersine ayarlanmasını istiyorsunuz \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}

Yeniden \fixstretchtanımlayarak açıkça sorun yapma ihtiyacından kurtulabilirsiniz \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}