#!/usr/bin/perl -pi 

s/(?<!\\)&/\\&/g;
s/\$\$/\$/g;
s/(?<!\\)%/\\%/g;
s/(?<!\\)#/\\#/g;

# those ops were idempotent

s/'''(.*)'''/\\textbf{$1}/g;
s/''(.*)''/\\emph{$1}/g;


# add these to easylatex:

s/^:(.*)/\n\\ \\ \\ \\ \\ $1\n\\\\\n/gm;
s/<pre>/\\begin{verbatim}/g;
s/<\/pre>/\\end{verbatim}/g;
s/-->/\\to/g;
#s/http:\/\/([\w\/\.]+)~([\w\/\.]*)/http:\/\/$1\\~{}$2/g;
s/~/\\~{}/g;
s/\\%(\s)/\\%\\ $1/sg;

# change graph size in \{seminar} class! 3,3?
s/\\begin{graph}/\\begin{graph}\nsize="3,3"/g;


# alert! bug in easylatex ?!?: an escaped equals sign didn't take:

#\ \ \ \ \ error rate \= 6\% (on \textbf{test} set)
#
#  had to be manually changed to
#
#\ \ \ \ \ error rate $=$ 6\% (on \textbf{test} set)

# note: must escape [s as \[s! must escape unwanted =s!