最終更新:2014-07-13 (日) 00:13:29 (1194d)

FrontPage

#!/usr/local/bin/perl -w
# Name:  Thor
# HP:    http://typeface.blog116.fc2.com/
# Email: thormac at gmail.com
# Date:  2005/02/02 16:48 JST +9:00
# Copying: Public Domain
#
# Reference
# webpage: http://oku.edu.mie-u.ac.jp/~okumura/texfaq/qa/34196.html
# Re:      HTML 実体参照 → LaTeX
# Name:    .
# date:    2005-02-02 14:09:44
# Reply :
# >>34193
# 紹介していただいたページの記述を加工すると…
# 下記のようなものが得られます(それをさらに加工して perl か何かの
# お好みのツールで処理させるスクリプトにするのは,容易でしょう).
# なお,一括置換の際には,コマンドの直後には適宜空白文字を置く
# 必要があることにご注意ください(念のため).
#
# ただし,変換後の LaTeX コマンドは
# 次のパッケージを用いることを仮定しています.
# \usepackage[T1]{fontenc}
# \usepackage{textcomp,amssymb}

# また,↵ については対応するコマンドが見当たらないため,
# 無視しています.

#$usage = 'Usage: h2lsymb <input.html >output.tex\n\n';

#&printPreamble ();#\begin{必要ならば}
#while (<>){
#    &isoToLaTeXCS ($_);
#    print $_;
#}
#&printPostamble ();#\end{必要ならば}

sub printPreamble {
    print "\\documentclass[a4j,11pt,papersize,uplatex]\{jsarticle\}\n";
    print "\\usepackage[T1]\{fontenc\}\n";
    print "\\usepackage\{textcomp,amssymb\}\n";
    print "\\usepackage\{type1ec\}% lmodern,....\n";
    print "\\begin\{document\}\n\n";
}

sub printPostamble {
    print "\\end\{document\}\n";
}

