Rev 5504 | Rev 5523 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5504 | Rev 5512 | ||
---|---|---|---|
Line 88... | Line 88... | ||
88 | 88 | ||
89 | ovlstrcpy(buf,p); strip_trailing_spaces(buf); singlespace(buf); |
89 | ovlstrcpy(buf,p); strip_trailing_spaces(buf); singlespace(buf); |
90 | p1=getvar("insmath_slashsubst"); |
90 | p1=getvar("insmath_slashsubst"); |
91 | if(p1!=NULL && strstr(p1,"yes")!=NULL) slashsubst(buf); // substitute backslash parameters |
91 | if(p1!=NULL && strstr(p1,"yes")!=NULL) slashsubst(buf); // substitute backslash parameters |
92 | f=instex_check_static(buf); //decide if image already exists |
92 | f=instex_check_static(buf); //decide if image already exists |
93 | substit(buf); |
93 | substit(buf);//substitute the variables |
94 | /* here replace .. by , : i=1 .. 5 -> i=1, 5 !*/ |
94 | /* here replace .. by , : i=1 .. 5 -> i=1, 5 !*/ |
95 | for(pp=strstr(buf,".."); pp!=NULL; pp=strstr(pp,"..")) { |
95 | for(pp=strstr(buf,".."); pp!=NULL; pp=strstr(pp,"..")) { |
96 | if(*(pp+2)=='.' || *(pp+2)==',') { |
96 | if(*(pp+2)=='.' || *(pp+2)==',') { |
97 | do pp++; while(*pp=='.'); continue; |
97 | do pp++; while(*pp=='.'); continue; |
- | 98 | } |
|
- | 99 | *pp=','; *(pp+1)=' '; |
|
98 | } |
100 | } |
99 |
|
101 | /* decide if it should be tex */ |
100 | } |
- | |
101 | ts=0; if(strchr(buf,'\\') || strchr(buf,'}')) ts=1; |
102 | ts=0; if(strchr(buf,'\\') || strchr(buf,'}')) ts=1; |
- | 103 | /* if not and if variable insmath_rawmath is there, do rawmath */ |
|
102 | rawmathready=0; |
104 | rawmathready=0; |
- | 105 | if(!ts) { /* should not be tex, looking if rawmath is asked */ |
|
103 | pp=getvar("insmath_rawmath"); |
106 | pp=getvar("insmath_rawmath"); |
104 | if(pp!=NULL && strstr(pp,"yes")!=NULL) { |
107 | if(pp!=NULL && strstr(pp,"yes")!=NULL) { |
105 | rawmath(buf); rawmathready=1; |
108 | rawmath(buf); rawmathready=1; |
106 | } |
109 | } |
107 | } |
110 | } |
108 | if(ts || mathalign_base==2 || |
111 | if(ts || mathalign_base==2 || |
109 | (strchr(buf,'[')!=NULL && |
112 | (strchr(buf,'[')!=NULL && |
110 | (strchr(buf,',')!=NULL || strchr(buf,';')!=NULL))) { |
113 | (strchr(buf,',')!=NULL || strchr(buf,';')!=NULL))) { |
111 | char alignbak[2048]; |
114 | char alignbak[2048]; |
112 | tex: instex_style="$$"; |
115 | tex: instex_style="$$"; |
113 | if(!ts) texmath(buf); // in particular, reinterpret variables and some fonts or functions as alpha pi cos |
116 | if(!ts) texmath(buf); // possibly tex - in particular, reinterpret variables and some fonts or functions as alpha pi cos |
114 | // see list in texmath.c : tmathfn |
117 | // see list in texmath.c : tmathfn |
115 | else {// need to interpret x y z |
118 | else {// need to interpret x y z |
116 | char *p1; |
119 | char *p1; |
117 | p1=find_word_start(buf); |
120 | p1=find_word_start(buf); |
118 | if(*p1=='\\') { |
121 | if(*p1=='\\') { |
119 | int i; |
122 | int i; |
120 | char *pt; |
123 | char *pt; |
121 | for(i=1;isalnum(p1[i]);i++); |
124 | for(i=1;isalnum(p1[i]);i++); /* find an alphanumeric string beginning by \\ */ |
122 | if(p1[i]==0 && (pt=mathfont(p1))!=NULL) { |
125 | if(p1[i]==0 && (pt=mathfont(p1))!=NULL) { /* find some mathfont as \calB */ |
123 | _output_(pt); *p=0; return; |
126 | _output_(pt); *p=0; return; |
124 | } |
127 | } |
125 | } |
128 | } |
126 | } |
129 | } |
127 | if(mathalign_base==2 && mathml(buf)) {*p=0; return;} |
130 | if(mathalign_base==2 && mathml(buf)) {*p=0; return;} |
- | 131 | /* only for images*/ |
|
128 | pp=getvar("ins_align"); |
132 | pp=getvar("ins_align"); |
129 | if(pp!=NULL) mystrncpy(alignbak,pp,sizeof(alignbak)); |
133 | if(pp!=NULL) mystrncpy(alignbak,pp,sizeof(alignbak)); |
130 | setvar("ins_align","middle"); |
134 | setvar("ins_align","middle"); |
131 | mystrncpy(ins_alt,buf,sizeof(ins_alt)); |
135 | mystrncpy(ins_alt,buf,sizeof(ins_alt)); |
132 | if(f==NULL) { |
136 | if(f==NULL) { |
Line 137... | Line 141... | ||
137 | } |
141 | } |
138 | instex_style=""; |
142 | instex_style=""; |
139 | if(alignbak[0]) setvar("ins_align",alignbak); |
143 | if(alignbak[0]) setvar("ins_align",alignbak); |
140 | return; |
144 | return; |
141 | } |
145 | } |
142 |
|
146 | /* end of the only for images*/ |
143 | for(pp=find_mathvar_start(buf); *pp; pp=find_mathvar_start(pe)) { |
147 | for(pp=find_mathvar_start(buf); *pp; pp=find_mathvar_start(pe)) { |
144 | pe=find_mathvar_end(pp); n=pe-pp; |
148 | pe=find_mathvar_end(pp); n=pe-pp; |
145 | if(!isalpha(*pp) || n<3 || n>16) continue; |
149 | if(!isalpha(*pp) || n<3 || n>16) continue; |
146 | memmove(nbuf,pp,n); nbuf[n]=0; |
150 | memmove(nbuf,pp,n); nbuf[n]=0; |
147 | if(wordchr(tnames,nbuf)!=NULL) goto tex; |
151 | if(wordchr(tnames,nbuf)!=NULL) goto tex; |
148 | } |
152 | } |
149 | - | ||
- | 153 | /* only for html in case where gifs is activated ?? look for / ?? */ |
|
150 | for(pp=strchr(buf,'/'); pp!=NULL && *find_word_start(pp+1)!='('; |
154 | for(pp=strchr(buf,'/'); pp!=NULL && *find_word_start(pp+1)!='('; |
151 | pp=strchr(pp+1,'/')); |
155 | pp=strchr(pp+1,'/')); |
152 | if(pp!=NULL) goto tex; |
156 | if(pp!=NULL) goto tex; /* so a/4 can be reinterpreted as {1 over 4 } a */ |
153 | if(rawmathready) rawmath_easy=1; |
157 | if(rawmathready) rawmath_easy=1; |
154 | for(pp=strchr(buf,'<'); pp!=NULL; pp=strchr(pp+1,'<')) |
158 | for(pp=strchr(buf,'<'); pp!=NULL; pp=strchr(pp+1,'<')) |
155 | string_modify(buf,pp,pp+1,"<"); |
159 | string_modify(buf,pp,pp+1,"<"); |
156 | for(pp=strchr(buf,'>'); pp!=NULL; pp=strchr(pp+1,'>')) |
160 | for(pp=strchr(buf,'>'); pp!=NULL; pp=strchr(pp+1,'>')) |
157 | string_modify(buf,pp,pp+1,">"); |
161 | string_modify(buf,pp,pp+1,">"); |