amsmath 中 \if@display 的用途是什麼?

amsmath 中 \if@display 的用途是什麼?

我注意到,在部分一個答案其中\pod使用 重新定義\mathchoice,語句\if@display... \else...\fi用於 的前兩個選項\mathchoice。我想知道:什麼意思,什麼時候有必要(或鼓勵)@display使用該聲明\if@display...... \else\fi

答案1

\if@display是單一標記,而不是\if @display在 amsmath 中定義和記錄如下:

%    The straightforward \cs{ifinner} test to see if the current math
%    context is non-display, fails if, for instance, we are typesetting
%    a multiline display within an \cs{halign}, with the pieces going
%    into constructions like
%    \begin{verbatim}
%    $\displaystyle...$
%    \end{verbatim}
%    So we need a better test to find out if we are `in a display'. We
%    therefore create \cs{if@display}.
%
%    \begin{macrocode}
\newif\if@display
\everydisplay\@xp{\the\everydisplay \@displaytrue}
%    \end{macrocode}

基本上,這是 amsmath 中的內部構造,不打算在其他地方使用,儘管有時可以小心地使用它作為通常\mathchoice構造的替代方案。

相關內容