[Tex/LaTex] Superimpose letter on integral symbol

stacking-symbolssymbols

Good Afternoon all,

I am trying to typeset a symbol that I have been using to represent the integral of a regulated function. This symbol is the standard integral symbol, with the letter "R" superimposed on it.

I have tried using \mathllap, \mathclap and \mathrlap (as suggested here), however none of these have managed to give the desired effect. When I tried doing it without the limits of integration, it got close to working, however then I was unable to have the limits to the right hand side of the symbol:

\mathop{\mathrlap{\int}R}_a^b f

Any help would be greatly appreciated, thank you in advance!

Minimal Example:

\documentclass{article}

\usepackage{amsmath,mathtools}

\begin{document}

Take the regulated function $f$, we want to compare the Riemann integral, $\int_a^b f$
to the regulated integral $\mathop{\mathrlap{\int}R}_a^b f$ by taking sequences of step
functions.

We will prove that
$$
\mathop{\mathrlap{\int}R}_a^b f = \int_a^b f
$$

\end{document}

Best Answer

The following example defines \Rint that superimposes an R on the integral symbol. If the integral is used in \displaystyle, then the integral size is usually quite large and \textstyle is used for the R. Otherwise \scriptscriptstyle is used or scaled down, if the total height of R exceeds 40% of the total height of the integral.

Remarks:

  • The R is put in the middle of the glyph box of the integral symbol, both horizontally and vertically centered.

  • \Rint supports \dots of package \amsmath. The dots are automatically placed on the math axis, if an integral follows.

  • The very last command of \Rint is \int, thus the subscript and superscript behave as usual.

  • The R might stick out a little to the let, if the integral symbol is narrower than the letter. But usually there is enough room in the middle and even, if the integral is used without sub-/superscripts, TeX will put a thin space between math operators (\mathop).

\documentclass[a5paper]{article}

\usepackage{graphicx}
\usepackage{etoolbox}

% Packages for testing
\usepackage{amsmath}
%\usepackage{MnSymbol}
%\usepackage{mathabx}
%\usepackage{txfonts}


\makeatletter
\let\DOTSI\relax % amsmath support for \dots
\newcommand*{\Rint}{%
  \DOTSI
  \mathop{%
    \mathpalette\@LetterOnInt{R}%
  }%
  \mkern-\thinmuskip % thin space is inserted between two \mathop
  \int
}
\newcommand*{\@LetterOnInt}[2]{%
  \sbox0{$#1\int\m@th$}%
  \sbox2{$%
    \ifx#1\displaystyle
      \textstyle
    \else
      \scriptscriptstyle
    \fi
    #2%
  \m@th$}%
  \dimen@=.4\dimexpr\ht0+\dp0\relax
  \ifdim\dimexpr\ht2+\dp2\relax>\dimen@
    \sbox2{\resizebox*{!}{\dimen@}{\unhcopy2}}%
  \fi
  \dimen@=\wd0 %
  \ifdim\wd2>\dimen@
    \dimen@=\wd2 %
  \fi
  \rlap{\hbox to \dimen@{\hfil
    $#1\vcenter{\copy2}\m@th$%
  \hfil}}%
  \ifdim\dimen@>\wd0 %
    \kern.5\dimexpr\dimen@-\wd0\relax
  \fi
}
\makeatother

\begin{document}

Take the regulated function $f$, we want to compare the Riemann integral,
$\int_a^b f$
to the regulated integral $\Rint_a^b f$ by taking
sequences of step
functions.

We will prove that
\[
  \Rint_a^b f = \int_a^b f
\]

\[
  \displaystyle      \int_a^b f \dots \Rint_a^b f \qquad
  \textstyle         \int_a^b f \dots \Rint_a^b f \qquad
  \scriptstyle       \int_a^b f \dots \Rint_a^b f \qquad
  \scriptscriptstyle \int_a^b f \dots \Rint_a^b f
\]

\end{document}

Result