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