
나는 setspace
텍스트의 간격을 변경하는 데 사용합니다.
\usepackage{setspace}
\setstretch{1.435}
방정식의 간격은 변경하여 관리할 수 있습니다.\arraystretch
@egreg의 접근 방식여기
\usepackage{etoolbox}
\pretocmd{\array}{\renewcommand{\arraystretch}{0.69686}}{}{} % 1/1.435=0.69686
또는 @campa의 접근 방식여기
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.435}
\everydisplay=\expandafter{\the\everydisplay\setstretch{1.0}}
그러나 어느 쪽이든 테이블의 행 간격은 신호 간격이며 \arraystretch
또는 의 값을 변경하여 변경할 수 없습니다 \setstretch
.
나는 신호 간격보다는 테이블의 행 간격을 조금 늘리는 것을 선호합니다. 어떻게 해야 합니까?
\documentclass{article}
\usepackage{lipsum} % just for this example
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{setspace}
\setstretch{1.435}
\usepackage{etoolbox}
\pretocmd{\array}{\renewcommand{\arraystretch}{1}}{}{} % increase a little for the row spacing in equations
\begin{document}
\lipsum*[1]
\begin{equation}
X=\begin{cases}
\frac{1}{2}, & \text{if $a=1$} \\
\frac{3}{2} & \text{otherwise}
\end{cases}
\end{equation}
\begin{table}[htbp]
\centering
\caption{Changing the row spacing in the table}
\begin{tabular}{ c c c }
\toprule
cell1 & cell2 & cell3 \\
\midrule
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
답변1
여러 줄로 된 방정식의 간격을 지정하려면 spreadlines
의 환경을 사용하는 것이 가능합니다 mathtools
. 일반 cases
환경 에서는 작동하지 않지만 mathtools
.
cellspace
테이블의 경우 지정자 앞에 문자가 붙은 열의 셀 위쪽과 아래쪽에 최소 수직 간격을 정의하는 를 사용할 수 있습니다 S
(또는 C
를 로드하는 경우 siunitx
). 마지막으로 caption
캡션과 플로트 사이의 건너뛰기를 설정할 수 있는 패키지를 로드하는 것이 좋습니다 .
다음은 과장된 예제 코드입니다.
\documentclass{article}
\usepackage{lipsum} % just for this example
\usepackage{mathtools, empheq, nccmath}
\usepackage{booktabs, caption}
\captionsetup{skip=20pt}
\usepackage[math]{cellspace}
\renewcommand{\cellspacetoplimit}{10pt}
\renewcommand{\cellspacebottomlimit}{10pt}
\usepackage{etoolbox}
\BeforeBeginEnvironment{equation}{\begin{spreadlines}{20pt}}%{\spreadlines{20pt}}%
\AfterEndEnvironment{equation}{\end{spreadlines}}
\BeforeBeginEnvironment{empheq}{\begin{spreadlines}{20pt}}%{\spreadlines{20pt}}%
\AfterEndEnvironment{empheq}{\end{spreadlines}}
\usepackage{setspace}
\setstretch{1.435}
\pretocmd{\array}{\renewcommand{\arraystretch}{1}}{}{} % increase a little for the row spacing in equations
\begin{document}
\lipsum*[1]
\begin{equation}
X=\begin{cases*}
\mfrac{1}{2}, & \text{if $a=1$} \\
\mfrac{3}{2} & \text{otherwise}
\end{cases*}
\end{equation}
\begin{empheq}[left ={ X = \empheqlbrace}]{alignat*=2}
& \mfrac{1}{2}, &\quad & \text{if $a=1$} \\
& \mfrac{3}{2} & & \text{otherwise}
\end{empheq}
\begin{table}[htbp]
\centering
\caption{Changing the row spacing in the table}
\begin{tabular}{ Sc c c }
\toprule
cell1 & cell2 & cell3 \\
\midrule
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}