# Stacking Symbols for a Math Operator [duplicate]

I want to create a math operator that is an integral with a square (\square) stack onto it such that the integral is still formated the way that the operator \int is. How do I do this?

## marked as duplicate by egreg, Mensch, Stefan Pinnow, TeXnician, CircumscribeJan 24 at 18:28

\documentclass{article}
\usepackage{esint}
\begin{document}

$\sqint\limits_0^1 x\,\mathrm dx\ne\int\limits_0^1 x\,\mathrm dx$
$\scriptstyle\sqint_0^1 x\,\mathrm dx\ne\int_0^1 x\,\mathrm dx$
$\scriptscriptstyle\sqint_0^1 x\,\mathrm dx\ne\int_0^1 x\,\mathrm dx$

$\sqiint\limits_0^1 x\,\mathrm dx\ne\iint\limits_0^1 x\,\mathrm dx$
$\scriptstyle\sqiint_0^1 x\,\mathrm dx\ne\iint_0^1 x\,\mathrm dx$
$\scriptscriptstyle\sqiint_0^1 x\,\mathrm dx\ne\iint_0^1 x\,\mathrm dx$
\end{document}


Adapting Heiko Oberdiek's code in https://tex.stackexchange.com/a/171445/4427 is almost straightforward

\documentclass[a5paper]{article}

\usepackage{graphicx}

\usepackage{amsmath}
\usepackage{amssymb}

\makeatletter
\let\DOTSI\relax % amsmath support for \dots
\newcommand*{\sqint}{%
\DOTSI
\mathop{%
\mathpalette\@LetterOnInt{\square}%
}%
\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 $\sqint_a^b f$ by taking
sequences of step
functions.

We will prove that
$\sqint_a^b f = \int_a^b f$

$\displaystyle \int_a^b f \dots \sqint_a^b f \qquad \textstyle \int_a^b f \dots \sqint_a^b f \qquad \scriptstyle \int_a^b f \dots \sqint_a^b f \qquad \scriptscriptstyle \int_a^b f \dots \sqint_a^b f$

\end{document}


Tweaked for CM font.

\documentclass{article}
\usepackage{amssymb,graphicx}
\newcommand\sqint{\mathchoice
{\raisebox{.75pt}{$\scriptscriptstyle\square$}\mkern-17.5mu}
{\raisebox{.75pt}{$\scriptscriptstyle\square$}\mkern-14mu}
{\scalebox{.8}{$\scriptscriptstyle\square$}\mkern-13mu}
{\scalebox{.55}{$\scriptscriptstyle\square$}\mkern-11mu}
\int}
\begin{document}
$\displaystyle\sqint_0^1 x\,dx\ne\int_0^1 x\,dx$\smallskip

$\sqint_0^1 x\,dx\ne\int_0^1 x\,dx$\smallskip

$\scriptstyle\sqint_0^1 x\,dx\ne\int_0^1 x\,dx$\smallskip

$\scriptscriptstyle\sqint_0^1 x\,dx\ne\int_0^1 x\,dx$
\end{document}