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'm trying to find the code to get boxes like the ones we can enjoy in the mathspec or biblatex user guides. It seems to be based on the listings and framed packages. Here is a working minimal example

\documentclass{book}
\usepackage{listings}
\usepackage{xcolor}
\usepackage[top=9cm,bottom=10cm]{geometry}
\usepackage{lipsum}
\definecolor{boxframe}{rgb}{0.99,0.05,0.05}
\definecolor{boxfill}{rgb}{0.99,0.95,0.95}
\lstdefinestyle{plain}{escapechar={\#}}
\lstnewenvironment{example}[1][]
{\lstset{aboveskip=15pt,xleftmargin=3pt,xrightmargin=3pt,basewidth=0.5em,basicstyle=\normalsize,frame=single,backgroundcolor=\color{boxfill},fillcolor=\color{white},rulecolor=\color{boxframe},framesep=2pt,framerule=0.5pt,style=plain,#1}}{}
\begin{document}
\lipsum[1]
\lipsum[1]
\begin{example}
listing
listing
listing
listing
listing
listing
\end{example}
\lipsum[1]
\end{document}

I'd like to be able to extract the relevant piece of code in the listings package for other purposes but, so far, in vain. I thought it was using the framed package but it is not.

share|improve this question
    
The source is all available, so you could go digging. For biblatex a lot of the work is done by ltxdockit.sty –  Alan Munn Jan 13 '11 at 1:21
    
it is pretty strange because the listings guide mentions the framed package but I cannot find where in the code? I think it is the same for ltxdockit.sty. I'll go further. –  pluton Jan 13 '11 at 1:30
    
listings is inspired by fancyvrb and it makes more sense to use it in a way you already did, define a new environment. –  Herbert Jan 13 '11 at 9:25
    
@Herbert: I'll have a look at fancyvrb but I wanted to create a theorem-like environment (title, numbering, labeling similar to ntheorem or thmtools) based on the frame offered by listings. That is why I wanted to extract the code dedicated to the frame. Using listings as such could be possible also. –  pluton Jan 13 '11 at 14:27

1 Answer 1

up vote 2 down vote accepted

You don't need framed.sty.

Use listings.sty and modify its properties.

Together with fancyvrb.sty you can create showexpl.sty-like environment that can span across multiple pages.

Let me know if you need more info how to do it.

share|improve this answer
    
@Herbert: OK. I will edit my answer. Thanks. –  xport Jan 13 '11 at 10:10
    
see my comment above. Thanks. –  pluton Jan 13 '11 at 14:27

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.