Changeset 47 for trunk/ToBeReviewed/TEXtoIDL/textoidl.pro
- Timestamp:
- 05/09/06 11:13:01 (18 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/ToBeReviewed/TEXtoIDL/textoidl.pro
r44 r47 41 41 ; $Id$ 42 42 ; $Log: textoidl.pro,v $ 43 ; Revision 1.7 2004/06/15 17:25:54 mcraig 44 ; Fixed bug in regular expression, changed array notation to square brackets 45 ; 46 ; Revision 1.6 2004/01/11 01:49:00 mcraig 47 ; Changed format of one array to newer [] style to avoidf conflict with function name in astro library. 48 ; 49 ; Revision 1.5 2001/11/23 21:10:55 mcraig 50 ; Added backslash '\' to tex sequences in translation table to protect them during regexp search in strsplit. 51 ; 43 52 ; Revision 1.4 1996/06/14 20:00:27 mcraig 44 53 ; Updated Copyright info. … … 54 63 ; 55 64 ; RELEASE: 56 ; $Name: Rel_ 1_2 $65 ; $Name: Rel_2_1_2 $ 57 66 ; 58 67 ; COPYRIGHT: … … 91 100 IF keyword_set (tex_seq) THEN BEGIN 92 101 table=textable() 93 return,table (0,*)102 return,table[0,*] 94 103 ENDIF 95 104 … … 123 132 ; around them if they are unbraced. This will have the result the 124 133 ; it will be difficult to use \ as a sub/superscript. Get over it. 125 strn = strtrans(strn, '^'+table(0, *), '^{'+table(0, *)+'}') 126 strn = strtrans(strn, '_'+table(0, *), '_{'+table(0, *)+'}') 134 135 ; V2.11 Must include the '\' in from of translation table TeX 136 ; sequences to ensure that strsplit properly treats the '\' in the 137 ; TeX sequence. Since strsplit is doing a regexp replace, and '\' is 138 ; special in regexps, need to escape it. 139 strn = strtrans(strn, '\^'+'\'+table[0, *], '^{'+table[0, *]+'}') 140 strn = strtrans(strn, '\_'+'\'+table[0, *], '_{'+table[0, *]+'}') 127 141 128 142 ; First we translate Greek letters and the like. This makes guessing 129 143 ; alignment of sub/superscripts easier, as all special characters will then 130 144 ; be one character long. 131 strn = strtrans(strn, table(0, *), table(1, *))132 145 133 FOR i = 0L, n_elements(strn)-1 DO $ 134 strn(i) = translate_sub_super(strn(i)) ; Take care of sub/superscripts 146 ; V2.11 Must include the '\' in from of translation table TeX 147 ; sequences to ensure that strsplit properly treats the '\' in the 148 ; TeX sequence. Since strsplit is doing a regexp replace, and '\' is 149 ; special in regexps, need to escape it. 150 strn = strtrans(strn, '\'+table[0, *], table[1, *]) 151 152 153 FOR i = 0L, n_elements(strn)-1 DO BEGIN 154 strn[i] = translate_sub_super(strn[i]) ; Take care of sub/superscripts 155 ENDFOR 135 156 136 157 return,strn
Note: See TracChangeset
for help on using the changeset viewer.