There's a symbol that's commonly used in an area of math I'm working in, called the direct integral, which is often written as \int^\oplus. I think it would be aesthetically nicer if the \oplus was actually in the middle of the integral sign, as is the case for the \oint symbol, but there isn't any LaTeX symbol I know of that does that automatically. I tried to create my own macro for this by writing \oplus\hspace{-1.12em}\int, but this only works well in display equations, and the sizes and positions don't fit together in inline equations. Is there any good way of creating a new LaTeX symbol or macro that would display this?

  • Can you point to some online resource where the symbol you'd prefer is actually used? – egreg Aug 10 at 10:05
  • No, I don’t know of it being used. I’m interested in this problem purely because I’m curious if it’s possible to create an aesthetically nicer symbol than the current one. – Monstrous Moonshine Aug 10 at 10:07
  • This is the output (click here). I don't think there is any real improvement possible: the vertical bar in the \oplus will always clash with the integral symbol some way or the other. For smaller sizes it is even worse. – egreg Aug 10 at 10:16
  • I’ve also thought about using an ominus instead, since the difference would be very slight. My main concern is just that for inline equations, the oplus/ominus tends to move quite a bit horizontally, and is much too big. – Monstrous Moonshine Aug 10 at 10:20
  • You can use \mathchoice to help you use different amounts of negative space depending on the style. Also, I'd suggest using \mkern (with units of mu) for the negative space. And expect the result to be highly font dependent! If you change the math font, you will have to change the spacing. – Harald Hanche-Olsen Aug 10 at 10:32
up vote 4 down vote accepted

The best I can offer is

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\directint}{\mathop{\mathpalette\direct@int\relax}\!\int}
\newcommand{\direct@int}[2]{%
  \sbox\z@{%
    \m@th
    \ooalign{%
      \hidewidth$\demote@style{#1}{\bigoplus}$\hidewidth\cr
      $#1\phantom{\int}$\cr
    }%
  }%
  \wd\z@=\z@\box\z@
}
\newcommand{\demote@style}[2]{%
  \ifx#1\displaystyle\scriptstyle#2\else
    \raise.5\fontdimen22\textfont2\hbox{$\scriptscriptstyle#2$}%
  \fi
}
\makeatother

\begin{document}

$\displaystyle\directint_X$ \qquad $\directint_X$

\end{document}

It doesn't work in subscripts, but I don't think working on it is worth the pain, because the symbol is ugly and, as you say, not used in the literature.

enter image description here

Another solution, based on stackengine:

\documentclass {article}
\usepackage{amsmath}
 \usepackage{stackengine} 

\newcommand*{\dd}{\mathop{}\!\mathrm{d}} 
\newcommand\directint{\mathop{\stackMath{\stackinset{c}{0.05ex}{c}{0ex}{\scriptscriptstyle\boldsymbol\oplus}{\displaystyle\int}}}}

\begin{document}

        \[ \displaystyle\directint A_x\dd\mu(x) \]

\end{document}

enter image description here

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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