Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}, in your case this most probably means \amsmath etc. –  Christian Hupfer Apr 14 at 14:08
    
@ChristianH. Have added the MWE. –  Daniel Wilson-Nunn Apr 14 at 14:36

3 Answers 3

up vote 6 down vote accepted

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

share|improve this answer

With the stackengine package, you have a solution which in not perfect, as it needs a manual correction for the lower bound. I define a \Rint maths operator as follows:

\documentclass[ a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage[]{stackengine}
\DeclareMathOperator{\Rint}{\ensurestackMath{\stackinset{c}{0pt}{c}{0pt}{\mathrm R}{\displaystyle\int}}}
\newlength\correct
\settowidth{\correct}{\ensuremath{\displaystyle\int}}

\begin{document}

 \begin{align*}
    & \Rint  f(x) \,\mathrm d x  \\
    &  \Rint_{\hspace*{-0.5\correct}a}^b  f(x) \,\mathrm d x \\
     & \int_a^b  f(x) \,\mathrm d x
 \end{align*}

\end{document}

enter image description here

Using \mathchoice, one could define \Rint for textstyle, scriptstyle and scriptscriptstyle. If you're not quite satisfied with the placement of R, you can change the values of 0pt and 0pt (which are horizontal and vertical shifts) to something else.

Added: Steven B. Segletes's suggestion not to have a manual adjustment for the lower bound of the integral, and also also the use of \mathchoice:

\documentclass[ a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage[]{stackengine}

\newlength\tmplength
 \def\showmybox{\tmplength=\wd0\relax\box0\kern-\tmplength}
 \def\mybox#1{\setbox0=\hbox{\ensurestackMath{#1}}}
 \def\SIn#1#2{\stackinset{c}{#1}{c}{#2}}
  \def\Rint{\mathchoice%
  {\mybox{\SIn{0.7pt}{0pt}{\mathrm R}{\displaystyle\phantom{int}}}\showmybox}% 0pt
  {\mybox{\SIn{-1.2pt}{0pt}{\scriptstyle\mathrm R}{\textstyle\phantom{int}}}\showmybox}% -1.5pt
  {\mybox{\SIn{-1.1pt}{0pt}{\scriptscriptstyle\mathrm R}{\scriptstyle\phantom{int}}}\showmybox}%
  {\mybox{\SIn{-1.65pt}{0pt}{\scalebox{0.7}{$\scriptscriptstyle\mathrm R$}}{%
     \scriptscriptstyle\phantom{int}}}\showmybox}%
   \int}

\begin{document}

 \begin{align*}
    & \Rint  f(x) \,\mathrm d x  \\
    &  \Rint_{a}^b  f(x) \,\mathrm d x \\%
     & \textstyle \Rint_a^b  f(x) \,\mathrm d x  \\
     & \scriptstyle \Rint_a^b  f(x) \,\mathrm d x  \\
     & \scriptscriptstyle \Rint_a^b  f(x) \,\mathrm d x  \\
 \end{align*}

\end{document} 

enter image description here

Of course the values chosen for hoffset, in the terminology of stackengine will depend on the font that's used.

share|improve this answer
    
+1 for effort. You can get rid of the horizontal correction with this slightly altered definition: \newlength\tmplength and \def\Rint{\setbox0=\hbox{\ensurestackMath{\stackinset{c}{0pt}{c}{0pt}{\mathrm R}{% \displaystyle\phantom{int}}}}\tmplength=\wd0\relax\box0\kern-\tmplength\int}. Because the \int has its own unique way of setting its limits, it is best if the replacement definition \Rint can end its definition on a \int. That way, it automatically picks up the original definition of sub and superscripting. –  Steven B. Segletes Apr 14 at 15:39
    
OK, your suggestion is very welcome and I'll add it to my answer. Do you think we can use it as is in a DeclareMathOperator command? –  Bernard Apr 14 at 15:58
    
Usually, I would want to use \DeclareMathOperator. But it sets limits above and below the operator. Therefore, in the sole case of \int, I find it best not to, or else you have to recreate the sub- and superscript placements that originally went with \int. Its a case by itself. –  Steven B. Segletes Apr 14 at 16:03
    
Try \newlength\tmplength \def\showmybox{\tmplength=\wd0\relax\box0\kern-\tmplength} \def\mybox#1{\setbox0=\hbox{\ensurestackMath{#1}}} \def\SIn#1#2{\stackinset{c}{#1}{c}{#2}} \def\Rint{\mathchoice% {\mybox{\SIn{0pt}{0pt}{\mathrm R}{\displaystyle\phantom{int}}}\showmybox}% {\mybox{\SIn{-1.5pt}{0pt}{\scriptstyle\mathrm R}{\textstyle\phantom{int}}}\showmybox}% {\mybox{\SIn{-1.3pt}{0pt}{\scriptscriptstyle\mathrm R}{\scriptstyle\phantom{int}}}\showmybox}% {\mybox{\SIn{-2pt}{0pt}{\scalebox{0.7}{$\scriptscriptstyle\mathrm R$}}{% \scriptscriptstyle\phantom{int}}}\showmybox}% \int} –  Steven B. Segletes Apr 14 at 16:20
    
@Steben B. Segletes: This last suggestion works fine and I'll add it. I just modified some offsets so that the (closed) upper part of R seems to be cut in 2 equal parts. –  Bernard Apr 15 at 0:15

Try the following 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{\scriptsize\, R}\int_a^b} f$ by taking sequences of step
functions.

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

\end{document}

I got the following output:

Updated image to crop the sides

Note, that the order of overlapping objects is reversed and you have to put limits as \int_a^b, otherwise the amsmath package does not know that a and b are limits.

Also, note the trickery in the inline math part.


EDIT: Updated answer with corrected image and code.

share|improve this answer
    
This however quenches inline math expressions using your commands as could be seen in the second line of your text. Does it work in conjunction with \limits^{b}_{a} ? –  Christian Hupfer Apr 14 at 14:58
    
@ChristianH. Thank you! That works very well for the displayed maths. There is still an issue with the inline math as you say. I have just tried the following $\mathop{\mathrlap{\int}\scriptstyle{R}}_a^b f$ and it looks alright. –  Daniel Wilson-Nunn Apr 14 at 15:03
    
Updated the code, check if it is all right now –  gns-ank Apr 14 at 15:07
    
Looks very good, thank you! –  Daniel Wilson-Nunn Apr 14 at 15:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.