11

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?

9
  • 1
    $\iiiint\!\!\int$
    – Cfun
    Jul 8, 2016 at 22:33
  • 2
    amsmath provides \idotsint.
    – egreg
    Jul 8, 2016 at 22:33
  • 2
    @SAM: in display math, you need \iiiint\!\!\!\int. (Cf. The TeXbook, bottom of p. 169.)
    – GuM
    Jul 8, 2016 at 22:43
  • 1
    I am using TexMaKer i.stack.imgur.com/LJGfj.png
    – Cfun
    Jul 8, 2016 at 22:51
  • 2
    After seeing your edit, I’d say that \idotsint_{\mathbb R^4 \times [0,T]} is sufficiently clear for the reader, and definitely looks better. Now, really, good night to everybody!
    – GuM
    Jul 8, 2016 at 23:15

1 Answer 1

13

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}

enter image description here

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}

enter image description here

11
  • Simply programmation side, why it doesn't work after 5 ? #1>4
    – Cfun
    Jul 8, 2016 at 22:44
  • 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.
    – Manuel
    Jul 8, 2016 at 22:47
  • but #1>4 is verified for 5 !
    – Cfun
    Jul 8, 2016 at 22:48
  • @SAM: Yes indeed, but the code that is executed if #1>4 simply adds one integral sign!
    – GuM
    Jul 8, 2016 at 22:51
  • 1
    @SAM I added a version allowing any number
    – egreg
    Jul 8, 2016 at 23:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.