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

Using a post_linebreak_filter callback, is it possible to access the nodes positioned above and under a given node?

share|improve this question
up vote 7 down vote accepted

Yes. You have to do a lot of calculation, though. To find the position of a node use node.dimensions() from the head to the node (see the examples in the reference manual, beware of glue_set, glue_sign and glue_order in the hlist node) and do the same with the lines above and below. With this you could implement a river detection algorithm :).

share|improve this answer
Thanks. I'd appreciate if you stopped reading my mind though (about implementing a river detection algorithm ;)) – ℝaphink Sep 20 '11 at 11:34
Can you explain a bit more about the glue_set, glue_sign and glue_order please? Also, once I have the dimensions, how do I find the nodes positioned at the same distance on other lines? – ℝaphink Sep 20 '11 at 11:35
@Raphink the hlist node has glue_set, glue_sign and glue_order entries. You need to provide these values to the call to node.dimensions() (an example is provided in the reference manual). Now you have the distance of the glue and the width (= the distance of the node after the glue minus the distance of the node before the glue). Just do the same call on the previous line, but use the three values of that hlist node, of course. Just walk through the list at prev_line.head and either call node.dimension() on every interesting node or add the width yourself. Does this help? – topskip Sep 20 '11 at 11:53
@Raphink the three entries are important to calculate the width of the glue nodes. That's it. – topskip Sep 20 '11 at 11:54
Alright, I will see :-) – ℝaphink Sep 20 '11 at 12:06

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.