#!/usr/bin/perl -p # # convert various Latex stuff to html # for use with makehtml ############## # accents ############## #acute s/\\'{a}/á/g; s/\\'{e}/é/g; s/\\'{\\i}/í/g; s/\\'{o}/ó/g; s/\\'{u}/ú/g; s/\\'{y}/ý/g; s/\\'{A}/Á/g; s/\\'{E}/É/g; s/\\'{I}/Í/g; s/\\'{O}/Ó/g; s/\\'{U}/ú/g; s/\\'{Y}/Ý/g; #umlauts s/\\"{a}/ä/g; s/\\"{e}/ë/g; s/\\"{\\i}/ï/g; s/\\"{o}/ö/g; s/\\"{u}/ü/g; s/\\"{y}/ÿ/g; s/\\"{A}/Ä/g; s/\\"{E}/Ë/g; s/\\"{I}/Ï/g; s/\\"{O}/Ö/g; s/\\"{U}/Ü/g; #graves s/\\`{a}/à/g; s/\\`{e}/è/g; s/\\`{\\i}/ì/g; s/\\`{o}/ò/g; s/\\`{u}/ù/g; s/\\`{A}/À/g; s/\\`{E}/È/g; s/\\`{I}/Ì/g; s/\\`{O}/Ò/g; s/\\`{U}/Ù/g; #circumflexes s/\\\^{a}/â/g; s/\\\^{e}/ê/g; s/\\\^{\\i}/î/g; s/\\\^{o}/ô/g; s/\\\^{u}/û/g; s/\\\^{A}/Â/g; s/\\\^{E}/Ê/g; s/\\\^{I}/Î/g; s/\\\^{O}/Ô/g; s/\\\^{U}/Û/g; #tildes s/\\~{a}/ã/g; s/\\~{n}/ñ/g; s/\\~{o}/õ/g; s/\\~{A}/Ã/g; s/\\~{N}/Ñ/g; s/\\~{O}/Õ/g; #circles s/\\aa/å/g; s/\\AA/Å/g; #slashes s/\\o/ø/g; s/\\O/Ø/g; #cedillas s/\\c{c}/ç/g; s/\\c{C}/Ç/g; #carons s/\\v{s}/š/g; s/\\v{S}/Š/g; #misc s/\\ae/æ/g; s/\\AE/Æ/g; s/\\ss/ß/g; #unavailable things s/\\'{c}/c/g; s/\\'{n}/n/g; s/\\'{s}/s/g; s/\\'{C}/C/g; s/\\c{s}/s;/g; s/\\v{c}/c/g; s/\\v{e}/e/g; s/\\v{n}/n/g; s/\\v{r}/r/g; s/\\v{z}/z/g; s/\\v{C}/C/g; s/\\l/l/g; s/\\L/L/g; # Punctuation s/\\&/&/g; s/~/ /g; # Dashes - note that bib2html deals with -- to ndash in page ranges s/\\textemdash /—/g; s/\\textemdash\\/—/g; s/\\textemdash/—/g; s/---/—/g; s/--/–/g; # Percent signs # Two cases: put in by bibtex at EOL # legitimate (and preceded by \) s/\\%/TEMPPERCENT/g; # find legitimate percents s{%\n}{}g; # fix unwanted % at EOL s/TEMPPERCENT/%/g; # put legitimate % back, without the \ # Miscellany s/\$\\mu\$/µ/g; s/\$\^\\circ\$/°/g; s/\$\\frac\{1\}\{2\}\$/½/g; s/\\frac\{1\}\{2\}/½/g; s/\\textit{t}/T<\/i>/g; # hack (hopefully temporary) - better # to stop bibtex from changing the case in the first place s/\\,/ /g; # Italicise s/\\textit{([\w\s\`\'.]+)}/$1<\/i>/g; s/\\textit{([\w\s\`\'.{}\n]+)}/$1<\/i>/g; # Get rid of excess { and } # Note that this will get rid of remaining wanted { and } # (other than \{ and \}) # so better make sure all get processed before this bit # # Might be useful to comment out for testing! s/\\{/TEMPLEFTCURLY/g; s/{//g; s/TEMPLEFTCURLY/{/g; s/\\}/TEMPRIGHTCURLY/g; s/}//g; s/TEMPRIGHTCURLY/}/g; #print;