Marcus Harnisch | 2 Jul 22:32
X-Face
Picon

Framed boxes and listings

Hi all

For a presentation I would like to create framed code blocks using the
great listings package. With delightment I noticed that the
environments provided by listings work in almost every case. It
triggered only one case where things didn't work as expected.

History: Framed boxes in LaTeX suck when used on low-resolution
devices such as projectors. The piecewise assembly using ruleboxes and
other stuff I don't even want to think about, causes rounding errors
which is a pain in the eye. No matter whether anti-aliased diaplay is
used or not. Each way is equally bad, although in different respects.
Antialiased display suffers mostly from different line thickness,
while a normal display has overshoots in most corners of a box.

Given that I use PDF output only, my goal is to use a "native"
frame. I got excellent results from putting the listing into a
rectangular node. Since that seemed a bit to baroque I tried stripping
down the solution to using a framed `tikzpicture' and \pgftext with my
`lstlisting' as argument. Somehow, in the latter case, PGF did not get
the bounding box of the environment right.

My two questions are now:

1. What did I miss. What is the Right Way to achieve what I want?

2. Why does it not work with \pgftext? Was I completely off-track?

3. Ideally I'd have a solution that wraps all that into a new
environment. Potential users don't want to bother with PGF/TikZ just
to get a framed block of code. Any suggestions?

4. Is there maybe a separate package already addressing my issues (see
above rant about framed boxes)?

Thank you very much
-- Marcus

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

Gmane