Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there a way to determine the height of the current line? More specifically, after the hbox comprising the current line is finalized, I'd like to determine it's height (and perhaps also depth) and write this information to an auxiliary file. The application I have in mind is placing something in the margin which is vertically aligned with the center of the current line, rather than with the baseline of the current line. I'm primarily interested in the case where the current line is a displayed equation.

(This is a more focused version of this older question.)

share|improve this question
add comment

2 Answers

There is some discussion along these lines in the TeXbook, appendix D (dirty tricks). For example, set \vsize very small so the lines get sent one at a time to the output routine, which can process them and then send them back to the page builder for regular processing (with a normal value of \vsize this time). Or, more close to your question, have the output routine write out notes to a file in a first pass, and process those notes on a second pass.

share|improve this answer
add comment

Unfortunately I don't know how to answer your more general question, but it sounds as if the marginnote package will help with the problem that motivated it. By using the \marginnote command in conjunction with its <voffset> option you can manually change to vertical alignment of the margin note arbitrarily. For example, the margin note in the following example is vertically aligned with the equation:

\documentclass{article}
\usepackage{marginnote}
\begin{document}
Here is some text.
\[
  F(b)-F(a)
  =
  \int_a^b f(x)dx
  \marginnote{A form of the fundamental theorem of calculus}[-2em]
\]
Here's a little more text.
\end{document}
share|improve this answer
1  
Thanks. I've already written a specialized numbers-in-the-margins package that does most of what I want. Manual vertical adjustment was my fall-back strategy, but I was hoping for something that would work automatically. The code for the marginnote package should be useful, in any case. –  Kevin Walker Aug 2 '10 at 21:30
add comment

Your Answer

 
discard

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.