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?
listingsenvironment. – M. Al Jumaily Aug 28 '19 at 21:23lstinputlistingsand is written by somebody else – 927589452 Aug 28 '19 at 22:02example-pseudoenvironment – 927589452 Aug 29 '19 at 07:36