[luatex] LuaLaTeX example: show hyphenation points

Pablo Rodríguez oinos at web.de
Sun Jan 16 21:04:25 CET 2011


On 01/11/2011 04:53 PM, Patrick Gundlach wrote:
> Hi,
>
> inspired by Paul Isambert's very nice article in the last MAPS(1) and also in tugboat 31:3 (2) I'd like to post a LaTeX/LuaTeX example. It shows all the hyphenation points of a text. It's also wikified at http://wiki.luatex.org/index.php/Show_the_hyphenation_points
>
> Please correct any errors at the wiki page, thanks!

Thanks for the document, Patrick.

How could be the hyphenation points marked in red?

I guess that red hyphenation points would be easier to be noticed.

Thanks for your help,


Pablo

> ------------------------------------------------------------------------------------
> \documentclass[12pt,a4paper]{scrartcl}
> \usepackage[english]{babel}
> \usepackage{blindtext}
> \usepackage{fontspec}
> \directlua{
> show_hyph = function(head)
>    while head do
>      if head.id == 0 or head.id == 1 then % hlist, vlist
>        show_hyph(head.list) % should be head.head in a newer luatex than 0.64
>      elseif head.id == 7 then             % disc
>        local n = node.new("whatsit","pdf_literal")
>        n.mode = 0
>        n.data = "q 0.3 w 0 2 m 0 7 l S Q"
>        n.next = head.next
>        n.prev = head
>        head.next = n
>        head = n
>      end
>    head = head.next
>    end
>    return true
> end
> luatexbase.add_to_callback("post_linebreak_filter",show_hyph,"show_hyph")
>
> }
>
> \begin{document}
> \begin{minipage}{5cm}
> \blindtext
> \end{minipage}
> \end{document}
> ------------------------------------------------------------------------------------

-- 
http://www.ousia.tk


More information about the luatex mailing list