我想使用LaTeX向文本文件写入反斜杠字符。
下面的第一行代码声明了一个名为'file'的变量,它描述了文件'myfile.out'。第二行打开文件,第三行尝试向文件中写入反斜杠 '\'。
\documentclass{article}
\begin{document}
\newwrite\file%
\immediate\openout\file=myfile.out%
\immediate\write\file{\}%
\end{document}
第三行不起作用,因为LaTeX混淆了反斜杠,有谁知道我该如何让它起作用?我尝试了很多方法,包括\textbackslash, $\backslash$ \char
``\`等等,但仍然没有成功。
非常感谢。