| 1 |
% slatex.sty |
| 2 |
% SLaTeX v. 2.2 |
| 3 |
% style file to be used in (La)TeX when using SLaTeX |
| 4 |
% (c) Dorai Sitaram, Rice U., 1991, 1994 |
| 5 |
|
| 6 |
% This file (or a soft link to it) should be in some |
| 7 |
% directory in your TEXINPUTS path (i.e., the one |
| 8 |
% (La)TeX scours for \input or \documentstyle option |
| 9 |
% files). |
| 10 |
|
| 11 |
% Do not attempt to debug this file, since the results |
| 12 |
% are not transparent just to (La)TeX. The Scheme part |
| 13 |
% of SLaTeX depends on information laid out here -- so |
| 14 |
% (La)TeX-minded debugging of this file will almost |
| 15 |
% inevitably sabotage SLaTeX. |
| 16 |
|
| 17 |
% It's possible you don't find the default style set |
| 18 |
% out here appealing: e.g., you may want to change the |
| 19 |
% positioning of displayed code; change the fonts for |
| 20 |
% keywords, constants, and variables; add new keywords, |
| 21 |
% constants, and variables; use your names instead of |
| 22 |
% the provided \scheme, [\begin|\end]{schemedisplay}, |
| 23 |
% [\begin|\end]{schemebox}, (or \[end]schemedisplay, |
| 24 |
% \[end]schemebox for TeX), which might be seem too |
| 25 |
% long or unmnemonic, and many other things. The clean |
| 26 |
% way to do these things is outlined in the |
| 27 |
% accompanying manual, slatex-d.tex. This way is both |
| 28 |
% easier than messing with this .sty file, and safer |
| 29 |
% since you will not unwittingly break SLaTeX. |
| 30 |
|
| 31 |
%%% |
| 32 |
|
| 33 |
% to prevent loading slatex.sty more than once |
| 34 |
|
| 35 |
\ifx\slatexignorecurrentfile\UNDEFINED |
| 36 |
\else\endinput\fi |
| 37 |
|
| 38 |
% use \slatexignorecurrentfile to disable slatex for |
| 39 |
% the current file. (Unstrangely, the very definition |
| 40 |
% disables slatex for the rest of _this_ file, slatex.sty.) |
| 41 |
|
| 42 |
\def\slatexignorecurrentfile{} |
| 43 |
|
| 44 |
% checking whether we're using LaTeX or TeX? |
| 45 |
|
| 46 |
\newif\ifusinglatex |
| 47 |
\ifx\newenvironment\UNDEFINED\usinglatexfalse\else\usinglatextrue\fi |
| 48 |
|
| 49 |
% make @ a letter for TeX |
| 50 |
\ifusinglatex\relax\else |
| 51 |
\edef\atcatcodebeforeslatex{\the\catcode`@} |
| 52 |
\catcode`@11 |
| 53 |
\fi |
| 54 |
|
| 55 |
% identification of TeX/LaTeX style for schemedisplay. |
| 56 |
% Do \defslatexenvstyle{tex} to get TeX environment |
| 57 |
% style in LaTeX |
| 58 |
\def\defslatexenvstyle#1{\gdef\slatexenvstyle{#1}} |
| 59 |
|
| 60 |
\ifusinglatex\defslatexenvstyle{latex}\else\defslatexenvstyle{tex}\fi |
| 61 |
|
| 62 |
% TeX doesn't have sans-serif; use roman instead |
| 63 |
\ifx\sf\UNDEFINED\def\sf{\rm}\fi |
| 64 |
|
| 65 |
% tabbing from plain TeX |
| 66 |
% |
| 67 |
\newif\ifus@ \newif\if@cr |
| 68 |
\newbox\tabs \newbox\tabsyet \newbox\tabsdone |
| 69 |
% |
| 70 |
\def\cleartabs{\global\setbox\tabsyet\null \setbox\tabs\null} |
| 71 |
\def\settabs{\setbox\tabs\null \futurelet\next\sett@b} |
| 72 |
\let\+=\relax % in case this file is being read in twice |
| 73 |
\def\sett@b{\ifx\next\+\let\next\relax |
| 74 |
\def\next{\afterassignment\s@tt@b\let\next}% |
| 75 |
\else\let\next\s@tcols\fi\next} |
| 76 |
\def\s@tt@b{\let\next\relax\us@false\m@ketabbox} |
| 77 |
\def\tabalign{\us@true\m@ketabbox} % non-\outer version of \+ |
| 78 |
\outer\def\+{\tabalign} |
| 79 |
\def\s@tcols#1\columns{\count@#1 \dimen@\hsize |
| 80 |
\loop\ifnum\count@>\z@ \@nother \repeat} |
| 81 |
\def\@nother{\dimen@ii\dimen@ \divide\dimen@ii\count@ |
| 82 |
\setbox\tabs\hbox{\hbox to\dimen@ii{}\unhbox\tabs}% |
| 83 |
\advance\dimen@-\dimen@ii \advance\count@\m@ne} |
| 84 |
% |
| 85 |
\def\m@ketabbox{\begingroup |
| 86 |
\global\setbox\tabsyet\copy\tabs |
| 87 |
\global\setbox\tabsdone\null |
| 88 |
\def\cr{\@crtrue\crcr\egroup\egroup |
| 89 |
\ifus@\unvbox\z@\lastbox\fi\endgroup |
| 90 |
\setbox\tabs\hbox{\unhbox\tabsyet\unhbox\tabsdone}}% |
| 91 |
\setbox\z@\vbox\bgroup\@crfalse |
| 92 |
\ialign\bgroup&\t@bbox##\t@bb@x\crcr} |
| 93 |
% |
| 94 |
\def\t@bbox{\setbox\z@\hbox\bgroup} |
| 95 |
\def\t@bb@x{\if@cr\egroup % now \box\z@ holds the column |
| 96 |
\else\hss\egroup \global\setbox\tabsyet\hbox{\unhbox\tabsyet |
| 97 |
\global\setbox\@ne\lastbox}% now \box\@ne holds its size |
| 98 |
\ifvoid\@ne\global\setbox\@ne\hbox to\wd\z@{}% |
| 99 |
\else\setbox\z@\hbox to\wd\@ne{\unhbox\z@}\fi |
| 100 |
\global\setbox\tabsdone\hbox{\box\@ne\unhbox\tabsdone}\fi |
| 101 |
\box\z@} |
| 102 |
% finished (re)defining TeX's tabbing macros |
| 103 |
|
| 104 |
% above from plain.tex; was disabled in lplain.tex. Do |
| 105 |
% not modify above unless you really know what you're |
| 106 |
% up to. Make all changes you want to following code. |
| 107 |
% The new env is preferable to LaTeX's tabbing env |
| 108 |
% since latter accepts only a small number of tabs |
| 109 |
|
| 110 |
% following retrieves something like LaTeX's tabbing |
| 111 |
% env without the above problem (it also creates a box |
| 112 |
% for easy manipulation!) |
| 113 |
|
| 114 |
\def\lat@xtabbing{\leavevmode\hbox\bgroup\vbox\bgroup |
| 115 |
\def\={\cleartabs&} \def\>{&} \def\\{\cr\tabalign} \tabalign} |
| 116 |
\def\endlat@xtabbing{\cr\egroup\egroup} |
| 117 |
|
| 118 |
%new |
| 119 |
|
| 120 |
\def\lat@xtabbing{\begingroup |
| 121 |
\def\={\cleartabs&} \def\>{&}% |
| 122 |
\def\\{\cr\tabalign\lat@xtabbingleftmost}% |
| 123 |
\tabalign\lat@xtabbingleftmost} |
| 124 |
\def\endlat@xtabbing{\cr\endgroup} |
| 125 |
\let\lat@xtabbingleftmost\relax |
| 126 |
|
| 127 |
% stuff for formating Scheme code |
| 128 |
|
| 129 |
\newskip\par@nlen \newskip\brack@tlen \newskip\quot@len |
| 130 |
\newskip\h@lflambda |
| 131 |
|
| 132 |
\newbox\garb@ge |
| 133 |
\def\s@ttowidth#1#2{\setbox\garb@ge\hbox{#2}#1\wd\garb@ge\relax} |
| 134 |
|
| 135 |
\s@ttowidth\par@nlen{$($} % size of paren |
| 136 |
\s@ttowidth\brack@tlen{$[$} % size of bracket |
| 137 |
\s@ttowidth\quot@len{'} % size of quote indentation |
| 138 |
\s@ttowidth\h@lflambda{ii} % size of half of lambda indentation |
| 139 |
|
| 140 |
\def\PRN{\hskip\par@nlen} % these are used by SLaTeX's codesetter |
| 141 |
\def\BKT{\hskip\brack@tlen} |
| 142 |
\def\QUO{\hskip\quot@len} |
| 143 |
\def\HL{\hskip\h@lflambda} |
| 144 |
|
| 145 |
\newskip\abovecodeskip \newskip\belowcodeskip |
| 146 |
\newskip\leftcodeskip \newskip\rightcodeskip |
| 147 |
|
| 148 |
% the following default assignments give a flushleft |
| 149 |
% display |
| 150 |
|
| 151 |
\abovecodeskip=\medskipamount \belowcodeskip=\medskipamount |
| 152 |
\leftcodeskip=0pt \rightcodeskip=0pt |
| 153 |
|
| 154 |
% adjust above,below,left,right codeskip's to personal |
| 155 |
% taste |
| 156 |
|
| 157 |
% for centered displays |
| 158 |
% |
| 159 |
% \leftcodeskip=0pt plus 1fil |
| 160 |
% \rightcodeskip=0pt plus 1fil |
| 161 |
% |
| 162 |
% if \rightcodeskip != 0pt, pagebreaks within Scheme |
| 163 |
% blocks in {schemedisplay} are disabled |
| 164 |
|
| 165 |
\def\checkfollpar{\futurelet\next\checkfollparII} |
| 166 |
\def\checkfollparII{\ifx\next\par\let\next\relax |
| 167 |
\else\par\noindent\let\next\ignorespaces\fi\next} |
| 168 |
|
| 169 |
% the following are the default font assignments for |
| 170 |
% words in code. Change them to suit personal taste |
| 171 |
|
| 172 |
\def\keywordfont#1{{\bf #1}} |
| 173 |
\def\variablefont#1{{\it #1\/}} |
| 174 |
\def\constantfont#1{{\sf #1}} |
| 175 |
\def\datafont#1{\constantfont{#1}} |
| 176 |
|
| 177 |
\def\schemecodehook{} |
| 178 |
|
| 179 |
%program listings that allow page breaks but |
| 180 |
%can't be centered |
| 181 |
|
| 182 |
\def\ZZZZschemedisplay{\edef\thez@skip{\the\z@skip}% |
| 183 |
\edef\@tempa{\the\rightcodeskip}% |
| 184 |
\ifx\@tempa\thez@skip\let\next\ZZZZschemeprogram |
| 185 |
\else\let\next\ZZZZschemeprogramII\fi\next} |
| 186 |
|
| 187 |
\def\endZZZZschemedisplay{\edef\thez@skip{\the\z@skip}% |
| 188 |
\edef\@tempa{\the\rightcodeskip}% |
| 189 |
\ifx\@tempa\thez@skip\let\next\endZZZZschemeprogram |
| 190 |
\else\let\next\endZZZZschemeprogramII\fi\next} |
| 191 |
|
| 192 |
\def\ZZZZschemeprogram{\vskip\abovecodeskip |
| 193 |
\begingroup |
| 194 |
\schemecodehook |
| 195 |
\let\sy=\keywordfont \let\cn=\constantfont |
| 196 |
\let\va=\variablefont \let\dt=\datafont |
| 197 |
\def\lat@xtabbingleftmost{\hskip\leftcodeskip\relax}% |
| 198 |
\lat@xtabbing} |
| 199 |
|
| 200 |
\def\endZZZZschemeprogram{\endlat@xtabbing |
| 201 |
\endgroup |
| 202 |
\vskip\belowcodeskip |
| 203 |
\ifusinglatex\let\next\@endparenv |
| 204 |
\else\let\next\checkfollpar\fi\next} |
| 205 |
|
| 206 |
\def\ZZZZschemeprogramII{\vskip\abovecodeskip |
| 207 |
\begingroup |
| 208 |
\noindent |
| 209 |
%\schemecodehook %\ZZZZschemebox already has it |
| 210 |
\hskip\leftcodeskip |
| 211 |
\ZZZZschemebox} |
| 212 |
|
| 213 |
\def\endZZZZschemeprogramII{\endZZZZschemebox |
| 214 |
\hskip\rightcodeskip |
| 215 |
\endgroup |
| 216 |
\vskip\belowcodeskip |
| 217 |
\ifusinglatex\let\next\@endparenv |
| 218 |
\else\let\next\checkfollpar\fi\next} |
| 219 |
|
| 220 |
% |
| 221 |
|
| 222 |
\def\ZZZZschemebox{% |
| 223 |
\leavevmode\hbox\bgroup\vbox\bgroup |
| 224 |
\schemecodehook |
| 225 |
\let\sy=\keywordfont \let\cn=\constantfont |
| 226 |
\let\va=\variablefont \let\dt=\datafont |
| 227 |
\lat@xtabbing} |
| 228 |
\def\endZZZZschemebox{\endlat@xtabbing |
| 229 |
\egroup\egroup\ignorespaces} |
| 230 |
|
| 231 |
%in-text |
| 232 |
|
| 233 |
\def\ZZZZschemecodeintext{\begingroup |
| 234 |
\let\sy\keywordfont \let\cn\constantfont |
| 235 |
\let\va\variablefont \let\dt\datafont} |
| 236 |
|
| 237 |
\def\endZZZZschemecodeintext{\endgroup\ignorespaces} |
| 238 |
|
| 239 |
\def\ZZZZschemeresultintext{\begingroup |
| 240 |
\let\sy\datafont \let\cn\constantfont |
| 241 |
\let\va\datafont \let\dt\datafont} |
| 242 |
|
| 243 |
\def\endZZZZschemeresultintext{\endgroup\ignorespaces} |
| 244 |
|
| 245 |
% \comm@nt<some-char>...text...<same-char> comments out |
| 246 |
% TeX source analogous to |
| 247 |
% \verb<some-char>...text...<same-char>. Sp. case: |
| 248 |
% \comm@nt{...text...} == \comm@nt}...text...} |
| 249 |
|
| 250 |
\def\@makeother#1{\catcode`#112\relax} |
| 251 |
|
| 252 |
\def\comm@nt{% |
| 253 |
\begingroup |
| 254 |
\let\do\@makeother \dospecials |
| 255 |
\@comm} |
| 256 |
|
| 257 |
\begingroup\catcode`\<1\catcode`\>2 |
| 258 |
\catcode`\{12\catcode`\}12 |
| 259 |
\long\gdef\@comm#1<% |
| 260 |
\if#1{\long\def\@tempa ##1}<\endgroup>\else |
| 261 |
\long\def\@tempa ##1#1<\endgroup>\fi |
| 262 |
\@tempa> |
| 263 |
\endgroup |
| 264 |
|
| 265 |
% input file if possible, else relax |
| 266 |
|
| 267 |
\def\inputifpossible#1{% |
| 268 |
\immediate\openin0=#1\relax% |
| 269 |
\ifeof0\relax\else\input#1\relax\fi% |
| 270 |
\immediate\closein0} |
| 271 |
|
| 272 |
\def\ZZZZinput#1{\input#1\relax} |
| 273 |
|
| 274 |
% you may replace the above by |
| 275 |
% |
| 276 |
% \def\ZZZZinput#1{\inputifpossible{#1}} |
| 277 |
% |
| 278 |
% if you just want to call (La)TeX on your text |
| 279 |
% ignoring the portions that need to be SLaTeX'ed |
| 280 |
|
| 281 |
%use \subjobname rather than \jobname to generate |
| 282 |
%slatex's temp files --- this allows us to change |
| 283 |
%\subjobname for more control, if necessary. |
| 284 |
|
| 285 |
\let\subjobname\jobname |
| 286 |
|
| 287 |
% counter for generating temp file names |
| 288 |
|
| 289 |
\newcount\sch@mefilenamecount |
| 290 |
\sch@mefilenamecount=-1 |
| 291 |
|
| 292 |
% To produce displayed Scheme code: |
| 293 |
% in LaTeX: |
| 294 |
% \begin{schemedisplay} |
| 295 |
% ... indented program (with sev'l lines) ... |
| 296 |
% \end{schemedisplay} |
| 297 |
% |
| 298 |
% in TeX: |
| 299 |
% \schemedisplay |
| 300 |
% ... indented program (with sev'l lines) ... |
| 301 |
% \endschemedisplay |
| 302 |
|
| 303 |
\begingroup\catcode`\|=0\catcode`\[=1\catcode`\]=2% |
| 304 |
\catcode`\{=12\catcode`\}=12\catcode`\\=12% |
| 305 |
|gdef|defschemedisplaytoken#1[% |
| 306 |
|long|expandafter|gdef|csname ZZZZcomment#1|endcsname[% |
| 307 |
|begingroup |
| 308 |
|let|do|@makeother |dospecials |
| 309 |
|csname ZZZZcomment|slatexenvstyle II#1|endcsname]% |
| 310 |
|long|expandafter|gdef|csname ZZZZcommentlatexII#1|endcsname##1\end{#1}[% |
| 311 |
|endgroup|end[#1]]% |
| 312 |
|long|expandafter|gdef|csname ZZZZcommenttexII#1|endcsname##1\end#1[% |
| 313 |
|endgroup|csname end#1|endcsname]% |
| 314 |
|long|expandafter|gdef|csname #1|endcsname[% |
| 315 |
|global|advance|sch@mefilenamecount by 1|relax% |
| 316 |
|ZZZZinput[|filehider Z|number|sch@mefilenamecount|subjobname.tex]% |
| 317 |
|csname ZZZZcomment#1|endcsname]% |
| 318 |
|long|expandafter|gdef|csname end#1|endcsname[]]% |
| 319 |
|endgroup |
| 320 |
|
| 321 |
\defschemedisplaytoken{schemedisplay} |
| 322 |
|
| 323 |
\def\undefschemedisplaytoken#1{% |
| 324 |
\expandafter\gdef\csname#1\endcsname{\UNDEFINED}} |
| 325 |
|
| 326 |
% \scheme|...program fragment...| produces Scheme code |
| 327 |
% in-text. Sp. case: \scheme{...} == \scheme}...} |
| 328 |
|
| 329 |
\def\defschemetoken#1{% |
| 330 |
\long\expandafter\def\csname#1\endcsname{% |
| 331 |
\global\advance\sch@mefilenamecount by 1\relax% |
| 332 |
\ZZZZinput{\filehider Z\number\sch@mefilenamecount\subjobname.tex}% |
| 333 |
\comm@nt}} |
| 334 |
\defschemetoken{scheme} |
| 335 |
|
| 336 |
\def\undefschemetoken#1{% |
| 337 |
\expandafter\gdef\csname#1\endcsname{\UNDEFINED}} |
| 338 |
|
| 339 |
% \schemeresult|...program fragment...| produces a |
| 340 |
% Scheme code result in-text: i.e. keyword or variable |
| 341 |
% fonts are replaced by the data font. Sp. case: |
| 342 |
% \schemeresult{...} == \schemeresult}...} |
| 343 |
|
| 344 |
\def\defschemeresulttoken#1{% |
| 345 |
\long\expandafter\def\csname#1\endcsname{% |
| 346 |
\global\advance\sch@mefilenamecount by 1\relax% |
| 347 |
\ZZZZinput{\filehider Z\number\sch@mefilenamecount\subjobname.tex}% |
| 348 |
\comm@nt}} |
| 349 |
\defschemeresulttoken{schemeresult} |
| 350 |
|
| 351 |
\def\undefschemeresulttoken#1{% |
| 352 |
\expandafter\gdef\csname#1\endcsname{\UNDEFINED}} |
| 353 |
|
| 354 |
% To produce a box of Scheme code: |
| 355 |
% in LaTeX: |
| 356 |
% \begin{schemebox} |
| 357 |
% ... indented program (with sev'l lines) ... |
| 358 |
% \end{schemebox} |
| 359 |
% |
| 360 |
% in TeX: |
| 361 |
% \schemebox |
| 362 |
% ... indented program (with sev'l lines) ... |
| 363 |
% \endschemebox |
| 364 |
|
| 365 |
\begingroup\catcode`\|=0\catcode`\[=1\catcode`\]=2% |
| 366 |
\catcode`\{=12\catcode`\}=12\catcode`\\=12% |
| 367 |
|gdef|defschemeboxtoken#1[% |
| 368 |
|long|expandafter|gdef|csname ZZZZcomment#1|endcsname[% |
| 369 |
|begingroup |
| 370 |
|let|do|@makeother |dospecials |
| 371 |
|csname ZZZZcomment|slatexenvstyle II#1|endcsname]% |
| 372 |
|long|expandafter|gdef|csname ZZZZcommentlatexII#1|endcsname##1\end{#1}[% |
| 373 |
|endgroup|end[#1]]% |
| 374 |
|long|expandafter|gdef|csname ZZZZcommenttexII#1|endcsname##1\end#1[% |
| 375 |
|endgroup|csname end#1|endcsname]% |
| 376 |
|long|expandafter|gdef|csname #1|endcsname[% |
| 377 |
|global|advance|sch@mefilenamecount by 1|relax% |
| 378 |
|ZZZZinput[|filehider Z|number|sch@mefilenamecount|subjobname.tex]% |
| 379 |
|csname ZZZZcomment#1|endcsname]% |
| 380 |
|long|expandafter|gdef|csname end#1|endcsname[]]% |
| 381 |
|endgroup |
| 382 |
|
| 383 |
\defschemeboxtoken{schemebox} |
| 384 |
|
| 385 |
\def\undefschemeboxtoken#1{% |
| 386 |
\expandafter\gdef\csname#1\endcsname{\UNDEFINED}} |
| 387 |
|
| 388 |
% for wholesale dumping of all-Scheme files into TeX (converting |
| 389 |
% .scm files to .tex), |
| 390 |
% use |
| 391 |
% \schemeinput{<filename>} |
| 392 |
% .scm, .ss, .s extensions optional |
| 393 |
|
| 394 |
\def\defschemeinputtoken#1{% |
| 395 |
\long\expandafter\gdef\csname#1\endcsname##1{% |
| 396 |
\global\advance\sch@mefilenamecount by 1\relax% |
| 397 |
\ZZZZinput{\filehider Z\number\sch@mefilenamecount\subjobname.tex}}} |
| 398 |
\defschemeinputtoken{schemeinput} |
| 399 |
|
| 400 |
\def\undefschemeinputtoken#1{% |
| 401 |
\expandafter\gdef\csname#1\endcsname{\UNDEFINED}} |
| 402 |
|
| 403 |
% delineating a region that features typeset code |
| 404 |
% not usually needed, except when using \scheme and schemedisplay |
| 405 |
% inside macro-args and macro-definition-bodies |
| 406 |
% in LaTeX: |
| 407 |
% \begin{schemeregion} |
| 408 |
% ... |
| 409 |
% \end{schemeregion} |
| 410 |
% |
| 411 |
% in TeX: |
| 412 |
% \schemeregion |
| 413 |
% ... |
| 414 |
% \endschemeregion |
| 415 |
|
| 416 |
\begingroup\catcode`\|=0\catcode`\[=1\catcode`\]=2% |
| 417 |
\catcode`\{=12\catcode`\}=12\catcode`\\=12% |
| 418 |
|gdef|defschemeregiontoken#1[% |
| 419 |
|long|expandafter|gdef|csname ZZZZcomment#1|endcsname[% |
| 420 |
|begingroup |
| 421 |
|let|do|@makeother |dospecials |
| 422 |
|csname ZZZZcomment|slatexenvstyle II#1|endcsname]% |
| 423 |
|long|expandafter|gdef|csname ZZZZcommentlatexII#1|endcsname##1\end{#1}[% |
| 424 |
|endgroup|end[#1]]% |
| 425 |
|long|expandafter|gdef|csname ZZZZcommenttexII#1|endcsname##1\end#1[% |
| 426 |
|endgroup|csname end#1|endcsname]% |
| 427 |
|long|expandafter|gdef|csname #1|endcsname[% |
| 428 |
|global|advance|sch@mefilenamecount by 1|relax% |
| 429 |
|ZZZZinput[|filehider Z|number|sch@mefilenamecount|subjobname.tex]% |
| 430 |
|csname ZZZZcomment#1|endcsname]% |
| 431 |
|long|expandafter|gdef|csname end#1|endcsname[]]% |
| 432 |
|endgroup |
| 433 |
|
| 434 |
\defschemeregiontoken{schemeregion} |
| 435 |
|
| 436 |
\def\undefschemeregiontoken#1{% |
| 437 |
\expandafter\gdef\csname#1\endcsname{\UNDEFINED}} |
| 438 |
|
| 439 |
% introducing new code-tokens to the keyword, variable and constant |
| 440 |
% categories |
| 441 |
|
| 442 |
\def\comm@ntII{% |
| 443 |
\begingroup |
| 444 |
\let\do\@makeother \dospecials |
| 445 |
\@commII} |
| 446 |
|
| 447 |
\begingroup\catcode`\[1\catcode`\]2 |
| 448 |
\catcode`\{12\catcode`\}12 |
| 449 |
\long\gdef\@commII{[% |
| 450 |
\long\def\@tempa ##1}[\endgroup]\@tempa]% |
| 451 |
\endgroup |
| 452 |
|
| 453 |
\let\setkeyword\comm@ntII |
| 454 |
\let\setvariable\comm@ntII |
| 455 |
\let\setconstant\comm@ntII |
| 456 |
|
| 457 |
% \defschememathescape makes the succeeding grouped character an |
| 458 |
% escape into latex math from within Scheme code; |
| 459 |
% this character can't be } |
| 460 |
|
| 461 |
\let\defschememathescape\comm@ntII |
| 462 |
\let\undefschememathescape\comm@ntII |
| 463 |
|
| 464 |
% telling SLaTeX that a certain Scheme identifier is to |
| 465 |
% be replaced by the specified LaTeX expression. |
| 466 |
% Useful for generating ``mathematical''-looking |
| 467 |
% typeset code even though the corresponding Scheme |
| 468 |
% code is ascii as usual and doesn't violate |
| 469 |
% identifier-naming rules |
| 470 |
|
| 471 |
\def\setspecialsymbol{% |
| 472 |
\begingroup |
| 473 |
\let\do\@makeother \dospecials |
| 474 |
\@commIII} |
| 475 |
|
| 476 |
\begingroup\catcode`\[1\catcode`\]2 |
| 477 |
\catcode`\{12\catcode`\}12 |
| 478 |
\long\gdef\@commIII{[% |
| 479 |
\long\def\@tempa ##1}[\endgroup\@gobbleI]\@tempa]% |
| 480 |
\endgroup |
| 481 |
|
| 482 |
\def\@gobbleI#1{} |
| 483 |
|
| 484 |
% \unsetspecialsymbol strips Scheme identifier(s) of |
| 485 |
% any ``mathematical'' look lent by the above |
| 486 |
|
| 487 |
\let\unsetspecialsymbol\comm@ntII |
| 488 |
|
| 489 |
% enabling/disabling slatex |
| 490 |
|
| 491 |
\def\slatexdisable#1{\expandafter\gdef\csname#1\endcsname{}} |
| 492 |
|
| 493 |
% \schemecasesensitive takes either true or false as |
| 494 |
% argument |
| 495 |
|
| 496 |
\def\schemecasesensitive#1{} |
| 497 |
|
| 498 |
%for latex only: use \slatexseparateincludes before the |
| 499 |
%occurrence of any Scheme code in your file, if you |
| 500 |
%want the various \include'd files to have their own |
| 501 |
%pool of temporary slatex files. This lets you juggle |
| 502 |
%your \include's in successive runs of LaTeX without |
| 503 |
%having to worry that the temp. files may interfere. |
| 504 |
%By default, only a single pool of temp files is used. |
| 505 |
%Warning: On DOS, if your \include'd files have fairly |
| 506 |
%similar names, avoid \slatexseparateincludes since the |
| 507 |
%short filenames on DOS will likely confuse the temp |
| 508 |
%file pools of different \include files. |
| 509 |
|
| 510 |
\def\slatexseparateincludes{% |
| 511 |
\gdef\include##1{{\def\subjobname{##1}% |
| 512 |
\sch@mefilenamecount=-1% |
| 513 |
\@include##1 }}} |
| 514 |
|
| 515 |
% convenient abbreviations for characters |
| 516 |
|
| 517 |
\begingroup |
| 518 |
\catcode`\|=0 |
| 519 |
|catcode`|\=12 |
| 520 |
|gdef|ttbackslash{{|tt|catcode`|\=12\}} |
| 521 |
|endgroup |
| 522 |
\mathchardef\lt="313C |
| 523 |
\mathchardef\gt="313E |
| 524 |
\begingroup |
| 525 |
\catcode`\@12% |
| 526 |
\global\let\atsign@% |
| 527 |
\endgroup |
| 528 |
\chardef\dq=`\" |
| 529 |
|
| 530 |
% leading character of slatex filenames: . for unix to |
| 531 |
% keep them out of the way |
| 532 |
|
| 533 |
\def\filehider{.} |
| 534 |
|
| 535 |
% since the above doesn't work of dos, slatex on dos |
| 536 |
% will use a different character, and make the |
| 537 |
% redefinition available through the following |
| 538 |
|
| 539 |
\inputifpossible{xZfilhid.tex} |
| 540 |
|
| 541 |
% @ is no longer a letter for TeX |
| 542 |
|
| 543 |
\ifusinglatex\relax\else |
| 544 |
\catcode`@\atcatcodebeforeslatex |
| 545 |
\fi |
| 546 |
|
| 547 |
\message{*** Check: Are you sure you called SLaTeX? ***} |