axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Colored/shaded code parts in dvi


From: Ralf HEMMECKE
Subject: [Axiom-developer] Colored/shaded code parts in dvi
Date: Mon, 04 Oct 2004 09:25:09 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616

Hello,

Somebody interested in the following style code?

It redefines the \nwbegincode and \nwendcode commands of noweb.sty to
achieve shaded code areas in the dvi output.

There is not need to change anything in the .nw/.pamphlet file.

The 'framed' package seems to be a standard package in the latex
distribution.

But be warned, not every dvi viewer is able to handle colors.

For me it works with

home> kdvi --version
Qt: 3.3.3
KDE: 3.2.3
KViewShell: 0.2

and does not work with

home> xdvi --version
xdvik version 22.40v
Copyright (C) 1990-2002 Paul Vojta and others.


Just put the files below into some directory, go there and say

noweave -n file.nw > file.nw.tex
latex wrapper.tex

Ralf Hemmecke


%%-- BEGIN wrapper.tex -- %%
\documentclass{article}

\usepackage{noweb}

\usepackage{color}
\usepackage{framed}
\definecolor{shadecolor}{rgb}{0.8,0.8,0.8}
\let\rhxnwbegincode\nwbegincode
\let\rhxnwendcode\nwendcode
\def\nwbegincode#1{\begin{shaded}\rhxnwbegincode{#1}}
\def\nwendcode#1{\rhxnwendcode{}\end{shaded}}

\begin{document}
\input{file.nw}
\end{document}
%%-- END wrapper.tex -- %%




%%-- BEGIN file.nw -- %%
So let us first define the first code part.
<<Code 1>>=
one one
one
@ %def one

And now the second code part.

<<Code 2>>=
two one two
@

Putting everything together...
<<*>>=
<<Code 1>>
<<Code 2>>
@
%%-- END file.nw -- %%






reply via email to

[Prev in Thread] Current Thread [Next in Thread]