Annotation of loncom/interface/entities.pm, revision 1.5

1.1       foxr        1: # The LearningOnline Network
                      2: # entity -> tex.
                      3: #
                      4: # $Id:
                      5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
                     14: #
                     15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: # http://www.lon-capa.org/
                     26: #
                     27: #
                     28: package Apache::entities;
                     29: use strict;
                     30: #
                     31: #   This file contains a table driven entity-->latex converter.
                     32: #
                     33: #  Assumptions:
                     34: #   The number of entities in a resource is small compared with the
                     35: #   number of possible entities that might be translated.
                     36: #   Therefore the strategy is to match a general entity pattern
                     37: #   &.+; over and over, pull out the match look it up in an entity -> tex hash
                     38: #   and do the replacement.
                     39: #
                     40: #  In order to simplify the hash, the following reductions are done:
                     41: #   &#d+; have the &# and ; stripped and is converted to an int.
                     42: #   &#.+; have the &#x and ; stripped and is converted to an int as a hex
                     43: #                             value.
                     44: #   All others have the & and ; stripped.
                     45: 
                     46: 
                     47: #  The hash:  Add new conversions here; leave off the leading & and the trailing ;
                     48: #  all numeric entities need only appear as their decimal versions
                     49: #  (e.g. no need for 1234 is sufficient, no need for 0x4d2 as well.
                     50: #
                     51: #  This entity table is mercilessly cribbed from the  HTML pocket reference
                     52: #  table starting at pg 82.  In most cases the LaTeX equivalent codes come from
                     53: #  the original massive regular expression replacements originally by 
                     54: #  A. Sakharuk in lonprintout.pm
                     55: #
1.2       foxr       56: #  I also want to acknowledge
                     57: #   ISO Character entities and their LaTeX equivalents by 
                     58: #      Vidar Bronken Gundersen, and Rune Mathisen
                     59: #    http://www.bitjungle.com/isoent-ref.pdf
                     60: #
                     61: 
