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

Yves V.
  • 179

1 Answers1

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
Henri Menke
  • 109,596