I have a source code named source.tex which produces a PDF file consisting of more than one page. The source code will be displayed by LTXinputExample as a formatted text and the corresponding output is provided by the existing PDF file via graphic option.
The problem is that graphic only shows the first page, the remaining pages are ignored.
I want all pages to be shown in matrix form.
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{source.tex}
\documentclass[tikz]{standalone}
\begin{document}
\tikz \draw[blue] (0,0) circle (1);
\newpage
\tikz \draw[red] (0,0) circle (1);
\end{document}
\end{filecontents*}
\immediate\write18{pdflatex source}
\usepackage{showexpl}
\lstset
{
frame=single,
}
\begin{document}
\LTXinputExample[graphic=source,pos=b,width=4cm,justification=\centering]{source.tex}
\end{document}
Can you make the graphic option of LTXinputExample able to render all pages of a multi-page PDF file?
Edit:
Could you merge the Doctor Herbert's solution with the following to get the better layout?
\documentclass{book}
\usepackage[a4paper,margin=25mm,showframe=false]{geometry}
\usepackage{graphicx}
\usepackage{listings}
\newcount\x
\newcommand\IncludeOutput[1]{% #1: filename without extension
\lstinputlisting[frame=single]{"#1.tex"}
\pdfximage{"#1.pdf"}%
\loop
\ifnum\x<\pdflastximagepages
\advance\x by 1
\noindent\hfill
\fbox{\includegraphics[width=0.5\dimexpr\linewidth-4\fboxrule-1cm,page=\x]{"#1"}}%
\ifnum\x<\pdflastximagepages
\advance\x by 1
\hfill
\fbox{\includegraphics[width=0.5\dimexpr\linewidth-4\fboxrule-1cm,page=\x]{"#1"}}%
\fi
\hfill\null\par
\repeat
}
\begin{document}
\IncludeOutput{DummyText}
And more text follows\dots
\end{document}


\SX@resultInputand insert a loop. – Ulrike Fischer Nov 03 '12 at 18:35