# replace text with variables

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

\newcommand{\Version}{1.0}


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

\begin{fullwidth}
\begin{lstlisting}[language=bash]
\end{lstlisting}
\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:

\lstset{escapeinside={|}{|}}


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

\documentclass{article}

\usepackage{listings}

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

\newcommand{\Version}{1.0}

\begin{document}

\begin{lstlisting}[language=bash]