Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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

2 Answers 2

up vote 6 down vote accepted

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

share|improve this answer
    
Thanks a lot, that did the trick! –  Ziegl Nov 4 '12 at 19:39

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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