© @kafukanoochan  
  (いかなる保証・補償もしません)

TeX数式のヘルプは、こちら(Wikiipedia)です。

[変換仕様]              
// Pre変換
  $fml2preTbl[mb_substr("¥",0,1,'UTF-8')] = "\\";
  $fml2preTbl[mb_substr('=',0,1,'UTF-8')] = '=';     
  $fml2preTbl[mb_substr("ー",0,1,'UTF-8')] = '-';     
  $fml2preTbl[mb_substr("-",0,1,'UTF-8')] = '-';
  $fml2preTbl[mb_substr('!',0,1,'UTF-8')] = '!';     
  $fml2preTbl[mb_substr("+",0,1,'UTF-8')] = '+';
  $fml2preTbl[mb_substr("*",0,1,'UTF-8')] = '*';
  $fml2preTbl[mb_substr("^",0,1,'UTF-8')] = '^';
  // imgタグ内には書けないもの
  $fml2preTbl[mb_substr('?',0,1,'UTF-8')] = '?';
  $fml2preTbl[mb_substr('&',0,1,'UTF-8')] = '&';
  $fml2preTbl[mb_substr('%',0,1,'UTF-8')] = '%';
  $fml2preTbl[mb_substr('<',0,1,'UTF-8')] = '<';     
  $fml2preTbl[mb_substr('>',0,1,'UTF-8')] = '>';
  $fml2preTbl[mb_substr("’",0,1,'UTF-8')] = "'";
  $fml2preTbl[mb_substr('”',0,1,'UTF-8')] = "''";
  // Hatenaブログ では書けないもの
  $fml2preTbl[mb_substr(':',0,1,'UTF-8')] = ':';
  $fml2preTbl[mb_substr(';',0,1,'UTF-8')] = ';';
  $fml2preTbl[mb_substr('[',0,1,'UTF-8')] = "[";
  $fml2preTbl[mb_substr(']',0,1,'UTF-8')] = "]";
  // wikiタグ内には書けないもの
  $fml2preTbl[mb_substr('、',0,1,'UTF-8')] = ',';     
  $fml2preTbl[mb_substr('(',0,1,'UTF-8')] = "(";
  $fml2preTbl[mb_substr(')',0,1,'UTF-8')] = ")";

// confurict 回避
  $confTbl[mb_substr('\,',0,2,'UTF-8')] = " ";
  $confTbl[mb_substr('\;',0,2,'UTF-8')] = "  ";
  $confTbl[mb_substr("\\\\",0,2,'UTF-8')] = ";";      // NewLine
  $confTbl[mb_substr("|_",0,2,'UTF-8')] = '\mid_';
  $confTbl[mb_substr('\e^',0,3,'UTF-8')] = " e^";      // mimeTeX のバグ

