# Math equation typeset problem

I would like typeset equation on the figure below.

I have problem with subsript text 1, 2, 3 and 4 under integrals. I try something like this:

\begin{align}\label{fyz:eq_fey_null2}
\displaystyle\int(\nabla\times\vec{C})_n d\vec{S} &=
\displaystyle\int\nabla\cdot(\nabla\times\vec{C}) dV.                   \\
\shortintertext{\hspace{6.7cm}text 1   \hspace{1.5cm}text 3}
\shortintertext{\hspace{6.7cm}text 2   \hspace{1.9cm}text 4}  \nonumber \\
\end{align}


But this solution is not good. Using \hspace leads to unpredictable behavior when changing equation in worst case the page formatting, or when is equation on the end of the page, it could be breake. I use xelatex and amsmath package.

-
Could you please post a complete MWE? –  Holene Oct 19 '13 at 6:42
The left hand side yields a vector while the right hand side yields a scalar. It does not make sense. There must be a scalar product on the left side. –  Oh my ghost Oct 20 '13 at 6:45
This equation, could be found in the second part of Feynman Lectures on Physics Vol. II, R.P. Feynman, R.B. Leighton, M. Sands, Addison Wesley, 1964 ISBN 0-201-02117-X-P. Right hand side is equal to zero! –  jafan Oct 26 '13 at 10:57

## 2 Answers

I introduce \stackint to stack any number of layers below the \displaystyle integral sign. No need to wrap the argument in \text macros. Each line of the undertext will be centered relative to the integral sign.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}[2013-10-15]
\newcommand\stackint[1]{\tiny\Shortunderstack{{\normalsize$\displaystyle\int$} \\ #1}}
\begin{document}
$\stackint{text 1\\text 2} (\vec{\nabla} \times \vec{C})_n \,\mathrm{d}\vec{S} = \stackint{text 3\\text 4} \vec{\nabla} \cdot (\vec{\nabla} \times \vec{C}) \,\mathrm{d}V.$
\end{document}


To not let the under-text affect the integral width, apply this line in the preamble sometime after stackengine is loaded:

\def\useanchorwidth{T}


-

You could use a \substack to stack items underneath an operator:

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\newcommand{\limitint}{\mathop{\int}}
\begin{document}
\begin{align}
\limitint_{\substack{\text{text 1}\\\text{text 2}}} (\vec{\nabla} \times \vec{C})_n \,\mathrm{d}\vec{S} &=
\limitint_{\substack{\text{text 3}\\\text{text 4}}} \vec{\nabla} \cdot (\vec{\nabla} \times \vec{C}) \,\mathrm{d}V.
\end{align}
\end{document}


Depending on what you have written for text 1...text 4, you may want to use mathtools' \mathclap to avoid too much horizontal spacing:

\documentclass{article}
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\newcommand{\limitint}{\mathop{\int}}
\begin{document}
\begin{align}
\limitint_{\mathclap{\substack{\text{text 1}\\\text{text 2}}}} (\vec{\nabla} \times \vec{C})_n \,\mathrm{d}\vec{S} &=
\limitint_{\mathclap{\substack{\text{text 3}\\\text{text 4}}}} \vec{\nabla} \cdot (\vec{\nabla} \times \vec{C}) \,\mathrm{d}V.
\end{align}
\end{document}

-
Using \int\limits instead of \mathop{\int} may (i) be "more standard" LaTeX code and (ii) produce slightly better horizontal positioning of the block below the integral symbols. With \mathop{\int}, the lower-limit material is centered relative to the entire TeX "box" that contains the integral symbol, whereas with \int\limits the lower-limit material appears to be centered relative to the bottom of the integral symbol. This difference becomes more readily apparent if there was upper-limit material to be typeset. –  Mico Oct 19 '13 at 9:14