Advertisement
diaaa

Untitled

Feb 22nd, 2022
1,183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 0.94 KB | None | 0 0
  1. \documentclass{article}
  2.  
  3.  
  4. \directlua{
  5. function tilderise(n)
  6. for nn in node.traverse(n) do
  7. if nn.id==0 or nn.id==1 then % hlist and vlist iterate over the lists
  8. tilderise(nn.head)
  9. elseif nn.id==29 then  % if it is a glyph node change the glyph
  10. print ('\string\n glyph=' .. nn.char .. '/' .. nn.font) % debugging
  11. nn.char=126 % this is ~
  12. nn.font=15  % force a text font as the classic math fonts don't have a ~ in this slot
  13. end
  14. end
  15. return n
  16. end
  17.  
  18. luatexbase.add_to_callback('hpack_filter',tilderise,'\string~ filter')
  19.  
  20. }
  21.  
  22. luatexbase.add_to_callback('pre_output_filter',tilderise,'\string~ filter')
  23.  
  24. \def\startzzz{\directlua{luatexbase.add_to_callback('pre_output_filter',tilderise,'\string~ filter')}} \def\stopzzz{\directluaa{luatexbase.remove_from_callback('pre_output_filter','\string~ filter')}}
  25.  
  26. \begin{document}
  27.     \startzzz
  28.     abc XYZ
  29.     \[\phi+\int\frac{a}{1+x}dx\]
  30.     \stopzzz
  31.     abc XYZ
  32.     \[\phi+\int\frac{a}{1+x}dx\]
  33.    
  34. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement