I have a case where I'm showing an integral of a fraction, but the integral sign doesn't stretch down to cover the entirety of the fraction:
This results from the following MWE:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\frac{3Q}{2\pi z^2} \displaystyle\int\frac{1}{\left( 1 + \dfrac{x^2 + y^2}{z^2} \right)^{\frac{5}{2}}}
\end{equation*}
\end{document}
The way I'm used to writing integrals looks more like this:
This question describes using packages like bigints
and mtpro2
to scale the integral size. However, these appear to scale the integral sign relative to the location of the fraction's horizontal bar, which would not be the desired result here. Is there a way to get the integral to stretch to cover the entire fraction, as shown above? Also, I'd like to be able to set limits of the integration as well as the indefinite integral.
Note to the mathematicians out there – if I am violating some sort of typesetting convention with my request, please let me know. I'm not particularly well-versed with the convention used in mathematical circles for this sort of thing.
Best Answer
It is very uncharacteristic to typeset an integral sign uncentered at horizontal math axis. All variable-with math elements like braces, big operators etc are centered in traditional typography.
But if you wish such behaviour then, of course, it is possible. TeX is flexible. You can try the following macros, where
\flexibleint
macro is created. Usage is:The integrand must be in braces.
How it works: First, the fontname of
\textfont3
(where\int
sign is expected) is extracted at 10pt size (into\intfont
) and the\int
in\displaystyle
at 10pt is measured (in\intsize
).Secondly, the scanning of
_a
or^b
is performed using auxiliary macros\fxintA
to\fxintE
.Finally, the integrand in box is measured, its vertically different positions is compared using
\box0
and\box1
(the second box is\vcenter
ed), the font for\textfont3
scaled to desired size is temporary loaded and the flexible integral is typeset.