I'm using beamer (CVS version) for slides and would like to use showexpl package to show LaTeX code examples and their results. The problem is that the LaTeX examples are processed like being into a presentation slide and not into an article or book. This means that some commands like \section (with special behaviour inside beamer) or \chapter cannot be used.
Let me show some examples:
Code: Select all
\RequirePackage{atbegshi}
\documentclass{beamer}
\usepackage{showexpl}
\lstloadlanguages{[LaTeX]Tex}
\lstset{%
basicstyle=\ttfamily\small,
commentstyle=\itshape\ttfamily\small,
showspaces=false,
showstringspaces=false,
breaklines=true,
breakautoindent=true,
captionpos=t
}
\begin{document}
\frame[containsverbatim]{
\frametitle{First slide}
\begin{LTXexample}
\begin{itemize}
\item a
\item b
\item c
\end{itemize}
\end{LTXexample}
\begin{LTXexample}
\begin{equation}
a^2+b^2=\sqrt{\frac{c^2}{1}}
\end{equation}
\end{LTXexample}
}
\frame[containsverbatim]{
\frametitle{Second slide}
\begin{LTXexample}
\documentclass{article}
\begin{document}
\section{Section 1}
Text for section 1
\end{document}
\end{LTXexample}
}
\end{document}
A second example with article instead of beamer.
Code: Select all
\documentclass{article}
\usepackage{showexpl}
\lstloadlanguages{[LaTeX]Tex}
\lstset{%
basicstyle=\ttfamily\small,
commentstyle=\itshape\ttfamily\small,
showspaces=false,
showstringspaces=false,
breaklines=true,
breakautoindent=true,
captionpos=t
}
\begin{document}
\begin{LTXexample}
\section{Section 1}
Text for section 1
\end{LTXexample}
\begin{LTXexample}
\documentclass[12pt]{article}
\begin{document}
\section{Section 1}
Text for section 1
\end{document}
\end{LTXexample}
\end{document}
Do you know if it's possible to fix a certain environment for the examples independent of the main document where they are declared? I could do it putting every example in its own file and including the result as a graphic file but it's no so comfortable like \LTXexample.
Do you know some other packages to show LaTeX code examples and results?
Thank you,
Ignasi