\adjustlimits 适用于两个以上的连续运算符

\adjustlimits 适用于两个以上的连续运算符

我知道我可以使用 \adjustlimits 来对齐两个连续运算符的界限。有没有办法对齐两个以上连续运算符的界限?例如,考虑以下情况

\begin{equation*}
\limsup_{n\uparrow\infty}\inf_{x\in \mathcal{X}}\sup_{\beta\in [0,1]}.
\end{equation*}

非常感谢!

答案1

这只是我对 @egreg 的解决方案的玩弄。我发现如果要应用 ,必须添加逗号是不自然的\multiadjustlimits,所以我改用了递归版本。它将以三重奏形式读取参数,如果没有三重奏,则保留它。在三重奏中,第二部分被认为等同于_

\documentclass{article}
\usepackage{amsmath,mathtools}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\multiadjustlimitsR}{m}
 {
  \group_begin:
  \multiadjustlimits_measure:n { #1 }
  \multiadjustlimits_print:n { #1 }
  \group_end:
 }

\dim_new:N \l__multiadjustlimits_ht_dim
\dim_new:N \l__multiadjustlimits_dp_dim
\tl_new:N  \l__multiadjustlimits_operator_tl
\tl_new:N  \l__multiadjustlimits_limit_tl

\cs_new_protected:Nn \multiadjustlimits_measure:n
{
  \__my_map_dlf:nnn #1 \q_recursion_tail \q_recursion_tail \q_recursion_tail
  \q_recursion_stop
}

\cs_new_protected:Nn \__my_map_dlf:nnn {
  \quark_if_recursion_tail_stop:n {#1}
  \quark_if_recursion_tail_stop:n {#2}
  \quark_if_recursion_tail_stop:n {#3}
  % here, we got 3 good args
  \tl_put_right:Nn \l__multiadjustlimits_operator_tl { #1 }
  \tl_put_right:Nn \l__multiadjustlimits_limit_tl { #3 }
  \__my_map_dlf:nnn
}

\cs_new_protected:Nn \multiadjustlimits_print:n
 {
  \__my_map_dlf_print:nnn #1 \q_recursion_tail \q_recursion_tail \q_recursion_tail
  \q_recursion_stop
}

\cs_new_protected:Nn \__my_map_dlf_print:nnn {
  \quark_if_recursion_tail_stop:n {#1}
  \quark_if_recursion_tail_stop_do:nn {#2}{#1}
  \quark_if_recursion_tail_stop_do:nn {#3}{#1#2}
  % here, we got 3 good args
  \__multiadjustlimits_print:NNn {#1}{#2}{#3}
  \__my_map_dlf_print:nnn
}
\cs_new_protected:Nn \__multiadjustlimits_print:NNn
 {
  \mathop { \vphantom{\l__multiadjustlimits_operator_tl} \mathopen{} #1 }
  \limits
  \sb{ \vphantom{\l__multiadjustlimits_limit_tl} #3 }
 }

\ExplSyntaxOff

\newcommand{\cX}{%
  \makebox[0pt]{\smash{\vrule depth 0.1pt width 3cm}}% for debugging
  \mathcal{X}%
}

\begin{document}
\begin{equation*}
\multiadjustlimitsR{
  \limsup_{n\uparrow\infty}
  \inf_{x\in \cX}
  \sup_{\beta\in [0,1]}
  \sum F
}
A(n,x,\beta)
\end{equation*}

 \end{document}

在此处输入图片描述

答案2

以下是两个或更多运算符的实现:

\documentclass{article}
\usepackage{amsmath,mathtools}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\multiadjustlimits}{m}
 {% the argument should be a comma separated list of items of the form
  % <operator>_{<limit>}
  \group_begin:
  \multiadjustlimits_measure:n { #1 }
  \multiadjustlimits_print:n { #1 }
  \group_end:
 }

\tl_new:N  \l__multiadjustlimits_operator_tl
\tl_new:N  \l__multiadjustlimits_limit_tl

\cs_new_protected:Nn \multiadjustlimits_measure:n
 {
  \clist_map_function:nN { #1 } \__multiadjustlimits_measure:n
 }
\cs_new_protected:Nn \__multiadjustlimits_measure:n
 {
  \__multiadjustlimits_measure:NNn #1
 }
\cs_new_protected:Nn \__multiadjustlimits_measure:NNn
 {
  \tl_put_right:Nn \l__multiadjustlimits_operator_tl { #1 }
  \tl_put_right:Nn \l__multiadjustlimits_limit_tl { #3 }
 }

\cs_new_protected:Nn \multiadjustlimits_print:n
 {
  \clist_map_function:nN { #1 } \__multiadjustlimits_print:n
 }
\cs_new_protected:Nn \__multiadjustlimits_print:n
 {
  \__multiadjustlimits_print:NNn #1
 }
\cs_new_protected:Nn \__multiadjustlimits_print:NNn
 {
  \mathop { \vphantom{\l__multiadjustlimits_operator_tl} \mathopen{} #1 }
  \limits
  \sb{ \vphantom{\cramped{\l__multiadjustlimits_limit_tl}} #3 }
 }

\ExplSyntaxOff

\newcommand{\cX}{%
  \makebox[0pt]{\smash{\vrule depth 0.1pt width 3cm}}% for debugging
  \mathcal{X}%
}

\begin{document}

\begin{equation*}
\multiadjustlimits{
  \limsup_{n\uparrow\infty},
  \inf_{x\in \cX},
  \sup_{\beta\in [0,1]}
}
A(n,x,\beta)
\end{equation*}

\end{document}

已经使用了的定义\cX来显示下标的共同基线,当然它应该在生产版本中被删除。

在此处输入图片描述

答案3

这是一个特别指定方法。我用 替换\inf\mathop{\vphantom{p}\inf}\limits我还在和\vphantom{[}中添加了下标。n...x...

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation*}
\limsup_{\vphantom{[}n\uparrow\infty}\mathop{\vphantom{p}\inf}\limits_{\vphantom{[}x\in 
  \mathcal{X}}\sup_{\beta\in [0,1]}.
\end{equation*}

\end{document}

在此处输入图片描述

一旦可以看到三个下标的基线是对齐的。

相关内容