\n"}; } $line = ""; } } close(INF); } if($numberofURLedref>0){ print "\n
\n/g;
s/\\(\\|cr|newline)/ \n/g;
s/\\end\{(equation\*?|displaymath)\}/\n <\/i><\/p>\n /g;
s/\\begin\{eqnarray\*?\}/\n \n\\begin{array}\n/g;
s/\\end\{eqnarray\*?\}/\n\\end\{array\}\n <\/i><\/p>\n/g;
s/\\begin\{align\*?\}/\n \n\\begin{array}[2]\n/g;
s/\\end\{align\*?\}/\n\\end\{array\}\n <\/i><\/p>\n/g;
s/\\begin\{description\}/\n \1<\/SMALL>\n\n/g;
s/\\date//g;
s/\\begin\{abstract\}/ /g;
s/\\author\s*\{([^\{\}]*{[^\}]*}[^\}]*)\}/
\n/g; # linebreaks
while(s/\\verb(.)(.*?)\1/ThIsStRiNgIsOnHoLd28<\/CODE>/ ||
s/(\\url)\{(.*?)\}/ThIsStRiNgIsOnHoLd28<\/CODE>/){
push(@verbstring,$2);
}
# fractions approximate treatment
s/\\nicefrac/\\frac/g;
s/\\frac\s*(1|\{1\})\s*(2|\{2\})/\½/g; # special fractions with html symbols
s/\\frac\s*(1|\{1\})\s*(4|\{4\})/\¼/g;
s/\\frac\s*(3|\{3\})\s*(4|\{4\})/\¾/g;
# fractions with {}:
s/\\frac\s*{(\w|\\\w+)}\s*{(\w|\\\w+)}/\1\/\2/g; # numerator and denominator are single symbols
s/\\frac\s*{(\w|\\\w+)}\s*{([^\}]*)}/\1\/(\2)/g; # numerator is single symbol
s/\\frac\s*{([^\}]*)}\s*{(\w|\\\w+)}/(\1)\/\2/g; # denominator is single symbol
s/\\frac\s*{([^\}]*)}\s*{([^\}]*)}/(\1)\/(\2)/g;
# fractions with some or all {} missing:
s/\\frac\s*{([^\}]*)}\s*([^ \\]|\\[^ \\]*)/(\1)\/\2/g; # numerator is single symbol
s/\\frac\s*([^ \\]|\\[^ \\]*)\s*{([^\}]*)}/\1\/(\2)/g; # denominator is single symbol
s/\\frac\s*([^ \\]|\\[^ \\]*)\s*([^ \\]|\\[^ \\]*)/\1\/\2/g; # numerator and denominator are single symbols
s/{([^\}]*)}\s*\\over\s*{([^\}]*)}/\1<\/sup>\/\2<\/sub>/g;
s/([^ \\]|\\[^ \\]*)\s*\\over\s*{([^\}]*)}/\1<\/sup>\/\2<\/sub>/g;
s/{([^\}]*)}\s*\\over\s*([^ \\]|\\[^ \\]*)/\1<\/sup>\/\2<\/sub>/g;
s/([^ \\]|\\[^ \\]*)\s*\\over\s*([^ \\]|\\[^ \\]*)/\1<\/sup>\/\2<\/sub>/g;
s/{([^\}]*)}\s*\\atop\s*{([^\}]*)}/\1 \/\/ \2/g;
s/([^ \\]|\\[^ \\]*)\s*\\atop\s*{([^\}]*)}/\1 \/\/ \2/g;
s/{([^\}]*)}\s*\\atop\s*([^ \\]|\\[^ \\]*)/\1 \/\/ \2/g;
s/([^ \\]|\\[^ \\]*)\s*\\atop\s*([^ \\]|\\[^ \\]*)/\1 \/\/ \2/g;
# below here start the character and calligraphic substitutions:
# subscripts & superscripts:
s/([_^])\{\\(bf|mathbf|bm)\s*\\rm\s+([^\}]*)\}/\1\{\3<\/B>\}/g; # both
s/([_^])\{\\rm\s*\\(bf|mathbf|bm)\s+([^\}]*)\}/\1\{\3<\/B>\}/g;
s/([^_^])\{\\(bf|mathbf|bm)\s+([^\}]+)\}/\1\3<\/B>/g; # boldfaces
s/\\textbf\s*\{([^\}]+)\}/\1<\/B>/g; # boldface
s/\\textbf\s*([^\{])/\1<\/B>/g; # boldface 1 char
s/([_^])\{\\(bf|mathbf|bm)\s+([^\}]+)\}/\1\{\3<\/B>\}/g;
s/([^_^])\{\\rm\s+([^\}]*)\}/\1\2<\/i>/g;# romans
s/([_^])\\textrm\s*\{([^\}]*)}/\1\{\2<\/i>\}/g;# romans
s/([_^])\\text\s*\{([^\}]*)}/\1\{\2<\/i>\}/g;# romans
s/\\textrm\s*\{([^\}]*)\}/\1<\/i>/g;# romans
s/\\text\s*\{([^\}]*)\}/\1<\/i>/g;# romans
s/([_^])\{\\rm\s+([^\}]*)\}/\1\{\2<\/i>\}/g;
s/([^_^])\{\\(mathcal|cal)\s+([^\}]*)\}/\1\3<\/CODE>/g;# cal
s/([_^])\{\\(mathcal|cal)\s+([^\}]*)\}/\1\{\3<\/CODE>\}/g;
s/~/\ /g; # ~ as a space
s/\\onlinecite/\\cite/g; # further processed below
s/\s\$([^\$]*)\$\s/\n\1<\/i>\n/g; # mathematical formulae
s/\$([^\$]*)\$/\1<\/i>/g; # are rendered as italic
s/\\begin\{(equation\*?|displaymath)\}/<\/p>\n /g;
s/\\end\{description\}/<\/UL>\n/g;
s/\\begin\{itemize\}/\n
\n/g;
s/\\end\{itemize\}/\n<\/UL>\n/g;
s/\\begin\{enumerate\}/\n
\n/g;
s/\\begin\{etaremune\}/\n
\n/g;
s/\\end\{(enumerate|etaremune)\}/\n<\/OL>\n/g;
s/\\item\[([^\]]+)\]/\n
\2<\/CODE>/g;# plain cal's
s/\\sum(\W)/\Σ\1/g; # special treatment of sum
s/\\(sin|cos|tan|arcsin|arccos|arctan|ln|log|exp|max|min)/\1<\/i>/g;
s/\\dag(\W)/\†\1/g;
s/\\sqrt\s*\{(.)\}/\\sqrt \1/g; # pretreatment of \sqrt
s/\\sqrt\s*\{(.[^\}]+)\}/\\sqrt(\1)/g;
s/([^\\])\\\,/\1 /g; # special spaces
s/([^\\])\\\:/\1 /g;
s/([^\\])\\\;/\1 /g;
s/([^\\])\\ /\1 /g;
s/([^\\])\\quad/\1 /g;
s/([^\\])\\qquad/\1 /g;
# s/([^\\])\\!\\!/\1/g;
# s/([^\\])\\!/\1/g;
s/\\\!//g;
s/(\w)\\-(\w)/\1\2/g; # syllabes
s/([^\\])\\%/\1%/g; # special characters
s/([^\\])\\#/\1#/g;
s/([^\\])\\&/\1\&/g;
s/\\mu(\W)/\µ\1/g;
s/\\partial\s*/\∂/g;
s/\\partial(\W)/\∂\1/g;
s/\\par/
\n/g; # linebreaks
s/\\hbar/\ℏ/g;
s/\\div/\÷/g;
s/\\AA/\Å/g;
s/\\circ/\°/g;
s/\\neq?(\W)/\≠\1/g;
s/\\pm(\W)/\±\1/g;
s/\\(g|l)eq(\W)/\&\1e;\2/g;
s/\\simeq(\W)/\≅\1/g;
s/\\approx(\W)/\≈\1/g;
s/\\cdot(\W)/\⋅\1/g;
s/\\dots/…/g;
s/\\propto(\W)/\∝\1/g;
s/\\infty(\W)/\∞\1/g;
s/\\sqrt\s*/\√/g;
s/\\protect//g; # useless stuff is removed:
s/\\nonumber//g;
s/\\newpage//g;
s/\\indent//g;
s/\\noindent//g;
s/\\hfill//g;
s/\\to(\W)/\→\1/g; # arrows:
s/\\rightarrow(\W)/\→\1/g;
s/\\longrightarrow(\W)/--\→\1/g;
s/\\longleftarrow(\W)/\←--\1/g;
s/\\longleftrightarrow(\W)/\↔\1/g;
s/\\uparrow(\W)/\↑\1/g;
s/\\downarrow(\W)/\↓\1/g;
# equivalent latex & html entities:
s/\\(times|otimes|oplus|cdots|ddots|vdots|int|perp|nabla|equiv|alpha|Alpha|beta|gamma|Gamma|delta|Delta|epsilon|zeta|eta|theta|Theta|iota|kappa|lambda|Lambda|nu|xi|Xi|omicron|pi|Pi|rho|sigma|Sigma|tau|upsilon|Upsilon|phi|Phi|chi|Chi|psi|Psi|omega|Omega|dagger|parallel|vert|sim|leq|geq|lesssim|gtrsim|leftrightarrow|leftarrow|rightarrow)(\W)/\&\1;\2/g;
s/\\varepsilon(\W)/\ε\1/g;
s/\\title\{([^\}]*)\}/\n\\title{\1}/g; # treat separately
s/\\chapter\*?\{([^\}]+)\}/\1<\/H1>/g;# sections, abstracts etc.
s/\\section\*?\{([^\}]+)\}/
\1<\/H2>/g;
s/\\subsection\*?\{([^\}]+)\}/
\1<\/H3>/g;
s/\\subsubsection\*?\{([^\}]+)\}/
\1<\/H4>/g;
s/\\appendix/
Appendix<\/H2>/g;
s/(
Abstract<\/H2>\n\n/g;
s/\\end\{abstract\}/\n<\/small>