1

which packages can I use to display the latex code and the compilation result at the same time?

rpapa
  • 12,350

1 Answers1

8

I find the tcolorbox package with the tcblisting environment very handy to display the source and output at the same time.

\documentclass{article}

\usepackage{tikzducks}
\usepackage[most]{tcolorbox}

\begin{document}

\begin{tcblisting}{title={Birthday duck}}
\begin{tikzpicture}
    \duck[cake]
\end{tikzpicture}
\end{tcblisting}

\end{document}

enter image description here