I want to put a very small figure inline with text. The figure must have the same height as the line it is positioned in. I have this:

Some text... \includegraphics[height=\baselineskip]{picture.png} ... some more text. 

This, however, makes the figure slightly too large, filling the whole space up to the bottom of the line above. I want the figure to be only as high as the capital letters of my font. What's the right way to do this?


3 Answers 3


Tell TeX that the figure should be as high as a “B”:

Some text... 
... some more text. 

You probably want to define a special command for this:


and type your paragraph as

some text \mychar{} some text

If you plan to use this also in titles or captions, it's better to say

  • this is exactly it. height=1em is not exactly what I wanted (as it is roughly the width of an 'M' as @Sigur posted)
    – ala
    Commented Oct 16, 2013 at 15:11
  • 3
    You might possibly want to end the group begun, but +1 for the % at end of lines:-) Commented Oct 16, 2013 at 15:14
  • This is a good solution, but if I use this command in Beamer, an image is stretched horizontally in uncontrollable manner, so it is important to add a width parameter to avoid the issue. Commented Aug 30, 2018 at 1:01
  • @VladimirS. I can't see the problem. Perhaps a new question is in order.
    – egreg
    Commented Aug 30, 2018 at 8:24
  • Just for the record @egreg , what does \fontcharht\font`\B mean ?
    – Etsaf
    Commented Jan 14, 2021 at 13:14

This is what \scalerel* does... it scales its first argument to the same vertical footprint as its second argument, in this case the letter "B".

This is an inline \scalerel*{\includegraphics{SelfPortrait}}{B} photo.

enter image description here


edit: as pointed out by @egreg, the approach below works only for the normal font size. I'll keep it for historical reasons.


% Create the reference text for measures




enter image description here

  • 1
    You don't need the box, just \settoheight{\myMheight}{M} Commented Oct 16, 2013 at 15:06
  • See You may like to have a look at tex.stackexchange.com/q/42114/4918 ;-)
    – Tobi
    Commented Oct 16, 2013 at 15:24
  • This will always use the same height independently of the context: in a \Large context it wouldn't be correct.
    – egreg
    Commented Oct 16, 2013 at 15:32
  • @Sigur Yes, it was.
    – egreg
    Commented Oct 16, 2013 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .