5

I'm trying to define a command in latex that gives me a flipped integral symbol as I haven't been able to find it in any existing package. So far this is my attempt:

\newcommand{\cocoendtni}{\operatorname{\vphantom{\sum}\mathchoice
    {\reflectbox{$\displaystyle \int$}}
    {\reflectbox{$\int$}}
    {\reflectbox{$\scriptstyle \int$}}
    {\reflectbox{$\scriptscriptstyle \int$}}}}

This has the problem that superscripts are not aligned to the integral sign itself, but its rightmost part. The usual integral sign does not have this problem with subscripts.

How can I align the superscripts horizontally? If this symbol already exists somewhere or you see other issues with my definition I'd be glad to hear about them of course!

1 Answer 1

6

Is this what you want?

\documentclass{article}
\usepackage{amsmath,graphicx}

\makeatletter
\NewDocumentCommand{\cocoendtni}{e{_^}}{%
  \mathop{\mathpalette\cocoendtni@{{#1}{#2}}}%
}
\NewDocumentCommand{\cocoendtni@}{mm}{%
  \cocoendtni@@#1#2%
}
\NewDocumentCommand{\cocoendtni@@}{mmm}{%
  \begingroup
  \sbox\z@{$\m@th#1\int$}%
  \reflectbox{\usebox\z@}%
  \IfValueT{#2}{% subscript
    _{#2}%
  }%
  \IfValueT{#3}{% superscript
    ^{\kern-\ifx#1\displaystyle0.5\else0.4\fi\wd\z@#3}%
  }%
  \endgroup
}
\makeatother

\begin{document}

\[
\cocoendtni_a^b
\]
\begin{center}
$\cocoendtni_a^b$\\
$\scriptstyle\cocoendtni_a^b$\\
$\scriptscriptstyle\cocoendtni_a^b$
\end{center}

\end{document}

The superscript is added with some amount of backspacing, so it goes nearer the integral sign.

enter image description here

1
  • 1
    Looks perfect, thank you!
    – Monoidoid
    Commented Jun 22, 2023 at 11:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .