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