1.1       foxr       62: #  Note numerical entities are essentially unicode character codes.
                     63: #
                     64: my %entities = {
                     65: 
                     66:     #  ---- ASCII code page: ----------------
                     67: 
                     68:     # Translation to empty strings:
                     69: 
                     70:     7        => "",
                     71:     9        => "",
                     72:     10       => "",
                     73:     13       => "",
                     74:     
                     75:     # Translations to simple characters:
                     76: 
                     77:     32       => " ",
                     78:     33       => "!",
                     79:     34       => '"',
                     80:     'quot'   => '"',
                     81:     35       => '\\\#',
                     82:     36       => '\\\$',
                     83:     37       => '\\%',
                     84:     38       => '\\&',
                     85:     'amp'    => '\\&',
                     86:     39       => '\'',		# Apostrophe
                     87:     40       => '(',
                     88:     41       => ')',
                     89:     42       => '\*',
                     90:     43       => '\+',
                     91:     44       => ',',		#  comma
                     92:     45       => '-',
                     93:     46       => '\.',
                     94:     47       => '\/',
                     95:     48       => '0',
                     96:     49       => '1',
                     97:     50       => '2',
                     98:     51       => '3',
                     99:     52       => '4',
                    100:     53       => '5',
                    101:     54       => '6',
                    102:     55       => '7',
                    103:     56       => '8',
                    104:     57       => '9',
                    105:     58       => ':',
                    106:     59       => ';',
                    107:     60       => '\\ensuremath\{<\}',
                    108:     'lt'     => '\\ensuremath\{<\}',
                    109:     61       => '\\ensuremath\{=\}',
                    110:     62       => '\\ensuremath\{>\}',
                    111:     'gt'     => '\\ensuremath\{>\}',
                    112:     63       => '\?',
                    113:     64       => '@',
                    114:     65       => 'A',
                    115:     66       => 'B',
                    116:     67       => 'C',
                    117:     68       => 'D',
                    118:     69       => 'E',
                    119:     70       => 'F',
                    120:     71       => 'G',
                    121:     72       => 'H',
                    122:     73       => 'I',
                    123:     74       => 'J',
                    124:     75       => 'K',
                    125:     76       => 'L',
                    126:     77       => 'M',
                    127:     78       => 'N',
                    128:     79       => 'O',
                    129:     80       => 'P',
                    130:     81       => 'Q',
                    131:     82       => 'R',
                    132:     83       => 'S',
                    133:     84       => 'T',
                    134:     85       => 'U',
                    135:     86       => 'V',
                    136:     87       => 'W',
                    137:     88       => 'X',
                    138:     89       => 'Y',
                    139:     90       => 'Z',
                    140:     91       => '[',
                    141:     92       => '\\ensuremath\{\\setminus\}', # \setminus is \ with special spacing.
                    142:     93       => ']',
                    143:     94       => '\\ensuremath\{\\wedge\}',
                    144:     95       => '\\underline\{\\makebox[2mm]\\{\\strut\}\}', # Underline 2mm of space for _
                    145:     96       => '`',
                    146:     97       => 'a',
                    147:     98       => 'b',
                    148:     99       => 'c',
                    149:     100      => 'd',
                    150:     101      => 'e',
                    151:     102      => 'f',
                    152:     103      => 'g',
                    153:     104      => 'h', 
                    154:     105      => 'i',
                    155:     106      => 'j',
                    156:     107      => 'k',
                    157:     108      => 'l',
                    158:     109      => 'm',
                    159:     110      => 'n',
                    160:     111      => 'o',
                    161:     112      => 'p',
                    162:     113      => 'q',
                    163:     114      => 'r',
                    164:     115      => 's',
                    165:     116      => 't',
                    166:     117      => 'u',
                    167:     118      => 'v',
                    168:     119      => 'w',
                    169:     120      => 'x',
                    170:     121      => 'y',
                    171:     122      => 'z',
                    172:     123      => '\\{',
                    173:     124      => '\|',
                    174:     125      => '\\}',
                    175:     126      => '\~',
                    176: 
                    177:     #   Controls and Latin-1 supplement.  Note that some entities that have
                    178:     #   visible effect are not printing unicode characters.  Specifically
                    179:     #   &#130;-&#160;
                    180: 
                    181:     130     => ',',
                    182:     131     => '\\textflorin ',
                    183:     132     => ',,',		# Low double left quotes.
                    184:     133     => '\\ensuremat\{\\ldots\}',
                    185:     134     => '\\ensuremath\{\\dagger\}',
                    186:     135     => '\\ensuremath\{\\ddagger\}',
                    187:     136     => '\\ensuremath\{\\wedge\}',
                    188:     137     => '\\textperthousand ',
                    189:     138     => '\\v\{S\}',
                    190:     139     => '\\ensuremath\{<\}',
                    191:     140     => '\{\\OE\}',
                    192:     
                    193:     #  There's a gap here in my entity table
                    194: 
                    195:     145     => '\`',
                    196:     146     => '\'',
                    197:     147     => '\`\`',
                    198:     148     => '\'\'',
                    199:     149     => '\\ensuremath\{\\bullet\}',
                    200:     150     => '--',
                    201:     151     => '---',
                    202:     152     => '\\ensuremath\{\\sim\}',
                    203:     153     => '\\texttrademark',
                    204:     154     => '\\v\{s\}',
                    205:     155     => '\\ensuremath\{>\}',
                    206:     156     => '\\oe ',
                    207:     
                    208:     # Another short gap:
                    209: 
                    210:     159     => '\\"Y',
                    211:     160     => '~',
                    212:     'nbsp'  => '~',
                    213:     161     => '\\textexclamdown ',
                    214:     'iexcl' => '\\textexclamdown ',
                    215:     162     => '\\textcent ',
                    216:     'cent'  => '\\textcent ',
                    217:     163     => '\\pounds ',
                    218:     'pound' => '\\pounds ',
                    219:     164     => '\\textcurrency ',
                    220:     'curren' => '\\textcurrency ',
                    221:     165     => '\\textyen ',
                    222:     'yen'   => '\\textyen ',
                    223:     166     => '\\textbrokenbar ',
                    224:     'brvbar' => '\\textbrokenbar ',
                    225:     167     => '\\textsection ',
                    226:     'sect'  => '\\textsection ',
                    227:     168     => '\\texthighdieresis ',
                    228:     'uml'   => '\\texthighdieresis ',
                    229:     169     => '\\copyright ',
                    230:     'copy'  => '\\copyright ',
                    231:     170     => '\\textordfeminine ',
                    232:     'ordf'  => '\\textordfeminine ',
                    233:     171     => '\\ensuremath\{\ll\}', # approximation of left angle quote.
                    234:     'laquo' => '\\ensuremath\{\ll\}', #   ""
                    235:     172     => '\\ensuremath\{\\neg\}',
                    236:     'not'   => '\\ensuremath\{\\neg\}',
                    237:     173     => ' - ',
                    238:     'shy'   => ' - ',
                    239:     174     => '\\textregistered ',
                    240:     'reg'   => '\\textregistered ',
                    241:     175     => '\\ensuremath\{^\{-\}\}',
                    242:     'macr'  => '\\ensuremath\{^\{-\}\}',
                    243:     176     => '\\ensuremath\{^\{\\circ\}\}',
                    244:     'deg'   => '\\ensuremath\{^\{\\circ\}\}',
                    245:     177     => '\\ensuremath\{\\pm\}',
                    246:     'plusmn' => '\\ensuremath\{\\pm\}',
                    247:     178     => '\\ensuremath\{^2\}',
                    248:     'sup2'  => '\\ensuremath\{^2\}',
                    249:     179     => '\\ensuremath\{^3\}',
                    250:     'sup3'  => '\\ensuremath\{^3\}',
                    251:     180     => '\\textacute ',
                    252:     'acute' => '\\textacute ',
                    253:     181     => '\\ensuremath\{\\mu\}',
                    254:     'micro' => '\\ensuremath\{\\mu\}',
                    255:     182     => '\\P ',
                    256:     para    => '\\P ',
                    257:     183     => '\\ensuremath\{\\cdot\}',
                    258:     'middot' => '\\ensuremath\{\\cdot\}',
                    259:     184     => '\\c\{\\strut\}',
                    260:     'cedil' => '\\c\{\\strut\}',
                    261:     185     => '\\ensuremath\{^1\}',
                    262:     sup1    => '\\ensuremath\{^1\}',
                    263:     186     => '\\textordmasculine ',
                    264:     'ordm'  => '\\textordmasculine ',
                    265:     187     => '\\ensuremath\{\\gg\}',
                    266:     'raquo' => '\\ensuremath\{\\gg\}',
                    267:     188     => '\\textonequarter ',
                    268:     'frac14' => '\\textonequarter ',
                    269:     189     => '\\textonehalf' ,
                    270:     'frac12' => '\\textonehalf' ,
                    271:     190     => '\\textthreequarters ',
                    272:     'frac34' => '\\textthreequarters ',
                    273:     191     =>  '\\textquestiondown ',
                    274:     'iquest' => '\\textquestiondown ',
                    275:     192     => '\\\`\{A\}',
                    276:     'Agrave' => '\\\`\{A\}',
                    277:     193     => '\\\'\{A\}',
                    278:     'Aacute' => '\\\'\{A\}',
                    279:     194     => '\\^\{A\}',
                    280:     'Acirc' => '\\^\{A\}',
                    281:     195     => '\\~{A}',
                    282:     'Atilde'=> '\\~{A}',
                    283:     196     => '\\\"{A}',
                    284:     'Auml'  => '\\\"{A}',
                    285:     197     => '{\\AA}',
                    286:     'Aring' => '{\\AA}',
                    287:     198     => '{\\AE}',
                    288:     'AElig' => '{\\AE}',
                    289:     199     => '\\c{c}',
                    290:     'Ccedil'=> '\\c{c}',
                    291:     '200'   => '\\\`{E}',
                    292:     'Egrave'=> '\\\`{E}',
                    293:     201     => '\\\'{E}',
                    294:     'Eacute'=> '\\\'{E}',
                    295:     202     => '\\\^{E}',
                    296:     'Ecirc' => '\\\^{E}',
                    297:     203     => '\\\"{E}',
                    298:     'Euml'  => '\\\"{E}',
                    299:     204     => '\\\`{I}',
                    300:     'Igrave'=> '\\\`{I}',
                    301:     205     => '\\\'{I}',
                    302:     'Iacute'=> '\\\'{I}',
                    303:     206     => '\\\^{I}',
                    304:     'Icirc' => '\\\^{I}',
                    305:     207     => '\\\"{I}',
                    306:     'Iuml'  => '\\\"{I}',
                    307:     208     => '\\OE',
                    308:     'ETH'   => '\\OE',
                    309:     209     => '\\~{N}',
                    310:     'Ntilde'=> '\\~{N}',
                    311:     210     => '\\\`{O}',
                    312:     'Ograve'=> '\\\`{O}',
                    313:     211     => '\\\'{O}',
                    314:     'Oacute'=> '\\\'{O}',
                    315:     212     => '\\\^{O}',
                    316:     'Ocirc' => '\\\^{O}',
                    317:     213     => '\\~{O}',
                    318:     'Otilde'=> '\\~{O}',
                    319:     214     => '\\\"{O}',
                    320:     'Ouml'  => '\\\"{O}',
                    321:     215     => '\\ensuremath\{\\times\}',
                    322:     'times' => '\\ensuremath\{\\times\}',
                    323:     216     => '\\O',
                    324:     'Oslash'=> '\\O',
                    325:     217     => '\\\`{U}',
                    326:     'Ugrave'=> '\\\`{U}',
                    327:     218     => '\\\'{U}',
                    328:     'Uacute'=> '\\\'{U}',
                    329:     219     => '\\\^{U}',
                    330:     'Ucirc' => '\\\^{U}',
                    331:     220     => '\\\"{U}',
                    332:     'Uuml'  => '\\\"{U}',
                    333:     221     => '\\\'{Y}',
                    334:     'Yacute'=> '\\\'{Y}',
                    335:     222     => '\\TH',
                    336:     'THORN' => '\\TH',
                    337:     223     => '{\\sz}',
                    338:     'szlig' => '{\\sz}',
                    339:     224     => '\\\`{a}',
                    340:     'agrave'=> '\\\`{a}',
                    341:     225     => '\\\'{a}',
                    342:     'aacute'=> '\\\'{a}',
                    343:     226     => '\\\^{a}',
                    344:     'acirc' => '\\\^{a}',
                    345:     227     => '\\\~{a}',
                    346:     'atilde'=> '\\\~{a}',
                    347:     228     => '\\\"{a}',
                    348:     'auml'  => '\\\"{a}',
                    349:     229     => '\\aa',
                    350:     'aring' => '\\aa',
                    351:     230     => '\\ae',
                    352:     'aelig' => '\\ae',
                    353:     231     => '\\c{c}',
                    354:     'ccedil'=> '\\c{c}',
                    355:     232     => '\\\`{e}',
                    356:     'egrave'=> '\\\`{e}',
                    357:     233     => '\\\'{e}',
                    358:     'eacute'=> '\\\'{e}',
                    359:     234     => '\\\^{e}',
                    360:     'ecirc' => '\\\^{e}',
                    361:     235     => '\\\"{e}',
                    362:     'euml'  => '\\\"{e}',
                    363:     236     => '\\\`{i}',
                    364:     'igrave'=> '\\\`{i}',
                    365:     237     => '\\\'{i}',
                    366:     'iacute'=> '\\\'{i}',
                    367:     238     => '\\\^{i}',
                    368:     'icirc' => '\\\^{i}',
                    369:     239     => '\\\"{i}',
                    370:     'iuml'  => '\\\"{i}',
                    371:     240     => '\\dh',
                    372:     'eth'   => '\\dh',
                    373:     241     => '\\\~{n}',
                    374:     'ntilde'=> '\\\~{n}',
                    375:     242     => '\\\`{o}',
                    376:     'ograve'=> '\\\`{o}',
                    377:     243     => '\\\'{o}',
                    378:     'oacute'=> '\\\'{o}',
                    379:     244     => '\\\^{o}',
                    380:     'ocirc' => '\\\^{o}',
                    381:     245     => '\\\~{o}',
                    382:     'otilde'=> '\\\~{o}',
                    383:     246     => '\\\"{o}',
                    384:     'ouml'  => '\\\"{o}',
                    385:     247     => '\\ensuremath\{\\div\}',
                    386:     'divide'=> '\\ensuremath\{\\div\}',
                    387:     248     => '{\\o}',
                    388:     'oslash'=> '{\\o}',
                    389:     249     => '\\\`{u}',
                    390:     'ugrave'=> '\\\`{u}',
                    391:     250     => '\\\'{u}',
                    392:     'uacute'=> '\\\'{u}',
                    393:     251     => '\\\^{u}',
                    394:     'ucirc' => '\\\^{u}',
                    395:     252     => '\\\"{u}',
                    396:     'uuml'  => '\\\"{u}',
                    397:     253     => '\\\'{y}',
                    398:     'yacute'=> '\\\'{y}',
                    399:     254     => '\\th',
                    400:     'thorn' => '\\th',
                    401:     255     => '\\\"{y}',
                    402:     'yuml'  => '\\\"{y}',
                    403: 
                    404:     # hbar entity number comes from the unicode charater:
                    405:     # see e.g. http://www.unicode.org/charts/PDF/U0100.pdf
                    406:     # ISO also documents a 'planck' entity.
                    407: 
                    408:     295     => '\\ensuremath\{\hbar\}',
                    409:     'plank' => '\\ensuremath\{\hbar\}',
                    410: 
                    411:     # Latin extended-A HTML 4.01 entities:
                    412: 
                    413:     338      => '\\OE',
                    414:     'OElig'  => '\\OE',
                    415:     339      => '\\oe',
                    416:     'oelig'  => '\\oe',
                    417:     352      => '\\v{S}',
                    418:     'Scaron' => '\\v{S}',
                    419:     353      => '\\v{s}',
                    420:     'scaron' => '\\v{s}',
                    421:     376      => '\\\"{Y}',
                    422:     'Yuml'   => '\\\"{Y}', 
                    423: 
                    424: 
                    425:     # Latin extended B HTML 4.01 entities
                    426: 
                    427:     402      => '\\ensuremath{f}',
                    428:     'fnof'   => '\\ensuremath{f}',
                    429: 
                    430:     # Spacing modifier letters:
                    431:     
                    432:     710      => '\^{}',
                    433:     'circ'   => '\^{}',
                    434:     732      => '\~{}',
                    435:     'tilde'  => '\~{}',
                    436: 
                    437:     # Greek uppercase:
                    438: 
                    439:     913      => '\\ensuremath\{\\mathrm\{A\}\}',
                    440:     'Alpha'  => '\\ensuremath\{\\mathrm\{A\}\}',
                    441:     914      => '\\ensuremath\{\\mathrm\{B\}\}',
                    442:     'Beta'   => '\\ensuremath\{\\mathrm\{B\}\}',
                    443:     915      => '\\ensuremath\{\\Gamma\}',
                    444:     'Gamma'  => '\\ensuremath\{\\Gamma\}',
                    445:     916      => '\\ensuremath\{\\Delta\}',
                    446:     'Delta'  => '\\ensuremath\{\\Delta\}',
                    447:     917      => '\\ensuremath\{\\mathrm\{E\}\}',
                    448:     'Epsilon'=> '\\ensuremath\{\\mathrm\{E\}\}',
                    449:     918      => '\\ensuremath\{\\mathrm\{Z\}\}',
                    450:     'Zeta'   => '\\ensuremath\{\\mathrm\{Z\}\}',
                    451:     919      => '\\ensuremath\{\\mathrm\{H\}\}',
                    452:     'Eta'    => '\\ensuremath\{\\mathrm\{H\}\}',
                    453:     920      => '\\ensuremath\{\\Theta\}',
                    454:     'Theta'  => '\\ensuremath\{\\Theta\}',
                    455:     921      => '\\ensuremath\{\\mathrm\{I\}\}',
                    456:     'Iota'   => '\\ensuremath\{\\mathrm\{I\}\}',
                    457:     922      => '\\ensuremath\{\\mathrm\{K\}\}',
                    458:     'Kappa'  => '\\ensuremath\{\\mathrm\{K\}\}',
                    459:     923      => '\\ensuremath\{\\Lambda\}',
                    460:     'Lambda' => '\\ensuremath\{\\Lambda\}',
                    461:     924      => '\\ensuremath\{\\mathrm\{M\}\}',
                    462:     'Mu'     => '\\ensuremath\{\\mathrm\{M\}\}',
                    463:     925      => '\\ensuremath\{\\mathrm\{N\}\}',
                    464:     'Nu'     => '\\ensuremath\{\\mathrm\{N\}\}',
                    465:     926      => '\\ensuremath\{\\mathrm\{\\Xi\}',
                    466:     'Xi'     => '\\ensuremath\{\\mathrm\{\\Xi\}',
                    467:     927      => '\\ensuremath\{\\mathrm\{O\}\}',
                    468:     'Omicron'=> '\\ensuremath\{\\mathrm\{O\}\}',
                    469:     928      => '\\ensuremath\{\\Pi\}',
                    470:     'Pi'     => '\\ensuremath\{\\Pi\}',
                    471:     929      => '\\ensuremath\{\\mathrm\{P\}\}',
                    472:     'Rho'    => '\\ensuremath\{\\mathrm\{P\}\}',
                    473:    
                    474:     # Skips 930
                    475: 
                    476:     931      => '\\ensuremath\{\Sigma\}',
                    477:     'Sigma'  => '\\ensuremath\{\Sigma\}',
                    478:     932      => '\\ensuremath\{\\mathrm\{T\}\}',
                    479:     'Tau'    => '\\ensuremath\{\\mathrm\{T\}\}',
                    480:     933      => '\\ensuremath\{\\Upsilon\}',
                    481:     'Upsilon'=> '\\ensuremath\{\\Upsilon\}',
                    482:     934      => '\\ensuremath\{\\Phi\}',
                    483:     'Phi'    => '\\ensuremath\{\\Phi\}',
                    484:     935      => '\\ensuremath\{\\mathrm\{X\}\}',
                    485:     'Chi'    => '\\ensuremath\{\\mathrm\{X\}\}',
                    486:     936      => '\\ensuremath\{\\Psi\}',
                    487:     'Psi'    => '\\ensuermath\{\\Psi\}',
                    488:     937      => '\\ensuremath\{\\Omega\}',
                    489:     'Omega'  => '\\ensuremath\{\\Omega\}',
                    490: 
                    491: 
                    492:     # Greek lowercase:
                    493: 
                    494:     945      => '\\ensuremath\{\\alpha\}',
                    495:     'alpha'  => '\\ensuremath\{\\alpha\}',
                    496:     946      => '\\ensuremath\{\\beta\}',
                    497:     'beta'   => '\\ensuremath\{\\beta\}',
                    498:     947      => '\\ensuremath\{\\gamma\}',
                    499:     'gamma'  => '\\ensuremath\{\\gamma\}',
                    500:     948      => '\\ensuremath\{\\delta\}',
                    501:     'delta'  => '\\ensuremath\{\\delta\}',
                    502:     949      => '\\ensuremath\{\\epsilon\}',
                    503:     'epsilon'=> '\\ensuremath\{\\epsilon\}',
                    504:     950      => '\\ensuremath\{\\zeta\}',
                    505:     'zeta'   => '\\ensuremath\{\\zeta\}',
                    506:     951      => '\\ensuremath\{\\eta\}',
                    507:     'eta'    => '\\ensuremath\{\\eta\}',
1.2       foxr      508:     952      => '\\ensuremath\{\\theta\}',
                    509:     'theta'  => '\\ensuremath\{\\theta\}',
                    510:     953      => '\\ensuremath\{\\iota\}',
                    511:     'iota'   => '\\ensuremath\{\\iota\}',
                    512:     954      => '\\ensuremath\{\\kappa\}',
                    513:     'kappa'  => '\\ensuremath\{\\kappa\}',
                    514:     955      => '\\ensuremath\{\\lambda\}',
                    515:     'lambda' => '\\ensuremath\{\\lambda\}',
                    516:     956      => '\\ensuremath\{\\mu\}',
                    517:     'mu'     => '\\ensuremath\{\\mu\}',
                    518:     957      => '\\ensuremath\{\\nu\}',
                    519:     'nu'     => '\\ensuremath\{\\nu\}',
                    520:     958      => '\\ensuremath\{\\xi\}',
                    521:     'xi'     => '\\ensuremath\{\\xi\}',
                    522:     959      => '\\ensuremath\{o\}',
                    523:     'omicron'=> '\\ensuremath\{o\}',
                    524:     960      => '\\ensuremath\{\\pi\}',
                    525:     'pi'     => '\\ensuremath\{\\pi\}',
                    526:     961      => '\\ensuremath\{\\rho\}',
                    527:     'rho'    => '\\ensuremath\{\\rho\}',
                    528:     962      => '\\ensuremath\{\\varsigma\}',
                    529:     'sigmaf' => '\\ensuremath\{\\varsigma\}',
                    530:     963      => '\\ensuremath\{\\sigma\}',
                    531:     'sigma'  => '\\ensuremath\{\\sigma\}',
                    532:     964      => '\\ensuremath\{\\tau\}',
                    533:     'tau'    => '\\ensuremath\{\\tau\}',
                    534:     965      => '\\ensuremath\{\\upsilon\}',
                    535:     'upsilon'=> '\\ensuremath\{\\upsilon\}',
                    536:     966      => '\\ensuremath\{\\phi\}',
                    537:     'phi'    => '\\ensuremath\{\\phi\}',
                    538:     967      => '\\ensuremath\{\\chi\}',
                    539:     'chi'    => '\\ensuremath\{\\chi\}',
                    540:     968      => '\\ensuremath\{\\psi\}',
                    541:     'psi'    => '\\ensuremath\{\\psi\}',
                    542:     969      => '\\ensuremath\{\\omega\}',
                    543:     'omega'  => '\\ensuremath\{\\omega\}',
                    544:     977      => '\\ensuremath\{\\vartheta\}',
                    545:     'thetasym'=>'\\ensuremath\{\\vartheta\}',
                    546:     978      => '\\ensuremath\{\\varUpsilon\}',
                    547:     'upsih'  => '\\ensuremath\{\\varUpsilon\}',
                    548:     982      => '\\ensuremath\{\\varpi\}',
                    549:     'piv'    => '\\ensuremath\{\\varpi\}',
                    550: 
                    551:     
                    552:     # The general punctuation set:
                    553: 
                    554:     8194,    => '\\hspace{.5em}',
                    555:     'enspc'  => '\\hspace{.5em}',
                    556:     8195     => '\\hspace{1.0em}',
                    557:     'emspc'  => '\\hspace{1.0em}',
                    558:     8201     => '\\hspace{0.167em}',
                    559:     'thinsp' => '\\hspace{0.167em}',
                    560:     8204     => '\{\}',
                    561:     'zwnj'   => '\{\}',
                    562:     8205     => '',
                    563:     'zwj'    => '',
                    564:     8206     => '',
                    565:     'lrm'    => '',
                    566:     8207     => '',
                    567:     'rlm'    => '',
                    568:     8211     => '--',
                    569:     'ndash'  => '--',
                    570:     8212     => '---',
                    571:     'mdash'  => '---',
                    572:     8216     => '`',
                    573:     'lsquo'  => '`',
                    574:     8217     => "'",
                    575:     'rsquo'  => "'",
                    576:     8218     => '\\quotesinglebase',
                    577:     'sbquo'  => '\\quotesinglebase',
                    578:     8220     => '``',
                    579:     'ldquo'  => '``',
                    580:     8221     => "''",
                    581:     'rdquo'  => "''",
                    582:     8222     => '\\quotedblbase',
                    583:     'bdquo'  => '\\quotedblbase',
                    584:     8224     => '\\dagger',
                    585:     'dagger' => '\\dagger',
                    586:     '8225'   => '\\ddag',
                    587:     'Dagger' => '\\ddag',
                    588:     8226     => '\\textbullet',
                    589:     'bull'   => '\\textbullet',
                    590:     8230     => '\\textellipsis',
                    591:     'hellep' => '\\textellipsis',
                    592:     8240     => '\\textperthousand',
                    593:     permil   => '\\textperthousand',
                    594:     8242     => '\\textquotesingle',
                    595:     'prime'  => '\\textquotesingle',
                    596:     8243     => '\\textquotedbl',
                    597:     'Prime'  => '\\textquotedbl',
                    598:     8249     => '\\guilsingleleft',
                    599:     'lsaquo' => '\\guilsingleleft',
                    600:     8250     => '\\guilsingleright',
                    601:     'rsaquo' => '\\guilsingleright',
                    602:     8254     => '\\textasciimacron',
                    603:     oline    => '\\textasciimacron',
                    604:     8260     => '\\textfractionsolidus',
                    605:     'frasl'  => '\\textfractionsolidus',
                    606:     8364     => '\\texteuro',
                    607:     'euro'   => '\\texteuro',
                    608: 
                    609:     # Letter like symbols
                    610: 
                    611:     
                    612:     8472     => '\\ensuremath\{\\wp\}',
                    613:     'weierp' => '\\ensuremath\{\\wp\}',
                    614:     8465     => '\\ensuremath\{\\Im\}',
                    615:     'image'  => '\\ensuremath\{\\Im\}',
                    616:     8476     => '\\ensuremath{\\Re\}',
                    617:     'real'   => '\\ensuremath{\\Re\}',
                    618:     8482     => '\\texttrademark',
                    619:     'trade'  => '\\texttrademark',
                    620:     8501     => '\\ensuremath{\\aleph\}',
                    621:     'alefsym'=> '\\ensuremath{\\aleph\}',
                    622: 
                    623:     # Arrows and then some (harpoons from Hon Kie).
                    624: 
                    625:     8592     => '\\textleftarrow',
                    626:     'larr'   => '\\textleftarrow',
                    627:     8593     => '\\textuparrow',
                    628:     'uarr'   => '\\textuparrow',
                    629:     8594     => '\\textrightarrow',
                    630:     'rarr'   => '\\textrightarrow',
                    631:     8595     => '\\textdownarrow',
                    632:     'darr'   => '\\textdownarrow',
                    633:     8596     => '\\ensuremath\{\\leftrightarrow\}',
                    634:     'harr'   => '\\ensuremath\{\\leftrightarrow\}',
                    635:     8598     => '\\ensuremath\{\\nwarrow\}',
                    636:     8599     => '\\ensuremath\{\\nearrow\}',
                    637:     8600     => '\\ensuremath\{\\searrow\}',
                    638:     8601     => '\\ensuremath\{\\swarrow\}',
                    639:     8605     => '\\ensuremath\{\\leadsto\}',
                    640:     8614     => '\\ensuremath\{\\mapsto\}',
                    641:     8617     => '\\ensuremath\{\\hookleftarrow\}',
                    642:     8618     => '\\ensuremath\{\\hookrightarrow\}',
                    643:     8629     => '\\ensuremath\{\\hookleftarrow\}', # not an exact match but best I know.
                    644:     'crarr'  => '\\ensuremath\{\\hookleftarrow\}', # not an exact match but best I know.
                    645:     8636     => '\\ensuremath\{\\leftharpoonup\}',
                    646:     8637     => '\\ensuremath\{\\leftharpoondown\}',
                    647:     8640     => '\\ensuremath\{\\rightharpoonup\}',
                    648:     8641     => '\\ensuremath\{\\rightharpoondown\}',
                    649:     8652     => '\\ensuremath\{\\rightleftharpoons\}',
                    650:     8656     => '\\ensuremath\{\\Leftarrow\}',
                    651:     'lArr'   => '\\ensuremath\{\\Leftarrow\}',
                    652:     8657     => '\\ensuremath\{\\Uparrow\}',
                    653:     'uArr'   => '\\ensuremath\{\\Uparrow\}',
                    654:     8658     => '\\ensuremath\{\\Rightarrow\}',
                    655:     'rArr'   => '\\ensuremath\{\\Rightarrow\}',
                    656:     8659     => '\\ensuremath\{\\Downarrow\}',
                    657:     'dArr'   => '\\ensuremath\{\\Downarrow\}',
                    658:     8660     => '\\ensuremath\{\\Leftrightarrow\}',
1.3       foxr      659:     'vArr'   => '\\ensuremath\{\\Updownarrow\}',
                    660:     8661     => '\\ensuremath\{\\Updownarrow\}',
                    661:     'lAarr'   => '\\ensuremath\{\\Lleftarrow\}',
                    662:     8666     => '\\ensuremath\{\\Lleftarrow\}',
                    663:     'rAarr'  => '\\ensuremath\{\\Rrightarrow\}',
                    664:     8667     => '\\ensuremath\{\\Rrightarrow\}',
                    665:     'rarrw'  => '\\ensuremath\{\\rightsquigarrow\}',
                    666:     8669     => '\\ensuremath\{\\rightsquigarrow\}',
                    667:     
1.1       foxr      668: 
1.2       foxr      669:     # Mathematical operators.
                    670: 	
1.1       foxr      671:     
1.3       foxr      672:     'forall' => '\\ensuremath\{\\forall\}',
                    673:     8704     => '\\ensuremath\{\\forall\}',
                    674:     'comp'   => '\\ensuremath\{\\complement\}',
                    675:     8705     => '\\ensuremath\{\\complement\}',
                    676:     'part'   => '\\ensuremath\{\\partial\}',
                    677:     8706     => '\\ensuremath\{\\partial\}',
                    678:     'exist'  => '\\ensuremath\{\\exists\}',
                    679:     8707     => '\\ensuremath\{\\exists\}',
                    680:     'nexist' => '\\ensuremath\{\\nexists\}',
                    681:     8708     => '\\ensuremath\{\\nexists\}',
                    682:     'empty'  => '\\ensuremath\{\\emptysset\}',
                    683:     8709     => '\\ensuremath\{\\emptysset\}',
                    684:     8710     => '\\ensuremath\{\\Delta\}',
                    685:     'nabla'  => '\\ensuremath\{\\nabla\}',
                    686:     8711     => '\\ensuremath\{\\nabla\}',
                    687:     'isin'   => '\\ensuremath\{\\in\}',
                    688:     8712     => '\\ensuremath\{\\in\}',
                    689:     'notin'  => '\\ensuremath\{\\notin\}',
                    690:     8713     => '\\ensuremath\{\\notin\}',
                    691:     ni       => '\\ensuremath\{\\ni\}',
                    692:     8715     => '\\ensuremath\{\\ni\}',
                    693:     8716     => '\\ensuremath\{\\not\\ni\}',
                    694:     'prod'   => '\\ensuremath\{\\prod\}',
                    695:     8719     => '\\ensuremath\{\\prod\}',
                    696:     8720     => '\\ensuremath\{\\coprod\}',
                    697:     'sum'    => '\\ensuremath\{\\sum\}',
                    698:     8721     => '\\ensuremath\{\\sum\}',
                    699:     'minus'  => '\\ensuremath\{-\}',
                    700:     8722     => '\\ensuremath\{-\}',
                    701:     8723     => '\\ensuremath\{\\mp\}',
                    702:     8724     => '\\ensuremath\{\\dotplus\}',
                    703:     8725     => '\\ensuremath\{\\diagup\}',
                    704:     8726     => '\\ensuremath\{\\smallsetminus\}',
                    705:     'lowast' => '\\ensuremath\{*\}',
                    706:     8727     => '\\ensuremath\{*\}',
                    707:     8728     => '\\ensuremath\{\\circ\}',
                    708:     8729     => '\\ensuremath\{\\bullet\}',
                    709:     'radic'  => '\\ensuremath\{\\surd\}',
                    710:     8730     => '\\ensuremath\{\\surd\}',
                    711:     8731     => '\\ensuremath\{\\sqrt[3]\{\}\}',
                    712:     8732     => '\\ensuremath\{\\sqrt[4]\{\}\}',
                    713:     'prop'   => '\\ensuremath\{\\propto\}',
                    714:     8733     => '\\ensuremath\{\\propto\}',
                    715:     'infin'  => '\\ensuremath\{\\infty\}',
                    716:     8734     => '\\ensuremath\{\\infty\}',
                    717:     'ang90'  => '\\ensuremath\{\\sqangle\}',
                    718:     8735     => '\\ensuremath\{\\sqangle\}',
                    719:     'ang'    => '\\ensuremath\{\\angle\}',
                    720:     8736     => '\\ensuremath\{\\angle\}',
                    721:     'angmsd' => '\\ensuremath\{\\measuredangle\}',
                    722:     8737     => '\\ensuremath\{\\measuredangle\}',
                    723:     'angsph' => '\\ensuremath\{\\sphiericalangle\}',
                    724:     8738     => '\\ensuremath\{\\sphiericalangle\}',
                    725:     8739     => '\\ensuremath\{\\vert\}',
                    726:     8740     => '\\ensuremath\{\\Vert\}',
                    727:     'and'    => '\\ensuremath\{\\land\}',
                    728:     8743     => '\\ensuremath\{\\land\}',
                    729:     'or'     => '\\ensuremath\{\\lor\}',
                    730:     8744     => '\\ensuremath\{\\lor\}',
                    731:     'cap'    => '\\ensuremath\{\\cap\}',
                    732:     8745     => '\\ensuremath\{\\cap\}',
                    733:     'cup'    => '\\ensuremath\{\\cup\}',
                    734:     8746     => '\\ensuremath\{\\cup\}',
                    735:     'int'    => '\\ensuremath\{\\int\}',
                    736:     8747     => '\\ensuremath\{\\int\}',
1.4       foxr      737:     'conint' => '\\ensuremath\{\\oint\}',
1.3       foxr      738:     8750     => '\\ensuremath\{\\oint\}',
                    739:     'there4' => '\\ensuremath\{\\therefore\}',
                    740:     8756     => '\\ensuremath\{\\therefore\}',
                    741:     'becaus' => '\\ensuremath\{\\because\}',
                    742:     8757     => '\\ensuremath\{\\because\}',
                    743:     8758     => '\\ensuremath\{:\}',
                    744:     8759     => '\\ensuremath\{::\}',
                    745:     'sim'    => '\\ensuremath\{\\sim\}',
                    746:     8764     => '\\ensuremath\{\\sim\}',
1.4       foxr      747:     8765     => '\\ensuremath\{\\backsim\}',
                    748:     'wreath' => '\\ensuremath\{\\wr\}',
                    749:     8768     => '\\ensuremath\{\\wr\}',
                    750:     'nsim'   => '\\ensuremath\{\\not\sim\}',
                    751:     8769     => '\\ensuremath\{\\not\sim\}',
                    752: #    'asymp'  => '\\ensuremath\{\\asymp\}',  &asymp; is actually a different glyph.
                    753:     8771     => '\\ensuremath\{\\asymp\}',
                    754:     8772     => '\\ensuremath\{\\not\\asymp\}',
                    755:     'cong'   => '\\ensuremath\{\\cong\}',
                    756:     8773     => '\\ensuremath\{\\cong\}',
                    757:     8775     => '\\ensuremath\{\\ncong\}',
                    758:     8778     => '\\ensuremath\{\\approxeq\}',
                    759:     8784     => '\\ensuremath\{\\doteq\}',
                    760:     8785     => '\\ensuremath\{\\doteqdot\}',
                    761:     8786     => '\\ensuremath\{\\fallingdotseq\}',
                    762:     8787     => '\\ensuremath\{\\risingdotseq\}',
                    763:     8788     => '\\ensuremath\{:=\}',
                    764:     8789     => '\\ensuremath\{=:\}',
                    765:     8790     => '\\ensuremath\{\\eqcirc\}',
                    766:     8791     => '\\ensuremath\{\\circeq\}',
                    767:     'wedgeq' => '\\ensuremath\{\\stackrel\{\\wedge\}\{=\}\}',
                    768:     8792     => '\\ensuremath\{\\stackrel\{\\wedge\}\{=\}\}',
                    769:     8794     => '\\ensuremath\{\\stackrel\{\\vee\}\{=\}\}',
                    770:     8795     => '\\ensuremath\{\\stackrel\{\\star}\{=\}\}',
                    771:     8796     => '\\ensuremath\{\\triangleeq\}',
                    772:     8797     => '\\ensuremath\{\\stackrel\{def\}\{=\}\}',
                    773:     8798     => '\\ensuremath\{\\stackrel\{m\}\{=\}\}',
                    774:     8799     => '\\ensuremath\{\\stackrel\{?\}\{=\}\}',
                    775:     'ne'     => '\\ensuremath\{\\neq\}',
                    776:     8800     => '\\ensuremath\{\\neq\}',
                    777:     'equiv'  => '\\ensuremath\{\\equiv\}',
                    778:     8801     => '\\ensuremath\{\\equiv\}',
                    779:     8802     => '\\ensuremath\{\\not\\equiv\}',
                    780:     'le'     => '\\ensuremath\{\\leq\}',
                    781:     8804     => '\\ensuremath\{\\leq\}',
                    782:     'ge'     => '\\ensuremath\{\\geq\}',
                    783:     8805     => '\\ensuremath\{\\geq\}',
                    784:     8806     => '\\ensuremath\{\\leqq\}',
                    785:     8807     => '\\ensuremath\{\\geqq\}',
                    786:     8810     => '\\ensuremath\{\\ll\}',
                    787:     8811     => '\\ensuremath\{\\gg\}',
                    788:     'twixt'  => '\\ensuremath\{\\between\}',
                    789:     8812     => '\\ensuremath\{\\between\}',
                    790:     8813     => '\\ensuremath\{\\not\\asymp\}',
                    791:     8814     => '\\ensuremath\{\\not<\}',
                    792:     8815     => '\\ensuremath\{\\not>\}',
                    793:     8816     => '\\ensuremath\{\\not\\leqslant\}',
                    794:     8817     => '\\ensuremath\{\\not\\geqslant\}',
                    795:     8818     => '\\ensuremath\{\\lessim\}',
                    796:     8819     => '\\ensuremath\{\\gtrsim\}',
                    797:     8820     => '\\ensuremath\{\\stackrel\{<\}\{>\}\}',
                    798:     8821     => '\\ensuremath\{\\stackrel\{>\}\{<\}\}',
                    799:     8826     => '\\ensuremath\{\\prec\}',
                    800:     8827     => '\\ensuremath\{\\succ\}',
                    801:     8828     => '\\ensuremath\{\\preceq\}',
                    802:     8829     => '\\ensuremath\{\\succeq\}',
                    803:     8830     => '\\ensuremath\{\\not\\prec\}',
                    804:     8831     => '\\ensuremath\{\\not\\succ\}',
                    805:     'sub'    => '\\ensuremath\{\\subset\}',
                    806:     8834     => '\\ensuremath\{\\subset\}',
                    807:     'sup'    => '\\ensuremath\{\\supset\}',
                    808:     8835     => '\\ensuremath\{\\supset\}',
                    809:     'nsub'   => '\\ensuremath\{\\not\\subset\}',
                    810:     8836     => '\\ensuremath\{\\not\\subset\}',
                    811:     8837     => '\\ensuremath\{\\not\\supset\}',
                    812:     'sube'   => '\\ensuremath\{\\subseteq\}',
                    813:     8838     => '\\ensuremath\{\\subseteq\}',
                    814:     'supe'   => '\\ensuermath\{\\supseteq\}',
                    815:     8839     => '\\ensuermath\{\\supseteq\}',
                    816:     8840     => '\\ensuremath\{\\nsubseteq\}',
                    817:     8841     => '\\ensuremath\{\\nsupseteq\}',
                    818:     8842     => '\\ensuremath\{\\subsetneq\}',
                    819:     8843     => '\\ensuremath\{\\supsetneq\}',
                    820:     8847     => '\\ensuremath\{\\sqsubset\}',
                    821:     8848     => '\\ensuremath\{\\sqsupset\}',
                    822:     8849     => '\\ensuremath\{\\sqsubseteq\}',
                    823:     8850     => '\\ensuremath\{\\sqsupseteq\}',
                    824:     8851     => '\\ensuremath\{\\sqcap\}',
                    825:     8852     => '\\ensuremath\{\\sqcup\}',
                    826:     'oplus'  => '\\ensuremath\{\\oplus\}',
                    827:     8853     => '\\ensuremath\{\\oplus\}',
                    828:     8854     => '\\ensuremath\{\\ominus\}',
                    829:     'otimes' => '\\ensuremath\{\\otimes\}',
                    830:     8855     => '\\ensuremath\{\\otimes\}',
                    831:     8856     => '\\ensuremath\{\\oslash\}',
                    832:     8857     => '\\ensuremath\{\\odot\}',
                    833:     8858     => '\\ensuremath\{\\circledcirc\}',
                    834:     8859     => '\\ensuremath\{\\circledast\}',
                    835:     8861     => '\\ensuremath\{\\ominus\}', # Close enough for government work.
                    836:     8862     => '\\ensuremath\{\\boxplus\}',
                    837:     8863     => '\\ensuremath\{\\boxminus\}',
                    838:     8864     => '\\ensuremath\{\\boxtimes\}',
                    839:     8865     => '\\ensuremath\{\\boxdot\}',
1.5     ! foxr      840:     'vdash'  => '\\ensuremath\{\\vdash\}',
        !           841:     8866     => '\\ensuremath\{\\vdash\}',
        !           842:     'dashv'  => '\\ensuremath\{\\dashv\}',
        !           843:     8867     => '\\ensuremath\{\\dashv\}',
        !           844:     'perp'   => '\\ensuremath\{\\perp\}',
        !           845:     8869     => '\\ensuremath\{\\perp\}',
        !           846:     8871     => '\\ensuremath\{\\models\}',
        !           847:     8872     => '\\ensuremath\{\\vDash\}',    
        !           848:     8873     => '\\ensuremath\{\\Vdash\}',
        !           849:     8874     => '\\ensuremath\{\\Vvdash\}',
        !           850:     8876     => '\\ensuremath\{\\nvdash\}',
        !           851:     8877     => '\\ensuremath\{\\nvDash\}',
        !           852:     8878     => '\\ensuremath\{\\nVdash\}',
        !           853:     8880     => '\\ensuremath\{\\prec\}',
        !           854:     8881     => '\\ensuremath\{\\succ\}',
        !           855:     8882     => '\\ensuremath\{\\vartriangleleft\}',
        !           856:     8883     => '\\ensuremath\{\\vartriangleright\}',
        !           857:     8884     => '\\ensuremath\{\\trianglelefteq\}',
        !           858:     8885     => '\\ensuremath\{\\trianglerighteq\}',
        !           859:     8891     => '\\ensuremath\{\\veebar\}',
        !           860:     8896     => '\\ensuremath\{\\land\}',
        !           861:     8897     => '\\ensuremath\{\\lor\}',
        !           862:     8898     => '\\ensuremath\{\\cap\}',
        !           863:     8899     => '\\ensuremath\{\\cup\}',
        !           864:     8900     => '\\ensuremath\{\\diamond\}',
        !           865:     'sdot'   => '\\ensuremath\{\\cdot\}',
        !           866:     8901     => '\\ensuremath\{\\cdot\}',
        !           867:     8902     => '\\ensuremath\{\\star\}',
        !           868:     8903     => '\\ensuremath\{\\divideontimes\}',
        !           869:     8904     => '\\ensuremath\{\\bowtie\}',
        !           870:     8905     => '\\ensuremath\{\\ltimes\}',
        !           871:     8906     => '\\ensuremath\{\\rtimes\}',
        !           872:     8907     => '\\ensuremath\{\\leftthreetimes\}',
        !           873:     8908     => '\\ensuremath\{\\rightthreetimes\}',
        !           874:     8909     => '\\ensuremath\{\\simeq\}',
        !           875:     8910     => '\\ensuremath\{\\curlyvee\}',
        !           876:     8911     => '\\ensuremath\{\\curlywedge\}',
        !           877:     8912     => '\\ensuremath\{\\Subset\}',
        !           878:     8913     => '\\ensuremath\{\\Supset\}',
        !           879:     8914     => '\\ensuremath\{\\Cap\}',
        !           880:     8915     => '\\ensuremath\{\\Cup\}',
        !           881:     8916     => '\\ensuremath\{\\pitchfork\}',
        !           882:     8918     => '\\ensuremath\{\\lessdot\}',
        !           883:     8919     => '\\ensuremath\{\\gtrdot\}',
        !           884:     8920     => '\\ensuremath\{\\lll\}',
        !           885:     8921     => '\\ensuremath\{\\ggg\}',
        !           886:     8922     => '\\ensuremath\{\\gtreqless\}',
        !           887:     8923     => '\\ensuremath\{\\lesseqgtr\}',
        !           888:     8924     => '\\ensuremath\{\\eqslantless\}',
        !           889:     8925     => '\\ensuremath\{\\eqslantgtr\}',
        !           890:     8926     => '\\ensuremath\{\\curlyeqprec\}',
        !           891:     8927     => '\\ensuremath\{\\curlyeqsucc\}',
        !           892:     8928     => '\\ensuremath\{\\not\\preccurlyeq\}',
        !           893:     8929     => '\\ensuremath\{\\not\\succurlyeq\}',
        !           894:     8930     => '\\ensuremath\{\\not\\sqsupseteq\}',
        !           895:     8931     => '\\ensuremath\{\\not\\sqsubseteq\}',
        !           896:     8938     => '\\ensuremath\{\\not\\vartriangleleft\}',
        !           897:     8939     => '\\ensuremath\{\\not\vartriangleright\}',
        !           898:     8940     => '\\ensuremath\{\\not\trianglelefteq\}',
        !           899:     8941     => '\\ensuremath\{\\not\trianglerighteq\}',
        !           900:     8942     => '\\ensuremath\{\\vdots\}',
        !           901:     8960     => '\\ensuremath\{\\varnothing\}',
        !           902:     'lceil'  => '\\ensuremath\{\\lceil\}',
        !           903:     8968     => '\\ensuremath\{\\lceil\}',
        !           904:     'rceil'  => '\\ensuremath\{\\rceil\}',
        !           905:     8969     => '\\ensuremath\{\\rceil\}',
        !           906:     'lfloor' => '\\ensuremath\{\\lfloor\}',
        !           907:     8970     => '\\ensuremath\{\\lfloor\}',
        !           908:     'rfloor' => '\\ensuremath\{\\rfloor}',
        !           909:     8971     => '\\ensuremath\{\\rfloor}',
        !           910:     'lang'   => '\\ensuremath\{\\langle\}',
        !           911:     9001     => '\\ensuremath\{\\langle\}',
        !           912:     'rang'   => '\\ensuremath\{\\rangle\}',
        !           913:     9002     => '\\ensuremath\{\\rangle\}',
        !           914:     'loz'    => '\\ensuremath\{\\lozenge\}',
        !           915:     9674     => '\\ensuremath\{\\lozenge\}',
        !           916:     'spades' => '\\ensuremath\{\\spadesuit\}',
        !           917:     9824     => '\\ensuremath\{\\spadesuit\}',
        !           918:     9825     => '\\ensuremath\{\\heartsuit\}',
        !           919:     9826     => '\\ensuremath\{\\diamondsuit\}',
        !           920:     'clubs'  => '\\ensuremath\{\\clubsuit\}',
        !           921:     9827     => '\\ensuremath\{\\clubsuit\}',
        !           922:     'diams'  => '\\ensuremath\{\\blacklozenge\}',
        !           923:     9830     => '\\ensuremath\{\\blacklozenge\}'
1.3       foxr      924:     
1.4       foxr      925: };
1.3       foxr      926: 
1.4       foxr      927: # 
                    928: #  Convert a numerical entity (that does not exist in our hash)
                    929: #  to its UTF-8 equivalent representation.
                    930: #  This allows us to support, to some extent, any entity for which
                    931: #  dvipdf can find a gylph (given that LaTeX is now UTF-8 clean).
                    932: #
