0

I'm writing to a file from within my document. At a certain location, I would like to actually write out the character #. I tried something like this:

\newwrite\tempo
\immediate\openout\tempo=outputo.txt
\immediate\write\tempo{\# This is a generated file, DO NOT EDIT directly.}

However, this writes out '\#' to that file, which is not what I want. The idea is that the file which is written out by the documentation in latex is automatically used from within a test-suite, and # denotes a comment in that file, so there should be no \ in front.

Leaving out the \ obviously does not work, nor did wrapping the # in another command.

Suggestions? Yves

0
0

In ConTeXt you can use buffers.

\setupsavebuffer[prefix=no]
\startbuffer[hash]
# This is a generated file, DO NOT EDIT directly.
\stopbuffer
\savebuffer[hash][outputo.txt]
\starttext
\stoptext
1
  • In latex filecontents or similar environments for verbatim output. – Ulrike Fischer Aug 9 '16 at 10:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.