Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I compile the following code in XeLaTeX (also works with pdflatex) under windows, [containsverbatim] shows up in the ouput:

Ouput

Here is the code:

\documentclass{book} 
\usepackage{showexpl} 
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage[top=5cm, bottom=5cm, left=6cm, right=3cm]{geometry}

\lstloadlanguages{[LaTeX]Tex} 
\lstset{% 
     basicstyle=\ttfamily\small, 
     commentstyle=\itshape\ttfamily\small, 
     showspaces=false, 
     showstringspaces=false, 
     breaklines=true, 
     breakautoindent=true, 
     captionpos=t 
} 

\begin{document}

\begin{frame}[containsverbatim] %Problem here

\begin{LTXexample} 

\chapter{Good buy}
\section{haha}
lorem ipsum dolor si amet...lorem ipsum dolor si amet...lorem ipsum dolor si amet...lorem ipsum dolor si amet...lorem ipsum dolor si amet...lorem ipsum dolor si amet...
\end{LTXexample}

\end{frame}

\end{document}

When I don't add [containsverbatim] it still works, but it leaves an annoying dot: Output 2

I'm surely doing something wrong here, so I appreciate any help.

share|improve this question
1  
The frame environment is proper of beamer, not of book (where \frame does a very different thing). There's no mention of containsverbatim in the beamer manual, though. –  egreg Mar 18 '12 at 14:46
    
Isn't that what \usepackage{showexpl} suppose to do? –  Yiannis Lazarides Mar 18 '12 at 14:50
    
@egreg containsverbatim is I think an old option for beamer: it's there in the code, but fragile is the supported option name. –  Joseph Wright Mar 18 '12 at 14:55
add comment

1 Answer

up vote 4 down vote accepted

The containsverbatim "option" to frame is something used in beamer which you are not using. Also, the frame environment is an inherited construct (actually a regular macro) within LaTeX, hence the fact that there is no error when using it.

If you wish to frame the entire LTXexample output, you should use the framed or mdframed packages that respectively provide the framed and mdframed environments.

Here's an MWE showcasing the use of the former (framed) package:

enter image description here

\documentclass{book}
\usepackage{showexpl}% http://ctan.org/pkg/showexpl
\usepackage[frenchb]{babel}% http://ctan.org/pkg/babel
\usepackage[T1]{fontenc}% http://ctan.org/pkg/fontenc
\usepackage[top=5cm, bottom=5cm, left=6cm, right=3cm]{geometry}% http://ctan.org/pkg/geometry
\usepackage{framed}% http://ctan.org/pkg/geometry

\lstloadlanguages{[LaTeX]Tex} 
\lstset{% 
     basicstyle=\ttfamily\small, 
     commentstyle=\itshape\ttfamily\small, 
     showspaces=false, 
     showstringspaces=false, 
     breaklines=true, 
     breakautoindent=true, 
     captionpos=t 
} 

\begin{document}

\begin{framed}

\begin{LTXexample} 

\chapter{Good buy}
\section{haha}
lorem ipsum dolor si amet...lorem ipsum dolor si amet...lorem ipsum dolor si amet...lorem ipsum dolor si amet...lorem ipsum dolor si amet...lorem ipsum dolor si amet...
\end{LTXexample}

\end{framed}

\end{document}
share|improve this answer
    
Thanks for very quick response (and for explaining), works perfectly. –  bobicool Mar 18 '12 at 15:02
    
I have a little side question... Is it possible with showexpl to only show the output without the code displaying? –  bobicool Mar 19 '12 at 2:45
    
@bobicool: You don't need showexpl to only show the output. LaTeX creates the output by default. Otherwise please explain your intent. –  Werner Mar 25 '12 at 21:23
    
Well, I posted another question related to what I asked you: tex.stackexchange.com/questions/49245/… maybe you can help me there? Since no has completely answered my question. –  bobicool Mar 26 '12 at 0:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.