[NTG-context] Placing margin notes on the left using Lua

Hannes Riebl hriebl at sub.uni-goettingen.de
Fri May 8 11:35:53 CEST 2015

Dear ConTeXt users,

I am typesetting a critical edition with margin notes. To place these, I 
am using the Lua code below. It is based on the code from the LuaTeX 
wiki (cf. 
http://wiki.luatex.org/index.php/Post_linebreak_filter#Margin_notes) and 
has the restrictions mentioned on this wiki page. For example, placing 
notes on the left of the text is not possible. Now, my questions are:

(1) How can I extend the code to place notes on the left of the text? I 
tried node.insert_before(line.list, line.list, glyph) but it did not 
work out.
(2) How do I use the callback within the output routine to distinguish 
odd and even pages?

Thank you very much for any hints or help!

Best regards
Hannes Riebl

make_notes = function(head)
   for line in node.traverse_id(node.id("hlist"), head) do

     local glyph = node.new("glyph")
     glyph.font = font.current()
     glyph.lang = tex.language
     glyph.char = 97

     node.insert_after(line.list, node.tail(line.list), glyph)


   return head

nodes.tasks.appendaction("finalizers", "after", "make_notes")

Hannes Riebl
Abteilung Forschung & Entwicklung

Georg-August-Universität Göttingen
Niedersächsische Staats- und Universitätsbibliothek Göttingen
D-37070 Göttingen

Papendiek 14 (Historisches Gebäude, Raum 2.409)

hriebl at sub.uni-goettingen.de

More information about the ntg-context mailing list