1.5     ! foxr      933: # Parameters:
        !           934: #   unicode  - The unicode for the character.  This is assumed to
        !           935: #              be a decimal value
        !           936: # Returns:
        !           937: #   The UTF-8 equiavalent of the value.
        !           938: #
1.4       foxr      939: sub entity_to_utf8 {
1.5     ! foxr      940:     my ($unicode) = @_;
        !           941: 
        !           942:     return pack("U", $unicode);
1.4       foxr      943: }
                    944: 
                    945: 
                    946: #
                    947: #  Convert an entity to the corresponding LateX if possible.
                    948: #  If not possible, and the entity is numeric,
                    949: #  the entity is treated like a Unicode character and converted
                    950: #  to UTF-8 which should display as long as dvipdf can find the
                    951: #  appropriate glyph.
                    952: #
1.5     ! foxr      953: #  The entity is assumed to have already had the 
        !           954: #  &# ;  or & ; removed
        !           955: #
        !           956: # Parameters:
        !           957: #   entity    - Name of entity to convert.
        !           958: # Returns:
        !           959: #  One of the following:
        !           960: #   - Latex string that produces the entity.
        !           961: #   - UTF-8 equivalent of a numeric entity for which we don't have a latex string.
        !           962: #   - ' ' for text entities for which there's no latex equivalent.
        !           963: #
