Diff for /loncom/interface/entities.pm between versions 1.7 and 1.13

version 1.7, 2008/04/15 10:10:10 version 1.13, 2008/11/17 13:52:39
Line 25 Line 25
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
 #  #
 package Apache::entities;  
 use strict;  
 #  
 #   This file contains a table driven entity-->latex converter.  
 #  
 #  Assumptions:  
 #   The number of entities in a resource is small compared with the  
 #   number of possible entities that might be translated.  
 #   Therefore the strategy is to match a general entity pattern  
 #   &.+; over and over, pull out the match look it up in an entity -> tex hash  
 #   and do the replacement.  
 #  
 #  In order to simplify the hash, the following reductions are done:  
 #   &#d+; have the &# and ; stripped and is converted to an int.  
 #   &#.+; have the &#x and ; stripped and is converted to an int as a hex  
 #                             value.  
 #   All others have the & and ; stripped.  
   
   
 #  The hash:  Add new conversions here; leave off the leading & and the trailing ;  =head1 NAME
 #  all numeric entities need only appear as their decimal versions  
 #  (e.g. no need for 1234 is sufficient, no need for 0x4d2 as well.  Apache::entities.pm
 #  
 #  This entity table is mercilessly cribbed from the  HTML pocket reference  =head1 SYNOPSIS
 #  table starting at pg 82.  In most cases the LaTeX equivalent codes come from  
 #  the original massive regular expression replacements originally by   This file contains a table driven entity-->latex converter.
 #  A. Sakharuk in lonprintout.pm  
 #  This is part of the LearningOnline Network with CAPA project
 #  I also want to acknowledge  described at http://www.lon-capa.org.
 #   ISO Character entities and their LaTeX equivalents by   
 #      Vidar Bronken Gundersen, and Rune Mathisen  =head1 OVERVIEW
 #    http://www.bitjungle.com/isoent-ref.pdf  
 #  
   Assumptions:
    The number of entities in a resource is small compared with the
    number of possible entities that might be translated.
    Therefore the strategy is to match a general entity pattern
    &.+; over and over, pull out the match look it up in an entity -> tex hash
    and do the replacement.
   
   In order to simplify the hash, the following reductions are done:
    &#d+; have the &# and ; stripped and is converted to an int.
    &#.+; have the &#x and ; stripped and is converted to an int as a hex
                              value.
    All others have the & and ; stripped.
   
   
   The hash:  Add new conversions here; leave off the leading & and the trailing ;
   all numeric entities need only appear as their decimal versions
   (e.g. no need for 1234 is sufficient, no need for 0x4d2 as well.
   
   This entity table is mercilessly cribbed from the  HTML pocket reference
   table starting at pg 82.  In most cases the LaTeX equivalent codes come from
   the original massive regular expression replacements originally by 
   A. Sakharuk in lonprintout.pm
   
   I also want to acknowledge
    ISO Character entities and their LaTeX equivalents by 
       Vidar Bronken Gundersen, and Rune Mathisen
     http://www.bitjungle.com/isoent-ref.pdf
   
   
   Note numerical entities are essentially unicode character codes.
   
   
   =head1 SUBROUTINES
   
   =item entity_to_utf8()
   
   
   Convert a numerical entity (that does not exist in our hash)
    to its UTF-8 equivalent representation.
    This allows us to support, to some extent, any entity for which
    dvipdf can find a gylph (given that LaTeX is now UTF-8 clean).
   
   Parameters:
     unicode  - The unicode for the character.  This is assumed to
                be a decimal value
   Returns:
     The UTF-8 equiavalent of the value.
   
   =item entity_to_latex()
   
    Convert an entity to the corresponding LateX if possible.
    If not possible, and the entity is numeric,
    the entity is treated like a Unicode character and converted
    to UTF-8 which should display as long as dvipdf can find the
    appropriate glyph.
   
    The entity is assumed to have already had the 
    &;  or & ; removed
   
   Parameters:
     entity    - Name of entity to convert.
   Returns:
    One of the following:
     - Latex string that produces the entity.
     - UTF-8 equivalent of a numeric entity for which we don't have a latex string.
     - ' ' for text entities for which there's no latex equivalent.
   
   
   =item replace_entities()
   
    Convert all the entities in a string.
    We locate all the entities, pass them into entity_to_latex and 
    and replace occurences in the input string.
    The assumption is that there are few entities in any string/document
    so this looping is not too bad.  The advantage of looping vs. regexping is
    that we now can use lookup tables for the translation in entity_to_latex above.
   
   Parameters:
     input   - Input string/document
   Returns
     input with entities replaced by latexable stuff (UTF-8 encodings or
     latex control strings to produce the entity.
   
   =head1 TABLES ASCII code page
   
   =cut
   
   
   package Apache::entities;
   use strict;
   
 #  Note numerical entities are essentially unicode character codes.  
 #  
 package Apache::entities;  package Apache::entities;
   
 my %entities = (  my %entities = (
   
     #  ---- ASCII code page: ----------------  =pod
   
   =out
   
   =item (7-13)
   
     # Translation to empty strings:      # Translation to empty strings:
   =cut
   
     7        => "",      7        => "",
     9        => "",      9        => "",
     10       => "",      10       => "",
     13       => "",      13       => "",
           
   =pod
   
   =item (32-126)
   
     # Translations to simple characters:      # Translations to simple characters:
   
   =cut
   
     32       => " ",      32       => " ",
     33       => "!",      33       => "!",
     34       => '"',      34       => '"',
     'quot'   => '"',      'quot'   => '"',
     35       => '\\\#',      35       => '\\#',
     36       => '\\\$',      36       => '\\$',
     37       => '\\%',      37       => '\%',
     38       => '\\&',      38       => '\&',
     'amp'    => '\\&',      'amp'    => '\&',
     39       => '\'', # Apostrophe      39       => '\'', # Apostrophe
     40       => '(',      40       => '(',
     41       => ')',      41       => ')',
     42       => '\*',      42       => '*',
     43       => '\+',      43       => '+',
     44       => ',', #  comma      44       => ',', #  comma
     45       => '-',      45       => '-',
     46       => '\.',      46       => '.',
     47       => '\/',      47       => '/',
     48       => '0',      48       => '0',
     49       => '1',      49       => '1',
     50       => '2',      50       => '2',
Line 106  my %entities = ( Line 188  my %entities = (
     57       => '9',      57       => '9',
     58       => ':',      58       => ':',
     59       => ';',      59       => ';',
     60       => '\\ensuremath\{<\}',      60       => '\ensuremath{<}',
     'lt'     => '\\ensuremath\{<\}',      'lt'     => '\ensuremath{<}',
     61       => '\\ensuremath\{=\}',      61       => '\ensuremath{=}',
     62       => '\\ensuremath\{>\}',      62       => '\ensuremath{>}',
     'gt'     => '\\ensuremath\{>\}',      'gt'     => '\ensuremath{>}',
     63       => '\?',      63       => '?',
     64       => '@',      64       => '@',
     65       => 'A',      65       => 'A',
     66       => 'B',      66       => 'B',
Line 140  my %entities = ( Line 222  my %entities = (
     89       => 'Y',      89       => 'Y',
     90       => 'Z',      90       => 'Z',
     91       => '[',      91       => '[',
     92       => '\\ensuremath\{\\setminus\}', # \setminus is \ with special spacing.      92       => '\ensuremath{\setminus}', # \setminus is \ with special spacing.
     93       => ']',      93       => ']',
     94       => '\\ensuremath\{\\wedge\}',      94       => '\ensuremath{\wedge}',
     95       => '\\underline\{\\makebox[2mm]\\{\\strut\}\}', # Underline 2mm of space for _      95       => '\underline{\makebox[2mm]{\strut}}', # Underline 2mm of space for _
     96       => '`',      96       => '`',
     97       => 'a',      97       => 'a',
     98       => 'b',      98       => 'b',
Line 171  my %entities = ( Line 253  my %entities = (
     120      => 'x',      120      => 'x',
     121      => 'y',      121      => 'y',
     122      => 'z',      122      => 'z',
     123      => '\\{',      123      => '\{',
     124      => '\|',      124      => '|',
     125      => '\\}',      125      => '\}',
     126      => '\~',      126      => '\~',
   
     #   Controls and Latin-1 supplement.  Note that some entities that have  =pod
     #   visible effect are not printing unicode characters.  Specifically  
     #   &#130;-&#160;  =item (130-140)
   
       Controls and Latin-1 supplement.  Note that some entities that have
       visible effect are not printing unicode characters.  Specifically
       &#130;-&#160;
   
   =cut
   
     130     => ',',      130     => ',',
     131     => '\\textflorin ',      131     => '\ensuremath{f}',
     132     => ',,', # Low double left quotes.      132     => ',,', # Low double left quotes.
     133     => '\\ensuremath\{\\ldots\}',      133     => '\ensuremath{\ldots}',
     134     => '\\ensuremath\{\\dagger\}',      134     => '\ensuremath{\dagger}',
     135     => '\\ensuremath\{\\ddagger\}',      135     => '\ensuremath{\ddagger}',
     136     => '\\ensuremath\{\\wedge\}',      136     => '\ensuremath{\wedge}',
     137     => '\\textperthousand ',      137     => '\textperthousand ',
     138     => '\\v\{S\}',      138     => '\v{S}',
     139     => '\\ensuremath\{<\}',      139     => '\ensuremath{<}',
     140     => '\{\\OE\}',      140     => '{\OE}',
           
     #  There's a gap here in my entity table  =pod
   
     145     => '\`',  =item (145-156)
   
       There's a gap here in my entity table
   
   =cut
   
       145     => '`',
     146     => '\'',      146     => '\'',
     147     => '\`\`',      147     => '``',
     148     => '\'\'',      148     => '\'\'',
     149     => '\\ensuremath\{\\bullet\}',      149     => '\ensuremath{\bullet}',
     150     => '--',      150     => '--',
     151     => '---',      151     => '---',
     152     => '\\ensuremath\{\\sim\}',      152     => '\ensuremath{\sim}',
     153     => '\\texttrademark',      153     => '\texttrademark',
     154     => '\\v\{s\}',      154     => '\v{s}',
     155     => '\\ensuremath\{>\}',      155     => '\ensuremath{>}',
     156     => '\\oe ',      156     => '\oe ',
       
     # Another short gap:  
   
     159     => '\\"Y',  =pod
   
   =item (159-255)
   
        Another short gap:
   
   =cut
   
       159     => '\"Y',
     160     => '~',      160     => '~',
     'nbsp'  => '~',      'nbsp'  => '~',
     161     => '\\textexclamdown ',      161     => '\textexclamdown ',
     'iexcl' => '\\textexclamdown ',      'iexcl' => '\textexclamdown ',
     162     => '\\textcent ',      162     => '\textcent ',
     'cent'  => '\\textcent ',      'cent'  => '\textcent ',
     163     => '\\pounds ',      163     => '\pounds ',
     'pound' => '\\pounds ',      'pound' => '\pounds ',
     164     => '\\textcurrency ',      164     => '\textcurrency ',
     'curren' => '\\textcurrency ',      'curren' => '\textcurrency ',
     165     => '\\textyen ',      165     => '\textyen ',
     'yen'   => '\\textyen ',      'yen'   => '\textyen ',
     166     => '\\textbrokenbar ',      166     => '\textbrokenbar ',
     'brvbar' => '\\textbrokenbar ',      'brvbar' => '\textbrokenbar ',
     167     => '\\textsection ',      167     => '\textsection ',
     'sect'  => '\\textsection ',      'sect'  => '\textsection ',
     168     => '\\texthighdieresis ',      168     => '\"{}',
     'uml'   => '\\texthighdieresis ',      'uml'   => '\"{}',
     169     => '\\copyright ',      169     => '\copyright ',
     'copy'  => '\\copyright ',      'copy'  => '\copyright ',
     170     => '\\textordfeminine ',      170     => '\textordfeminine ',
     'ordf'  => '\\textordfeminine ',      'ordf'  => '\textordfeminine ',
     171     => '\\ensuremath\{\ll\}', # approximation of left angle quote.      171     => '\ensuremath{\ll}', # approximation of left angle quote.
     'laquo' => '\\ensuremath\{\ll\}', #   ""      'laquo' => '\ensuremath{\ll}', #   ""
     172     => '\\ensuremath\{\\neg\}',      172     => '\ensuremath{\neg}',
     'not'   => '\\ensuremath\{\\neg\}',      'not'   => '\ensuremath{\neg}',
     173     => ' - ',      173     => ' - ',
     'shy'   => ' - ',      'shy'   => ' - ',
     174     => '\\textregistered ',      174     => '\textregistered ',
     'reg'   => '\\textregistered ',      'reg'   => '\textregistered ',
     175     => '\\ensuremath\{^\{-\}\}',      175     => '\ensuremath{^{-}}',
     'macr'  => '\\ensuremath\{^\{-\}\}',      'macr'  => '\ensuremath{^{-}}',
     176     => '\\ensuremath\{^\{\\circ\}\}',      176     => '\ensuremath{^{\circ}}',
     'deg'   => '\\ensuremath\{^\{\\circ\}\}',      'deg'   => '\ensuremath{^{\circ}}',
     177     => '\\ensuremath\{\\pm\}',      177     => '\ensuremath{\pm}',
     'plusmn' => '\\ensuremath\{\\pm\}',      'plusmn' => '\ensuremath{\pm}',
     178     => '\\ensuremath\{^2\}',      178     => '\ensuremath{^2}',
     'sup2'  => '\\ensuremath\{^2\}',      'sup2'  => '\ensuremath{^2}',
     179     => '\\ensuremath\{^3\}',      179     => '\ensuremath{^3}',
     'sup3'  => '\\ensuremath\{^3\}',      'sup3'  => '\ensuremath{^3}',
     180     => '\\textacute ',      180     => "\\'{}",
     'acute' => '\\textacute ',      'acute' => "\\'{}",
     181     => '\\ensuremath\{\\mu\}',      181     => '\ensuremath{\mu}',
     'micro' => '\\ensuremath\{\\mu\}',      'micro' => '\ensuremath{\mu}',
     182     => '\\P ',      182     => '\P ',
     para    => '\\P ',      para    => '\P ',
     183     => '\\ensuremath\{\\cdot\}',      183     => '\ensuremath{\cdot}',
     'middot' => '\\ensuremath\{\\cdot\}',      'middot' => '\ensuremath{\cdot}',
     184     => '\\c\{\\strut\}',      184     => '\c{\strut}',
     'cedil' => '\\c\{\\strut\}',      'cedil' => '\c{\strut}',
     185     => '\\ensuremath\{^1\}',      185     => '\ensuremath{^1}',
     sup1    => '\\ensuremath\{^1\}',      sup1    => '\ensuremath{^1}',
     186     => '\\textordmasculine ',      186     => '\textordmasculine ',
     'ordm'  => '\\textordmasculine ',      'ordm'  => '\textordmasculine ',
     187     => '\\ensuremath\{\\gg\}',      187     => '\ensuremath{\gg}',
     'raquo' => '\\ensuremath\{\\gg\}',      'raquo' => '\ensuremath{\gg}',
     188     => '\\textonequarter ',      188     => '\textonequarter ',
     'frac14' => '\\textonequarter ',      'frac14' => '\textonequarter ',
     189     => '\\textonehalf' ,      189     => '\textonehalf' ,
     'frac12' => '\\textonehalf' ,      'frac12' => '\textonehalf' ,
     190     => '\\textthreequarters ',      190     => '\textthreequarters ',
     'frac34' => '\\textthreequarters ',      'frac34' => '\textthreequarters ',
     191     =>  '\\textquestiondown ',      191     =>  '\textquestiondown ',
     'iquest' => '\\textquestiondown ',      'iquest' => '\textquestiondown ',
     192     => '\\\`\{A\}',      192     => '\\`{A}',
     'Agrave' => '\\\`\{A\}',      'Agrave' => '\\`{A}',
     193     => '\\\'\{A\}',      193     => "\\'{A}",
     'Aacute' => '\\\'\{A\}',      'Aacute' => "\\'{A}",
     194     => '\\^\{A\}',      194     => '\^{A}',
     'Acirc' => '\\^\{A\}',      'Acirc' => '\^{A}',
     195     => '\\~{A}',      195     => '\~{A}',
     'Atilde'=> '\\~{A}',      'Atilde'=> '\~{A}',
     196     => '\\\"{A}',      196     => '\\"{A}',
     'Auml'  => '\\\"{A}',      'Auml'  => '\\"{A}',
     197     => '{\\AA}',      197     => '{\AA}',
     'Aring' => '{\\AA}',      'Aring' => '{\AA}',
     198     => '{\\AE}',      198     => '{\AE}',
     'AElig' => '{\\AE}',      'AElig' => '{\AE}',
     199     => '\\c{c}',      199     => '\c{c}',
     'Ccedil'=> '\\c{c}',      'Ccedil'=> '\c{c}',
     '200'   => '\\\`{E}',       200   =>  '\\`{E}',
     'Egrave'=> '\\\`{E}',      'Egrave'=> '\\`{E}',
     201     => '\\\'{E}',      201     => "\\'{E}",
     'Eacute'=> '\\\'{E}',      'Eacute'=> "\\'{E}",
     202     => '\\\^{E}',      202     => '\\^{E}',
     'Ecirc' => '\\\^{E}',      'Ecirc' => '\\^{E}',
     203     => '\\\"{E}',      203     => '\\"{E}',
     'Euml'  => '\\\"{E}',      'Euml'  => '\\"{E}',
     204     => '\\\`{I}',      204     => '\\`{I}',
     'Igrave'=> '\\\`{I}',      'Igrave'=> '\\`{I}',
     205     => '\\\'{I}',      205     => "\\'{I}",
     'Iacute'=> '\\\'{I}',      'Iacute'=> "\\'{I}",
     206     => '\\\^{I}',      206     => '\\^{I}',
     'Icirc' => '\\\^{I}',      'Icirc' => '\\^{I}',
     207     => '\\\"{I}',      207     => '\\"{I}',
     'Iuml'  => '\\\"{I}',      'Iuml'  => '\\"{I}',
     208     => '\\OE',      208     => '\DH',
     'ETH'   => '\\OE',      'ETH'   => '\DH',
     209     => '\\~{N}',      209     => '\~{N}',
     'Ntilde'=> '\\~{N}',      'Ntilde'=> '\~{N}',
     210     => '\\\`{O}',      210     => '\\`{O}',
     'Ograve'=> '\\\`{O}',      'Ograve'=> '\\`{O}',
     211     => '\\\'{O}',      211     => "\\'{O}",
     'Oacute'=> '\\\'{O}',      'Oacute'=> "\\'{O}",
     212     => '\\\^{O}',      212     => '\\^{O}',
     'Ocirc' => '\\\^{O}',      'Ocirc' => '\\^{O}',
     213     => '\\~{O}',      213     => '\~{O}',
     'Otilde'=> '\\~{O}',      'Otilde'=> '\~{O}',
     214     => '\\\"{O}',      214     => '\\"{O}',
     'Ouml'  => '\\\"{O}',      'Ouml'  => '\\"{O}',
     215     => '\\ensuremath\{\\times\}',      215     => '\ensuremath{\times}',
     'times' => '\\ensuremath\{\\times\}',      'times' => '\ensuremath{\times}',
     216     => '\\O',      216     => '\O',
     'Oslash'=> '\\O',      'Oslash'=> '\O',
     217     => '\\\`{U}',      217     => '\\`{U}',
     'Ugrave'=> '\\\`{U}',      'Ugrave'=> '\\`{U}',
     218     => '\\\'{U}',      218     => "\\'{U}",
     'Uacute'=> '\\\'{U}',      'Uacute'=> "\\'{U}",
     219     => '\\\^{U}',      219     => '\\^{U}',
     'Ucirc' => '\\\^{U}',      'Ucirc' => '\\^{U}',
     220     => '\\\"{U}',      220     => '\\"{U}',
     'Uuml'  => '\\\"{U}',      'Uuml'  => '\\"{U}',
     221     => '\\\'{Y}',      221     => "\\'{Y}",
     'Yacute'=> '\\\'{Y}',      'Yacute'=> "\\'{Y}",
     222     => '\\TH',      223     => '{\ss}',
     'THORN' => '\\TH',      'szlig' => '{\ss}',
     223     => '{\\sz}',      224     => '\\`{a}',
     'szlig' => '{\\sz}',      'agrave'=> '\\`{a}',
     224     => '\\\`{a}',      225     => "\\'{a}",
     'agrave'=> '\\\`{a}',      'aacute'=> "\\'{a}",
     225     => '\\\'{a}',      226     => '\\^{a}',
     'aacute'=> '\\\'{a}',      'acirc' => '\\^{a}',
     226     => '\\\^{a}',      227     => '\\~{a}',
     'acirc' => '\\\^{a}',      'atilde'=> '\\~{a}',
     227     => '\\\~{a}',      228     => '\\"{a}',
     'atilde'=> '\\\~{a}',      'auml'  => '\\"{a}',
     228     => '\\\"{a}',      229     => '\aa',
     'auml'  => '\\\"{a}',      'aring' => '\aa',
     229     => '\\aa',      230     => '\ae',
     'aring' => '\\aa',      'aelig' => '\ae',
     230     => '\\ae',      231     => '\c{c}',
     'aelig' => '\\ae',      'ccedil'=> '\c{c}',
     231     => '\\c{c}',      232     => '\\`{e}',
     'ccedil'=> '\\c{c}',      'egrave'=> '\\`{e}',
     232     => '\\\`{e}',      233     => "\\'{e}",
     'egrave'=> '\\\`{e}',      'eacute'=> "\\'{e}",
     233     => '\\\'{e}',      234     => '\\^{e}',
     'eacute'=> '\\\'{e}',      'ecirc' => '\\^{e}',
     234     => '\\\^{e}',      235     => '\\"{e}',
     'ecirc' => '\\\^{e}',      'euml'  => '\\"{e}',
     235     => '\\\"{e}',      236     => '\\`{i}',
     'euml'  => '\\\"{e}',      'igrave'=> '\\`{i}',
     236     => '\\\`{i}',      237     => "\\'{i}",
     'igrave'=> '\\\`{i}',      'iacute'=> "\\'{i}",
     237     => '\\\'{i}',      238     => '\\^{i}',
     'iacute'=> '\\\'{i}',      'icirc' => '\\^{i}',
     238     => '\\\^{i}',      239     => '\\"{i}',
     'icirc' => '\\\^{i}',      'iuml'  => '\\"{i}',
     239     => '\\\"{i}',      241     => '\\~{n}',
     'iuml'  => '\\\"{i}',      'ntilde'=> '\\~{n}',
     240     => '\\dh',      242     => '\\`{o}',
     'eth'   => '\\dh',      'ograve'=> '\\`{o}',
     241     => '\\\~{n}',      243     => "\\'{o}",
     'ntilde'=> '\\\~{n}',      'oacute'=> "\\'{o}",
     242     => '\\\`{o}',      244     => '\\^{o}',
     'ograve'=> '\\\`{o}',      'ocirc' => '\\^{o}',
     243     => '\\\'{o}',      245     => '\\~{o}',
     'oacute'=> '\\\'{o}',      'otilde'=> '\\~{o}',
     244     => '\\\^{o}',      246     => '\\"{o}',
     'ocirc' => '\\\^{o}',      'ouml'  => '\\"{o}',
     245     => '\\\~{o}',      247     => '\ensuremath{\div}',
     'otilde'=> '\\\~{o}',      'divide'=> '\ensuremath{\div}',
     246     => '\\\"{o}',      248     => '{\o}',
     'ouml'  => '\\\"{o}',      'oslash'=> '{\o}',
     247     => '\\ensuremath\{\\div\}',      249     => '\\`{u}',
     'divide'=> '\\ensuremath\{\\div\}',      'ugrave'=> '\\`{u}',
     248     => '{\\o}',      250     => "\\'{u}",
     'oslash'=> '{\\o}',      'uacute'=> "\\'{u}",
     249     => '\\\`{u}',      251     => '\\^{u}',
     'ugrave'=> '\\\`{u}',      'ucirc' => '\\^{u}',
     250     => '\\\'{u}',      252     => '\\"{u}',
     'uacute'=> '\\\'{u}',      'uuml'  => '\\"{u}',
     251     => '\\\^{u}',      253     => "\\'{y}",
     'ucirc' => '\\\^{u}',      'yacute'=> "\\'{y}",
     252     => '\\\"{u}',      255     => '\\"{y}',
     'uuml'  => '\\\"{u}',      'yuml'  => '\\"{y}',
     253     => '\\\'{y}',  
     'yacute'=> '\\\'{y}',  
     254     => '\\th',  =pod
     'thorn' => '\\th',  
     255     => '\\\"{y}',  =item (295)
     'yuml'  => '\\\"{y}',  
        hbar entity number comes from the unicode charater:
     # hbar entity number comes from the unicode charater:       see e.g. http://www.unicode.org/charts/PDF/U0100.pdf
     # see e.g. http://www.unicode.org/charts/PDF/U0100.pdf       ISO also documents a 'planck' entity.
     # ISO also documents a 'planck' entity.  
   =cut
     295     => '\\ensuremath\{\hbar\}',  
     'plank' => '\\ensuremath\{\hbar\}',      295     => '\ensuremath{\hbar}',
       'planck' => '\ensuremath{\hbar}',
     # Latin extended-A HTML 4.01 entities:  
   =pod
     338      => '\\OE',  
     'OElig'  => '\\OE',  =item (338-376)
     339      => '\\oe',  
     'oelig'  => '\\oe',      Latin extended-A HTML 4.01 entities:
     352      => '\\v{S}',  
     'Scaron' => '\\v{S}',  =cut
     353      => '\\v{s}',  
     'scaron' => '\\v{s}',      338      => '\OE',
     376      => '\\\"{Y}',      'OElig'  => '\OE',
     'Yuml'   => '\\\"{Y}',       339      => '\oe',
       'oelig'  => '\oe',
       352      => '\v{S}',
       'Scaron' => '\v{S}',
       353      => '\v{s}',
       'scaron' => '\v{s}',
       376      => '\\"{Y}',
       'Yuml'   => '\\"{Y}', 
   
   =pod
   
   =item (402)
   
       Latin extended B HTML 4.01 entities
   
   =cut
   
       402      => '\ensuremath{f}',
       'fnof'   => '\ensuremath{f}',
   
   =pod
   
     # Latin extended B HTML 4.01 entities  =item (710 & 732)
   
     402      => '\\ensuremath{f}',      Spacing modifier letters:
     'fnof'   => '\\ensuremath{f}',  
   
     # Spacing modifier letters:  =cut
           
     710      => '\^{}',      710      => '\^{}',
     'circ'   => '\^{}',      'circ'   => '\^{}',
     732      => '\~{}',      732      => '\~{}',
     'tilde'  => '\~{}',      'tilde'  => '\~{}',
   
     # Greek uppercase:  =pod
   
   =item (913-929)
   
       Greek uppercase:
   
   =cut
   
     913      => '\\ensuremath\{\\mathrm\{A\}\}',      913      => '\ensuremath{\mathrm{A}}',
     'Alpha'  => '\\ensuremath\{\\mathrm\{A\}\}',      'Alpha'  => '\ensuremath{\mathrm{A}}',
     914      => '\\ensuremath\{\\mathrm\{B\}\}',      914      => '\ensuremath{\mathrm{B}}',
     'Beta'   => '\\ensuremath\{\\mathrm\{B\}\}',      'Beta'   => '\ensuremath{\mathrm{B}}',
     915      => '\\ensuremath\{\\Gamma\}',      915      => '\ensuremath{\Gamma}',
     'Gamma'  => '\\ensuremath\{\\Gamma\}',      'Gamma'  => '\ensuremath{\Gamma}',
     916      => '\\ensuremath\{\\Delta\}',      916      => '\ensuremath{\Delta}',
     'Delta'  => '\\ensuremath\{\\Delta\}',      'Delta'  => '\ensuremath{\Delta}',
     917      => '\\ensuremath\{\\mathrm\{E\}\}',      917      => '\ensuremath{\mathrm{E}}',
     'Epsilon'=> '\\ensuremath\{\\mathrm\{E\}\}',      'Epsilon'=> '\ensuremath{\mathrm{E}}',
     918      => '\\ensuremath\{\\mathrm\{Z\}\}',      918      => '\ensuremath{\mathrm{Z}}',
     'Zeta'   => '\\ensuremath\{\\mathrm\{Z\}\}',      'Zeta'   => '\ensuremath{\mathrm{Z}}',
     919      => '\\ensuremath\{\\mathrm\{H\}\}',      919      => '\ensuremath{\mathrm{H}}',
     'Eta'    => '\\ensuremath\{\\mathrm\{H\}\}',      'Eta'    => '\ensuremath{\mathrm{H}}',
     920      => '\\ensuremath\{\\Theta\}',      920      => '\ensuremath{\Theta}',
     'Theta'  => '\\ensuremath\{\\Theta\}',      'Theta'  => '\ensuremath{\Theta}',
     921      => '\\ensuremath\{\\mathrm\{I\}\}',      921      => '\ensuremath{\mathrm{I}}',
     'Iota'   => '\\ensuremath\{\\mathrm\{I\}\}',      'Iota'   => '\ensuremath{\mathrm{I}}',
     922      => '\\ensuremath\{\\mathrm\{K\}\}',      922      => '\ensuremath{\mathrm{K}}',
     'Kappa'  => '\\ensuremath\{\\mathrm\{K\}\}',      'Kappa'  => '\ensuremath{\mathrm{K}}',
     923      => '\\ensuremath\{\\Lambda\}',      923      => '\ensuremath{\Lambda}',
     'Lambda' => '\\ensuremath\{\\Lambda\}',      'Lambda' => '\ensuremath{\Lambda}',
     924      => '\\ensuremath\{\\mathrm\{M\}\}',      924      => '\ensuremath{\mathrm{M}}',
     'Mu'     => '\\ensuremath\{\\mathrm\{M\}\}',      'Mu'     => '\ensuremath{\mathrm{M}}',
     925      => '\\ensuremath\{\\mathrm\{N\}\}',      925      => '\ensuremath{\mathrm{N}}',
     'Nu'     => '\\ensuremath\{\\mathrm\{N\}\}',      'Nu'     => '\ensuremath{\mathrm{N}}',
     926      => '\\ensuremath\{\\mathrm\{\\Xi\}',      926      => '\ensuremath{\mathrm{\Xi}}',
     'Xi'     => '\\ensuremath\{\\mathrm\{\\Xi\}',      'Xi'     => '\ensuremath{\mathrm{\Xi}}',
     927      => '\\ensuremath\{\\mathrm\{O\}\}',      927      => '\ensuremath{\mathrm{O}}',
     'Omicron'=> '\\ensuremath\{\\mathrm\{O\}\}',      'Omicron'=> '\ensuremath{\mathrm{O}}',
     928      => '\\ensuremath\{\\Pi\}',      928      => '\ensuremath{\Pi}',
     'Pi'     => '\\ensuremath\{\\Pi\}',      'Pi'     => '\ensuremath{\Pi}',
     929      => '\\ensuremath\{\\mathrm\{P\}\}',      929      => '\ensuremath{\mathrm{P}}',
     'Rho'    => '\\ensuremath\{\\mathrm\{P\}\}',      'Rho'    => '\ensuremath{\mathrm{P}}',
         
     # Skips 930  
   
     931      => '\\ensuremath\{\Sigma\}',  =pod
     'Sigma'  => '\\ensuremath\{\Sigma\}',  
     932      => '\\ensuremath\{\\mathrm\{T\}\}',  =item (931-937)
     'Tau'    => '\\ensuremath\{\\mathrm\{T\}\}',  
     933      => '\\ensuremath\{\\Upsilon\}',      Skips 930
     'Upsilon'=> '\\ensuremath\{\\Upsilon\}',  
     934      => '\\ensuremath\{\\Phi\}',  =cut
     'Phi'    => '\\ensuremath\{\\Phi\}',  
     935      => '\\ensuremath\{\\mathrm\{X\}\}',      931      => '\ensuremath{\Sigma}',
     'Chi'    => '\\ensuremath\{\\mathrm\{X\}\}',      'Sigma'  => '\ensuremath{\Sigma}',
     936      => '\\ensuremath\{\\Psi\}',      932      => '\ensuremath{\mathrm{T}}',
     'Psi'    => '\\ensuermath\{\\Psi\}',      'Tau'    => '\ensuremath{\mathrm{T}}',
     937      => '\\ensuremath\{\\Omega\}',      933      => '\ensuremath{\Upsilon}',
     'Omega'  => '\\ensuremath\{\\Omega\}',      'Upsilon'=> '\ensuremath{\Upsilon}',
       934      => '\ensuremath{\Phi}',
       'Phi'    => '\ensuremath{\Phi}',
     # Greek lowercase:      935      => '\ensuremath{\mathrm{X}}',
       'Chi'    => '\ensuremath{\mathrm{X}}',
     945      => '\\ensuremath\{\\alpha\}',      936      => '\ensuremath{\Psi}',
     'alpha'  => '\\ensuremath\{\\alpha\}',      'Psi'    => '\ensuremath{\Psi}',
     946      => '\\ensuremath\{\\beta\}',      937      => '\ensuremath{\Omega}',
     'beta'   => '\\ensuremath\{\\beta\}',      'Omega'  => '\ensuremath{\Omega}',
     947      => '\\ensuremath\{\\gamma\}',  
     'gamma'  => '\\ensuremath\{\\gamma\}',  =pod
     948      => '\\ensuremath\{\\delta\}',  
     'delta'  => '\\ensuremath\{\\delta\}',  =item (945-982)
     949      => '\\ensuremath\{\\epsilon\}',  
     'epsilon'=> '\\ensuremath\{\\epsilon\}',      Greek lowercase:
     950      => '\\ensuremath\{\\zeta\}',  
     'zeta'   => '\\ensuremath\{\\zeta\}',  =cut
     951      => '\\ensuremath\{\\eta\}',  
     'eta'    => '\\ensuremath\{\\eta\}',      945      => '\ensuremath{\alpha}',
     952      => '\\ensuremath\{\\theta\}',      'alpha'  => '\ensuremath{\alpha}',
     'theta'  => '\\ensuremath\{\\theta\}',      946      => '\ensuremath{\beta}',
     953      => '\\ensuremath\{\\iota\}',      'beta'   => '\ensuremath{\beta}',
     'iota'   => '\\ensuremath\{\\iota\}',      947      => '\ensuremath{\gamma}',
     954      => '\\ensuremath\{\\kappa\}',      'gamma'  => '\ensuremath{\gamma}',
     'kappa'  => '\\ensuremath\{\\kappa\}',      948      => '\ensuremath{\delta}',
     955      => '\\ensuremath\{\\lambda\}',      'delta'  => '\ensuremath{\delta}',
     'lambda' => '\\ensuremath\{\\lambda\}',      949      => '\ensuremath{\epsilon}',
     956      => '\\ensuremath\{\\mu\}',      'epsilon'=> '\ensuremath{\epsilon}',
     'mu'     => '\\ensuremath\{\\mu\}',      950      => '\ensuremath{\zeta}',
     957      => '\\ensuremath\{\\nu\}',      'zeta'   => '\ensuremath{\zeta}',
     'nu'     => '\\ensuremath\{\\nu\}',      951      => '\ensuremath{\eta}',
     958      => '\\ensuremath\{\\xi\}',      'eta'    => '\ensuremath{\eta}',
     'xi'     => '\\ensuremath\{\\xi\}',      952      => '\ensuremath{\theta}',
     959      => '\\ensuremath\{o\}',      'theta'  => '\ensuremath{\theta}',
     'omicron'=> '\\ensuremath\{o\}',      953      => '\ensuremath{\iota}',
     960      => '\\ensuremath\{\\pi\}',      'iota'   => '\ensuremath{\iota}',
     'pi'     => '\\ensuremath\{\\pi\}',      954      => '\ensuremath{\kappa}',
     961      => '\\ensuremath\{\\rho\}',      'kappa'  => '\ensuremath{\kappa}',
     'rho'    => '\\ensuremath\{\\rho\}',      955      => '\ensuremath{\lambda}',
     962      => '\\ensuremath\{\\varsigma\}',      'lambda' => '\ensuremath{\lambda}',
     'sigmaf' => '\\ensuremath\{\\varsigma\}',      956      => '\ensuremath{\mu}',
     963      => '\\ensuremath\{\\sigma\}',      'mu'     => '\ensuremath{\mu}',
     'sigma'  => '\\ensuremath\{\\sigma\}',      957      => '\ensuremath{\nu}',
     964      => '\\ensuremath\{\\tau\}',      'nu'     => '\ensuremath{\nu}',
     'tau'    => '\\ensuremath\{\\tau\}',      958      => '\ensuremath{\xi}',
     965      => '\\ensuremath\{\\upsilon\}',      'xi'     => '\ensuremath{\xi}',
     'upsilon'=> '\\ensuremath\{\\upsilon\}',      959      => '\ensuremath{o}',
     966      => '\\ensuremath\{\\phi\}',      'omicron'=> '\ensuremath{o}',
     'phi'    => '\\ensuremath\{\\phi\}',      960      => '\ensuremath{\pi}',
     967      => '\\ensuremath\{\\chi\}',      'pi'     => '\ensuremath{\pi}',
     'chi'    => '\\ensuremath\{\\chi\}',      961      => '\ensuremath{\rho}',
     968      => '\\ensuremath\{\\psi\}',      'rho'    => '\ensuremath{\rho}',
     'psi'    => '\\ensuremath\{\\psi\}',      962      => '\ensuremath{\varsigma}',
     969      => '\\ensuremath\{\\omega\}',      'sigmaf' => '\ensuremath{\varsigma}',
     'omega'  => '\\ensuremath\{\\omega\}',      963      => '\ensuremath{\sigma}',
     977      => '\\ensuremath\{\\vartheta\}',      'sigma'  => '\ensuremath{\sigma}',
     'thetasym'=>'\\ensuremath\{\\vartheta\}',      964      => '\ensuremath{\tau}',
     978      => '\\ensuremath\{\\varUpsilon\}',      'tau'    => '\ensuremath{\tau}',
     'upsih'  => '\\ensuremath\{\\varUpsilon\}',      965      => '\ensuremath{\upsilon}',
     982      => '\\ensuremath\{\\varpi\}',      'upsilon'=> '\ensuremath{\upsilon}',
     'piv'    => '\\ensuremath\{\\varpi\}',      966      => '\ensuremath{\phi}',
       'phi'    => '\ensuremath{\phi}',
           967      => '\ensuremath{\chi}',
     # The general punctuation set:      'chi'    => '\ensuremath{\chi}',
       968      => '\ensuremath{\psi}',
     8194,    => '\\hspace{.5em}',      'psi'    => '\ensuremath{\psi}',
     'enspc'  => '\\hspace{.5em}',      969      => '\ensuremath{\omega}',
     8195     => '\\hspace{1.0em}',      'omega'  => '\ensuremath{\omega}',
     'emspc'  => '\\hspace{1.0em}',      977      => '\ensuremath{\vartheta}',
     8201     => '\\hspace{0.167em}',      'thetasym'=>'\ensuremath{\vartheta}',
     'thinsp' => '\\hspace{0.167em}',      978      => '\ensuremath{\mathit{\Upsilon}}',
     8204     => '\{\}',      'upsih'  => '\ensuremath{\mathit{\Upsilon}}',
     'zwnj'   => '\{\}',      982      => '\ensuremath{\varpi}',
       'piv'    => '\ensuremath{\varpi}',
   
   =pod
   
   =item (8194-8364)
       
       The general punctuation set:
   
   =cut
   
       8194,    => '\hspace{.5em}',
       'enspc'  => '\hspace{.5em}',
       8195     => '\hspace{1.0em}',
       'emspc'  => '\hspace{1.0em}',
       8201     => '\hspace{0.167em}',
       'thinsp' => '\hspace{0.167em}',
       8204     => '{}',
       'zwnj'   => '{}',
     8205     => '',      8205     => '',
     'zwj'    => '',      'zwj'    => '',
     8206     => '',      8206     => '',
Line 575  my %entities = ( Line 716  my %entities = (
     'lsquo'  => '`',      'lsquo'  => '`',
     8217     => "'",      8217     => "'",
     'rsquo'  => "'",      'rsquo'  => "'",
     8218     => '\\quotesinglebase',      8218     => '\quotesinglbase',
     'sbquo'  => '\\quotesinglebase',      'sbquo'  => '\quotesinglbase',
     8220     => '``',      8220     => '``',
     'ldquo'  => '``',      'ldquo'  => '``',
     8221     => "''",      8221     => "''",
     'rdquo'  => "''",      'rdquo'  => "''",
     8222     => '\\quotedblbase',      8222     => '\quotedblbase',
     'bdquo'  => '\\quotedblbase',      'bdquo'  => '\quotedblbase',
     8224     => '\\dagger',      8224     => '\ensuremath{\dagger}',
     'dagger' => '\\dagger',      'dagger' => '\ensuremath{\dagger}',
     '8225'   => '\\ddag',      '8225'   => '\ensuremath{\ddag}',
     'Dagger' => '\\ddag',      'Dagger' => '\ensuremath{\ddag}',
     8226     => '\\textbullet',      8226     => '\textbullet',
     'bull'   => '\\textbullet',      'bull'   => '\textbullet',
     8230     => '\\textellipsis',      8230     => '\textellipsis',
     'hellep' => '\\textellipsis',      'hellep' => '\textellipsis',
     8240     => '\\textperthousand',      8240     => '\textperthousand',
     permil   => '\\textperthousand',      permil   => '\textperthousand',
     8242     => '\\textquotesingle',      8242     => '\textquotesingle',
     'prime'  => '\\textquotesingle',      'prime'  => '\textquotesingle',
     8243     => '\\textquotedbl',      8243     => '\textquotedbl',
     'Prime'  => '\\textquotedbl',      'Prime'  => '\textquotedbl',
     8249     => '\\guilsingleleft',      8249     => '\guilsinglleft',
     'lsaquo' => '\\guilsingleleft',      'lsaquo' => '\guilsinglleft',
     8250     => '\\guilsingleright',      8250     => '\guilsinglright',
     'rsaquo' => '\\guilsingleright',      'rsaquo' => '\guilsinglright',
     8254     => '\\textasciimacron',      8254     => '\textasciimacron',
     oline    => '\\textasciimacron',      oline    => '\textasciimacron',
     8260     => '\\textfractionsolidus',      8260     => '\textfractionsolidus',
     'frasl'  => '\\textfractionsolidus',      'frasl'  => '\textfractionsolidus',
     8364     => '\\texteuro',      8364     => '\texteuro',
     'euro'   => '\\texteuro',      'euro'   => '\texteuro',
   
     # Letter like symbols  =pod
   
       =item (8472-8501)
     8472     => '\\ensuremath\{\\wp\}',  
     'weierp' => '\\ensuremath\{\\wp\}',      Letter like symbols
     8465     => '\\ensuremath\{\\Im\}',  
     'image'  => '\\ensuremath\{\\Im\}',  =cut
     8476     => '\\ensuremath{\\Re\}',  
     'real'   => '\\ensuremath{\\Re\}',  
     8482     => '\\texttrademark',  
     'trade'  => '\\texttrademark',  
     8501     => '\\ensuremath{\\aleph\}',  
     'alefsym'=> '\\ensuremath{\\aleph\}',  
   
     # Arrows and then some (harpoons from Hon Kie).  
   
     8592     => '\\textleftarrow',  
     'larr'   => '\\textleftarrow',  
     8593     => '\\textuparrow',  
     'uarr'   => '\\textuparrow',  
     8594     => '\\textrightarrow',  
     'rarr'   => '\\textrightarrow',  
     8595     => '\\textdownarrow',  
     'darr'   => '\\textdownarrow',  
     8596     => '\\ensuremath\{\\leftrightarrow\}',  
     'harr'   => '\\ensuremath\{\\leftrightarrow\}',  
     8598     => '\\ensuremath\{\\nwarrow\}',  
     8599     => '\\ensuremath\{\\nearrow\}',  
     8600     => '\\ensuremath\{\\searrow\}',  
     8601     => '\\ensuremath\{\\swarrow\}',  
     8605     => '\\ensuremath\{\\leadsto\}',  
     8614     => '\\ensuremath\{\\mapsto\}',  
     8617     => '\\ensuremath\{\\hookleftarrow\}',  
     8618     => '\\ensuremath\{\\hookrightarrow\}',  
     8629     => '\\ensuremath\{\\hookleftarrow\}', # not an exact match but best I know.  
     'crarr'  => '\\ensuremath\{\\hookleftarrow\}', # not an exact match but best I know.  
     8636     => '\\ensuremath\{\\leftharpoonup\}',  
     8637     => '\\ensuremath\{\\leftharpoondown\}',  
     8640     => '\\ensuremath\{\\rightharpoonup\}',  
     8641     => '\\ensuremath\{\\rightharpoondown\}',  
     8652     => '\\ensuremath\{\\rightleftharpoons\}',  
     8656     => '\\ensuremath\{\\Leftarrow\}',  
     'lArr'   => '\\ensuremath\{\\Leftarrow\}',  
     8657     => '\\ensuremath\{\\Uparrow\}',  
     'uArr'   => '\\ensuremath\{\\Uparrow\}',  
     8658     => '\\ensuremath\{\\Rightarrow\}',  
     'rArr'   => '\\ensuremath\{\\Rightarrow\}',  
     8659     => '\\ensuremath\{\\Downarrow\}',  
     'dArr'   => '\\ensuremath\{\\Downarrow\}',  
     8660     => '\\ensuremath\{\\Leftrightarrow\}',  
     'vArr'   => '\\ensuremath\{\\Updownarrow\}',  
     8661     => '\\ensuremath\{\\Updownarrow\}',  
     'lAarr'   => '\\ensuremath\{\\Lleftarrow\}',  
     8666     => '\\ensuremath\{\\Lleftarrow\}',  
     'rAarr'  => '\\ensuremath\{\\Rrightarrow\}',  
     8667     => '\\ensuremath\{\\Rrightarrow\}',  
     'rarrw'  => '\\ensuremath\{\\rightsquigarrow\}',  
     8669     => '\\ensuremath\{\\rightsquigarrow\}',  
           
       8472     => '\ensuremath{\wp}',
       'weierp' => '\ensuremath{\wp}',
       8465     => '\ensuremath{\Im}',
       'image'  => '\ensuremath{\Im}',
       8476     => '\ensuremath{\Re}',
       'real'   => '\ensuremath{\Re}',
       8482     => '\texttrademark',
       'trade'  => '\texttrademark',
       8501     => '\ensuremath{\aleph}',
       'alefsym'=> '\ensuremath{\aleph}',
   
     # Mathematical operators.  =pod
   
   =item (8592-8669)
       
       Arrows and then some (harpoons from Hon Kie).
   
   =cut
   
       8592     => '\textleftarrow',
       'larr'   => '\textleftarrow',
       8593     => '\textuparrow',
       'uarr'   => '\textuparrow',
       8594     => '\textrightarrow',
       'rarr'   => '\textrightarrow',
       8595     => '\textdownarrow',
       'darr'   => '\textdownarrow',
       8596     => '\ensuremath{\leftrightarrow}',
       'harr'   => '\ensuremath{\leftrightarrow}',
       8598     => '\ensuremath{\nwarrow}',
       8599     => '\ensuremath{\nearrow}',
       8600     => '\ensuremath{\searrow}',
       8601     => '\ensuremath{\swarrow}',
       8605     => '\ensuremath{\leadsto}',
       8614     => '\ensuremath{\mapsto}',
       8617     => '\ensuremath{\hookleftarrow}',
       8618     => '\ensuremath{\hookrightarrow}',
       8629     => '\ensuremath{\hookleftarrow}', # not an exact match but best I know.
       'crarr'  => '\ensuremath{\hookleftarrow}', # not an exact match but best I know.
       8636     => '\ensuremath{\leftharpoonup}',
       8637     => '\ensuremath{\leftharpoondown}',
       8640     => '\ensuremath{\rightharpoonup}',
       8641     => '\ensuremath{\rightharpoondown}',
       8652     => '\ensuremath{\rightleftharpoons}',
       8656     => '\ensuremath{\Leftarrow}',
       'lArr'   => '\ensuremath{\Leftarrow}',
       8657     => '\ensuremath{\Uparrow}',
       'uArr'   => '\ensuremath{\Uparrow}',
       8658     => '\ensuremath{\Rightarrow}',
       'rArr'   => '\ensuremath{\Rightarrow}',
       8659     => '\ensuremath{\Downarrow}',
       'dArr'   => '\ensuremath{\Downarrow}',
       8660     => '\ensuremath{\Leftrightarrow}',
       'hArr'   => '\ensuremath{\Leftrightarrow}',
       8661     => '\ensuremath{\Updownarrow}',
       'vArr'   => '\ensuremath{\Updownarrow}',
       8666     => '\ensuremath{\Lleftarrow}',
       'lAarr'   => '\ensuremath{\Lleftarrow}',
       8667     => '\ensuremath{\Rrightarrow}',
       'rAarr'  => '\ensuremath{\Rrightarrow}',
       8669     => '\ensuremath{\rightsquigarrow}',
       'rarrw'  => '\ensuremath{\rightsquigarrow}',
       
   =pod
   
   =item (8704-8734)
   
       Mathematical operators.
   
   =cut
   
           
     'forall' => '\\ensuremath\{\\forall\}',      'forall' => '\ensuremath{\forall}',
     8704     => '\\ensuremath\{\\forall\}',      8704     => '\ensuremath{\forall}',
     'comp'   => '\\ensuremath\{\\complement\}',      'comp'   => '\ensuremath{\complement}',
     8705     => '\\ensuremath\{\\complement\}',      8705     => '\ensuremath{\complement}',
     'part'   => '\\ensuremath\{\\partial\}',      'part'   => '\ensuremath{\partial}',
     8706     => '\\ensuremath\{\\partial\}',      8706     => '\ensuremath{\partial}',
     'exist'  => '\\ensuremath\{\\exists\}',      'exist'  => '\ensuremath{\exists}',
     8707     => '\\ensuremath\{\\exists\}',      8707     => '\ensuremath{\exists}',
     'nexist' => '\\ensuremath\{\\nexists\}',      'nexist' => '\ensuremath{\nexists}',
     8708     => '\\ensuremath\{\\nexists\}',      8708     => '\ensuremath{\nexists}',
     'empty'  => '\\ensuremath\{\\emptysset\}',      'empty'  => '\ensuremath{\emptyset}',
     8709     => '\\ensuremath\{\\emptysset\}',      8709     => '\ensuremath{\emptyset}',
     8710     => '\\ensuremath\{\\Delta\}',      8710     => '\ensuremath{\Delta}',
     'nabla'  => '\\ensuremath\{\\nabla\}',      'nabla'  => '\ensuremath{\nabla}',
     8711     => '\\ensuremath\{\\nabla\}',      8711     => '\ensuremath{\nabla}',
     'isin'   => '\\ensuremath\{\\in\}',      'isin'   => '\ensuremath{\in}',
     8712     => '\\ensuremath\{\\in\}',      8712     => '\ensuremath{\in}',
     'notin'  => '\\ensuremath\{\\notin\}',      'notin'  => '\ensuremath{\notin}',
     8713     => '\\ensuremath\{\\notin\}',      8713     => '\ensuremath{\notin}',
     ni       => '\\ensuremath\{\\ni\}',      ni       => '\ensuremath{\ni}',
     8715     => '\\ensuremath\{\\ni\}',      8715     => '\ensuremath{\ni}',
     8716     => '\\ensuremath\{\\not\\ni\}',      8716     => '\ensuremath{\not\ni}',
     'prod'   => '\\ensuremath\{\\prod\}',      'prod'   => '\ensuremath{\prod}',
     8719     => '\\ensuremath\{\\prod\}',      8719     => '\ensuremath{\prod}',
     8720     => '\\ensuremath\{\\coprod\}',      8720     => '\ensuremath{\coprod}',
     'sum'    => '\\ensuremath\{\\sum\}',      'sum'    => '\ensuremath{\sum}',
     8721     => '\\ensuremath\{\\sum\}',      8721     => '\ensuremath{\sum}',
     'minus'  => '\\ensuremath\{-\}',      'minus'  => '\ensuremath{-}',
     8722     => '\\ensuremath\{-\}',      8722     => '\ensuremath{-}',
     8723     => '\\ensuremath\{\\mp\}',      8723     => '\ensuremath{\mp}',
     8724     => '\\ensuremath\{\\dotplus\}',      8724     => '\ensuremath{\dotplus}',
     8725     => '\\ensuremath\{\\diagup\}',      8725     => '\ensuremath{\diagup}',
     8726     => '\\ensuremath\{\\smallsetminus\}',      8726     => '\ensuremath{\smallsetminus}',
     'lowast' => '\\ensuremath\{*\}',      'lowast' => '\ensuremath{*}',
     8727     => '\\ensuremath\{*\}',      8727     => '\ensuremath{*}',
     8728     => '\\ensuremath\{\\circ\}',      8728     => '\ensuremath{\circ}',
     8729     => '\\ensuremath\{\\bullet\}',      8729     => '\ensuremath{\bullet}',
     'radic'  => '\\ensuremath\{\\surd\}',      'radic'  => '\ensuremath{\surd}',
     8730     => '\\ensuremath\{\\surd\}',      8730     => '\ensuremath{\surd}',
     8731     => '\\ensuremath\{\\sqrt[3]\{\}\}',      8731     => '\ensuremath{\sqrt[3]{}}',
     8732     => '\\ensuremath\{\\sqrt[4]\{\}\}',      8732     => '\ensuremath{\sqrt[4]{}}',
     'prop'   => '\\ensuremath\{\\propto\}',      'prop'   => '\ensuremath{\propto}',
     8733     => '\\ensuremath\{\\propto\}',      8733     => '\ensuremath{\propto}',
     'infin'  => '\\ensuremath\{\\infty\}',      'infin'  => '\ensuremath{\infty}',
     8734     => '\\ensuremath\{\\infty\}',      8734     => '\ensuremath{\infty}',
     'ang90'  => '\\ensuremath\{\\sqangle\}',  
     8735     => '\\ensuremath\{\\sqangle\}',  
     'ang'    => '\\ensuremath\{\\angle\}',  =pod
     8736     => '\\ensuremath\{\\angle\}',  
     'angmsd' => '\\ensuremath\{\\measuredangle\}',  =item (8735-9830)
     8737     => '\\ensuremath\{\\measuredangle\}',  
     'angsph' => '\\ensuremath\{\\sphiericalangle\}',  
     8738     => '\\ensuremath\{\\sphiericalangle\}',      The items below require the isoent latex package which I can't find at least for FC5.
     8739     => '\\ensuremath\{\\vert\}',      Temporarily commented out.
     8740     => '\\ensuremath\{\\Vert\}',      
     'and'    => '\\ensuremath\{\\land\}',      'ang90'  => '\ensuremath{\sqangle}',
     8743     => '\\ensuremath\{\\land\}',      8735     => '\ensuremath{\sqangle}',
     'or'     => '\\ensuremath\{\\lor\}',  
     8744     => '\\ensuremath\{\\lor\}',  =cut
     'cap'    => '\\ensuremath\{\\cap\}',  
     8745     => '\\ensuremath\{\\cap\}',      'ang'    => '\ensuremath{\angle}',
     'cup'    => '\\ensuremath\{\\cup\}',      8736     => '\ensuremath{\angle}',
     8746     => '\\ensuremath\{\\cup\}',      'angmsd' => '\ensuremath{\measuredangle}',
     'int'    => '\\ensuremath\{\\int\}',      8737     => '\ensuremath{\measuredangle}',
     8747     => '\\ensuremath\{\\int\}',      'angsph' => '\ensuremath{\sphericalangle}',
     'conint' => '\\ensuremath\{\\oint\}',      8738     => '\ensuremath{\sphericalangle}',
     8750     => '\\ensuremath\{\\oint\}',      8739     => '\ensuremath{\vert}',
     'there4' => '\\ensuremath\{\\therefore\}',      8740     => '\ensuremath{\Vert}',
     8756     => '\\ensuremath\{\\therefore\}',      'and'    => '\ensuremath{\land}',
     'becaus' => '\\ensuremath\{\\because\}',      8743     => '\ensuremath{\land}',
     8757     => '\\ensuremath\{\\because\}',      'or'     => '\ensuremath{\lor}',
     8758     => '\\ensuremath\{:\}',      8744     => '\ensuremath{\lor}',
     8759     => '\\ensuremath\{::\}',      'cap'    => '\ensuremath{\cap}',
     'sim'    => '\\ensuremath\{\\sim\}',      8745     => '\ensuremath{\cap}',
     8764     => '\\ensuremath\{\\sim\}',      'cup'    => '\ensuremath{\cup}',
     8765     => '\\ensuremath\{\\backsim\}',      8746     => '\ensuremath{\cup}',
     'wreath' => '\\ensuremath\{\\wr\}',      'int'    => '\ensuremath{\int}',
     8768     => '\\ensuremath\{\\wr\}',      8747     => '\ensuremath{\int}',
     'nsim'   => '\\ensuremath\{\\not\sim\}',      'conint' => '\ensuremath{\oint}',
     8769     => '\\ensuremath\{\\not\sim\}',      8750     => '\ensuremath{\oint}',
 #    'asymp'  => '\\ensuremath\{\\asymp\}',  &asymp; is actually a different glyph.      'there4' => '\ensuremath{\therefore}',
     8771     => '\\ensuremath\{\\asymp\}',      8756     => '\ensuremath{\therefore}',
     8772     => '\\ensuremath\{\\not\\asymp\}',      'becaus' => '\ensuremath{\because}',
     'cong'   => '\\ensuremath\{\\cong\}',      8757     => '\ensuremath{\because}',
     8773     => '\\ensuremath\{\\cong\}',      8758     => '\ensuremath{:}',
     8775     => '\\ensuremath\{\\ncong\}',      8759     => '\ensuremath{::}',
     8778     => '\\ensuremath\{\\approxeq\}',      'sim'    => '\ensuremath{\sim}',
     8784     => '\\ensuremath\{\\doteq\}',      8764     => '\ensuremath{\sim}',
     8785     => '\\ensuremath\{\\doteqdot\}',      8765     => '\ensuremath{\backsim}',
     8786     => '\\ensuremath\{\\fallingdotseq\}',      'wreath' => '\ensuremath{\wr}',
     8787     => '\\ensuremath\{\\risingdotseq\}',      8768     => '\ensuremath{\wr}',
     8788     => '\\ensuremath\{:=\}',      'nsim'   => '\ensuremath{\not\sim}',
     8789     => '\\ensuremath\{=:\}',      8769     => '\ensuremath{\not\sim}',
     8790     => '\\ensuremath\{\\eqcirc\}',  #    'asymp'  => '\ensuremath{\asymp}',  &asymp; is actually a different glyph.
     8791     => '\\ensuremath\{\\circeq\}',      8771     => '\ensuremath{\asymp}',
     'wedgeq' => '\\ensuremath\{\\stackrel\{\\wedge\}\{=\}\}',      8772     => '\ensuremath{\not\asymp}',
     8792     => '\\ensuremath\{\\stackrel\{\\wedge\}\{=\}\}',      'cong'   => '\ensuremath{\cong}',
     8794     => '\\ensuremath\{\\stackrel\{\\vee\}\{=\}\}',      8773     => '\ensuremath{\cong}',
     8795     => '\\ensuremath\{\\stackrel\{\\star}\{=\}\}',      8775     => '\ensuremath{\ncong}',
     8796     => '\\ensuremath\{\\triangleeq\}',      8778     => '\ensuremath{\approxeq}',
     8797     => '\\ensuremath\{\\stackrel\{def\}\{=\}\}',      8784     => '\ensuremath{\doteq}',
     8798     => '\\ensuremath\{\\stackrel\{m\}\{=\}\}',      8785     => '\ensuremath{\doteqdot}',
     8799     => '\\ensuremath\{\\stackrel\{?\}\{=\}\}',      8786     => '\ensuremath{\fallingdotseq}',
     'ne'     => '\\ensuremath\{\\neq\}',      8787     => '\ensuremath{\risingdotseq}',
     8800     => '\\ensuremath\{\\neq\}',      8788     => '\ensuremath{:=}',
     'equiv'  => '\\ensuremath\{\\equiv\}',      8789     => '\ensuremath{=:}',
     8801     => '\\ensuremath\{\\equiv\}',      8790     => '\ensuremath{\eqcirc}',
     8802     => '\\ensuremath\{\\not\\equiv\}',      8791     => '\ensuremath{\circeq}',
     'le'     => '\\ensuremath\{\\leq\}',      'wedgeq' => '\ensuremath{\stackrel{\wedge}{=}}',
     8804     => '\\ensuremath\{\\leq\}',      8792     => '\ensuremath{\stackrel{\wedge}{=}}',
     'ge'     => '\\ensuremath\{\\geq\}',      8794     => '\ensuremath{\stackrel{\vee}{=}}',
     8805     => '\\ensuremath\{\\geq\}',      8795     => '\ensuremath{\stackrel{\star}{=}}',
     8806     => '\\ensuremath\{\\leqq\}',      8796     => '\ensuremath{\triangleq}',
     8807     => '\\ensuremath\{\\geqq\}',      8797     => '\ensuremath{\stackrel{def}{=}}',
     8810     => '\\ensuremath\{\\ll\}',      8798     => '\ensuremath{\stackrel{m}{=}}',
     8811     => '\\ensuremath\{\\gg\}',      8799     => '\ensuremath{\stackrel{?}{=}}',
     'twixt'  => '\\ensuremath\{\\between\}',      'ne'     => '\ensuremath{\neq}',
     8812     => '\\ensuremath\{\\between\}',      8800     => '\ensuremath{\neq}',
     8813     => '\\ensuremath\{\\not\\asymp\}',      'equiv'  => '\ensuremath{\equiv}',
     8814     => '\\ensuremath\{\\not<\}',      8801     => '\ensuremath{\equiv}',
     8815     => '\\ensuremath\{\\not>\}',      8802     => '\ensuremath{\not\equiv}',
     8816     => '\\ensuremath\{\\not\\leqslant\}',      'le'     => '\ensuremath{\leq}',
     8817     => '\\ensuremath\{\\not\\geqslant\}',      8804     => '\ensuremath{\leq}',
     8818     => '\\ensuremath\{\\lessim\}',      'ge'     => '\ensuremath{\geq}',
     8819     => '\\ensuremath\{\\gtrsim\}',      8805     => '\ensuremath{\geq}',
     8820     => '\\ensuremath\{\\stackrel\{<\}\{>\}\}',      8806     => '\ensuremath{\leqq}',
     8821     => '\\ensuremath\{\\stackrel\{>\}\{<\}\}',      8807     => '\ensuremath{\geqq}',
     8826     => '\\ensuremath\{\\prec\}',      8810     => '\ensuremath{\ll}',
     8827     => '\\ensuremath\{\\succ\}',      8811     => '\ensuremath{\gg}',
     8828     => '\\ensuremath\{\\preceq\}',      'twixt'  => '\ensuremath{\between}',
     8829     => '\\ensuremath\{\\succeq\}',      8812     => '\ensuremath{\between}',
     8830     => '\\ensuremath\{\\not\\prec\}',      8813     => '\ensuremath{\not\asymp}',
     8831     => '\\ensuremath\{\\not\\succ\}',      8814     => '\ensuremath{\not<}',
     'sub'    => '\\ensuremath\{\\subset\}',      8815     => '\ensuremath{\not>}',
     8834     => '\\ensuremath\{\\subset\}',      8816     => '\ensuremath{\not\leqslant}',
     'sup'    => '\\ensuremath\{\\supset\}',      8817     => '\ensuremath{\not\geqslant}',
     8835     => '\\ensuremath\{\\supset\}',      8818     => '\ensuremath{\lesssim}',
     'nsub'   => '\\ensuremath\{\\not\\subset\}',      8819     => '\ensuremath{\gtrsim}',
     8836     => '\\ensuremath\{\\not\\subset\}',      8820     => '\ensuremath{\stackrel{<}{>}}',
     8837     => '\\ensuremath\{\\not\\supset\}',      8821     => '\ensuremath{\stackrel{>}{<}}',
     'sube'   => '\\ensuremath\{\\subseteq\}',      8826     => '\ensuremath{\prec}',
     8838     => '\\ensuremath\{\\subseteq\}',      8827     => '\ensuremath{\succ}',
     'supe'   => '\\ensuermath\{\\supseteq\}',      8828     => '\ensuremath{\preceq}',
     8839     => '\\ensuermath\{\\supseteq\}',      8829     => '\ensuremath{\succeq}',
     8840     => '\\ensuremath\{\\nsubseteq\}',      8830     => '\ensuremath{\not\prec}',
     8841     => '\\ensuremath\{\\nsupseteq\}',      8831     => '\ensuremath{\not\succ}',
     8842     => '\\ensuremath\{\\subsetneq\}',      'sub'    => '\ensuremath{\subset}',
     8843     => '\\ensuremath\{\\supsetneq\}',      8834     => '\ensuremath{\subset}',
     8847     => '\\ensuremath\{\\sqsubset\}',      'sup'    => '\ensuremath{\supset}',
     8848     => '\\ensuremath\{\\sqsupset\}',      8835     => '\ensuremath{\supset}',
     8849     => '\\ensuremath\{\\sqsubseteq\}',      'nsub'   => '\ensuremath{\not\subset}',
     8850     => '\\ensuremath\{\\sqsupseteq\}',      8836     => '\ensuremath{\not\subset}',
     8851     => '\\ensuremath\{\\sqcap\}',      8837     => '\ensuremath{\not\supset}',
     8852     => '\\ensuremath\{\\sqcup\}',      'sube'   => '\ensuremath{\subseteq}',
     'oplus'  => '\\ensuremath\{\\oplus\}',      8838     => '\ensuremath{\subseteq}',
     8853     => '\\ensuremath\{\\oplus\}',      'supe'   => '\ensuremath{\supseteq}',
     8854     => '\\ensuremath\{\\ominus\}',      8839     => '\ensuremath{\supseteq}',
     'otimes' => '\\ensuremath\{\\otimes\}',      8840     => '\ensuremath{\nsubseteq}',
     8855     => '\\ensuremath\{\\otimes\}',      8841     => '\ensuremath{\nsupseteq}',
     8856     => '\\ensuremath\{\\oslash\}',      8842     => '\ensuremath{\subsetneq}',
     8857     => '\\ensuremath\{\\odot\}',      8843     => '\ensuremath{\supsetneq}',
     8858     => '\\ensuremath\{\\circledcirc\}',      8847     => '\ensuremath{\sqsubset}',
     8859     => '\\ensuremath\{\\circledast\}',      8848     => '\ensuremath{\sqsupset}',
     8861     => '\\ensuremath\{\\ominus\}', # Close enough for government work.      8849     => '\ensuremath{\sqsubseteq}',
     8862     => '\\ensuremath\{\\boxplus\}',      8850     => '\ensuremath{\sqsupseteq}',
     8863     => '\\ensuremath\{\\boxminus\}',      8851     => '\ensuremath{\sqcap}',
     8864     => '\\ensuremath\{\\boxtimes\}',      8852     => '\ensuremath{\sqcup}',
     8865     => '\\ensuremath\{\\boxdot\}',      'oplus'  => '\ensuremath{\oplus}',
     'vdash'  => '\\ensuremath\{\\vdash\}',      8853     => '\ensuremath{\oplus}',
     8866     => '\\ensuremath\{\\vdash\}',      8854     => '\ensuremath{\ominus}',
     'dashv'  => '\\ensuremath\{\\dashv\}',      'otimes' => '\ensuremath{\otimes}',
     8867     => '\\ensuremath\{\\dashv\}',      8855     => '\ensuremath{\otimes}',
     'perp'   => '\\ensuremath\{\\perp\}',      8856     => '\ensuremath{\oslash}',
     8869     => '\\ensuremath\{\\perp\}',      8857     => '\ensuremath{\odot}',
     8871     => '\\ensuremath\{\\models\}',      8858     => '\ensuremath{\circledcirc}',
     8872     => '\\ensuremath\{\\vDash\}',          8859     => '\ensuremath{\circledast}',
     8873     => '\\ensuremath\{\\Vdash\}',      8861     => '\ensuremath{\ominus}', # Close enough for government work.
     8874     => '\\ensuremath\{\\Vvdash\}',      8862     => '\ensuremath{\boxplus}',
     8876     => '\\ensuremath\{\\nvdash\}',      8863     => '\ensuremath{\boxminus}',
     8877     => '\\ensuremath\{\\nvDash\}',      8864     => '\ensuremath{\boxtimes}',
     8878     => '\\ensuremath\{\\nVdash\}',      8865     => '\ensuremath{\boxdot}',
     8880     => '\\ensuremath\{\\prec\}',      'vdash'  => '\ensuremath{\vdash}',
     8881     => '\\ensuremath\{\\succ\}',      8866     => '\ensuremath{\vdash}',
     8882     => '\\ensuremath\{\\vartriangleleft\}',      'dashv'  => '\ensuremath{\dashv}',
     8883     => '\\ensuremath\{\\vartriangleright\}',      8867     => '\ensuremath{\dashv}',
     8884     => '\\ensuremath\{\\trianglelefteq\}',      'perp'   => '\ensuremath{\perp}',
     8885     => '\\ensuremath\{\\trianglerighteq\}',      8869     => '\ensuremath{\perp}',
     8891     => '\\ensuremath\{\\veebar\}',      8871     => '\ensuremath{\models}',
     8896     => '\\ensuremath\{\\land\}',      8872     => '\ensuremath{\vDash}',    
     8897     => '\\ensuremath\{\\lor\}',      8873     => '\ensuremath{\Vdash}',
     8898     => '\\ensuremath\{\\cap\}',      8874     => '\ensuremath{\Vvdash}',
     8899     => '\\ensuremath\{\\cup\}',      8876     => '\ensuremath{\nvdash}',
     8900     => '\\ensuremath\{\\diamond\}',      8877     => '\ensuremath{\nvDash}',
     'sdot'   => '\\ensuremath\{\\cdot\}',      8878     => '\ensuremath{\nVdash}',
     8901     => '\\ensuremath\{\\cdot\}',      8880     => '\ensuremath{\prec}',
     8902     => '\\ensuremath\{\\star\}',      8881     => '\ensuremath{\succ}',
     8903     => '\\ensuremath\{\\divideontimes\}',      8882     => '\ensuremath{\vartriangleleft}',
     8904     => '\\ensuremath\{\\bowtie\}',      8883     => '\ensuremath{\vartriangleright}',
     8905     => '\\ensuremath\{\\ltimes\}',      8884     => '\ensuremath{\trianglelefteq}',
     8906     => '\\ensuremath\{\\rtimes\}',      8885     => '\ensuremath{\trianglerighteq}',
     8907     => '\\ensuremath\{\\leftthreetimes\}',      8891     => '\ensuremath{\veebar}',
     8908     => '\\ensuremath\{\\rightthreetimes\}',      8896     => '\ensuremath{\land}',
     8909     => '\\ensuremath\{\\simeq\}',      8897     => '\ensuremath{\lor}',
     8910     => '\\ensuremath\{\\curlyvee\}',      8898     => '\ensuremath{\cap}',
     8911     => '\\ensuremath\{\\curlywedge\}',      8899     => '\ensuremath{\cup}',
     8912     => '\\ensuremath\{\\Subset\}',      8900     => '\ensuremath{\diamond}',
     8913     => '\\ensuremath\{\\Supset\}',      'sdot'   => '\ensuremath{\cdot}',
     8914     => '\\ensuremath\{\\Cap\}',      8901     => '\ensuremath{\cdot}',
     8915     => '\\ensuremath\{\\Cup\}',      8902     => '\ensuremath{\star}',
     8916     => '\\ensuremath\{\\pitchfork\}',      8903     => '\ensuremath{\divideontimes}',
     8918     => '\\ensuremath\{\\lessdot\}',      8904     => '\ensuremath{\bowtie}',
     8919     => '\\ensuremath\{\\gtrdot\}',      8905     => '\ensuremath{\ltimes}',
     8920     => '\\ensuremath\{\\lll\}',      8906     => '\ensuremath{\rtimes}',
     8921     => '\\ensuremath\{\\ggg\}',      8907     => '\ensuremath{\leftthreetimes}',
     8922     => '\\ensuremath\{\\gtreqless\}',      8908     => '\ensuremath{\rightthreetimes}',
     8923     => '\\ensuremath\{\\lesseqgtr\}',      8909     => '\ensuremath{\simeq}',
     8924     => '\\ensuremath\{\\eqslantless\}',      8910     => '\ensuremath{\curlyvee}',
     8925     => '\\ensuremath\{\\eqslantgtr\}',      8911     => '\ensuremath{\curlywedge}',
     8926     => '\\ensuremath\{\\curlyeqprec\}',      8912     => '\ensuremath{\Subset}',
     8927     => '\\ensuremath\{\\curlyeqsucc\}',      8913     => '\ensuremath{\Supset}',
     8928     => '\\ensuremath\{\\not\\preccurlyeq\}',      8914     => '\ensuremath{\Cap}',
     8929     => '\\ensuremath\{\\not\\succurlyeq\}',      8915     => '\ensuremath{\Cup}',
     8930     => '\\ensuremath\{\\not\\sqsupseteq\}',      8916     => '\ensuremath{\pitchfork}',
     8931     => '\\ensuremath\{\\not\\sqsubseteq\}',      8918     => '\ensuremath{\lessdot}',
     8938     => '\\ensuremath\{\\not\\vartriangleleft\}',      8919     => '\ensuremath{\gtrdot}',
     8939     => '\\ensuremath\{\\not\vartriangleright\}',      8920     => '\ensuremath{\lll}',
     8940     => '\\ensuremath\{\\not\trianglelefteq\}',      8921     => '\ensuremath{\ggg}',
     8941     => '\\ensuremath\{\\not\trianglerighteq\}',      8922     => '\ensuremath{\gtreqless}',
     8942     => '\\ensuremath\{\\vdots\}',      8923     => '\ensuremath{\lesseqgtr}',
     8960     => '\\ensuremath\{\\varnothing\}',      8924     => '\ensuremath{\eqslantless}',
     'lceil'  => '\\ensuremath\{\\lceil\}',      8925     => '\ensuremath{\eqslantgtr}',
     8968     => '\\ensuremath\{\\lceil\}',      8926     => '\ensuremath{\curlyeqprec}',
     'rceil'  => '\\ensuremath\{\\rceil\}',      8927     => '\ensuremath{\curlyeqsucc}',
     8969     => '\\ensuremath\{\\rceil\}',      8928     => '\ensuremath{\not\preccurlyeq}',
     'lfloor' => '\\ensuremath\{\\lfloor\}',      8929     => '\ensuremath{\not\succcurlyeq}',
     8970     => '\\ensuremath\{\\lfloor\}',      8930     => '\ensuremath{\not\sqsupseteq}',
     'rfloor' => '\\ensuremath\{\\rfloor}',      8931     => '\ensuremath{\not\sqsubseteq}',
     8971     => '\\ensuremath\{\\rfloor}',      8938     => '\ensuremath{\not\vartriangleleft}',
     'lang'   => '\\ensuremath\{\\langle\}',      8939     => '\ensuremath{\not\vartriangleright}',
     9001     => '\\ensuremath\{\\langle\}',      8940     => '\ensuremath{\not\trianglelefteq}',
     'rang'   => '\\ensuremath\{\\rangle\}',      8941     => '\ensuremath{\not\trianglerighteq}',
     9002     => '\\ensuremath\{\\rangle\}',      8942     => '\ensuremath{\vdots}',
     'loz'    => '\\ensuremath\{\\lozenge\}',      8960     => '\ensuremath{\varnothing}',
     9674     => '\\ensuremath\{\\lozenge\}',      'lceil'  => '\ensuremath{\lceil}',
     'spades' => '\\ensuremath\{\\spadesuit\}',      8968     => '\ensuremath{\lceil}',
     9824     => '\\ensuremath\{\\spadesuit\}',      'rceil'  => '\ensuremath{\rceil}',
     9825     => '\\ensuremath\{\\heartsuit\}',      8969     => '\ensuremath{\rceil}',
     9826     => '\\ensuremath\{\\diamondsuit\}',      'lfloor' => '\ensuremath{\lfloor}',
     'clubs'  => '\\ensuremath\{\\clubsuit\}',      8970     => '\ensuremath{\lfloor}',
     9827     => '\\ensuremath\{\\clubsuit\}',      'rfloor' => '\ensuremath{\rfloor}',
     'diams'  => '\\ensuremath\{\\blacklozenge\}',      8971     => '\ensuremath{\rfloor}',
     9830     => '\\ensuremath\{\\blacklozenge\}'      'lang'   => '\ensuremath{\langle}',
       9001     => '\ensuremath{\langle}',
       'rang'   => '\ensuremath{\rangle}',
       9002     => '\ensuremath{\rangle}',
       'loz'    => '\ensuremath{\lozenge}',
       9674     => '\ensuremath{\lozenge}',
       'spades' => '\ensuremath{\spadesuit}',
       9824     => '\ensuremath{\spadesuit}',
       9825     => '\ensuremath{\heartsuit}',
       9826     => '\ensuremath{\diamondsuit}',
       'clubs'  => '\ensuremath{\clubsuit}',
       9827     => '\ensuremath{\clubsuit}',
       'diams'  => '\ensuremath{\blacklozenge}',
       9830     => '\ensuremath{\blacklozenge}'
           
 );  );
   
 #   =pod
 #  Convert a numerical entity (that does not exist in our hash)  
 #  to its UTF-8 equivalent representation.  =item *
 #  This allows us to support, to some extent, any entity for which  
 #  dvipdf can find a gylph (given that LaTeX is now UTF-8 clean).      There are some named entities that don't have a good
 #      latex equivalent, these are converted to utf-8 via this table
 # Parameters:      of entity name -> unicode number.
 #   unicode  - The unicode for the character.  This is assumed to  
 #              be a decimal value  =cut
 # Returns:  
 #   The UTF-8 equiavalent of the value.  my  %utf_table = (
 #      'THORN'  => 222,
       'thorn'  => 254,
       'eth'    => 240,
       'hearts' => 9829
   );
   
 sub entity_to_utf8 {  sub entity_to_utf8 {
     my ($unicode) = @_;      my ($unicode) = @_;
       my $result =  pack("U", $unicode);
     return pack("U", $unicode);      return $result;
 }  }
   
   
 #  
 #  Convert an entity to the corresponding LateX if possible.  
 #  If not possible, and the entity is numeric,  
 #  the entity is treated like a Unicode character and converted  
 #  to UTF-8 which should display as long as dvipdf can find the  
 #  appropriate glyph.  
 #  
 #  The entity is assumed to have already had the   
 #  &# ;  or & ; removed  
 #  
 # Parameters:  
 #   entity    - Name of entity to convert.  
 # Returns:  
 #  One of the following:  
 #   - Latex string that produces the entity.  
 #   - UTF-8 equivalent of a numeric entity for which we don't have a latex string.  
 #   - ' ' for text entities for which there's no latex equivalent.  
 #  
 sub entity_to_latex {  sub entity_to_latex {
     my ($entity) = @_;      my ($entity) = @_;
   
     # Try to look up the entity (text or numeric) in the hash:      # Try to look up the entity (text or numeric) in the hash:
   
   
   
     my $latex = $entities{"$entity"};      my $latex = $entities{"$entity"};
     if (defined $latex) {      if (defined $latex) {
  return $latex;   return $latex;
     }      }
     # If the text is purely numeric we can do the UTF-8 conversion:      # If the text is purely numeric we can do the UTF-8 conversion:
       # Otherwise there are a few textual entities that don't have good latex
     if ($entity =~ /^\d$/) {      # which can be converted to unicode:
       #
       if ($entity =~ /^\d+$/) {
  return &entity_to_utf8($entity);   return &entity_to_utf8($entity);
       } else {
    my $result = $utf_table{"$entity"};
    if (defined $result) {
       return &entity_to_utf8($result);
    }
     }      }
     #  Can't do the conversion`< ...      #  Can't do the conversion`< ...
   
     return " ";      return " ";
 }  }
   
 #  
 #  Convert all the entities in a string.  
 #  We locate all the entities, pass them into entity_to_latex and   
 #  and replace occurences in the input string.  
 #  The assumption is that there are few entities in any string/document  
 #  so this looping is not too bad.  The advantage of looping vs. regexping is  
 #  that we now can use lookup tables for the translation in entity_to_latex above.  
 #  
 # Parameters:  
 #   input   - Input string/document  
 # Returns  
 #   input with entities replaced by latexable stuff (UTF-8 encodings or  
 #   latex control strings to produce the entity.  
 #  
 #  
 sub replace_entities {  sub replace_entities {
     my ($input)  = @_;      my ($input)  = @_;
     my $start;      my $start;
Line 1014  sub replace_entities { Line 1168  sub replace_entities {
  $latex = &entity_to_latex($entity);   $latex = &entity_to_latex($entity);
  substr($input, $start, $end-$start) = $latex;   substr($input, $start, $end-$start) = $latex;
     }      }
   
       # Hexadecimal entities:
   
       while ($input =~ /&\#x(\d|[a-f,A-f])+;/) {
    ($start) = @-;
    ($end)   = @+;
    $entity  = "0" . substr($input, $start+2, $end-$start-3); # 0xhexnumber
    $latex = &entity_to_latex(hex($entity));
    substr($input, $start, $end-$start) = $latex;
       }
   
   
     # Now the &text; entites;      # Now the &text; entites;
           
     while ($input =~/(&\w+;)/) {      while ($input =~/(&\w+;)/) {
Line 1030  sub replace_entities { Line 1196  sub replace_entities {
 1;   1; 
   
 __END__  __END__
   
   =pod
   
   =back
   
   =cut

Removed from v.1.7  
changed lines
  Added in v.1.13


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>