I'm calling a script where I give a command line input to LaTeX:
pdflatex "\def\myvar{given_test} \input{figures.tex}"
And then in the script, I try to use this "given_test" input and print it:
\textbf{filename: \myvar}
This breaks LaTeX, then I try to use detokenize
\textbf{filename: \detokenize{\myvar}}
And that just prints the text "\myvar"
The underscore is a necessity, since we are reading from a more complex pipeline that uses them for the file identifiers.
So how do I read what is inside \myvar and not break LaTeX.


\textbf{filename: \expandafter\detokenize\expandafter{\myvar}}– Werner Nov 15 '13 at 03:25\textbfonto\textttgives underscore in the desired place. – Przemysław Scherwentke Nov 15 '13 at 04:29\edef\myvar{\detokenize{given_test}}in the command line. – egreg Nov 15 '13 at 17:58