# text (partly as html) to hyperref pdflatex conversion, # a draft by jh, Feb 2007; employed for lp_what_is.htm; # tables and an image had to be edited manually sed -r ' s/^[[:blank:]]*<\/P>[[:blank:]]*$// ' $1 >/tmp/noendpar.tmp #s/^([[:blank:]]*<[pPhHdD])/\ #\1/ sed -rn ' /^[[:blank:]]*[^[:blank:]]+/{H;d} /^[[:blank:]]*$/{x; s/\n/ /g; s/$/\ / p; d; x; p} ' /tmp/noendpar.tmp >/tmp/oneline.tmp sed -r " //tmp/bef_quo.tmp sed -r '1i \ \\documentclass[12pt,a4paper]{article}\ \\textwidth 210mm\ \\textheight 297mm\ \\addtolength{\\textwidth}{-2in}\ \\addtolength{\\textheight}{-2in}\ \\addtolength{\\textwidth}{1cm}\ \\addtolength{\\textheight}{3cm}\ % \\footskip 0mm % comment this line for numbered pages\ \\addtolength{\\textheight}{-\\footskip}\ % \\pagestyle{empty} % comment this line for numbered pages\ \\topmargin -10mm\ \\headsep 0mm\ \\headheight 0mm\ \\oddsidemargin -5mm\ \\usepackage{graphicx}\ \\RequirePackage[latin2]{inputenc}\ \\usepackage[pdftex,bookmarksopen=true,backref,pdfauthor={Jan\\ Hollan}]\ {hyperref}\ \\newcommand{\\mylabel}[2]{\\protect\\label{#1}\\protect\\hypertarget{#1}{#2}} \ \\newcommand {\\myref}[2]{\\protect\\hyperlink{#1}{#2}} \ \\begin{document} /<[Hh]1>/h s/<[Hh]1>/\\section*{/ /<[Hh]2>/h s/<[Hh]2>/\\subsection*{/ /<[Hh]3>/h s/<[Hh]3>/\\subsubsection*{/ /<[Hh]4>/h s/<[Hh]4>/\\paragraph*{/ /<\/[Hh][1234]>/{ s/<\/[Hh][1234]>/}/ G s/<[Hh]2>([^<]+)/\\addcontentsline{toc}{subsection}{\1}/ s/<[Hh]3>([^<]+)/\\addcontentsline{toc}{subsubsection}{\1}/ s/<[Hh]3><[^>]+>([^<]+).*/\\addcontentsline{toc}{subsubsection}{\1}/ s/<[Hh]1>([^<]+)/\\addcontentsline{toc}{section}{\1}/ s/<[Hh]4>([^<]+)/\\addcontentsline{toc}{paragraph}{\1}/ s/<\/[Hh][1234]>// } s/<[lL][iI]>/\\item{}/g s/<[oO][lL]>/\\begin{enumerate}/ s/<[oO][lL] start=([0-9]+)>/\\begin{enumerate}\\setcounter{enumi}{\1}/ s/<\/[oO][lL]>/\\end{enumerate}/ s/<[dD][lL]>/\\begin{description}/ s/<[dD][tT]>(.+)<[dD][dD]>(.+)/\\item[\1]{\2}/g s/<\/[dD][lL]>/\\end{description}/ s/<[pP]>//g s/
/\\bigskip\\noindent\\textit{/ s/<\/ADDRESS>/}/ s/<(BLOCKQUOTE|blockquote)>/\\begin{quotation}/ s/<\/(BLOCKQUOTE|blockquote)>/\\end{quotation}/ s/\×/\\ensuremath{\\times}/g s/\ /~/g s/\–/--/g s/\×/\\mtimes{}/g s/\′/\\ensuremath{^\\prime}/g s/\μ/\\ensuremath{\\mu}/g s/\λ/\\ensuremath{\\lambda}/g s/\θ/\\ensuremath{\\theta}/g s/\Σ/\\ensuremath{\\Sigma}/g s/\−/\\ensuremath{-}/g s/\</\\ensuremath{<}/g s/\>/\\ensuremath{>}/g s/\≤/\\ensuremath{\\le}/g s/\≥/\\ensuremath{\\ge}/g s/<[bB]>/\\textbf{/g s/<\/[bB]>/}/g s/<[eE][mM]>/\\emph{/g s/<\/[eE][mM]>/}/g s/<[iI]>/\\textit{/g s/<\/[iI]>/}/g s/<[aA] +href= *"#([^"]+)" *>([^<]+)<\/A>/\\myref{\1}{\2}/g s/<[aA] +name= *"([^"]+)" *>([^<]+)<\/A>/\\mylabel{\1}{\2}/g s/<[aA] +href= *"#([^"]+)" +name=" *([^"]+)" *>([^<]+)<\/A>/\\myref{\1}{\\mylabel{\2}{\3}}/g s/<[aA] +name= *"([^"]+)" +href= *"#([^"]+)" *>([^<]+)<\/A>/\\mylabel{\1}{\\myref{\2}{\3}}/g s/<[aA] +name= *"([^"]+)" +href= *"([^"]+)" *>([^<]+)<\/A>/\\mylabel{\1}{\\href{\2}{\3}}/g s/%/\\%/g s/<[bB][rR]>/\\\\/g s/([&_#])/\\\1/g s/<[aA] (href|HREF)= *"([^#][^"]+)" *>([^<]+)<\/A>/\\href{\2}{\3}/g s/<[hH][rR]>/\\hrulefill{}/ # ULRs at the end of the sentence (appended by .), inside a line s|(http://[-a-zA-Z0-9/~_.]+[-a-zA-Z0-9/~_#]+)\.([ )])|\\wwws{\1}.\2|g # ULRs at the end of the sentence (appended by .), ending a line s|(http://[-a-zA-Z0-9/~_.]+[-a-zA-Z0-9/~_#]+)\.$|\\wwws{\1}.|g # ULRs inside a sentence, inside a line s|(http://[-a-zA-Z0-9/~_.#]+)([ ,);])|\\wwws{\1}\2|g # ULRs inside a sentence, ending a line s|(http://[-a-zA-Z0-9/~_.#]+)$|\\wwws{\1}|g s/<[sS][uU][bB]>/\\ensuremath{_{/g s/<\/[sS][uU][bB]>/}}/g s/<[sS][uU][pP]>/\\ensuremath{^{/g s/<\/[sS][uU][pP]>/}}/g $a\ \\end{document} ' /tmp/bef_quo.tmp