How to print out a backslash in LaTeX

You can use \@backslashchar. The following works for me:

\documentclass{article}
\begin{document}
\newwrite\file
\immediate\openout\file=myfile.out
\makeatletter
\immediate\write\file{\@backslashchar}
\makeatother
\closeout\file
\end{document}

Leave a Comment