Wither Self

Marc Ernst Eddy van Woerkom Marc.Vanwoerkom@REDACTED
Fri Sep 12 18:21:17 CEST 2003

> To get nice looking printed results on our colour printer I had to
> tweak my printing variables a little bit. Here's what Works For Me:

So we have html renderings of syntax colored listings
and direct printouts .. but what about putting syntax colored 
listings into TeX?


I just had to write a documentation of a Pascal program,
which I did with LaTeX2e (to render into PDF with pdfLaTeX),
it contained about 10-20 pages of blabla and about 100
pages with the 5000 lines of Pascal as appendix.


Getting that to work forced me to use such a script


# prepare pascal sources 

for f in \
  calc.pas \
  numbers.pas \
  numarith.pas \
  numutil.pas \
  propra.pas \
  util.pas \
  echo "creating file '$f.tex'"
  echo "% created by makedoku.sh on `date`" >$f.tex
  echo "\begin{verbatim}" >>$f.tex
  # remove DOS ^M and ^Z, Umlaut to TeX, tab to 8 spaces
  # complicated Umlaut translation due to sed etc
  # not able to deal with non Ascii chars..
  cat $SRC/$f | 
      tr -d "\032\r" |
      tr "\304" "~" | sed -e "s/~/Ae/g" |
      tr "\326" "~" | sed -e "s/~/Oe/g" |
      tr "\334" "~" | sed -e "s/~/Ue/g" |
      tr "\344" "~" | sed -e "s/~/ae/g" |
      tr "\366" "~" | sed -e "s/~/oe/g" |
      tr "\374" "~" | sed -e "s/~/ue/g" |
      tr "\t" "~  " | sed -e "s/~/        /g" \
  echo "\end{verbatim}" >>$f.tex

# tex 2 times
echo "first pdflatex pass.."
pdflatex doku-mvw.tex
echo "second pdflatex pass.."
pdflatex doku-mvw.tex

It produced cleansed versions (no Umlauts, tabs, ..)
braced by a verbatim environment.

In the main .tex doc I included them.

But pdflatex is able to support colors.
I would have loved to put in syntax coloured versions
of the listings.

Any idea?


More information about the erlang-questions mailing list