// TeX変換
  $grk[mb_substr("ℏ", 0,1,'UTF-8')] = '\hbar ';
  $grk[mb_substr("ℒ",0,1,'UTF-8')] = '\mathcal{L}';
  $grk[mb_substr("ℋ",0,1,'UTF-8')] = '\mathcal{H}';
  $grk[mb_substr("ℵ",0,1,'UTF-8')] = '\aleph ';
  $grk[mb_substr("א",0,1,'UTF-8')] = '\aleph ';
  $grk[mb_substr("ℓ",0,1,'UTF-8')] = 'mathit{l}';
  $grk[mb_substr("½",0,1,'UTF-8')] = '\frac{1}{2}';
  $grk[mb_substr("⅓",0,1,'UTF-8')] = '\frac{1}{3}';
  $grk[mb_substr("⅔",0,1,'UTF-8')] = '\frac{2}{3}';
  $grk[mb_substr("⁺",0,1,'UTF-8')] = '{}^{+}';
  $grk[mb_substr("⁻",0,1,'UTF-8')] = '{}~{-}';
  $grk[mb_substr("¹",0,1,'UTF-8')] = '{}^{1}';
  $grk[mb_substr("²",0,1,'UTF-8')] = '{}^{2}';
  $grk[mb_substr("³",0,1,'UTF-8')] = '{}^{3}';
  $grk[mb_substr("ⁿ",0,1,'UTF-8')] = '{}^{n}';
  $grk[mb_substr("₀",0,1,'UTF-8')] = '{}_{0}';
  $grk[mb_substr("₁",0,1,'UTF-8')] = '{}_{1}';
  $grk[mb_substr("₂",0,1,'UTF-8')] = '{}_{2}';
  $grk[mb_substr("₃",0,1,'UTF-8')] = '{}_{3}';
  $grk[mb_substr("∛",0,1,'UTF-8')] = '\sqrt[3]';
  $grk[mb_substr("⊕",0,1,'UTF-8')] = '\oplus ';
  $grk[mb_substr("⊗",0,1,'UTF-8')] = '\otimes ';

  $grk[mb_substr("1",0,1,'UTF-8')] = '\mathbf{1}';
  $grk[mb_substr("A",0,1,'UTF-8')] = '\mathbf{A}';
  $grk[mb_substr("B",0,1,'UTF-8')] = '\mathbf{B}';
  $grk[mb_substr("C",0,1,'UTF-8')] = '\mathbf{C}';
  $grk[mb_substr("D",0,1,'UTF-8')] = '\mathbf{D}';
  $grk[mb_substr("E",0,1,'UTF-8')] = '\mathbf{E}';
  $grk[mb_substr("F",0,1,'UTF-8')] = '\mathbf{F}';
  $grk[mb_substr("G",0,1,'UTF-8')] = '\mathbf{G}';
  $grk[mb_substr("H",0,1,'UTF-8')] = '\mathbf{H}';
  $grk[mb_substr("I",0,1,'UTF-8')] = '\mathbf{I}';
  $grk[mb_substr("J",0,1,'UTF-8')] = '\mathbf{J}';
  $grk[mb_substr("K",0,1,'UTF-8')] = '\mathbf{K}';
  $grk[mb_substr("L",0,1,'UTF-8')] = '\mathbf{L}';
  $grk[mb_substr("M",0,1,'UTF-8')] = '\mathbf{M}';
  $grk[mb_substr("N",0,1,'UTF-8')] = '\mathbf{N}';
  $grk[mb_substr("O",0,1,'UTF-8')] = '\mathbf{O}';
  $grk[mb_substr("P",0,1,'UTF-8')] = '\mathbf{P}';
  $grk[mb_substr("Q",0,1,'UTF-8')] = '\mathbf{Q}';
  $grk[mb_substr("R",0,1,'UTF-8')] = '\mathbf{R}';
  $grk[mb_substr("S",0,1,'UTF-8')] = '\mathbf{S}';
  $grk[mb_substr("T",0,1,'UTF-8')] = '\mathbf{T}';
  $grk[mb_substr("U",0,1,'UTF-8')] = '\mathbf{U}';
  $grk[mb_substr("V",0,1,'UTF-8')] = '\mathbf{V}';
  $grk[mb_substr("W",0,1,'UTF-8')] = '\mathbf{W}';
  $grk[mb_substr("X",0,1,'UTF-8')] = '\mathbf{X}';
  $grk[mb_substr("Y",0,1,'UTF-8')] = '\mathbf{Y}';
  $grk[mb_substr("Z",0,1,'UTF-8')] = '\mathbf{Z}';
  $grk[mb_substr("a",0,1,'UTF-8')] = '\mathbf{a}';
  $grk[mb_substr("c",0,1,'UTF-8')] = '\mathbf{c}';
  $grk[mb_substr("g",0,1,'UTF-8')] = '\mathbf{g';
  $grk[mb_substr("p",0,1,'UTF-8')] = '\mathbf{p}';
  $grk[mb_substr("q",0,1,'UTF-8')] = '\mathbf{q}';
  $grk[mb_substr("r",0,1,'UTF-8')] = '\mathbf{r}';
  $grk[mb_substr("u",0,1,'UTF-8')] = '\mathbf{u}';
  $grk[mb_substr("v",0,1,'UTF-8')] = '\mathbf{v}';
  $grk[mb_substr("e",0,1,'UTF-8')] = '\mathrm{e}';
  $grk[mb_substr("d",0,1,'UTF-8')] = '\mathrm{d}';
  $grk[mb_substr("n",0,1,'UTF-8')] = '\mathrm{n}';
  $grk[mb_substr("m",0,1,'UTF-8')] = '\mathrm{m}';
  $grk[mb_substr("i",0,1,'UTF-8')] = '\mathrm{i}';
  $grk[mb_substr("j",0,1,'UTF-8')] = '\mathrm{j}';
  $grk[mb_substr("k",0,1,'UTF-8')] = '\kappa ';
  $grk[mb_substr("x",0,1,'UTF-8')] = 'x';
  $grk[mb_substr("y",0,1,'UTF-8')] = 'y';
  $grk[mb_substr("z",0,1,'UTF-8')] = 'z';
  $grk[mb_substr("t",0,1,'UTF-8')] = 't';

  $grk[mb_substr("α",0,1,'UTF-8')] = '\alpha ';
  $grk[mb_substr("β",0,1,'UTF-8')] = '\beta ';
  $grk[mb_substr("γ",0,1,'UTF-8')] = '\gamma ';
  $grk[mb_substr("δ",0,1,'UTF-8')] = '\delta ';
  $grk[mb_substr("ε",0,1,'UTF-8')] = '\epsilon ';
  $grk[mb_substr("ζ",0,1,'UTF-8')] = '\zeta ';
  $grk[mb_substr("η",0,1,'UTF-8')] = '\eta ';
  $grk[mb_substr("θ",0,1,'UTF-8')] = '\theta ';
  $grk[mb_substr("ι",0,1,'UTF-8')] = '\iota ';
  $grk[mb_substr("κ",0,1,'UTF-8')] = '\kappa ';
  $grk[mb_substr("λ",0,1,'UTF-8')] = '\lambda ';
  $grk[mb_substr("μ",0,1,'UTF-8')] = '\mu ';
  $grk[mb_substr("ν",0,1,'UTF-8')] = '\nu ';
  $grk[mb_substr("ξ",0,1,'UTF-8')] = '\xi ';
  $grk[mb_substr("π",0,1,'UTF-8')] = '\pi ';
  $grk[mb_substr("ρ",0,1,'UTF-8')] = '\rho ';
  $grk[mb_substr('ο',0,1,'UTF-8')] = 'o ';      // ?
  $grk[mb_substr("σ",0,1,'UTF-8')] = '\sigma ';
  $grk[mb_substr("τ",0,1,'UTF-8')] = '\tau ';
  $grk[mb_substr("υ",0,1,'UTF-8')] = '\upsilon ';
  $grk[mb_substr("φ",0,1,'UTF-8')] = '\phi ';
  $grk[mb_substr("χ",0,1,'UTF-8')] = '\chi ';
  $grk[mb_substr('ψ',0,1,'UTF-8')] = '\psi ';
  $grk[mb_substr("ω",0,1,'UTF-8')] = '\omega ';
  $grk[mb_substr("Β",0,1,'UTF-8')] = '\Beta ';
  $grk[mb_substr("Γ",0,1,'UTF-8')] = '\Gamma ';
  $grk[mb_substr("⊿",0,1,'UTF-8')] = '\Delta ';
  $grk[mb_substr("Δ",0,1,'UTF-8')] = '\Delta ';
  $grk[mb_substr("Ξ",0,1,'UTF-8')] = '\Xi ';
  $grk[mb_substr("Θ",0,1,'UTF-8')] = '\Theta ';
  $grk[mb_substr("Λ",0,1,'UTF-8')] = '\Lambda ';
  $grk[mb_substr('Ψ',0,1,'UTF-8')] = '\Psi ';
  $grk[mb_substr("Φ",0,1,'UTF-8')] = '\Phi ';
  $grk[mb_substr("Ω",0,1,'UTF-8')] = '\Omega ';

  $grk[mb_substr('Σ',0,1,'UTF-8')] = '\sum ';
  $grk[mb_substr("Π",0,1,'UTF-8')] = '\prod ';

  $grk[mb_substr("∞",0,1,'UTF-8')] = '\infty ';
  $grk[mb_substr("∇",0,1,'UTF-8')] = '\nabla ';
  //$grk[mb_substr("□",0,1,'UTF-8')] = '\Box ';       // mimeTeX のバグ
  $grk[mb_substr("△",0,1,'UTF-8')] = '\triangle ';
  $grk[mb_substr("・",0,1,'UTF-8')] = '\cdot ';
  $grk[mb_substr("。",0,1,'UTF-8')] = '\circ ';
  $grk[mb_substr("田",0,1,'UTF-8')] = '\otimes ';
  $grk[mb_substr('×',0,1,'UTF-8')] = '\times ';
  $grk[mb_substr('÷',0,1,'UTF-8')] = '\div ';
  $grk[mb_substr("√",0,1,'UTF-8')] = '\sqrt ';
  $grk[mb_substr("±",0,1,'UTF-8')] = '\pm ';
  $grk[mb_substr("=",0,1,'UTF-8')] = '=';
  $grk[mb_substr("≒",0,1,'UTF-8')] = '\simeq ';
  $grk[mb_substr("≡",0,1,'UTF-8')] = '\equiv ';
  $grk[mb_substr("≠",0,1,'UTF-8')] = '\neq ';
  $grk[mb_substr("≦",0,1,'UTF-8')] = '\leq ';
  $grk[mb_substr("≧",0,1,'UTF-8')] = '\geq ';
  $grk[mb_substr("~",0,1,'UTF-8')] = '\sim ';
  $grk[mb_substr('∫',0,1,'UTF-8')] = '{\int}';
  $grk[mb_substr('∮',0,1,'UTF-8')] = '\oint ';
  $grk[mb_substr('∬',0,1,'UTF-8')] = '\iint ';
  $grk[mb_substr('∂',0,1,'UTF-8')] = '\partial ';  
  $grk[mb_substr("∴",0,1,'UTF-8')] = '\therefore ';
  $grk[mb_substr('∀',0,1,'UTF-8')] = '\forall ';
  $grk[mb_substr('∃',0,1,'UTF-8')] = '\exists ';
  $grk[mb_substr('∩',0,1,'UTF-8')] = '\cap ';
  $grk[mb_substr('∪',0,1,'UTF-8')] = '\cup ';
  $grk[mb_substr('⊂',0,1,'UTF-8')] = '\subset ';
  $grk[mb_substr('⊃',0,1,'UTF-8')] = '\supset ';
  $grk[mb_substr('∈',0,1,'UTF-8')] = '\in ';
  $grk[mb_substr('∉', 0,1,'UTF-8')] = '\notin ';
  $grk[mb_substr("†",0,1,'UTF-8')] = '\dagger ';
  $grk[mb_substr("↑",0,1,'UTF-8')] = '\uparrow ';
  $grk[mb_substr("↓",0,1,'UTF-8')] = '\downarrow ';
  $grk[mb_substr("→",0,1,'UTF-8')] = '\rightarrow ';
  $grk[mb_substr("←",0,1,'UTF-8')] = '\leftarrow ';
  $grk[mb_substr("|",0,1,'UTF-8')] = '\right| ';
  $grk[mb_substr('∨' ,0,1,'UTF-8')] = '\lor ';
  $grk[mb_substr('∧' ,0,1,'UTF-8')] = '\land ';

  $grk[mb_substr('[',0,1,'UTF-8')] = "[";
  $grk[mb_substr(']',0,1,'UTF-8')] = "]";
  $grk[mb_substr(";" ,0,1,'UTF-8')] = "\\\\";      // newline
  $grk[mb_substr('/',0,1,'UTF-8')] = '\over ';
  $grk[mb_substr("’",0,1,'UTF-8')] = "'";
  $grk[mb_substr('”',0,1,'UTF-8')] = "''";
  $grk[mb_substr("{",0,1,'UTF-8')] = '\lbrace ';
  $grk[mb_substr("}",0,1,'UTF-8')] = '\rbrace ';
  $grk[mb_substr('"',0,1,'UTF-8')] = "''";
  $grk[mb_substr("~" ,0,1,'UTF-8')] = "\\vec ";
  $grk[mb_substr('<',0,1,'UTF-8')]  = "\\lt ";
  $grk[mb_substr('>',0,1,'UTF-8')]  = "\\gt ";
  $grk[mb_substr(' ',0,1,'UTF-8')] = '\, ';      // 1/3 space

