0

I am trying to explain a program code step-by-step, but I would like to show what we have atm in each example, without retyping.

\documentclass{report}
\usepackage{listings}

\begin{document}

\begin{lstlisting}
#!/bin/sh
export A=2
\end{lstlisting}

We have
\begin{example}
\( A =2 \)
\end{example}

\begin{lstlisting}
export B=2
\end{lstlisting}

And we have now
\begin{example}
\( A = 2 \)
\( B = 2 \)
\end{example}

\end{document}

Is there an environment, which stores these? Or is there a better style in doing this, while still showing all variables already declared?

927589452
  • 118

0 Answers0