2 Jul 22:32
Framed boxes and listings
Marcus Harnisch <marcus.harnisch <at> gmx.net>
2007-07-02 20:32:14 GMT
2007-07-02 20:32:14 GMT
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(Continue reading)

RSS Feed