# [Tex/LaTex] Vertical alignment of inline images

graphicsinline()vertical alignment

Images appearing inline aren't always ideally placed relative to the baseline and risers of the text itself, so I frequently find myself doing manual adjustment, by eye, using \raisebox{}{} with a negative first parameter.

My question is whether there is a simple way to get a comparable effect without adjusting the parameter manually against the output in each case.

Images are added with a zero depth, i.e. they sit on the baseline. It depends very much on the situation (and personal taste) what the "ideal" placement of a particular image is. So no, there is no way to automatically get-it-just-right (TM).

Note that \raisebox allows the use of \height, \depth, \width and \totalheight (=height+depth) which represent the original dimension of the to be raised box. As said, \depth is zero and so \totalheight is identical to \height for images. So if you want all you images to be 10% below the baseline you can use \raisebox{-.1\height}{\includegraphics[...]{...}}.

If you want the images to be as deep as the normal text you can use \dp\strutbox as a reference. The \strutbox contains the depth and height of a \strut. Both together are equal to \baselineskip so about 20% larger than the actual font size. Therefore you might want to use -.8\dp\strutbox. Alternatively you can use a font size relative length in ex. 1ex is about the height of an x.

As always you might want to make a macro for this if you need this more often.