[Tex/LaTex] insert an image into an equation

equationsgraphicsmath-mode

I would like to use a small image in an equation, where a symbol like \alpha might otherwise be. Is there a nice way to do this?

Best Answer

It won't scale nicely with font size, but a simple approach is straightforward. The image should have a tight bounding box, which you can achieve with tools like pdfcrop.

\newcommand{\mysymbol}{\mathord{\includegraphics[height=1.6ex]{symbol}}}

\mathord is suitable for ordinary symbols, since you indicated that it would be used similarly as \alpha.

With the suggestions from the comments, I wrote a better solution.

\newcommand{\myfancysymbol}{
 {\mathchoice
  {\includegraphics[height=1.6ex]{symbol}}
  {\includegraphics[height=1.6ex]{symbol}}
  {\includegraphics[height=1.2ex]{symbol}}
  {\includegraphics[height=0.9ex]{symbol}}
 }
}

The symbol scales like a capital X for subscript and subsubscripts.