TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Mikael Öhman's answer to this question, he provides some code for placing an image in math mode as a symbol using the \mathord declaration. I can define a new command in the preamble using this, and it works, but the image is placed on the baseline of the equation.

I want it to be a good deal taller than typical text, so ideally I could use \vcenter to center it vertically. When I do include the centering, the image is treated as if it were as wide as the page, i.e. there are about 6 inches of white space following it. (The image is closely cropped, so the white space is certainly created by LaTeX.

Where is the glitch in my code?

share|improve this question
up vote 11 down vote accepted

Use \hbox within \vcenter:


You could add \vcenter{\hbox{...}} to your macro definition if you always use it vertically centered.

Btw. generally you could simply use additional braces instead of \mathord to get the normal spacing.

share|improve this answer
+1 I was just finishing the same post :-) – Martin Scharrer Mar 1 '11 at 9:43
Thanks, Stefan. – Sammy Black Mar 2 '11 at 2:53
I'm getting an error with it (in LuaLaTeX): ! Missing $ inserted. <inserted text> $ l.415 \vcenter {\hbox{\includegraphics[scale=0.27]{./figures/donkey}}}} ?. Any idea how to solve? – nutty about natty Jul 10 '13 at 13:05
@nuttyaboutnatty \vcenter requires math mode, so just put it in $...$. – Stefan Kottwitz Jul 10 '13 at 13:53

Your Answer


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.