source: trunk/Textoidl/textable.pro @ 69

Last change on this file since 69 was 47, checked in by pinsard, 18 years ago

upgrade of TEXT2IDL/TEXtoIDL according to cerbere.lodyc.jussieu.fr: /usr/home/smasson/SAXO_RD/ : files

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 8.4 KB
Line 
1;
2;+
3; NAME:
4;       TEXTABLE
5; PURPOSE:
6;       Returns a translation table from TeX to IDL.
7; CATEGORY:
8;       text/strings
9; CALLING SEQUENCE:
10;       table = textable()
11; INPUTS:
12;       None
13; KEYWORD PARAMETERS:
14;       /POSTSCRIPT -- If set, return postscript translation
15;                      table rather than vector fonts table.
16;                      Default is translations for vector
17;                      fonts.
18;       /HELP       -- Print help and exit.
19; OUTPUTS:
20;       table -- a 2D text array.  table(0,*) contains          out
21;                the words to be translated away, table(1,*)
22;                contains the words to translate them to.   
23; COMMON BLOCKS:
24; SIDE EFFECTS:
25; NOTES:
26;       To find out what TeX sequences are available, look at
27;       table(0,*).
28; EXAMPLE:
29; MODIFICATION HISTORY:
30;       $Id$
31;       $Log: textable.pro,v $
32;       Revision 1.8  2004/06/15 17:25:54  mcraig
33;       Fixed bug in regular expression, changed array notation to square brackets
34;
35;       Revision 1.7  1996/07/22 23:56:08  mcraig
36;       Added \vartheta.
37;
38;       Revision 1.6  1996/07/12 21:31:42  mcraig
39;       Fixed \varphi in vector font, added \circ.
40;
41;       Revision 1.5  1996/06/14 20:00:27  mcraig
42;       Updated Copyright info.
43;
44;       Revision 1.4  1996/05/09 00:22:17  mcraig
45;       Added command to return to previous font after switching to Greek or
46;       symbol font.
47;
48;       Revision 1.3  1996/02/08 19:49:35  mcraig
49;       Removed control sequence \perp because the postscript code for it is '^'.
50;
51;       Revision 1.2  1996/02/08 18:53:38  mcraig
52;       Added translations for PostScript fonts, and added several new TeX
53;       control sequences.
54;
55;       Revision 1.1  1996/01/31 18:47:37  mcraig
56;       Initial revision
57;
58; RELEASE:
59;       $Name: Rel_2_1_2 $
60;
61; COPYRIGHT:
62;  Copyright (C) 1996 The Regents of the University of California, All
63;  Rights Reserved.  Written by Matthew W. Craig.
64;  See the file COPYRIGHT for restrictions on distrubting this code.
65;  This code comes with absolutely NO warranty; see DISCLAIMER for details.
66;-
67;
68FUNCTION textable, POSTSCRIPT=ps, VECTOR=vec,  HELP=Help
69
70; Return to caller if error.
71    On_error, 2
72
73; Print help if necessary.
74    IF keyword_set(Help)  THEN BEGIN
75        offset = '   '
76        print, offset+'Returns a translation table from TeX to IDL.'
77        print, offset+'table = textable()'
78        print, offset+'Keywords:'
79        print, offset+offset+'/POSTSCRIPT -- If set, return postscript translation'
80        print, offset+offset+'               table rather than vector fonts table.'
81        print, offset+offset+'               Default is translations for vector'
82        print, offset+offset+'               fonts.'
83        print, offset+offset+'/HELP       -- Print help and exit.'
84        print, offset+'Outputs:'
85        print, offset+offset+'table -- a 2D text array.  table(0,*) contains          out'
86        print, offset+offset+'         the words to be translated away, table(1,*)'
87        print, offset+offset+'         contains the words to translate them to.'
88        print, offset+'Notes:'
89        print, offset+offset+'To find out what TeX sequences are available, look at'
90        print, offset+offset+'table(0,*).'
91    ENDIF
92
93    VECFONT=1                   ; index of vector font in translation table
94    PSFONT=2                    ; index of postscript font in trans table
95    IF keyword_set(ps) THEN FontSelection=PSFONT ELSE FontSelection=VECFONT
96
97;  Set IDL font sequence needed to switch to Greek letters.
98    GreekFont = strarr(3)
99    GreekFont[VECFONT] = '!7'
100    GreekFont[PSFONT] = '!M'
101
102;  Set IDL font sequence needed to switch to special symbol font.
103    SymbolFont = strarr(3)
104    SymbolFont[VECFONT] = '!M'
105    SymbolFont[PSFONT] = '!M'
106
107;  Set IDL font sequence needed to switch back to initial font.
108    PreviousFont = strarr(3)
109    PreviousFont[VECFONT] = '!X'
110    PreviousFont[PSFONT] = '!X'
111
112;lowercase Greek --
113;    Note there is some trickery involved in getting \varphi
114;    to work in the vector fonts, because it is actually
115;    a member of the symbol font set, not the Greek font
116;    set.  Go figure.  Solution is just to make the vector
117;    character a switch to symbol, the proper character from
118;    that font, and a switch back out of symbol.  Same comment holds
119;    for \vartheta.
120;;        TeX SEQUENCE       VECTOR       POSTSCRIPT
121    LowercaseGreek = [$
122        [ '\alpha',             'a'     ,     'a'     ],$
123        [ '\beta',              'b'     ,     'b'     ],$
124        [ '\gamma',             'c'     ,     'g'     ],$
125        [ '\delta',             'd'     ,     'd'     ],$
126        [ '\epsilon',           'e'     ,     'e'     ],$
127        [ '\zeta',              'f'     ,     'z'     ],$
128        [ '\eta',               'g'     ,     'h'     ],$
129        [ '\theta',             'h'     ,     'q'     ],$
130        [ '\iota',              'i'     ,     'i'     ],$
131        [ '\kappa',             'j'     ,     'k'     ],$
132        [ '\lambda',            'k'     ,     'l'     ],$
133        [ '\mu',                'l'     ,     'm'     ],$
134        [ '\nu',                'm'     ,     'n'     ],$
135        [ '\xi',                'n'     ,  '!S !Rx'   ],$
136        [ '\pi',                'p'     ,     'p'     ],$
137        [ '\rho',               'q'     ,     'r'     ],$
138        [ '\sigma',             'r'     ,     's'     ],$
139        [ '\tau',               's'     ,     't'     ],$
140        [ '\upsilon',           't'     ,     'u'     ],$
141        [ '\phi',               'u'     ,     'f'     ],$
142        [ '\chi',               'v'     ,     'c'     ],$
143        [ '\psi',               'w'     ,     'y'     ],$
144        [ '\omega',             'x'     ,     'w'     ],$
145        [ '\varpi',             'p'     ,     'v'     ],$
146        [ '\varepsilon',        'e'     ,     'e'     ],$
147        [ '\varphi',    $
148            SymbolFont(VECFONT)+'P'+PreviousFont(VECFONT) $
149                                        ,     'j'     ],$
150        [ '\vartheta',  $
151            SymbolFont(VECFONT)+'t'+PreviousFont(VECFONT) $
152                                        ,     'J'     ]$
153                             ]
154;Uppercase Greek --
155;;        TeX SEQUENCE        VECTOR          POSTSCRIPT
156    UppercaseGreek = [$
157        [ '\Gamma',             'C'   ,         'G'         ],$
158        [ '\Delta',             'D'   ,         'D'         ],$
159        [ '\Theta',             'H'   ,         'Q'         ],$
160        [ '\Lambda',            'K'   ,         'L'         ],$
161        [ '\Xi',                'N'   ,      '!S !RX'       ],$
162        [ '\Pi',                'P'   ,         'P'         ],$
163        [ '\Sigma',             'R'   ,         'S'         ],$
164        [ '\Upsilon',           'T'   ,  string(byte(161))  ],$
165        [ '\Phi',               'U'   ,         'F'         ],$
166        [ '\Psi',               'W'   ,         'Y'         ],$
167        [ '\Omega',             'X'   ,         'W'         ]$
168                           ]
169;Special symbols --
170;  NOTES -- You must leave \infty before \in in the translatation
171;           table to avoid having the \in part of \infty translated
172;           away.
173;           
174;           DO NOT blindly add the control sequence \perp.  Its
175;           PostScript code is '^', which leads to thing being
176;           interpreted as superscripts which shouldn't be.
177;
178;;        TeX SEQUENCE        VECTOR          POSTSCRIPT
179    Symbols = [$
180        [ '\aleph',             '@'   ,  string(byte(192))  ],$
181        [ '\ast',               '*'   ,         '*'         ],$
182        [ '\cap',               '3'   ,  string(byte(199))  ],$
183        [ '\cdot',              '.'   ,  string(byte(215))  ],$
184        [ '\cup',               '1'   ,  string(byte(200))  ],$
185        [ '\exists',            'E'   ,         '$'         ],$
186        [ '\infty',             '$'   ,  string(byte(165))  ],$
187        [ '\in',                'e'   ,  string(byte(206))  ],$
188        [ '\equiv',             ':'   ,  string(byte(186))  ],$
189        [ '\pm',                '+'   ,  string(byte(177))  ],$
190        [ '\div',               '/'   ,  string(byte(184))  ],$
191        [ '\subset',            '0'   ,  string(byte(204))  ],$
192        [ '\superset',          '2'   ,  string(byte(201))  ],$
193        [ '\leftarrow',         '4'   ,  string(byte(172))  ],$
194        [ '\downarrow',         '5'   ,  string(byte(175))  ],$
195        [ '\rightarrow',        '6'   ,  string(byte(174))  ],$
196        [ '\uparrow',           '7'   ,  string(byte(173))  ],$
197        [ '\neq',               '='   ,  string(byte(185))  ],$
198        [ '\propto',            '?'   ,  string(byte(181))  ],$
199        [ '\sim',               'A'   ,  string(byte(126))  ],$
200        [ '\partial',           'D'   ,  string(byte(182))  ],$
201        [ '\nabla',             'G'   ,  string(byte(209))  ],$
202        [ '\angle',             'a'   ,  string(byte(208))  ],$
203        [ '\times',             'X'   ,  string(byte(180))  ],$
204        [ '\geq',               'b'   ,  string(byte(179))  ],$
205        [ '\leq',               'l'   ,  string(byte(163))  ],$
206        [ "\'",                 "'"   ,  string(byte(162))  ],$
207        [ '\prime',             "'"   ,  string(byte(162))  ],$
208        [ '\circ',              "%"   ,  string(byte(176))  ]$
209                          ]
210    LowercaseGreek[1,*] = $
211      GreekFont[FontSelection] $
212      + LowercaseGreek[FontSelection,*] $
213      + PreviousFont[FontSelection]
214    UppercaseGreek[1,*] = $
215      GreekFont[FontSelection] +$
216      UppercaseGreek[FontSelection,*] $
217      + PreviousFont[FontSelection]
218    Symbols[1,*] = $
219      SymbolFont[FontSelection] $
220      + Symbols[FontSelection,*] $
221      + PreviousFont[FontSelection]
222
223    TranslationTable = [[LowercaseGreek],[UppercaseGreek],[Symbols]]
224    return,TranslationTable[0:1,*]
225
226END
227
Note: See TracBrowser for help on using the repository browser.