# How do I get my integral-like symbol to align like the integral?

OK, so I've been tasked with creating this integral-like symbol in Latex, and the best way to create it from scratch seemed to be using the includegraphics command and giving it a /def/. Unfortunately was quite huge and didn't really correspond so I had to use scalerel to scale the symbol. This is beneficial since for inline text, in paragraphs or titles etc, the symbol can just scale to a maximum of this large image size. But for this math display, integral symbols do not scale so I kept an aspect ratio.

\def\integrallikesymbol{\raisebox{-9pt}{\includegraphics[width=60pt,height=23pt,keepaspectratio]{image}}}


So this works okay for smaller sizes but I noticed as I increased the size of math displays, where the integral symbol stays the same size and aligns with the text, mine doesn't align quite well...

Note: that's not quite the symbol I'm using but it's a goofy substitute of the same image size.

So my question is: is my solution way too convoluted? What can I do if I have an image of this symbol and I want to scale it down but keep aspect ratio and most importantly align with the text like the integral symbol does? It has ascenders and descenders above and below the text height so it's been a little tricky for me.

Here is the theory; the image does not seem to align to the top and bottom of the integral sign because it has some white space above and below that I didn't remove.

Use your own image, of course.

\documentclass{article}
\usepackage{graphicx}

\makeatletter
\DeclareRobustCommand{\duckintegral}{%
\mathop{\mathpalette\duck@integral\relax}\nolimits
}
\newdimen\duck@height
\newcommand{\duck@integral}[2]{%
\sbox\z@{$#1\int$}%
\duck@height=\dimexpr\ht\z@+\dp\z@\relax
\vcenter{\hbox{%
\includegraphics[height=\duck@height]{../duck}%
}}%
}
\makeatother

\begin{document}

$\duckintegral(u,v)=\int (u,v)$
\begin{center}
$\duckintegral(u,v)=\int (u,v)$
\end{center}

\end{document}

• It seems that people at TeX.SX use a “standard” duck for this kind of examples: would you mind including a reference to the image, perhaps in a comment? – GuM Jun 29 '16 at 23:28
• @GustavoMezzetti I think I got it here: efdreams.com/data_images/dreams/duck/duck-05.jpg I also have the Cookie Monster integral – egreg Jun 29 '16 at 23:31
• Thanks for the reference. So, it is not a “standard” duck, somehow related to this question. I thought it was… (;-) – GuM Jun 29 '16 at 23:39
• @egreg One think I noticed in your example is that the integral symbol in both instances is a little bit stretched in the first one compared to the second (as in, it's not simply a scaled up version of the second one). Is there a way to get the duck stretched in the first and not in the second while still having just one \duckintegral that does both like \int does? – latexinquirer Jun 30 '16 at 4:05
• This is the best answer ever. :) – Paulo Cereda Jun 30 '16 at 11:10