Is there a way in PDFLaTeX to determine the height of the line you are in? Maybe something similar to PDFsavepos.

In a normal line (i.e. no heading etc.), you might approximate the height by a fixed multiple of ex. But is there a better way?

  • 5
    The length \baselineskip may be what you are looking for. Mar 4, 2013 at 20:40
  • I would suspect this could be done in luaTeX (which I don't know well). Anybody?
    – mbork
    Mar 4, 2013 at 21:47

1 Answer 1


Short answer: no.

Longer answer as noted in comments the current target baseline spacing is \baselineskip so perhaps that is what you are looking for, but if you mean can you determine the height of the current line which may have large inline tables or math expression then it gets harder.

There is no way of having a macro that gives this information at the point that macros expand as an entire paragraph is set (and all macros expanded) before TeX breaks the paragraph into lines and the question has any possible answer.

If you are in a vbox rather than on the main vertical list you can mark the point that you are interested in with \vadjust{\penalty some special value less than -10000} and then \vsplit the box at that point, then look with \lastbox to get the last line box before the forced break, and then looking at the height of that box gives the answer. If the text is on the main vertical list it is a lot harder (you would need a special output routine to take apart and re-assemble the page.

You could use \pdfsaveposition to access the vertical position of the current point on the next latex run, however you can not easily insert this on every line so it isn't clear that you can use this to determine the height of the line at that point.

The following plain TeX file marks two lines (with !) and reports their heights as:

marked line 1: height: 6.94444pt, depth 1.94444pt
marked line 2: height: 12.38954pt, depth 6.14844pt

enter image description here


\def\a{One two three four five six seven eight nine ten. }

\def\thislineinfo{\global\advance\linecount1 !\vadjust{\break}}

\a\a\thislineinfo\a\thislineinfo $A^{^A}A\over B_{B_B}$ \a\a\a


\setbox4=\vsplit2 to \maxdimen
\immediate\write20{marked line \the\count0: height: \the\ht0, depth \the\dp0}}
\advance\count0 1



You must log in to answer this question.

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