// TeX 2byte変換Tbl
  $grk2[mb_substr('  ',0,2,'UTF-8')] = '\; ';   // 1 Space
  //$grk2[mb_substr("\\!",0,2,'UTF-8')] = ' ';      // -1/3 space
  $grk2[mb_substr('!∈',0,2,'UTF-8')] = '\notin ';
  $grk2[mb_substr("h’",0,2,'UTF-8')] = '\hbar ';
  $grk2[mb_substr("h'", 0,2,'UTF-8')] = '\hbar ';
  //$grk2[mb_substr("√[",0,2,'UTF-8')] = '\sqrt[';
  $grk2[mb_substr('\N',0,2,'UTF-8')] = '\mathbb{N}';
  $grk2[mb_substr('\Z',0,2,'UTF-8')] = '\mathbb{Z}';
  $grk2[mb_substr('\Q',0,2,'UTF-8')] = '\mathbb{Q}';
  $grk2[mb_substr('\R',0,2,'UTF-8')] = '\mathbb{R}';
  $grk2[mb_substr('\C',0,2,'UTF-8')] = '\mathbb{C}';
  $grk2[mb_substr('\L',0,2,'UTF-8')] = '\mathcal{L}';
  $grk2[mb_substr('\H',0,2,'UTF-8')] = '\mathcal{H}';
  $grk2[mb_substr('\X',0,2,'UTF-8')] = '\aleph ';
  $grk2[mb_substr("\l",0,2,'UTF-8')] = 'mathit{l}';      // ℓ
  $grk2[mb_substr("dx",0,2,'UTF-8')] = '\mathrm{dx}';
  $grk2[mb_substr("dy",0,2,'UTF-8')] = '\mathrm{dy}';
  $grk2[mb_substr("dz",0,2,'UTF-8')] = '\mathrm{dz}';
  $grk2[mb_substr("dt",0,2,'UTF-8')] = '\mathrm{dt}';
  $grk2[mb_substr('\<',0,2,'UTF-8')] = '\langle ';
  $grk2[mb_substr('\>',0,2,'UTF-8')] = '\rangle ';
  $grk2[mb_substr("==",0,2,'UTF-8')]  = '\equiv ';
  $grk2[mb_substr('<=',0,2,'UTF-8')] = "\\leq ";
  $grk2[mb_substr('>=',0,2,'UTF-8')] = "\\geq ";
  $grk2[mb_substr('!=',0,2,'UTF-8')] = '\neq';
  $grk2[mb_substr('<<',0,2,'UTF-8')] = "\\llt ";
  $grk2[mb_substr('>>',0,2,'UTF-8')] = "\\ggt ";
  $grk2[mb_substr("->",0,2,'UTF-8')] = '\rightarrow ';
  $grk2[mb_substr("=>",0,2,'UTF-8')] = '\Longrightarrow ';
  $grk2[mb_substr("<-",0,2,'UTF-8')] = '\leftarrow ';
  $grk2[mb_substr("<=",0,2,'UTF-8')] = '\Longlefttarrow ';
  $grk2[mb_substr("^*",0,2,'UTF-8')] = '^{*}';
  $grk2[mb_substr(" _",0,2,'UTF-8')] = '{}_';
  $grk2[mb_substr(" _",0,2,'UTF-8')] = '{}_';
  $grk2[mb_substr(" ^",0,2,'UTF-8')] = '{}^';
  $grk2[mb_substr(" ^",0,2,'UTF-8')] = '{}^';

  $grk3Tbl[mb_substr("\\h'",0,3,'UTF-8')] = '\hbar ';
  $grk3Tbl[mb_substr('(*)',0,3,'UTF-8')] = '\otimes ';
  $grk3Tbl[mb_substr("-->",0,3,'UTF-8')] = '\longrightarrow ';
  $grk3Tbl[mb_substr("<--",0,3,'UTF-8')] = '\longlefttarrow ';
  $grk3Tbl[mb_substr("<->",0,3,'UTF-8')] = '\longleftrightarrow ';
  $grk3Tbl[mb_substr("<=>",0,3,'UTF-8')] = '\Longleftrightarrow ';
  $grk3Tbl[mb_substr('...',0,3,'UTF-8')] = '\cdots ';
  $grk3Tbl[mb_substr('・・・',0,3,'UTF-8')] = '\cdots';