Lower and upper Riemann integrals?
Personally I use shorter bars. It makes the macro much more complex:
\documentclass{article}
\usepackage{amsmath}
\def\upint{\mathchoice%
{\mkern13mu\overline{\vphantom{\intop}\mkern7mu}\mkern-20mu}%
{\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}%
{\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}%
{\mkern7mu\overline{\vphantom{\intop}\mkern7mu}\mkern-14mu}%
\int}
\def\lowint{\mkern3mu\underline{\vphantom{\intop}\mkern7mu}\mkern-10mu\int}
\begin{document}
\begin{gather*}
\upint_a^b f(x)\,\mathrm{d}x \\
\lowint_a^b f(x)\,\mathrm{d}x
\end{gather*}
\end{document}
I'm not sure which is better. Some new Unicode math fonts (XITS Math and Asana Math) have \lowint
and \upint
, and you can use unicode-math
package to load the fonts. They also use wide bars.
(from unimath-symbols
doc)
From what I've seen online, it suffices to use \overline
and \underline
.
Here is a minimal example that defines
\upRiemannint{<lo>}{<hi>}
which draws the "upper Riemann integral" over the range [<lo>
,<hi>
]. Analogously,
\loRiemannint{<lo>}{<hi>}
defines the "lower Riemann integral" over the range [<lo>
,<hi>
].
\documentclass{article}
\newcommand{\upRiemannint}[2]{
\overline{\int_{#1}^{#2}}
}
\newcommand{\loRiemannint}[2]{
\underline{\int_{#1}^{#2}}
}
\begin{document}
\[
\loRiemannint{a}{b} f(x)\,\mathrm{d}x \qquad \textrm{or} \qquad \upRiemannint{a}{b} f(x)\,\mathrm{d}x
\]
\end{document}
These integrals also translate to use in text mode, but vertical alignment is slightly off due to the integral sign by default.
If you want complete control over the placement of the bars, you can try the following code for the lower integral:
\lefteqn{\int_a^b f(x)}\lefteqn{\hspace{0.0ex}\rule[-2.25ex]{1.1ex}{.05ex}}
\phantom{\int_a^b f(x)}\mathrm{d}x
And for the upper integral:
\lefteqn{\int_a^b f(x)}\lefteqn{\hspace{1.2ex}\rule[ 3.35ex]{1.1ex}{.05ex}}
\phantom{\int_a^b f(x)}\mathrm{d}x
The hspace
argument controls left/right positioning. The three rule
arguments respectively control height, length and thickness of the bar.