ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Placing margin notes on the left using Lua
@ 2015-05-08  9:35 Hannes Riebl
  2015-05-08 10:17 ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Hannes Riebl @ 2015-05-08  9:35 UTC (permalink / raw)
  To: ntg-context

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)

     ...
   end

   return head
end


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@sub.uni-goettingen.de
http://www.sub.uni-goettingen.de
http://www.rdd.sub.uni-goettingen.de
http://dhd-blog.org
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-05-20 16:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-08  9:35 Placing margin notes on the left using Lua Hannes Riebl
2015-05-08 10:17 ` Wolfgang Schuster
2015-05-08 10:36   ` Hannes Riebl
2015-05-08 10:41     ` Wolfgang Schuster
2015-05-08 11:14       ` Hannes Riebl
2015-05-20 15:14         ` Hannes Riebl
2015-05-20 15:21           ` luigi scarso
2015-05-20 16:44             ` Hannes Riebl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).