7

I currently would like to typeset an integral with long integral borders. But either I get too much space after the integral sign and before the function I integrate, or I get a wrong alignment of the border:

enter image description here

How can I typeset long integral borders?

MWE

\documentclass[a5paper]{scrartcl}
\usepackage{amssymb, amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage{mathtools}
\begin{document}
\section*{With mathclap}
\begin{align*}
\int_S f \mathrm{d} A &= \sum_{i=1}^n \int_{\mathclap{V_i}} f \mathrm{d} A \\
&- \sum_{i \neq j} \int_{\mathclap{V_i \cap V_j}} f \mathrm{d} A \\
&+ \sum_{i,j,k} \int_{\mathclap{V_i \cap V_j \cap V_k}} f \mathrm{d} A\\
&- \dots
\end{align*}

\section*{Without mathclap}
\begin{align*}
\int_S f \mathrm{d} A &= \sum_{i=1}^n \int_{V_i} f \mathrm{d} A \\
&- \sum_{i \neq j} \int_{V_i \cap V_j} f \mathrm{d} A \\
&+ \sum_{i,j,k} \int_{V_i \cap V_j \cap V_k} f \mathrm{d} A\\
&- \dots
\end{align*}
\end{document}
  • 2
    Not recommending anything… but there exist \mathrlap and \mathllap just in case it works for you. – Manuel Feb 20 '14 at 14:39
  • @Manuel that is exactly what I was looking for! Thank you! – Martin Thoma Feb 20 '14 at 14:41
4

\mathrlap{…} could do the job.

\documentclass[a5paper]{scrartcl}
\usepackage{amssymb, amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage{mathtools}
\begin{document}
\section*{With mathrlap}
\begin{align*}
\int_S f \mathrm{d} A &= \sum_{i=1}^n \int_{\mathrlap{V_i}} f \mathrm{d} A \\
&- \sum_{i \neq j} \int_{\mathrlap{V_i \cap V_j}} f \mathrm{d} A \\
&+ \sum_{i,j,k} \int_{\mathrlap{V_i \cap V_j \cap V_k}} f \mathrm{d} A\\
&- \dots
\end{align*}

\section*{Without mathrlap}
\begin{align*}
\int_S f \mathrm{d} A &= \sum_{i=1}^n \int_{V_i} f \mathrm{d} A \\
&- \sum_{i \neq j} \int_{V_i \cap V_j} f \mathrm{d} A \\
&+ \sum_{i,j,k} \int_{V_i \cap V_j \cap V_k} f \mathrm{d} A\\
&- \dots
\end{align*}
\end{document}

enter image description here

4

Some hand tuning is necessary, with formulas like these.

\documentclass[a5paper]{scrartcl}
\usepackage{amsmath} % needed for math

\newcommand{\diff}{\mathop{}\!\mathrm{d}}
\newcommand{\back}[1]{\mspace{-#1mu}}

\begin{document}

\begin{align*}
\int_S f \diff A
&      = \sum_{i=1}^n    \; \int\limits_{V_i} f \diff A \\
&\quad - \sum_{i \neq j} \; \int\limits_{V_i \cap V_j}          \back{6} f \diff A \\
&\quad + \sum_{i,j,k}    \; \int\limits_{V_i \cap V_j \cap V_k} \back{12} f \diff A\\
&\quad - \dotsb
\end{align*}
\end{document}

With \back you get some back spacing. The integration domain should be below the integral sign.

Don't use explicit \mathrm{d} for the differential (and don't use an upright “d”, but this is another matter), prefer a high level command. The one I propose automatically takes care of a thin space before the “d”.

enter image description here

2
\documentclass[a5paper]{scrartcl}
\usepackage{amssymb, amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage{mathtools}
\usepackage{stackengine}
\stackMath
\begin{document}

\section*{With stacks}
\begin{align*}
\int_S f \mathrm{d} A &= \sum_{i=1}^n \stackunder{%
  \displaystyle\int}{\scriptstyle V_i} f \mathrm{d} A \\
&- \sum_{i \neq j} \def\stackalignment{l}\addstackgap{\stackunder{%
  \displaystyle\int}{\rlap{$\scriptstyle V_i \cap V_j$}}} f \mathrm{d} A \\
&- \sum_{i ,j,k} \def\stackalignment{l}\addstackgap{\stackunder{%
  \displaystyle\int}{\rlap{$\scriptstyle V_i \cap V_j\cap V_k$}}} f \mathrm{d} A \\
&- \dots
\end{align*}
\end{document}

enter image description here

EDITED to provide more vertical gap between equations.

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.