I created a new command to replace all references with a text:


This works well in my texts. However, it does not work in this case:

        mv ~/Downloads/application_\Version.bin .. # comment
\end{fullwidth} endcode

How can I do this? The expected result should replace \Version with 1.0


To do this you have to "escape" the listings code back to LaTeX using an escapeinside option to listings, like this:


then code between || is parsed by latex. Since vertical bar is used a lot in bash, I used the delimiters from here:



\lstset{escapeinside={(*@}{@*)}}% Text between (*@ and @*) will be parsed by LaTeX



  mv ~/Downloads/application_(*@\Version@*).bin .. # comment


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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