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

I am using a TikZ picture followed by a text. How do I create a picture that aligns with the top of the text?

\tikz[baseline=(current bounding box.north)] {
    \draw (0,0) rectangle (2,-3);
} text

enter image description here

share|improve this question
up vote 7 down vote accepted

You need to shift the baseline lower to shift the tikzpicture higher, e.g. by the height of a \strut or something between 1ex (height of lowercase letter) and 1.6ex (~height of uppercase letter), depending on your liking.
See also my question Determine height and depth of letters relative to the font size for a discussion about the correct height.

\tikz[baseline={([yshift={-\ht\strutbox}]current bounding box.north)}] {
    \draw (0,0) rectangle (2,-3);
} text





share|improve this answer
Thank you Martin. – Regis da Silva Jul 20 '11 at 23:30

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.