Advertisement
diaaa

Untitled

Feb 22nd, 2022
621
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. \directlua{
  2. function tilderise(n)
  3. for nn in node.traverse(n) do
  4. if nn.id==0 or nn.id==1 then % hlist and vlist iterate over the lists
  5. tilderise(nn.head)
  6. elseif nn.id==29 then  % if it is a glyph node change the glyph
  7. print ('\string\n glyph=' .. nn.char .. '/' .. nn.font) % debugging
  8. nn.char=126 % this is ~
  9. nn.font=15  % force a text font as the classic math fonts don't have a ~ in this slot
  10. end
  11. end
  12. return n
  13. end
  14.  
  15. %%%
  16. luatexbase.add_to_callback('hpack_filter',tilderise,'\string~ filter')
  17.  
  18. }
  19. luatexbase.add_to_callback('pre_output_filter',tilderise,'\string~ filter')
  20. \def\startRedaction{\directlua{luatexbase.add_to_callback('pre_output_filter',tilderise,'\string~ filter')}}
  21. \def\stopRedaction{\directluaa{uatexbase.remove_from_callback('pre_output_filter','\string~ filter')}}
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement