Kaydet (Commit) 0a6f6cb0 authored tarafından Noel Grandin's avatar Noel Grandin

fix indentation

Change-Id: Icd67d066eb72b951f3e4846d45d00e7863a6000e
üst a28e7f7a
...@@ -63,321 +63,321 @@ static bool eq_sentence(MzString& outs, istream *strm, const char *end = 0); ...@@ -63,321 +63,321 @@ static bool eq_sentence(MzString& outs, istream *strm, const char *end = 0);
struct hwpeq { struct hwpeq {
const char *key; // hwp math keyword const char *key; // hwp math keyword
const char *latex; // corresponding latex keywork const char *latex; // corresponding latex keywork
int nargs; // # of argument int nargs; // # of argument
unsigned char flag; // case sensitive? unsigned char flag; // case sensitive?
}; };
static const hwpeq eq_tbl[] = { static const hwpeq eq_tbl[] = {
{ "!=", "\\equiv ", 0, 0 }, { "!=", "\\equiv ", 0, 0 },
{ "#", "\\\\", 0, 0 }, { "#", "\\\\", 0, 0 },
{ "+-", "\\pm ", 0, 0 }, { "+-", "\\pm ", 0, 0 },
{ "-+", "\\mp ", 0, 0 }, { "-+", "\\mp ", 0, 0 },
{ "<=", "\\leq ", 0, 0 }, { "<=", "\\leq ", 0, 0 },
{ "==", "\\equiv ", 0, 0 }, { "==", "\\equiv ", 0, 0 },
{ ">=", "\\geq ", 0, 0 }, { ">=", "\\geq ", 0, 0 },
{ "Pr", NULL, 0, 0 }, { "Pr", NULL, 0, 0 },
{ "^", "^", 1, 0 }, { "^", "^", 1, 0 },
{ "_", "_", 1, 0 }, { "_", "_", 1, 0 },
{ "`", "\\;", 0, 0 }, { "`", "\\;", 0, 0 },
{ "acute", NULL, 1, 0 }, { "acute", NULL, 1, 0 },
{ "aleph", NULL, 0, 0 }, { "aleph", NULL, 0, 0 },
{ "alpha", NULL, 0, EQ_CASE }, { "alpha", NULL, 0, EQ_CASE },
{ "amalg", NULL, 0, 0 }, { "amalg", NULL, 0, 0 },
{ "and", NULL, 0, 0 }, { "and", NULL, 0, 0 },
{ "angle", NULL, 0, 0 }, { "angle", NULL, 0, 0 },
{ "angstrom", NULL, 0, 0 }, { "angstrom", NULL, 0, 0 },
{ "approx", NULL, 0, 0 }, { "approx", NULL, 0, 0 },
{ "arc", NULL, 0, 0 }, { "arc", NULL, 0, 0 },
{ "arccos", NULL, 0, 0 }, { "arccos", NULL, 0, 0 },
{ "arch", NULL, 0, 0 }, { "arch", NULL, 0, 0 },
{ "arcsin", NULL, 0, 0 }, { "arcsin", NULL, 0, 0 },
{ "arctan", NULL, 0, 0 }, { "arctan", NULL, 0, 0 },
{ "arg", NULL, 0, 0 }, { "arg", NULL, 0, 0 },
{ "assert", "\\vdash", 0, 0 }, { "assert", "\\vdash", 0, 0 },
{ "ast", NULL, 0, 0 }, { "ast", NULL, 0, 0 },
{ "asymp", NULL, 0, 0 }, { "asymp", NULL, 0, 0 },
{ "atop", NULL, 1, EQ_ATOP }, { "atop", NULL, 1, EQ_ATOP },
{ "backslash", NULL, 0, 0 }, { "backslash", NULL, 0, 0 },
{ "bar", NULL, 1, 0 }, { "bar", NULL, 1, 0 },
{ "because", NULL, 0, 0 }, { "because", NULL, 0, 0 },
{ "beta", NULL, 0, EQ_CASE }, { "beta", NULL, 0, EQ_CASE },
{ "big", NULL, 0, EQ_CASE }, { "big", NULL, 0, EQ_CASE },
{ "bigcap", NULL, 0, 0 }, { "bigcap", NULL, 0, 0 },
{ "bigcirc", NULL, 0, 0 }, { "bigcirc", NULL, 0, 0 },
{ "bigcup", NULL, 0, 0 }, { "bigcup", NULL, 0, 0 },
{ "bigg", NULL, 0, EQ_CASE }, { "bigg", NULL, 0, EQ_CASE },
{ "bigodiv", NULL, 0, 0 }, { "bigodiv", NULL, 0, 0 },
{ "bigodot", NULL, 0, 0 }, { "bigodot", NULL, 0, 0 },
{ "bigominus", NULL, 0, 0 }, { "bigominus", NULL, 0, 0 },
{ "bigoplus", NULL, 0, 0 }, { "bigoplus", NULL, 0, 0 },
{ "bigotimes", NULL, 0, 0 }, { "bigotimes", NULL, 0, 0 },
{ "bigsqcap", NULL, 0, 0 }, { "bigsqcap", NULL, 0, 0 },
{ "bigsqcup", NULL, 0, 0 }, { "bigsqcup", NULL, 0, 0 },
{ "biguplus", NULL, 0, 0 }, { "biguplus", NULL, 0, 0 },
{ "bigvee", NULL, 0, 0 }, { "bigvee", NULL, 0, 0 },
{ "bigwedge", NULL, 0, 0 }, { "bigwedge", NULL, 0, 0 },
{ "binom", NULL, 2, 0 }, { "binom", NULL, 2, 0 },
{ "bmatrix", NULL, 0, EQ_ENV }, { "bmatrix", NULL, 0, EQ_ENV },
{ "bold", NULL, 0, 0 }, { "bold", NULL, 0, 0 },
{ "bot", NULL, 0, 0 }, { "bot", NULL, 0, 0 },
{ "breve", NULL, 1, 0 }, { "breve", NULL, 1, 0 },
{ "buildrel", NULL, 0, 0 }, // LATER { "buildrel", NULL, 0, 0 }, // LATER
{ "bullet", NULL, 0, 0 }, { "bullet", NULL, 0, 0 },
{ "cap", NULL, 0, 0 }, { "cap", NULL, 0, 0 },
{ "cases", NULL, 0, EQ_ENV }, { "cases", NULL, 0, EQ_ENV },
{ "ccol", NULL, 0, 0 }, /* 세로로 가운데 */ { "ccol", NULL, 0, 0 }, /* 세로로 가운데 */
{ "cdot", NULL, 0, 0 }, { "cdot", NULL, 0, 0 },
{ "cdots", NULL, 0, 0 }, { "cdots", NULL, 0, 0 },
{ "check", NULL, 1, 0 }, { "check", NULL, 1, 0 },
{ "chi", NULL, 0, EQ_CASE }, { "chi", NULL, 0, EQ_CASE },
{ "choose", NULL, 0, EQ_ATOP }, { "choose", NULL, 0, EQ_ATOP },
{ "circ", NULL, 0, 0 }, { "circ", NULL, 0, 0 },
{ "col", NULL, 0, 0 }, // LATER { "col", NULL, 0, 0 }, // LATER
{ "cong", NULL, 0, 0 }, { "cong", NULL, 0, 0 },
{ "coprod", NULL, 0, 0 }, { "coprod", NULL, 0, 0 },
{ "cos", NULL, 0, 0 }, { "cos", NULL, 0, 0 },
{ "cosec", NULL, 0, 0 }, { "cosec", NULL, 0, 0 },
{ "cosh", NULL, 0, 0 }, { "cosh", NULL, 0, 0 },
{ "cot", NULL, 0, 0 }, { "cot", NULL, 0, 0 },
{ "coth", NULL, 0, 0 }, { "coth", NULL, 0, 0 },
{ "cpile", NULL, 0, 0 }, // LATER { "cpile", NULL, 0, 0 }, // LATER
{ "csc", NULL, 0, 0 }, { "csc", NULL, 0, 0 },
{ "cup", NULL, 0, 0 }, { "cup", NULL, 0, 0 },
{ "dagger", NULL, 0, 0 }, { "dagger", NULL, 0, 0 },
{ "dashv", NULL, 0, 0 }, { "dashv", NULL, 0, 0 },
{ "ddagger", NULL, 0, 0 }, { "ddagger", NULL, 0, 0 },
{ "ddot", NULL, 1, 0 }, { "ddot", NULL, 1, 0 },
{ "ddots", NULL, 0, 0 }, { "ddots", NULL, 0, 0 },
{ "def", NULL, 0, 0 }, { "def", NULL, 0, 0 },
{ "deg", NULL, 0, 0 }, { "deg", NULL, 0, 0 },
{ "del", NULL, 0, 0 }, { "del", NULL, 0, 0 },
{ "delta", NULL, 0, EQ_CASE }, { "delta", NULL, 0, EQ_CASE },
{ "diamond", NULL, 0, 0 }, { "diamond", NULL, 0, 0 },
{ "dim", NULL, 0, 0 }, { "dim", NULL, 0, 0 },
{ "div", NULL, 0, 0 }, { "div", NULL, 0, 0 },
{ "divide", NULL, 0, 0 }, { "divide", NULL, 0, 0 },
{ "dline", NULL, 0, 0 }, { "dline", NULL, 0, 0 },
{ "dmatrix", NULL, 0, EQ_ENV }, { "dmatrix", NULL, 0, EQ_ENV },
{ "dot", NULL, 1, 0 }, { "dot", NULL, 1, 0 },
{ "doteq", NULL, 0, 0 }, { "doteq", NULL, 0, 0 },
{ "dotsaxis", NULL, 0, 0 }, { "dotsaxis", NULL, 0, 0 },
{ "dotsdiag", NULL, 0, 0 }, { "dotsdiag", NULL, 0, 0 },
{ "dotslow", "\\ldots", 0, 0 }, { "dotslow", "\\ldots", 0, 0 },
{ "dotsvert", "\\vdots", 0, 0 }, { "dotsvert", "\\vdots", 0, 0 },
{ "downarrow", NULL, 0, EQ_CASE }, { "downarrow", NULL, 0, EQ_CASE },
{ "dsum", "+", 0, 0 }, { "dsum", "+", 0, 0 },
{ "dyad", NULL, 0, 0 }, // LATER { "dyad", NULL, 0, 0 }, // LATER
{ "ell", NULL, 0, 0 }, { "ell", NULL, 0, 0 },
{ "emptyset", NULL, 0, 0 }, { "emptyset", NULL, 0, 0 },
{ "epsilon", NULL, 0, EQ_CASE }, { "epsilon", NULL, 0, EQ_CASE },
{ "eqalign", NULL, 0, EQ_ENV }, { "eqalign", NULL, 0, EQ_ENV },
{ "equiv", NULL, 0, 0 }, { "equiv", NULL, 0, 0 },
{ "eta", NULL, 0, EQ_CASE }, { "eta", NULL, 0, EQ_CASE },
{ "exarrow", NULL, 0, 0 }, { "exarrow", NULL, 0, 0 },
{ "exist", "\\exists", 0, 0 }, { "exist", "\\exists", 0, 0 },
{ "exists", NULL, 0, 0 }, { "exists", NULL, 0, 0 },
{ "exp", NULL, 0, EQ_CASE }, { "exp", NULL, 0, EQ_CASE },
{ "for", NULL, 0, 0 }, { "for", NULL, 0, 0 },
{ "forall", NULL, 0, 0 }, { "forall", NULL, 0, 0 },
{ "from", "_", 1, 0 }, { "from", "_", 1, 0 },
{ "gamma", NULL, 0, EQ_CASE }, { "gamma", NULL, 0, EQ_CASE },
{ "gcd", NULL, 0, 0 }, { "gcd", NULL, 0, 0 },
{ "ge", "\\geq", 0, 0 }, { "ge", "\\geq", 0, 0 },
{ "geq", NULL, 0, 0 }, { "geq", NULL, 0, 0 },
{ "ggg", NULL, 0, 0 }, { "ggg", NULL, 0, 0 },
{ "grad", NULL, 0, 0 }, { "grad", NULL, 0, 0 },
{ "grave", NULL, 1, 0 }, { "grave", NULL, 1, 0 },
{ "hat", "\\widehat", 1, 0 }, { "hat", "\\widehat", 1, 0 },
{ "hbar", NULL, 0, 0 }, { "hbar", NULL, 0, 0 },
{ "hom", NULL, 0, 0 }, { "hom", NULL, 0, 0 },
{ "hookleft", NULL, 0, 0 }, { "hookleft", NULL, 0, 0 },
{ "hookright", NULL, 0, 0 }, { "hookright", NULL, 0, 0 },
{ "identical", NULL, 0, 0 }, // LATER { "identical", NULL, 0, 0 }, // LATER
{ "if", NULL, 0, 0 }, { "if", NULL, 0, 0 },
{ "imag", NULL, 0, 0 }, { "imag", NULL, 0, 0 },
{ "image", NULL, 0, 0 }, { "image", NULL, 0, 0 },
{ "imath", NULL, 0, 0 }, { "imath", NULL, 0, 0 },
{ "in", NULL, 0, 0 }, { "in", NULL, 0, 0 },
{ "inf", "\\infty", 0, 0 }, { "inf", "\\infty", 0, 0 },
{ "infinity", "\\infty", 0, 0 }, { "infinity", "\\infty", 0, 0 },
{ "infty", NULL, 0, 0 }, { "infty", NULL, 0, 0 },
{ "int", NULL, 0, 0 }, { "int", NULL, 0, 0 },
{ "integral", "\\int", 0, 0 }, { "integral", "\\int", 0, 0 },
{ "inter", "\\bigcap", 0, 0 }, { "inter", "\\bigcap", 0, 0 },
{ "iota", NULL, 0, EQ_CASE }, { "iota", NULL, 0, EQ_CASE },
{ "iso", NULL, 0, 0 }, // ams { "iso", NULL, 0, 0 }, // ams
{ "it", NULL, 0, 0 }, { "it", NULL, 0, 0 },
{ "jmath", NULL, 0, 0 }, { "jmath", NULL, 0, 0 },
{ "kappa", NULL, 0, EQ_CASE }, { "kappa", NULL, 0, EQ_CASE },
{ "ker", NULL, 0, 0 }, { "ker", NULL, 0, 0 },
{ "lambda", NULL, 0, EQ_CASE }, { "lambda", NULL, 0, EQ_CASE },
{ "land", NULL, 0, 0 }, // LATER { "land", NULL, 0, 0 }, // LATER
{ "langle", NULL, 0, 0 }, { "langle", NULL, 0, 0 },
{ "larrow", "\\leftarrow", 0, EQ_CASE }, { "larrow", "\\leftarrow", 0, EQ_CASE },
{ "lbrace", NULL, 0, 0 }, { "lbrace", NULL, 0, 0 },
{ "lbrack", "[", 0, 0 }, { "lbrack", "[", 0, 0 },
{ "lceil", NULL, 0, 0 }, { "lceil", NULL, 0, 0 },
{ "lcol", NULL, 0, 0 }, // LATER { "lcol", NULL, 0, 0 }, // LATER
{ "ldots", NULL, 0, 0 }, { "ldots", NULL, 0, 0 },
{ "le", NULL, 0, 0 }, { "le", NULL, 0, 0 },
{ "left", NULL, 0, 0 }, { "left", NULL, 0, 0 },
{ "leftarrow", NULL, 0, EQ_CASE }, { "leftarrow", NULL, 0, EQ_CASE },
{ "leq", NULL, 0, 0 }, { "leq", NULL, 0, 0 },
{ "lfloor", NULL, 0, 0 }, { "lfloor", NULL, 0, 0 },
{ "lg", NULL, 0, 0 }, { "lg", NULL, 0, 0 },
{ "lim", NULL, 0, EQ_CASE }, { "lim", NULL, 0, EQ_CASE },
{ "line", "\\vert", 0, 0 }, { "line", "\\vert", 0, 0 },
{ "liter", "\\ell", 0, 0 }, { "liter", "\\ell", 0, 0 },
{ "lll", NULL, 0, 0 }, // ams { "lll", NULL, 0, 0 }, // ams
{ "ln", NULL, 0, 0 }, { "ln", NULL, 0, 0 },
{ "log", NULL, 0, 0 }, { "log", NULL, 0, 0 },
{ "lor", "\\vee", 0, 0 }, { "lor", "\\vee", 0, 0 },
{ "lparen", "(", 0, 0 }, { "lparen", "(", 0, 0 },
{ "lpile", NULL, 0, 0 }, // LATER { "lpile", NULL, 0, 0 }, // LATER
{ "lrarrow", "\\leftrightarrow", 0, EQ_CASE }, { "lrarrow", "\\leftrightarrow", 0, EQ_CASE },
{ "lrharpoons", "\\leftrightharpoons",0, 0 }, { "lrharpoons", "\\leftrightharpoons",0, 0 },
{ "mapsto", NULL, 0, 0 }, { "mapsto", NULL, 0, 0 },
{ "massert", "\\dashv", 0, 0 }, { "massert", "\\dashv", 0, 0 },
{ "matrix", NULL, 0, EQ_ENV }, { "matrix", NULL, 0, EQ_ENV },
{ "max", NULL, 0, 0 }, { "max", NULL, 0, 0 },
{ "mho", NULL, 0, 0 }, // ams { "mho", NULL, 0, 0 }, // ams
{ "min", NULL, 0, 0 }, { "min", NULL, 0, 0 },
{ "minusplus", NULL, 0, 0 }, { "minusplus", NULL, 0, 0 },
{ "mit", "", 0, 0 }, // font { "mit", "", 0, 0 }, // font
{ "mod", "\\bmod", 0, 0 }, { "mod", "\\bmod", 0, 0 },
{ "models", NULL, 0, 0 }, { "models", NULL, 0, 0 },
{ "msangle", NULL, 0, 0 }, // LATER { "msangle", NULL, 0, 0 }, // LATER
{ "mu", NULL, 0, EQ_CASE }, { "mu", NULL, 0, EQ_CASE },
{ "nabla", NULL, 0, 0 }, { "nabla", NULL, 0, 0 },
{ "ne", NULL, 0, 0 }, { "ne", NULL, 0, 0 },
{ "nearrow", NULL, 0, 0 }, { "nearrow", NULL, 0, 0 },
{ "neg", NULL, 0, 0 }, { "neg", NULL, 0, 0 },
{ "neq", NULL, 0, 0 }, { "neq", NULL, 0, 0 },
{ "nequiv", NULL, 0, 0 }, { "nequiv", NULL, 0, 0 },
{ "ni", NULL, 0, 0 }, { "ni", NULL, 0, 0 },
{ "not", NULL, 0, 0 }, { "not", NULL, 0, 0 },
{ "notin", NULL, 0, 0 }, { "notin", NULL, 0, 0 },
{ "nu", NULL, 0, EQ_CASE }, { "nu", NULL, 0, EQ_CASE },
{ "nwarrow", NULL, 0, 0 }, { "nwarrow", NULL, 0, 0 },
{ "odiv", NULL, 0, 0 }, { "odiv", NULL, 0, 0 },
{ "odot", NULL, 0, 0 }, { "odot", NULL, 0, 0 },
{ "oint", NULL, 0, 0 }, { "oint", NULL, 0, 0 },
{ "omega", NULL, 0, EQ_CASE }, { "omega", NULL, 0, EQ_CASE },
{ "omicron", NULL, 0, EQ_CASE }, { "omicron", NULL, 0, EQ_CASE },
{ "ominus", NULL, 0, 0 }, { "ominus", NULL, 0, 0 },
{ "oplus", NULL, 0, 0 }, { "oplus", NULL, 0, 0 },
{ "or ", NULL, 0, 0 }, { "or ", NULL, 0, 0 },
{ "oslash", NULL, 0, 0 }, { "oslash", NULL, 0, 0 },
{ "otimes", NULL, 0, 0 }, { "otimes", NULL, 0, 0 },
{ "over", NULL, 1, EQ_ATOP }, { "over", NULL, 1, EQ_ATOP },
{ "overline", NULL, 1, 0 }, { "overline", NULL, 1, 0 },
{ "owns", "\\ni", 0, 0 }, { "owns", "\\ni", 0, 0 },
{ "parallel", NULL, 0, 0 }, { "parallel", NULL, 0, 0 },
{ "partial", NULL, 0, 0 }, { "partial", NULL, 0, 0 },
{ "phantom", NULL, 0, 0 }, { "phantom", NULL, 0, 0 },
{ "phi", NULL, 0, EQ_CASE }, { "phi", NULL, 0, EQ_CASE },
{ "pi", NULL, 0, EQ_CASE }, { "pi", NULL, 0, EQ_CASE },
{ "pile", NULL, 0, 0 }, // LATER { "pile", NULL, 0, 0 }, // LATER
{ "plusminus", "\\pm", 0, 0 }, { "plusminus", "\\pm", 0, 0 },
{ "pmatrix", NULL, 0, EQ_ENV }, { "pmatrix", NULL, 0, EQ_ENV },
{ "prec", NULL, 0, 0 }, { "prec", NULL, 0, 0 },
{ "prep", NULL, 0, 0 }, { "prep", NULL, 0, 0 },
{ "prime", NULL, 0, 0 }, { "prime", NULL, 0, 0 },
{ "prod", NULL, 0, 0 }, { "prod", NULL, 0, 0 },
{ "propto", NULL, 0, 0 }, { "propto", NULL, 0, 0 },
{ "psi", NULL, 0, EQ_CASE }, { "psi", NULL, 0, EQ_CASE },
{ "rangle", NULL, 0, 0 }, { "rangle", NULL, 0, 0 },
{ "rarrow", "\\rightarrow", 0, EQ_CASE }, { "rarrow", "\\rightarrow", 0, EQ_CASE },
{ "rbrace", "]", 0, 0 }, { "rbrace", "]", 0, 0 },
{ "rbrace", NULL, 0, 0 }, { "rbrace", NULL, 0, 0 },
{ "rceil", NULL, 0, 0 }, { "rceil", NULL, 0, 0 },
{ "rcol", NULL, 0, 0 }, // LATER { "rcol", NULL, 0, 0 }, // LATER
{ "real", "\\Re", 0, 0 }, { "real", "\\Re", 0, 0 },
{ "reimage", NULL, 0, 0 }, { "reimage", NULL, 0, 0 },
{ "rel", NULL, 0, 0 }, { "rel", NULL, 0, 0 },
{ "rfloor", NULL, 0, 0 }, { "rfloor", NULL, 0, 0 },
{ "rho", NULL, 0, EQ_CASE }, { "rho", NULL, 0, EQ_CASE },
{ "right", NULL, 0, 0 }, { "right", NULL, 0, 0 },
{ "rightarrow", NULL, 0, EQ_CASE }, { "rightarrow", NULL, 0, EQ_CASE },
{ "rlharpoons", NULL, 0, 0 }, { "rlharpoons", NULL, 0, 0 },
{ "rm", NULL, 0, 0 }, { "rm", NULL, 0, 0 },
{ "root", "\\sqrt", 1, 0 }, { "root", "\\sqrt", 1, 0 },
{ "rparen", ")", 0, 0 }, { "rparen", ")", 0, 0 },
{ "rpile", NULL, 0, 0 }, // LATER { "rpile", NULL, 0, 0 }, // LATER
{ "rtangle", NULL, 0, 0 }, { "rtangle", NULL, 0, 0 },
{ "sangle", NULL, 0, 0 }, { "sangle", NULL, 0, 0 },
{ "scale", NULL, 0, 0 }, { "scale", NULL, 0, 0 },
{ "searrow", NULL, 0, 0 }, { "searrow", NULL, 0, 0 },
{ "sec", NULL, 0, 0 }, { "sec", NULL, 0, 0 },
{ "sigma", NULL, 0, EQ_CASE }, { "sigma", NULL, 0, EQ_CASE },
{ "sim", NULL, 0, 0 }, { "sim", NULL, 0, 0 },
{ "simeq", NULL, 0, 0 }, { "simeq", NULL, 0, 0 },
{ "sin", NULL, 0, 0 }, { "sin", NULL, 0, 0 },
{ "sinh", NULL, 0, 0 }, { "sinh", NULL, 0, 0 },
{ "slash", NULL, 0, 0 }, { "slash", NULL, 0, 0 },
{ "smallint", NULL, 0, 0 }, { "smallint", NULL, 0, 0 },
{ "smallinter", NULL, 0, 0 }, { "smallinter", NULL, 0, 0 },
{ "smalloint", NULL, 0, 0 }, { "smalloint", NULL, 0, 0 },
{ "smallprod", NULL, 0, 0 }, { "smallprod", NULL, 0, 0 },
{ "smallsum", NULL, 0, 0 }, { "smallsum", NULL, 0, 0 },
{ "smallunion", NULL, 0, 0 }, { "smallunion", NULL, 0, 0 },
{ "smcoprod", NULL, 0, 0 }, { "smcoprod", NULL, 0, 0 },
{ "sqcap", NULL, 0, 0 }, { "sqcap", NULL, 0, 0 },
{ "sqcup", NULL, 0, 0 }, { "sqcup", NULL, 0, 0 },
{ "sqrt", NULL, 1, 0 }, { "sqrt", NULL, 1, 0 },
{ "sqsubset", NULL, 0, 0 }, { "sqsubset", NULL, 0, 0 },
{ "sqsubseteq", NULL, 0, 0 }, { "sqsubseteq", NULL, 0, 0 },
{ "sqsupset", NULL, 0, 0 }, { "sqsupset", NULL, 0, 0 },
{ "sqsupseteq", NULL, 0, 0 }, { "sqsupseteq", NULL, 0, 0 },
{ "star", NULL, 0, 0 }, { "star", NULL, 0, 0 },
{ "sub", "_", 0, 0 }, { "sub", "_", 0, 0 },
{ "subset", NULL, 0, 0 }, { "subset", NULL, 0, 0 },
{ "subseteq", NULL, 0, 0 }, { "subseteq", NULL, 0, 0 },
{ "succ", NULL, 0, 0 }, { "succ", NULL, 0, 0 },
{ "sum", NULL, 0, 0 }, { "sum", NULL, 0, 0 },
{ "sup", "^", 0, 0 }, { "sup", "^", 0, 0 },
{ "superset", NULL, 0, 0 }, { "superset", NULL, 0, 0 },
{ "supset", NULL, 0, 0 }, { "supset", NULL, 0, 0 },
{ "supseteq", NULL, 0, 0 }, { "supseteq", NULL, 0, 0 },
{ "swarrow", NULL, 0, 0 }, { "swarrow", NULL, 0, 0 },
{ "tan", NULL, 0, 0 }, { "tan", NULL, 0, 0 },
{ "tanh", NULL, 0, 0 }, { "tanh", NULL, 0, 0 },
{ "tau", NULL, 0, EQ_CASE }, { "tau", NULL, 0, EQ_CASE },
{ "therefore", NULL, 0, 0 }, { "therefore", NULL, 0, 0 },
{ "theta", NULL, 0, EQ_CASE }, { "theta", NULL, 0, EQ_CASE },
{ "tilde", "\\widetilde", 1, 0 }, { "tilde", "\\widetilde", 1, 0 },
{ "times", NULL, 0, 0 }, { "times", NULL, 0, 0 },
{ "to", "^", 1, 0 }, { "to", "^", 1, 0 },
{ "top", NULL, 0, 0 }, { "top", NULL, 0, 0 },
{ "triangle", NULL, 0, 0 }, { "triangle", NULL, 0, 0 },
{ "triangled", NULL, 0, 0 }, { "triangled", NULL, 0, 0 },
{ "trianglel", NULL, 0, 0 }, { "trianglel", NULL, 0, 0 },
{ "triangler", NULL, 0, 0 }, { "triangler", NULL, 0, 0 },
{ "triangleu", NULL, 0, 0 }, { "triangleu", NULL, 0, 0 },
{ "udarrow", "\\updownarrow",0, EQ_CASE }, { "udarrow", "\\updownarrow",0, EQ_CASE },
{ "under", "\\underline", 1, 0 }, { "under", "\\underline", 1, 0 },
{ "underline", "\\underline", 1, 0 }, { "underline", "\\underline", 1, 0 },
{ "union", "\\bigcup", 0, 0 }, { "union", "\\bigcup", 0, 0 },
{ "uparrow", NULL, 0, EQ_CASE }, { "uparrow", NULL, 0, EQ_CASE },
{ "uplus", NULL, 0, 0 }, { "uplus", NULL, 0, 0 },
{ "upsilon", NULL, 0, EQ_CASE }, { "upsilon", NULL, 0, EQ_CASE },
{ "varepsilon", NULL, 0, 0 }, { "varepsilon", NULL, 0, 0 },
{ "varphi", NULL, 0, 0 }, { "varphi", NULL, 0, 0 },
{ "varpi", NULL, 0, 0 }, { "varpi", NULL, 0, 0 },
{ "varrho", NULL, 0, 0 }, { "varrho", NULL, 0, 0 },
{ "varsigma", NULL, 0, 0 }, { "varsigma", NULL, 0, 0 },
{ "vartheta", NULL, 0, 0 }, { "vartheta", NULL, 0, 0 },
{ "varupsilon", NULL, 0, 0 }, { "varupsilon", NULL, 0, 0 },
{ "vdash", NULL, 0, 0 }, { "vdash", NULL, 0, 0 },
{ "vdots", NULL, 0, 0 }, { "vdots", NULL, 0, 0 },
{ "vec", NULL, 1, 0 }, { "vec", NULL, 1, 0 },
{ "vee", NULL, 0, 0 }, { "vee", NULL, 0, 0 },
{ "vert", NULL, 0, 0 }, { "vert", NULL, 0, 0 },
{ "wedge", NULL, 0, 0 }, { "wedge", NULL, 0, 0 },
{ "wp", NULL, 0, 0 }, { "wp", NULL, 0, 0 },
{ "xi", NULL, 0, EQ_CASE }, { "xi", NULL, 0, EQ_CASE },
{ "xor", NULL, 0, 0 }, { "xor", NULL, 0, 0 },
{ "zeta", NULL, 0, EQ_CASE } { "zeta", NULL, 0, EQ_CASE }
}; };
static const hwpeq *lookup_eqn(char *str) static const hwpeq *lookup_eqn(char *str)
...@@ -420,15 +420,15 @@ void make_keyword( char *keyword, const char *token) ...@@ -420,15 +420,15 @@ void make_keyword( char *keyword, const char *token)
int capital = isupper(keyword[1]); int capital = isupper(keyword[1]);
for( ptr = keyword + 2; *ptr && result; ptr++ ) for( ptr = keyword + 2; *ptr && result; ptr++ )
if( (*ptr & 0x80) || if( (*ptr & 0x80) ||
(!capital && isupper(*ptr)) || (!capital && isupper(*ptr)) ||
(capital && islower(*ptr)) ) (capital && islower(*ptr)) )
result = false; result = false;
if( result ) { if( result ) {
ptr = keyword; ptr = keyword;
while( *ptr ) { while( *ptr ) {
if( isupper(*ptr) ) if( isupper(*ptr) )
*ptr = sal::static_int_cast<char>(tolower(*ptr)); *ptr = sal::static_int_cast<char>(tolower(*ptr));
ptr++; ptr++;
} }
} }
...@@ -597,33 +597,34 @@ static int eq_word(MzString& outs, istream *strm, int status) ...@@ -597,33 +597,34 @@ static int eq_word(MzString& outs, istream *strm, int status)
state << white << token; state << white << token;
make_keyword(keyword, token); make_keyword(keyword, token);
if( token[0] == '^' ) if( token[0] == '^' )
script_status |= SCRIPT_SUP; script_status |= SCRIPT_SUP;
else if( token[0] == '_' ) else if( token[0] == '_' )
script_status |= SCRIPT_SUB; script_status |= SCRIPT_SUB;
else else
script_status = SCRIPT_NONE; script_status = SCRIPT_NONE;
if( 0 != (eq = lookup_eqn(keyword)) ) { if( 0 != (eq = lookup_eqn(keyword)) ) {
int nargs = eq->nargs; int nargs = eq->nargs;
int ch; int ch;
while( nargs-- ) { while( nargs-- ) {
ch = read_white_space(state, strm); ch = read_white_space(state, strm);
if( ch != '{' ) state << '{'; if( ch != '{' ) state << '{';
eq_word(state, strm, script_status); eq_word(state, strm, script_status);
if( ch != '{' ) state << '}'; if( ch != '{' ) state << '}';
} }
} }
if( !next_token(white, token, strm) ) if( !next_token(white, token, strm) )
break; break;
// end loop and restart with this // end loop and restart with this
if( (token[0] == '^' && status && !(status & SCRIPT_SUP)) || if( (token[0] == '^' && status && !(status & SCRIPT_SUP)) ||
(token[0] == '_' && status && !(status & SCRIPT_SUB)) || (token[0] == '_' && status && !(status & SCRIPT_SUB)) ||
strcmp("over", token) == 0 || strcmp("atop", token) == 0 || strcmp("over", token) == 0 || strcmp("atop", token) == 0 ||
strchr("{}#&`", token[0]) || strchr("{}#&`", token[0]) ||
(!strchr("^_", token[0]) && white.length()) ) { (!strchr("^_", token[0]) && white.length()) )
push_token(white, token, strm); {
break; push_token(white, token, strm);
break;
} }
} }
} }
...@@ -651,7 +652,7 @@ static bool eq_sentence(MzString& outs, istream *strm, const char *end) ...@@ -651,7 +652,7 @@ static bool eq_sentence(MzString& outs, istream *strm, const char *end)
outs << '{' << state << '}'; outs << '{' << state << '}';
else { else {
if( !token.compare("#") ) if( !token.compare("#") )
multiline = true; multiline = true;
outs << state; outs << state;
} }
state = 0; state = 0;
...@@ -674,13 +675,13 @@ static char eq2ltxconv(MzString& sstr, istream *strm, const char *sentinel) ...@@ -674,13 +675,13 @@ static char eq2ltxconv(MzString& sstr, istream *strm, const char *sentinel)
make_keyword(key, token); make_keyword(key, token);
if( (eq = lookup_eqn(key)) != 0 ) { if( (eq = lookup_eqn(key)) != 0 ) {
if( eq->latex ) if( eq->latex )
strcpy(key, eq->latex); strcpy(key, eq->latex);
else { else {
key[0] = '\\'; key[0] = '\\';
strcpy(key + 1, eq->key); strcpy(key + 1, eq->key);
} }
if( (eq->flag & EQ_CASE) && isupper(token[0]) ) if( (eq->flag & EQ_CASE) && isupper(token[0]) )
key[1] = sal::static_int_cast<char>(toupper(key[1])); key[1] = sal::static_int_cast<char>(toupper(key[1]));
token = key; token = key;
} }
...@@ -691,29 +692,30 @@ static char eq2ltxconv(MzString& sstr, istream *strm, const char *sentinel) ...@@ -691,29 +692,30 @@ static char eq2ltxconv(MzString& sstr, istream *strm, const char *sentinel)
} }
else if( eq && (eq->flag & EQ_ENV) ) { else if( eq && (eq->flag & EQ_ENV) ) {
next_token(white, token, strm); next_token(white, token, strm);
if( token[0] != '{' ) return 0; if( token[0] != '{' )
return 0;
sstr << "\\begin" << "{" << eq->key << "}" << ENDL ; sstr << "\\begin" << "{" << eq->key << "}" << ENDL ;
eq2ltxconv(sstr, strm, "}"); eq2ltxconv(sstr, strm, "}");
if( sstr[sstr.length() - 1] != '\n' ) if( sstr[sstr.length() - 1] != '\n' )
sstr << ENDL ; sstr << ENDL ;
sstr << "\\end" << "{" << eq->key << "}" << ENDL ; sstr << "\\end" << "{" << eq->key << "}" << ENDL ;
} }
else if( eq && (eq->flag & EQ_ATOP) ) { else if( eq && (eq->flag & EQ_ATOP) ) {
if( sstr.length() == 0 ) if( sstr.length() == 0 )
sstr << '{'; sstr << '{';
else { else {
int pos = sstr.rfind('}'); int pos = sstr.rfind('}');
if( 0 < pos) if( 0 < pos)
sstr.replace(pos, ' '); sstr.replace(pos, ' ');
} }
sstr << token; sstr << token;
while( (ch = strm->get()) != EOF && IS_WS(ch) ) while( (ch = strm->get()) != EOF && IS_WS(ch) )
sstr << (char)ch; sstr << (char)ch;
if( ch != '{' ) if( ch != '{' )
sstr << "{}"; sstr << "{}";
else { else {
eq2ltxconv(sstr, strm, "}"); eq2ltxconv(sstr, strm, "}");
sstr << '}'; sstr << '}';
} }
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment