增加對齊*案例環境中的行高

增加對齊*案例環境中的行高

我試著用案例來呈現一些帶有分數的方程,並發現這些行太壓縮而難以閱讀。有沒有辦法既增加行間距又增加排版字元的大小? MWE 是

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align*}
A = \begin{cases}
\frac{B-.5b}{C-.5c} & \text{sometimes} \\
\frac{D-.3d}{E-.7e} & \text{other times}
\end{cases}
\end{align*}

\end{document}

產生

對齊時壓扁文字

答案1

mathtools擴展amsmathdcases

在此輸入影像描述

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\[
A = \begin{dcases}
\frac{B-.5b}{C-.5c} & \text{sometimes} \\
\frac{D-.3d}{E-.7e} & \text{other times}
\end{dcases}
\]

\end{document}

答案2

下面顯示如何cases使用複製array

在此輸入影像描述

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align*}
  A = \begin{cases}
    \frac{B-.5b}{C-.5c} & \text{sometimes} \\
    \frac{D-.3d}{E-.7e} & \text{other times}
  \end{cases}
\end{align*}
\begin{align*}
  A &= \begin{cases}
    \frac{B-.5b}{C-.5c} & \text{sometimes} \\
    \frac{D-.3d}{E-.7e} & \text{other times}
  \end{cases} \\
  A &= \renewcommand{\arraystretch}{1.5}\left\{\begin{array}{@{}l@{\quad}l@{}}
    \frac{B-.5b}{C-.5c} & \text{sometimes} \\
    \frac{D-.3d}{E-.7e} & \text{other times}
  \end{array}\right.\kern-\nulldelimiterspace
\end{align*}

\end{document}

第一個align*複製您的輸出,而第二個align*包括原始內容casesarray實作。使用 時array,您可以調整\arraystretch以垂直拉伸“ cases”結構(類似於中的其他建議)表格中的列和行填充)。

請注意,預設\arraystretchcasesamsmath1.2,如\env@cases定義所示(取自amsmath.dtx`):

\def\env@cases{%
  \let\@ifnextchar\new@ifnextchar
  \left\lbrace
  \def\arraystretch{1.2}%
  \array{@{}l@{\quad}l@{}}%
}

當然,您可以將此預設1.2拉伸因子變更為更大的值,但我的假設是您只希望cases稍微播放 的特定實例,而不是進行全域變更。


\dfrac可以使用代替 來調整字元的大小\frac。然而,這需要一個大於\arraystretch的值1.5。我不確定這在視覺上能帶來什麼好處。

答案3

我所做的就是調用\displaystyle每一行並插入一個額外的空行。已編輯(根據維爾納的提醒)在加載包時使用\dfrac而不是, 。\displaystyle\fracamsmath

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align*}
A = \begin{cases}
\dfrac{B-.5b}{C-.5c} & \text{sometimes} \\
\\
\dfrac{D-.3d}{E-.7e} & \text{other times}
\end{cases}
\end{align*}

\end{document}

在此輸入影像描述

答案4

對以上所有答案的補充

一個有用的功能是控制垂直距離casesarray或類似環境的方程式之間。您可以透過編寫\\[your distance with units]而不是簡單地做到這一點\\。例如\\[1.5em]。它也適用於負間距,例如,\\[-0.5em]

在這個最小的例子中我使用\\[1.0em]

\documentclass{article}
\usepackage{amsmath}
\begin{document}

    \begin{align*}
        A = \begin{cases}
            \dfrac{B-.5b}{C-.5c} & \text{sometimes} \\[1.0em]
            \dfrac{D-.3d}{E-.7e} & \text{other times}
        \end{cases}
    \end{align*}

\end{document}

在此輸入影像描述

此程式碼是 Steven B. Segletes 修改的。在我看來,它看起來比只是一個額外的空行更好。 ;)

相關內容