1.4       foxr      964: sub entity_to_latex {
1.5     ! foxr      965:     my ($entity) = @_;
        !           966: 
        !           967:     # Try to look up the entity (text or numeric) in the hash:
        !           968: 
        !           969:     my $latex = $entities{$entity};
        !           970:     if ($latex) {
        !           971: 	return $latex;
        !           972:     }
        !           973:     # If the text is purely numeric we can do the UTF-8 conversion:
        !           974: 
        !           975:     if ($entity =~ /^\d$/) {
        !           976: 	return &entity_to_utf8($entity);
        !           977:     }
        !           978:     #  Can't do the conversion ...
        !           979: 
        !           980:     return " ";
        !           981: }
        !           982: 
        !           983: #
        !           984: #  Convert all the entities in a string.
        !           985: #  We locate all the entities, pass them into entity_to_latex and 
        !           986: #  and replace occurences in the input string.
        !           987: #  The assumption is that there are few entities in any string/document
        !           988: #  so this looping is not too bad.  The advantage of looping vs. regexping is
        !           989: #  that we now can use lookup tables for the translation in entity_to_latex above.
        !           990: #
        !           991: # Parameters:
        !           992: #   input   - Input string/document
        !           993: # Returns
        !           994: #   input with entities replaced by latexable stuff (UTF-8 encodings or
        !           995: #   latex control strings to produce the entity.
        !           996: #
        !           997: #
        !           998: sub replace_entities {
        !           999:     my ($input)  = @_;
1.4       foxr     1000: }
1.3       foxr     1001: 

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