[Tex/LaTex] Positioning of image within an equation

equationsgraphicspositioning

I have the following problem: I would like to have images of Feynman diagrams as part of equations. Using

\newcommand{\imineq}[2]{
\includegraphics[height=#2ex]{#1}}

I had success in as far as

\begin{equation}
H\left(\imineq{Feynman_image}{7}\right)=
\end{equation}

does put the image roughly where it's meant to be but shifted upwards to the top half of the brackets. Anyone have any ideas as to how I can get the image to appear vertically centered and ideally get the brackets to scale properly?

Best Answer

In math mode there is the command \vcenter which will center material vertically. So you can set up your command as follows:

\documentclass{article}

\usepackage{mwe}

\newcommand{\imineq}[2]{\vcenter{\hbox{\includegraphics[height=#2ex]{#1}}}}

\begin{document}

\( a \left( \imineq{example-image-a}{4} \right) b \)

\end{document}

Sample output