Wither Self

Marc Ernst Eddy van Woerkom <>
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?

Background:

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.

  http://www.stud.fernuni-hagen.de/q5480035/propra01580

Getting that to work forced me to use such a script

------------------------------------------------------------
#!/usr/local/bin/bash

# prepare pascal sources 
SRC=../src

for f in \
  calc.pas \
  numbers.pas \
  numarith.pas \
  numutil.pas \
  propra.pas \
  util.pas \
  zeros.pas
do
  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" \
      >>$f.tex
  echo "\end{verbatim}" >>$f.tex
done


# 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?

Regards,
Marc
  



More information about the erlang-questions mailing list