I was successful before in writing the hashtag symbol # into an output file. please see the following MWE.
\documentclass{book}
\usepackage{newverbs}
\Verbdef\myHashtagSymbolOne{#}%
\newcommand*{\myWriteNewLine}{^^J}%
\newwrite\myOutputFileName%
\begin{document}
\edef\myHashtagSymbolTwo{\myHashtagSymbolOne}%
\edef\myHashtagSymbolThree{\detokenize\expandafter{\myHashtagSymbolTwo}}%
\immediate\openout\myOutputFileName=hashtag.tex%
\immediate\write\myOutputFileName%
{%
Here is my hashtag:%
\myWriteNewLine%
\myHashtagSymbolThree%
}%
\immediate\closeout\myOutputFileName%
\end{document}
I compiled using pdflatex with shellescape (MikTeX), which is working fine.
Note that the output file hashtag.tex used to contain exactly the following:
Here is my hashtag:
In the MWE, we can see that the goal is for \myHashtagSymbolThree
to appear in the output file. We also notice that there are "intermediate" variables such as \myHashtagSymbolOne
and \myHashtagSymbolTwo
, which are necessary for my actual (long) program to run (and these variables serve other purposes in my program, but are no longer shown here.)
Now, I updated my MikTeX program just a few days ago. I also updated all packages, including the newverbs package. For one reason or another, when I compiled my program, the following now appears in the output file hashtag.tex:
Here is my hashtag:
\protect #
Suddenly, the unnecessary command \protect
suddenly appeared. This appearance is unacceptable to me because my other programs which would use the output file are no longer functioning properly because of the appearance of \protect
. To verify indeed that \protect
is causing the problem, i removed/deleted it temporarily from the output file, and my other programs which use the output file are now working properly. This leads me to conclude that \protect
should not be there. But I am at a loss why it suddenly appeared. What I wanted is for only the hashtag to appear (without the \protect
).
Seeking kindly your help.