The following code is the simplified version of my real scenario. It might look trivial.
I forgot to say that the following code is the Minimal Not Working Example (MNWE):
\documentclass{article}
\usepackage{showexpl}
\usepackage{graphicx}
\begin{document}
\newcount\counter
\counter=-1
\loop
\advance \counter by 1
\ifnum\counter<5
\LTXexample
\scalebox{\counter}{\counter}
\endLTXexample
\newpage
\repeat
\end{document}
When \counter=1
, for example, I want the input part (source part) to get rendered as
\scalebox{1}{1}
rather than
\scalebox{\counter}{\counter}
.
Error messages when it is compiled with pdflatex, latex, xelatex:
(c:/texlive/2010/texmf-dist/tex/latex/listings/lstmisc.sty)
Package Listings Warning: Text dropped after begin of listing on input line 21.
(c:/texlive/2010/texmf-dist/tex/latex/base/omscmr.fd))
*
! Emergency stop.
<*> counterlistings
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on counterlistings.log.
How to execute \LTXexample
repeatitively with a looping macro such that its counter value gets rendered in both input/output parts?