Apparently, there are the commands \iint
, \iiint
, and \iiiint
to type iterated integral symbols. To compute an integral in R^4 x [0,T] (i.e. over a 4-dimensional space and time), I would type \iiiiint_{\mathbb R^4 \times [0,T]}
, except that the command \iiiiint
is not pre-defined. Is there a way to type a symbol containing five iterated integrals?
1 Answer
The amsmath
package already provides the infrastructure:
\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}
A variant allowing any number of integral signs; \multiint
should only be used with an argument at least 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}
-
-
Just add more lines with
#1>5
,#1>6
, etc. You could definitely add a command there to do the work rather than add one line at a time, for instance\replicate{#1-2}{\noexpand\intop\noexpand\intkern@}
. Each line adds an integral sign more, so if you have 5 lines, at most you have 5 integrals. But I think it could be done more efficiently.– ManuelJul 8, 2016 at 22:47 -
-
@SAM: Yes indeed, but the code that is executed if
#1>4
simply adds one integral sign!– GuMJul 8, 2016 at 22:51 -
1
amsmath
provides\idotsint
.\iiiint\!\!\!\int
. (Cf. The TeXbook, bottom of p. 169.)\idotsint_{\mathbb R^4 \times [0,T]}
is sufficiently clear for the reader, and definitely looks better. Now, really, good night to everybody!