#!/usr/bin/perl -s our ($o); $o ||= "_pretty.tex"; undef $/; $iii = <>; $iii =~ s/_/!!/g; $iii =~ s/!!(o|x|\+)!!/_$1_/g; $iii =~ s/!!c\b/_c/g; $iii =~ s/"(.*?)"/ta($1)/ge; open (W,"> __p") or die "cant open __p\n"; print W $iii; close W; if ($t) { system ("pretty -t > $o < __p") ; } else {system ("pretty -o $o __p") ; } open (R,$o) or die "cant open $o\n"; $iii = ; close R; $iii =~ s/([^\\])(".*?[^\\]")/$1.pppp($2)/ge; $iii =~ s/!!/\\_/g; open (W,"> $o") or die "cant open $o\n"; print W $iii; close W; #print $iii; sub ta{ my $a = shift; $a =~ s/_/!!/g; $a =~ s/\\n/(cr)/g; "\"$a\""; } sub pppp{ my $a=shift; for ($a){ s/\\/\\backslash/g; s/\$/\\\$/g; s/\%/\\\%/g; s/{/\\{/g; s/}/\\}/g; s/\~/\\\~{ }/g; s/\\backslash/\$$&\$/g; } "\\mbox{\\texttt{$a}}" } =head1 NAME jjpretty - Camila to LaTeX converter =head1 SYNOPSYS jjpretty file.cam jjpretty -t file.cam jjpretty -o=file.tex file.cam =head1 DESCRIPTION C creates a file C<_pretty.tex> (to be included in a LaTeX document) If we want a complete LaTeX cocument try C which adds \documentclass{article} \input camila.mac \usepackage{fullpage} \begin{document} ... \end{document} without arguments it works like a pipe =head1 FILES camila.mac - this latex file should be present in the usual places (~/lib/tex/ or any directory with texinputs). =head1 SEE ALSO camila, latex, dvips, xdvi =head1 AUTHOR F. Luís Neves (fln@di.uminho.pt) J. João Almeida (jj@di.uminho.pt) =head1 DATE Nov-98