sub isoToLaTeXCS {
  $_ =~ s/(&quot;|&\#34;|&\#x0022;)/\"/gi;
  $_ =~ s/(&amp;|&\#38;|&\#x0026;)/\\&/gi;
  $_ =~ s/(&lt;|&\#60;|&\#x003C;)/\\textless /gi;
  $_ =~ s/(&gt;|&\#62;|&\#x003E;)/\\textgreater /gi;
  $_ =~ s/(&nbsp;|&\#160;|&\#x00A0;)/~/gi;
  $_ =~ s/(&iexcl;|&\#161;|&\#x00A1;)/\\textexclamdown /gi;
  $_ =~ s/(&cent;|&\#162;|&\#x00A2;)/\\textcent /gi;
  $_ =~ s/(&pound;|&\#163;|&\#x00A3;)/\\pounds /gi;
  $_ =~ s/(&curren;|&\#164;|&\#x00A4;)/\\textcurrency /gi;
  $_ =~ s/(&yen;|&\#165;|&\#x00A5;)/\\textyen /gi;
  $_ =~ s/(&brvbar;|&\#166;|&\#x00A6;)/\\textbrokenbar /gi;
  $_ =~ s/(&sect;|&\#167;|&\#x00A7;)/\\S /gi;
  $_ =~ s/(&uml;|&\#168;|&\#x00A8;)/\\textasciidieresis /gi;
  $_ =~ s/(&copy;|&\#169;|&\#x00A9;)/\\textcopyright /gi;
  $_ =~ s/(&ordf;|&\#170;|&\#x00AA;)/\\textordfeminine /gi;
  $_ =~ s/(&laquo;|&\#171;|&\#x00AB;)/\\guillemotleft /gi;
  $_ =~ s/(&not;|&\#172;|&\#x00AC;)/\\ensuremath{\\lnot} /gi;
  $_ =~ s/(&shy;|&\#173;|&\#x00AD;)/  /gi;
  $_ =~ s/(&reg;|&\#174;|&\#x00AE;)/\\textregistered /gi;
  $_ =~ s/(&macr;|&\#175;|&\#x00AF;)/\\textasciimacron /gi;
  $_ =~ s/(&deg;|&\#176;|&\#x00B0;)/\\textdegree /gi;
  $_ =~ s/(&plusmn;|&\#177;|&\#x00B1;)/\\ensuremath{\\pm} /gi;
  $_ =~ s/(&sup2;|&\#178;|&\#x00B2;)/\\texttwosuperior /gi;
  $_ =~ s/(&sup3;|&\#179;|&\#x00B3;)/\\textthreesuperior /gi;
  $_ =~ s/(&acute;|&\#180;|&\#x00B4;)/\\textasciiacute /gi;
  $_ =~ s/(&micro;|&\#181;|&\#x00B5;)/\\textmu /gi;
  $_ =~ s/(&para;|&\#182;|&\#x00B6;)/\\P /gi;
  $_ =~ s/(&middot;|&\#183;|&\#x00B7;)/\\textperiodcentered /gi;
  $_ =~ s/(&cedil;|&\#184;|&\#x00B8;)/\\c{\\ } /gi;
  $_ =~ s/(&sup1;|&\#185;|&\#x00B9;)/\\textonesuperior /gi;
  $_ =~ s/(&ordm;|&\#186;|&\#x00BA;)/\\textordmasculine /gi;
  $_ =~ s/(&raquo;|&\#187;|&\#x00BB;)/\\guillemotright /gi;
  $_ =~ s/(&frac14;|&\#188;|&\#x00BC;)/\\textonequarter /gi;
  $_ =~ s/(&frac12;|&\#189;|&\#x00BD;)/\\textonehalf /gi;
  $_ =~ s/(&frac34;|&\#190;|&\#x00BE;)/\\textthreequarters /gi;
  $_ =~ s/(&iquest;|&\#191;|&\#x00BF;)/\\textquestiondown /gi;
  $_ =~ s/(&Agrave;|&\#192;|&\#x00C0;)/\\\`A/gi;
  $_ =~ s/(&Aacute;|&\#193;|&\#x00C1;)/\\\'A/gi;
  $_ =~ s/(&Acirc;|&\#194;|&\#x00C2;)/\\^A/gi;
  $_ =~ s/(&Atilde;|&\#195;|&\#x00C3;)/\\~A/gi;
  $_ =~ s/(&Auml;|&\#196;|&\#x00C4;)/\\\"A/gi;
  $_ =~ s/(&Aring;|&\#197;|&\#x00C5;)/\\r{A}/gi;
  $_ =~ s/(&AElig;|&\#198;|&\#x00C6;)/\\AE /gi;
  $_ =~ s/(&Ccedil;|&\#199;|&\#x00C7;)/\\c{C}/gi;
  $_ =~ s/(&Egrave;|&\#200;|&\#x00C8;)/\\\`E/gi;
  $_ =~ s/(&Eacute;|&\#201;|&\#x00C9;)/\\\'E/gi;
  $_ =~ s/(&Ecirc;|&\#202;|&\#x00CA;)/\\^E/gi;
  $_ =~ s/(&Euml;|&\#203;|&\#x00CB;)/\\\"E/gi;
  $_ =~ s/(&Igrave;|&\#204;|&\#x00CC;)/\\\`I/gi;
  $_ =~ s/(&Iacute;|&\#205;|&\#x00CD;)/\\\'I/gi;
  $_ =~ s/(&Icirc;|&\#206;|&\#x00CE;)/\\^I/gi;
  $_ =~ s/(&Iuml;|&\#207;|&\#x00CF;)/\\\"I/gi;
  $_ =~ s/(&ETH;|&\#208;|&\#x00D0;)/\\DH /gi;
  $_ =~ s/(&Ntilde;|&\#209;|&\#x00D1;)/\\~N/gi;
  $_ =~ s/(&Ograve;|&\#210;|&\#x00D2;)/\\\`O/gi;
  $_ =~ s/(&Oacute;|&\#211;|&\#x00D3;)/\\\'O/gi;
  $_ =~ s/(&Ocirc;|&\#212;|&\#x00D4;)/\\^O/gi;
  $_ =~ s/(&Otilde;|&\#213;|&\#x00D5;)/\\\~O/gi;
  $_ =~ s/(&Ouml;|&\#214;|&\#x00D6;)/\\\"O/gi;
  $_ =~ s/(&times;|&\#215;|&\#x00D7;)/\\ensuremath{\\times}/gi;
  $_ =~ s/(&Oslash;|&\#216;|&\#x00D8;)/\\O/gi;
  $_ =~ s/(&Ugrave;|&\#217;|&\#x00D9;)/\\\`U/gi;
  $_ =~ s/(&Uacute;|&\#218;|&\#x00DA;)/\\\'U/gi;
  $_ =~ s/(&Ucirc;|&\#219;|&\#x00DB;)/\\^U/gi;
  $_ =~ s/(&Uuml;|&\#220;|&\#x00DC;)/\\\"U/gi;
  $_ =~ s/(&Yacute;|&\#221;|&\#x00DD;)/\\\'Y/gi;
  $_ =~ s/(&THORN;|&\#222;|&\#x00DE;)/\\TH /gi;
  $_ =~ s/(&szlig;|&\#223;|&\#x00DF;)/\\ss /gi;
  $_ =~ s/(&agrave;|&\#224;|&\#x00E0;)/\\\`a/gi;
  $_ =~ s/(&aacute;|&\#225;|&\#x00E1;)/\\\'a/gi;
  $_ =~ s/(&acirc;|&\#226;|&\#x00E2;)/\\^a/gi;
  $_ =~ s/(&atilde;|&\#227;|&\#x00E3;)/\\~a/gi;
  $_ =~ s/(&auml;|&\#228;|&\#x00E4;)/\\\"a/gi;
  $_ =~ s/(&aring;|&\#229;|&\#x00E5;)/\\r{a}/gi;
  $_ =~ s/(&aelig;|&\#230;|&\#x00E6;)/\\ae /gi;
  $_ =~ s/(&ccedil;|&\#231;|&\#x00E7;)/\\c{c}/gi;
  $_ =~ s/(&egrave;|&\#232;|&\#x00E8;)/\\\`e/gi;
  $_ =~ s/(&eacute;|&\#233;|&\#x00E9;)/\\\'e/gi;
  $_ =~ s/(&ecirc;|&\#234;|&\#x00EA;)/\\^e/gi;
  $_ =~ s/(&euml;|&\#235;|&\#x00EB;)/\\\"e/gi;
  $_ =~ s/(&igrave;|&\#236;|&\#x00EC;)/\\\`\\i /gi;
  $_ =~ s/(&iacute;|&\#237;|&\#x00ED;)/\\\'\\i /gi;
  $_ =~ s/(&icirc;|&\#238;|&\#x00EE;)/\\^\\i /gi;
  $_ =~ s/(&iuml;|&\#239;|&\#x00EF;)/\\\"\\i /gi;
  $_ =~ s/(&eth;|&\#240;|&\#x00F0;)/\\dh /gi;
  $_ =~ s/(&ntilde;|&\#241;|&\#x00F1;)/\\~n/gi;
  $_ =~ s/(&ograve;|&\#242;|&\#x00F2;)/\\\`o/gi;
  $_ =~ s/(&oacute;|&\#243;|&\#x00F3;)/\\\'o/gi;
  $_ =~ s/(&ocirc;|&\#244;|&\#x00F4;)/\\^o/gi;
  $_ =~ s/(&otilde;|&\#245;|&\#x00F5;)/\\~o/gi;
  $_ =~ s/(&ouml;|&\#246;|&\#x00F6;)/\\\"o/gi;
  $_ =~ s/(&divide;|&\#247;|&\#x00F7;)/\\ensuremath{\\div}/gi;
  $_ =~ s/(&oslash;|&\#248;|&\#x00F8;)/\\o/gi;
  $_ =~ s/(&ugrave;|&\#249;|&\#x00F9;)/\\\`u/gi;
  $_ =~ s/(&uacute;|&\#250;|&\#x00FA;)/\\\'u/gi;
  $_ =~ s/(&ucirc;|&\#251;|&\#x00FB;)/\\^u/gi;
  $_ =~ s/(&uuml;|&\#252;|&\#x00FC;)/\\\"u/gi;
  $_ =~ s/(&yacute;|&\#253;|&\#x00FD;)/\\\'y/gi;
  $_ =~ s/(&thorn;|&\#254;|&\#x00FE;)/\\th /gi;
  $_ =~ s/(&yuml;|&\#255;|&\#x00FF;)/\\\"y/gi;
  $_ =~ s/(&OElig;|&\#338;|&\#x0152;)/\\OE /gi;
  $_ =~ s/(&oelig;|&\#339;|&\#x0153;)/\\oe /gi;
  $_ =~ s/(&Scaron;|&\#352;|&\#x0160;)/\\v{S}/gi;
  $_ =~ s/(&scaron;|&\#353;|&\#x0161;)/\\v{s}/gi;
  $_ =~ s/(&Yuml;|&\#376;|&\#x0178;)/\\\"Y/gi;
  $_ =~ s/(&fnof;|&\#402;|&\#x0192;)/\\ensuremath{f}/gi;
  $_ =~ s/(&circ;|&\#710;|&\#x02C6;)/\\textasciicircum /gi;
  $_ =~ s/(&tilde;|&\#732;|&\#x02DC;)/\\textasciitilde /gi;
  $_ =~ s/(&Alpha;|&\#913;|&\#x391;)/A/gi;
  $_ =~ s/(&Beta;|&\#914;|&\#x392;)/B/gi;
  $_ =~ s/(&Gamma;|&\#915;|&\#x393;)/\\ensuremath{\\Gamma}/gi;
  $_ =~ s/(&Delta;|&\#916;|&\#x394;)/\\ensuremath{\\Delta}/gi;
  $_ =~ s/(&Epsilon;|&\#917;|&\#x395;)/E/gi;
  $_ =~ s/(&Zeta;|&\#918;|&\#x396;)/Z/gi;
  $_ =~ s/(&Eta;|&\#919;|&\#x397;)/H/gi;
  $_ =~ s/(&Theta;|&\#920;|&\#x398;)/\\ensuremath{\\Theta}/gi;
  $_ =~ s/(&Iota;|&\#921;|&\#x399;)/I/gi;
  $_ =~ s/(&Kappa;|&\#922;|&\#x39A;)/K/gi;
  $_ =~ s/(&Lambda;|&\#923;|&\#x39B;)/\\ensuremath{\\Lambda}/gi;
  $_ =~ s/(&Mu;|&\#924;|&\#x39C;)/M/gi;
  $_ =~ s/(&Nu;|&\#925;|&\#x39D;)/N/gi;
  $_ =~ s/(&Xi;|&\#926;|&\#x39E;)/\\ensuremath{\\Xi}/gi;
  $_ =~ s/(&Omicron;|&\#927;|&\#x39F;)/O/gi;
  $_ =~ s/(&Pi;|&\#928;|&\#x3A0;)/\\ensuremath{\\Pi}/gi;
  $_ =~ s/(&Rho;|&\#929;|&\#x3A1;)/P/gi;
  $_ =~ s/(&Sigma;|&\#931;|&\#x3A3;)/\\ensuremath{\\Sigma}/gi;
  $_ =~ s/(&Tau;|&\#932;|&\#x3A4;)/T/gi;
  $_ =~ s/(&Upsilon;|&\#933;|&\#x3A5;)/\\ensuremath{\\Upsilon}/gi;
  $_ =~ s/(&Phi;|&\#934;|&\#x3A6;)/\\ensuremath{\\Phi}/gi;
  $_ =~ s/(&Chi;|&\#935;|&\#x3A7;)/X/gi;
  $_ =~ s/(&Psi;|&\#936;|&\#x3A8;)/\\ensuremath{\\Psi}/gi;
  $_ =~ s/(&Omega;|&\#937;|&\#x3A9;)/\\ensuremath{\\Omega}/gi;
  $_ =~ s/(&alpha;|&\#945;|&\#x3B1;)/\\ensuremath{\\alpha}/gi;
  $_ =~ s/(&beta;|&\#946;|&\#x3B2;)/\\ensuremath{\\beta}/gi;
  $_ =~ s/(&gamma;|&\#947;|&\#x3B3;)/\\ensuremath{\\gamma}/gi;
  $_ =~ s/(&delta;|&\#948;|&\#x3B4;)/\\ensuremath{\\delta}/gi;
  $_ =~ s/(&epsilon;|&\#949;|&\#x3B5;)/\\ensuremath{\\varepsilon}/gi;
  $_ =~ s/(&zeta;|&\#950;|&\#x3B6;)/\\ensuremath{\\zeta}/gi;
  $_ =~ s/(&eta;|&\#951;|&\#x3B7;)/\\ensuremath{\\eta}/gi;
  $_ =~ s/(&theta;|&\#952;|&\#x3B8;)/\\ensuremath{\\theta}/gi;
  $_ =~ s/(&iota;|&\#953;|&\#x3B9;)/\\ensuremath{\\iota}/gi;
  $_ =~ s/(&kappa;|&\#954;|&\#x3BA;)/\\ensuremath{\\kappa}/gi;
  $_ =~ s/(&lambda;|&\#955;|&\#x3BB;)/\\ensuremath{\\lambda}/gi;
  $_ =~ s/(&mu;|&\#956;|&\#x3BC;)/\\ensuremath{\\mu}/gi;
  $_ =~ s/(&nu;|&\#957;|&\#x3BD;)/\\ensuremath{\\nu}/gi;
  $_ =~ s/(&xi;|&\#958;|&\#x3BE;)/\\ensuremath{\\xi}/gi;
  $_ =~ s/(&omicron;|&\#959;|&\#x3BF;)/\\ensuremath{o}/gi;
  $_ =~ s/(&pi;|&\#960;|&\#x3C0;)/\\ensuremath{\\pi}/gi;
  $_ =~ s/(&rho;|&\#961;|&\#x3C1;)/\\ensuremath{\\rho}/gi;
  $_ =~ s/(&sigmaf;|&\#962;|&\#x3C2;)/\\ensuremath{\\varsigma}/gi;
  $_ =~ s/(&sigma;|&\#963;|&\#x3C3;)/\\ensuremath{\\sigma}/gi;
  $_ =~ s/(&tau;|&\#964;|&\#x3C4;)/\\ensuremath{\\tau}/gi;
  $_ =~ s/(&upsilon;|&\#965;|&\#x3C5;)/\\ensuremath{\\upsilon}/gi;
  $_ =~ s/(&phi;|&\#966;|&\#x3C6;)/\\ensuremath{\\phi}/gi;
  $_ =~ s/(&chi;|&\#967;|&\#x3C7;)/\\ensuremath{\\chi}/gi;
  $_ =~ s/(&psi;|&\#968;|&\#x3C8;)/\\ensuremath{\\psi}/gi;
  $_ =~ s/(&omega;|&\#969;|&\#x3C9;)/\\ensuremath{\\omega}/gi;
  $_ =~ s/(&thetasym;|&\#977;|&\#x3D1;)/\\ensuremath{\\vartheta}/gi;
  $_ =~ s/(&upsih;|&\#978;|&\#x3D2;)/\\ensuremath{\\Upsilon}/gi;
  $_ =~ s/(&piv;|&\#982;|&\#x3D6;)/\\ensuremath{\\varpi}/gi;
  $_ =~ s/(&ensp;|&\#8194;|&\#x2002;)/\\enspace /gi;
  $_ =~ s/(&emsp;|&\#8195;|&\#x2003;)/\\quad /gi;
  $_ =~ s/(&thinsp;|&\#8201;|&\#x2009;)/\\thinspace /gi;
  $_ =~ s/(&zwnj;|&\#8204;|&\#x200C;)/  /gi;
  $_ =~ s/(&zwj;|&\#8205;|&\#x200D;)/  /gi;
  $_ =~ s/(&lrm;|&\#8206;|&\#x200E;)/  /gi;
  $_ =~ s/(&rlm;|&\#8207;|&\#x200F;)/  /gi;
  $_ =~ s/(&ndash;|&\#8211;|&\#x2013;)/{--}/gi;
  $_ =~ s/(&mdash;|&\#8212;|&\#x2014;)/{---}/gi;
  $_ =~ s/(&lsquo;|&\#8216;|&\#x2018;)/\`/gi;
  $_ =~ s/(&rsquo;|&\#8217;|&\#x2019;)/\'/gi;
  $_ =~ s/(&sbquo;|&\#8218;|&\#x201A;)/\\quotesinglbase /gi;
  $_ =~ s/(&ldquo;|&\#8220;|&\#x201C;)/\`\`/gi;
  $_ =~ s/(&rdquo;|&\#8221;|&\#x201D;)/\'\'/gi;
  $_ =~ s/(&bdquo;|&\#8222;|&\#x201E;)/\\quotedblbase /gi;
  $_ =~ s/(&dagger;|&\#8224;|&\#x2020;)/\\textdagger /gi;
  $_ =~ s/(&Dagger;|&\#8225;|&\#x2021;)/\\textdaggerdbl /gi;
  $_ =~ s/(&bull;|&\#8226;|&\#x2022;)/\\textbullet /gi;
  $_ =~ s/(&hellip;|&\#8230;|&\#x2026;)/\\dots /gi;
  $_ =~ s/(&permil;|&\#8240;|&\#x2030;)/\\textperthousand /gi;
  $_ =~ s/(&prime;|&\#8242;|&\#x2032;)/\\ensuremath{\'}/gi;
  $_ =~ s/(&Prime;|&\#8243;|&\#x2033;)/\\ensuremath{\'\'}/gi;
  $_ =~ s/(&lsaquo;|&\#8249;|&\#x2039;)/\\guilsinglleft /gi;
  $_ =~ s/(&rsaquo;|&\#8250;|&\#x203A;)/\\guilsinglright /gi;
  $_ =~ s/(&oline;|&\#8254;|&\#x203E;)/\\={\\ }/gi;
  $_ =~ s/(&frasl;|&\#8260;|&\#x2044;)/\//gi;
  $_ =~ s/(&euro;|&\#8364;|&\#x20AC;)/\\texteuro /gi;
  $_ =~ s/(&weierp;|&\#8472;|&\#x2118;)/\\ensuremath{\\wp}/gi;
  $_ =~ s/(&image;|&\#8465;|&\#x2111;)/\\ensuremath{\\Im}/gi;
  $_ =~ s/(&real;|&\#8476;|&\#x211C;)/\\ensuremath{\\Re}/gi;
  $_ =~ s/(&trade;|&\#8482;|&\#x2122;)/\\texttrademark /gi;
  $_ =~ s/(&alefsym;|&\#8501;|&\#x2135;)/\\ensuremath{\\aleph}/gi;
  $_ =~ s/(&larr;|&\#8592;|&\#x2190;)/\\textleftarrow /gi;
  $_ =~ s/(&uarr;|&\#8593;|&\#x2191;)/\\textuparrow /gi;
  $_ =~ s/(&rarr;|&\#8594;|&\#x2192;)/\\textrightarrow /gi;
  $_ =~ s/(&darr;|&\#8595;|&\#x2193;)/\\textdownarrow /gi;
  $_ =~ s/(&harr;|&\#8596;|&\#x2194;)/\\ensuremath{\\leftrightarrow}/gi;
  $_ =~ s/(&lArr;|&\#8656;|&\#x21D0;)/\\ensuremath{\\Leftarrow}/gi;
  $_ =~ s/(&uArr;|&\#8657;|&\#x21D1;)/\\ensuremath{\\Uparrow}/gi;
  $_ =~ s/(&rArr;|&\#8658;|&\#x21D2;)/\\ensuremath{\\Rightarrow}/gi;
  $_ =~ s/(&dArr;|&\#8659;|&\#x21D3;)/\\ensuremath{\\Downarrow}/gi;
  $_ =~ s/(&hArr;|&\#8660;|&\#x21D4;)/\\ensuremath{\\Leftrightarrow}/gi;
  $_ =~ s/(&forall;|&\#8704;|&\#x2200;)/\\ensuremath{\\forall}/gi;
  $_ =~ s/(&part;|&\#8706;|&\#x2202;)/\\ensuremath{\\partial}/gi;
  $_ =~ s/(&exist;|&\#8707;|&\#x2203;)/\\ensuremath{\\exists}/gi;
  $_ =~ s/(&empty;|&\#8709;|&\#x2205;)/\\ensuremath{\\emptyset}/gi;
  $_ =~ s/(&nabla;|&\#8711;|&\#x2207;)/\\ensuremath{\\nabla}/gi;
  $_ =~ s/(&isin;|&\#8712;|&\#x2208;)/\\ensuremath{\\in}/gi;
  $_ =~ s/(&notin;|&\#8713;|&\#x2209;)/\\ensuremath{\\notin}/gi;
  $_ =~ s/(&ni;|&\#8715;|&\#x220B;)/\\ensuremath{\\ni}/gi;
  $_ =~ s/(&prod;|&\#8719;|&\#x220F;)/\\ensuremath{\\prod}/gi;
  $_ =~ s/(&sum;|&\#8721;|&\#x2211;)/\\ensuremath{\\sum}/gi;
  $_ =~ s/(&minus;|&\#8722;|&\#x2212;)/\\ensuremath{-}/gi;
  $_ =~ s/(&lowast;|&\#8727;|&\#x2217;)/\\ensuremath{*}/gi;
  $_ =~ s/(&radic;|&\#8730;|&\#x221A;)/\\ensuremath{\\sqrt{\\quad}}/gi;
  $_ =~ s/(&prop;|&\#8733;|&\#x221D;)/\\ensuremath{\\propto}/gi;
  $_ =~ s/(&infin;|&\#8734;|&\#x221E;)/\\ensuremath{\\infty}/gi;
  $_ =~ s/(&ang;|&\#8736;|&\#x2220;)/\\ensuremath{\\angle}/gi;
  $_ =~ s/(&and;|&\#8743;|&\#x2227;)/\\ensuremath{\\land}/gi;
  $_ =~ s/(&or;|&\#8744;|&\#x2228;)/\\ensuremath{\\lor}/gi;
  $_ =~ s/(&cap;|&\#8745;|&\#x2229;)/\\ensuremath{\\cap}/gi;
  $_ =~ s/(&cup;|&\#8746;|&\#x222A;)/\\ensuremath{\\cup}/gi;
  $_ =~ s/(&int;|&\#8747;|&\#x222B;)/\\ensuremath{\\int}/gi;
  $_ =~ s/(&there4;|&\#8756;|&\#x2234;)/\\ensuremath{\\therefore}/gi;
  $_ =~ s/(&sim;|&\#8764;|&\#x223C;)/\\ensuremath{\\sim}/gi;
  $_ =~ s/(&cong;|&\#8773;|&\#x2245;)/\\ensuremath{\\cong}/gi;
  $_ =~ s/(&asymp;|&\#8776;|&\#x2248;)/\\ensuremath{\\approx}/gi;
  $_ =~ s/(&ne;|&\#8800;|&\#x2260;)/\\ensuremath{\\ne}/gi;
  $_ =~ s/(&equiv;|&\#8801;|&\#x2261;)/\\ensuremath{\\equiv}/gi;
  $_ =~ s/(&le;|&\#8804;|&\#x2264;)/\\ensuremath{\\le}/gi;
  $_ =~ s/(&ge;|&\#8805;|&\#x2265;)/\\ensuremath{\\ge}/gi;
  $_ =~ s/(&sub;|&\#8834;|&\#x2282;)/\\ensuremath{\\subset}/gi;
  $_ =~ s/(&sup;|&\#8835;|&\#x2283;)/\\ensuremath{\\supset}/gi;
  $_ =~ s/(&nsub;|&\#8836;|&\#x2284;)/\\ensuremath{\\not\\subset}/gi;
  $_ =~ s/(&sube;|&\#8838;|&\#x2286;)/\\ensuremath{\\subseteq}/gi;
  $_ =~ s/(&supe;|&\#8839;|&\#x2287;)/\\ensuremath{\\supseteq}/gi;
  $_ =~ s/(&oplus;|&\#8853;|&\#x2295;)/\\ensuremath{\\oplus}/gi;
  $_ =~ s/(&otimes;|&\#8855;|&\#x2297;)/\\ensuremath{\\otimes}/gi;
  $_ =~ s/(&perp;|&\#8869;|&\#x22A5;)/\\ensuremath{\\perp}/gi;
  $_ =~ s/(&sdot;|&\#8901;|&\#x22C5;)/\\ensuremath{\\cdot}/gi;
  $_ =~ s/(&lceil;|&\#8968;|&\#x2308;)/\\ensuremath{\\lceil}/gi;
  $_ =~ s/(&rceil;|&\#8969;|&\#x2309;)/\\ensuremath{\\rceil}/gi;
  $_ =~ s/(&lfloor;|&\#8970;|&\#x230A;)/\\ensuremath{\\lfloor}/gi;
  $_ =~ s/(&rfloor;|&\#8971;|&\#x230B;)/\\ensuremath{\\rfloor}/gi;
  $_ =~ s/(&lang;|&\#9001;|&\#x2329;)/\\ensuremath{\\langle}/gi;
  $_ =~ s/(&rang;|&\#9002;|&\#x232A;)/\\ensuremath{\\rangle}/gi;
  $_ =~ s/(&loz;|&\#9674;|&\#x25CA;)/\\ensuremath{\\diamondsuit}/gi;
  $_ =~ s/(&spades;|&\#9824;|&\#x2660;)/\\ensuremath{\\spadesuit}/gi;
  $_ =~ s/(&clubs;|&\#9827;|&\#x2663;)/\\ensuremath{\\clubsuit}/gi;
  $_ =~ s/(&hearts;|&\#9829;|&\#x2665;)/\\ensuremath{\\heartsuit}/gi;
  $_ =~ s/(&diams;|&\#9830;|&\#x2666;)/\\ensuremath{\\blacklozenge}/gi;
}

#\begin{必要ならば}
#1;
#\end{必要ならば}