5

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?

  • You can use \raisebox{-2ex}{\includegraphics...} to adjust the position, or perhaps simpler use the adjustbox package – David Carlisle Nov 1 '12 at 15:10
6

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

1

If you don't mind adjusting it manually, you can use \raisebox. But I'm not sure this is the best way. \vcenter might be an option. You might have to put the image in an hbox to use use this.

As far as the brackets goes, I would manually specify the size you want, e.g. \bigl( and \bigr).

A more satisfying answer might be to use TikZ which gives you a great deal of power for positioning such things. Here is an example of someone doing something similar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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