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.

I am writing a short introductory book on LaTeX and I would like to implement nice looking code example boxes. Using this answer: Source code listing with frame around code? I made the boxes with the listings packages by setting in the preamble:


and in the text for example:

\begin{lstlisting}[label=firstlook,caption=A First Look]
Hello World!

Which results in: Nice-looking box

And looks nice. I would like to make something similar for the output, and was wondering how I could do that (by manually writing the output I mean, not automatically taking what I enter there and evaluate it). Just the same looking box would be cool, having this box split in the middle and show an "output panel" or something would be even cooler. Does anyone know how I can do such a thing?

share|improve this question
something like the examplep package? –  Spike Jun 18 '11 at 15:22
plus one for @Spike: it is very nice "Special care is taken so section, page and footnote numbers do not interfere with the main document." –  xport Jun 18 '11 at 16:41
The bclogo package is also a good alternative. –  Paulo Cereda Jun 18 '11 at 18:25
examplep looks like exactly what I am looking for. Can you make it an answer so I can accept it? –  Sacha Epskamp Jun 19 '11 at 10:19
add comment

1 Answer

up vote 6 down vote accepted

I think the good package is showexpl .This package works with listings.

I work actually on the tkzexample package. The last version is on ctan but I try to finish the doc. You can present the source code and the result but it's not possible to highlight the syntax.



\begin{tkzexample}[small,width=8cm,overhang,frame tex=red,frame code=blue]
      \section{Minipage et  èçéà\&§}
    Ceci est un test pour "minipage"

\begin{tkzexample}[small,width=3cm,frame tex=red,frame code=blue]
     \draw (0,0)  node[circle,
                       ball color=Peach,minimum size=2cm]{};

\begin{tkzltxexample}[line frame width=2pt]
\begin{tkzexample}[width=4cm,frame tex=red,frame code=blue]
  \node [circle,line width=1ex,draw=blue,fill=blue]

\begin{tkzexample}[width=4cm,frame tex=red,frame code=blue]
  \node [circle,line width=1ex,draw=blue,fill=blue] 

\begin{tkzexample}[width=3cm,frame tex=red,frame code=blue]   
   $x \mathbin{\tikz[baseline]  \draw[|->,>=triangle 45]%
  (0pt,.5ex) -- (8ex,.5ex);} f(x)$


enter image description here

share|improve this answer
Would you mind to remove your picture with the pstricks-»example«? I seems not decent to me. –  Keks Dose Jun 18 '11 at 20:36
@Keks No problem but it was only to say that I never use pstricks :) but I can add Vi, emacs, listings and a lot of things! –  Alain Matthes Jun 18 '11 at 21:55
Looks cool, I'll surely look into this too:) –  Sacha Epskamp Jun 19 '11 at 10:19
add comment

Your Answer


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.