diff --git a/lib/LaTeXML/Engine/plain.pool.ltxml b/lib/LaTeXML/Engine/plain.pool.ltxml index 873627b31..2473d9aef 100644 --- a/lib/LaTeXML/Engine/plain.pool.ltxml +++ b/lib/LaTeXML/Engine/plain.pool.ltxml @@ -47,28 +47,20 @@ DefMacro('\brack', #====================================================================== # Special Characters. # Try to give them some sense in math... -DefMacroI('\#', undef, '\ifmmode\lx@math@hash\else\lx@text@hash\fi', protected => 1); -DefMacroI('\&', undef, '\ifmmode\lx@math@amp\else\lx@text@amp\fi', protected => 1); -DefMacroI('\%', undef, '\ifmmode\lx@math@percent\else\lx@text@percent\fi', protected => 1); -DefMacroI("\\\$", undef, '\ifmmode\lx@math@dollar\else\lx@text@dollar\fi', protected => 1); -DefMacroI('\_', undef, '\ifmmode\lx@math@underscore\else\lx@text@underscore\fi', protected => 1); -DefPrimitiveI('\lx@text@hash', undef, '#', alias => '\#'); -DefPrimitiveI('\lx@text@amp', undef, '&', alias => '\&'); -DefPrimitiveI('\lx@text@percent', undef, '%', alias => '\%'); -DefPrimitiveI('\lx@text@dollar', undef, "\$", alias => "\\\$"); -DefPrimitiveI('\lx@text@underscore', undef, '_', alias => '\_'); -DefMathI('\lx@math@hash', undef, '#', alias => '\#'); -DefMathI('\lx@math@amp', undef, '&', role => 'ADDOP', meaning => 'and', alias => '\&'); -DefMathI('\lx@math@percent', undef, '%', role => 'POSTFIX', meaning => 'percent', alias => '\%'); -DefMathI('\lx@math@dollar', undef, "\$", role => 'OPERATOR', meaning => 'currency-dollar', - alias => "\\\$"); -DefMathI('\lx@math@underscore', undef, '_', alias => '\_'); +DefPrimitive('\#', sub { + Box('#', undef, undef, T_CS('\#')); }); +DefPrimitive('\&', sub { + Box('&', undef, undef, T_CS('\&'), role => 'ADDOP', meaning => 'and'); }); +DefPrimitive('\%', sub { + Box('%', undef, undef, T_CS('\%'), role => 'POSTFIX', meaning => 'percent'); }); +DefPrimitive('\$', sub { + Box('$', undef, undef, T_CS('\$'), role => 'OPERATOR', meaning => 'currency-dollar'); }); +DefPrimitive('\_', sub { + Box('_', undef, undef, T_CS('\_')); }); # Discretionary times; just treat as invisible ? DefMathI('\*', undef, "\x{2062}", role => 'MULOP', name => '', meaning => 'times'); # INVISIBLE TIMES (or MULTIPLICATION SIGN = 00D7) -# These 3 should have some `name' assigned ... but what??? - #====================================================================== # If an XMWrap (presumably from \mathop, \mathbin, etc) # has multiple children, ALL are XMTok, within a restricted set of roles, diff --git a/lib/LaTeXML/Util/Unicode.pm b/lib/LaTeXML/Util/Unicode.pm index 90bc2ed76..dcb6122ca 100644 --- a/lib/LaTeXML/Util/Unicode.pm +++ b/lib/LaTeXML/Util/Unicode.pm @@ -340,27 +340,29 @@ our %math_props = ( "8" => { role => 'NUMBER', meaning => 8 }, "9" => { role => 'NUMBER', meaning => 9 }, #====================================================================== - '=' => { role => 'RELOP', meaning => 'equals' }, - '+' => { role => 'ADDOP', meaning => 'plus' }, - '-' => { role => 'ADDOP', meaning => 'minus' }, - '*' => { role => 'MULOP', meaning => 'times' }, - '/' => { role => 'MULOP', meaning => 'divide' }, - '!' => { role => 'POSTFIX', meaning => 'factorial' }, - ',' => { role => 'PUNCT' }, - '.' => { role => 'PERIOD' }, - ';' => { role => 'PUNCT' }, - ':' => { role => 'METARELOP', name => 'colon' }, # plausible default? - '|' => { role => 'VERTBAR', stretchy => 'false' }, - '<' => { role => 'RELOP', meaning => 'less-than' }, - '>' => { role => 'RELOP', meaning => 'greater-than' }, - '(' => { role => 'OPEN', stretchy => 'false' }, - ')' => { role => 'CLOSE', stretchy => 'false' }, - '[' => { role => 'OPEN', stretchy => 'false' }, - ']' => { role => 'CLOSE', stretchy => 'false' }, - '{' => { role => 'OPEN', stretchy => 'false' }, - '}' => { role => 'CLOSE', stretchy => 'false' }, - '&' => { role => 'ADDOP', meaning => 'and' }, -## ':' => { role => 'METARELOP' }, # \colon # Seems like good default role + '=' => { role => 'RELOP', meaning => 'equals' }, + '+' => { role => 'ADDOP', meaning => 'plus' }, + '-' => { role => 'ADDOP', meaning => 'minus' }, + '*' => { role => 'MULOP', meaning => 'times' }, + '/' => { role => 'MULOP', meaning => 'divide' }, + '!' => { role => 'POSTFIX', meaning => 'factorial' }, + ',' => { role => 'PUNCT' }, + '.' => { role => 'PERIOD' }, + ';' => { role => 'PUNCT' }, + ':' => { role => 'METARELOP', name => 'colon' }, # plausible default? + '|' => { role => 'VERTBAR', stretchy => 'false' }, + '<' => { role => 'RELOP', meaning => 'less-than' }, + '>' => { role => 'RELOP', meaning => 'greater-than' }, + '(' => { role => 'OPEN', stretchy => 'false' }, + ')' => { role => 'CLOSE', stretchy => 'false' }, + '[' => { role => 'OPEN', stretchy => 'false' }, + ']' => { role => 'CLOSE', stretchy => 'false' }, + '{' => { role => 'OPEN', stretchy => 'false' }, + '}' => { role => 'CLOSE', stretchy => 'false' }, + '&' => { role => 'ADDOP', meaning => 'and' }, + '&' => { role => 'ADDOP', meaning => 'and' }, + '%' => { role => 'POSTFIX', meaning => 'percent' }, + '$' => { role => 'OPERATOR', meaning => 'currency-dollar' }, #====================================================================== UTF(0x5C) => { role => 'ADDOP', meaning => 'set-minus' }, # \backslash