This is related to a previous question of mine (if I understand correctly, \write
works a bit like \edef
).
Consider the following code:
\documentclass[varwidth,convert={size=640}]{standalone}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{fancyvrb}
\begin{document}
\newwrite\foo
\immediate\openout\foo=foo.txt
$\immediate\write\foo{\ifmmode\noexpand\true\else\noexpand\false\fi}$
\immediate\closeout\foo
\VerbatimInput{foo.txt}
\end{document}
I'd like to write \true
to the file. How can I do?