\documentclass{article} \begin{document} Test newlines and other non printable chars: <%= tex_safe "tab:\tEND" %> <%= tex_safe "cr:\rEND" %> <%= tex_safe "newline:\nEND" %> <%= tex_safe "form feed:\fEND" %> \end{document}