显然,有命令\iint
、\iiint
和\iiiint
来输入迭代积分符号。要计算 R^4 x [0,T] 中的积分(即在 4 维空间和时间上),我会输入\iiiiint_{\mathbb R^4 \times [0,T]}
,但该命令\iiiiint
不是预定义的。有没有办法输入包含五个迭代积分的符号?
答案1
该amsmath
软件包已经提供了基础设施:
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\ams@newcommand{\iiiiint}{\DOTSI\protect\MultiIntegral{5}}
\renewcommand{\MultiIntegral}[1]{%
\edef\ints@c{\noexpand\intop
\ifnum#1=\z@\noexpand\intdots@\else\noexpand\intkern@\fi
\ifnum#1>\tw@\noexpand\intop\noexpand\intkern@\fi
\ifnum#1>\thr@@\noexpand\intop\noexpand\intkern@\fi
\ifnum#1>4 \noexpand\intop\noexpand\intkern@\fi % <---- added
\noexpand\intop
\noexpand\ilimits@
}%
\futurelet\@let@token\ints@a
}
\makeatother
\begin{document}
\begin{gather}
\int\quad
\iint\quad
\iiint\quad
\iiiint\quad
\iiiiint
\\
\int_{\Gamma}\quad
\iint_{\Gamma}\quad
\iiint_{\Gamma}\quad
\iiiint_{\Gamma}\quad
\iiiiint_{\Gamma}
\\
\int\limits_{\Gamma}\quad
\iint\limits_{\Gamma}\quad
\iiint\limits_{\Gamma}\quad
\iiiint\limits_{\Gamma}\quad
\iiiiint\limits_{\Gamma}
\end{gather}
\end{document}
允许任意数量的积分符号的变体;\multiint
应仅与至少 2 个参数一起使用。
\documentclass{article}
\usepackage{amsmath}
\usepackage{expl3}
\makeatletter
%\ams@newcommand{\iiiiint}{\DOTSI\protect\MultiIntegral{5}}
\ams@newcommand{\multiint}[1]{\DOTSI\protect\MultiIntegral{#1}}
\renewcommand{\MultiIntegral}[1]{%
\edef\ints@c{\noexpand\intop
\ifnum#1=\z@\noexpand\intdots@\else\noexpand\intkern@\fi
\replicate{#1-2}{\noexpand\intop\noexpand\intkern@}%
\noexpand\intop
\noexpand\ilimits@
}%
\futurelet\@let@token\ints@a
}
\makeatother
\ExplSyntaxOn
\cs_new:Npn \replicate #1 #2 { \prg_replicate:nn { #1 } { #2 } }
\ExplSyntaxOff
\begin{document}
\begin{gather}
\int\quad
\iint\quad
\iiint\quad
\multiint{4}\quad
\multiint{5}\quad
\multiint{6}
\\
\int_{\Gamma}\quad
\iint_{\Gamma}\quad
\iiint_{\Gamma}\quad
\multiint{4}_{\Gamma}\quad
\multiint{5}_{\Gamma}\quad
\multiint{6}_{\Gamma}
\\
\int\limits_{\Gamma}\quad
\iint\limits_{\Gamma}\quad
\iiint\limits_{\Gamma}\quad
\multiint{4}\limits_{\Gamma}\quad
\multiint{5}\limits_{\Gamma}\quad
\multiint{6}\limits_{\Gamma}
\end{gather}
\end{document}