Vertical alignment of inline images in LaTeX
This is one of those things which isn’t so easy to find, so here’s my contribution.
The Problem
You’re using LaTeX, and have a small image which you want to display inline with the text (i.e. not a float). So, you use something like the following:
...indicate whether the phrase you've constructed is valid (\includegraphics{tick.png}) or not (\includegraphics{cross.png}}). To make things...
This works, but often the vertical alignment is not quite right, as shown in the images below:
The Solution
After some searching and experimenting, I found the best solution to be using the \raisebox command with a negative value, like so:
...indicate whether the phrase you've constructed is valid (\raisebox{-1mm}{\includegraphics{tick.png}}) or not (\raisebox{-1mm}{\includegraphics{cross.png}}). To make things...
The additional code is minimal and it works perfectly (as far as I can tell). Results as below:




Thanx for this, helped me with my inline images
Ladislav
Comment by Ladislav Klinc — 21 May, 2010 @ 9:19 am
Ditto. Thanks so much!
Comment by Andrew Pennebaker — 3 September, 2010 @ 10:20 pm
Many thanks for this. Was driving me nuts.
Comment by Barry Gausden — 25 November, 2010 @ 3:49 am
it works!! thanks!!
Comment by Rui Pedrosa — 1 December, 2010 @ 5:28 pm
Thanks for this little hack.
Comment by Alexandra — 15 February, 2011 @ 6:06 am
Just wanted to say thanks. This helped a lot.
Comment by Marcelo — 25 August, 2011 @ 9:01 pm