1
%% Macros needed for EYacas.
2
%% Jay Belanger (belanger@truman.edu)
4
%% Some of this was taken from Dan Dill's TeX/MMA (in modified
5
%% form, of course), and some was taken from other sources. Some
6
%% I may even have written myself.
8
\def\Yacas{{\sffamily yacas\/}}
9
\def\yacasheadersize{\tiny}
11
%% Let's use some local macros
14
\newdimen\yacasinputbaselineskip
15
\newdimen\yacasoutputbaselineskip
16
\newdimen\preyacasspace
18
%% Here are the values that the user may wish to change.
19
%% They can be changed here or in the main TeX file.
21
\font\yacasinputfont = cmtt10
22
\yacasinputbaselineskip = 10pt
24
\font\yacasoutputfont = cmtt10
25
\yacasoutputbaselineskip = 14pt
29
%% First of all, set up some delimiters
30
%% The units are in terms of em and ex, so if the font size is
31
%% changed, the units will be changed accordingly
33
%% To make things line up, we'll need the size of "Initial"
35
\font\yac@sheaderfont=cmtt8 scaled 800
36
\setbox0=\hbox{\yac@sheaderfont\ Initial}
41
\def\sm@llsk{\vskip 1ex}
45
\hbox to \hsize{\vrule depth 1ex height .3pt width .4pt
46
\vrule height .4pt depth 0pt width 1.1em
47
\lower .4ex \hbox{\yacasheadersize\ \Yacas}
49
\vrule depth 1ex height .3pt width .4pt}
55
\hbox to \hsize{\vrule depth 1ex height .3pt width .4pt
56
\vrule height .4pt depth 0pt width 1.1em
57
\lower .4ex \hbox{\yacasheadersize\ \Yacas}
59
\lower .4ex \hbox{\yac@sheaderfont\ Initial}
60
\vrule height .4pt depth 0pt width 1em
61
\vrule depth 1ex height .3pt width .4pt}
66
\hbox to \hsize{\vrule depth 1ex height .3pt width .4pt
67
\vrule height .4pt depth 0pt width 1.1em
68
\lower .4ex \hbox{\yacasheadersize\ \Yacas}
70
\lower .4ex \hbox{\yac@sheaderfont\ #1}
72
\vrule height .4pt depth 0pt width \in@t
73
\vrule depth 1ex height .3pt width .4pt}
76
\def\yac@sinitparttop#1{
78
\hbox to \hsize{\vrule depth 1ex height .3pt width .4pt
79
\vrule height .4pt depth 0pt width 1.1em
80
\lower .4ex \hbox{\yacasheadersize\ \Yacas}
82
\lower .4ex \hbox{\yac@sheaderfont\ #1}
84
\lower .4ex \hbox{\yac@sheaderfont\ Initial}
85
\vrule height .4pt depth 0pt width 1em
86
\vrule depth 1ex height .3pt width .4pt}
92
\hbox to \hsize{\hskip 1.5em
93
\vrule height .4pt depth 0pt width 3em
94
\lower .4ex \hbox{\yac@sheaderfont\ Output}
103
\hbox to \hsize{\hskip 1.5em
104
\vrule height .4pt depth 0pt width 3em
105
\lower .4ex \hbox{\yac@sheaderfont\ \TeX\ Output}
112
\def\yac@sgraphicsoutput{
114
\hbox to \hsize{\hskip 1.5em
115
\vrule height .4pt depth 0pt width 3em
116
\lower .4ex \hbox{\yac@sheaderfont\ Graphics}
124
\hbox to \hsize{\vrule depth 0ex height 1ex width .4pt
126
\vrule depth 0ex height 1ex width .4pt}
130
%% Next, it is necessary to have a verbatim environment for the Yacas
133
%% The verbatim environment for the input is based mostly on the
134
%% environment from "TeX for the Impatient" and Tim Morgan's verbtim2.tex
150
{\catcode`\ =13\gdef\verbatimdefs{\def^^M{\ \par}\let =\ }}
151
\gdef\verbatimgobble#1^^M{}}
153
\def\yac@sinputverbatim{
155
\setlength{\parskip}{0pt} %% added by WMS
165
\let\endyac@sinputverbatim=\endgroup
167
%% The verbatim for Yacas output is taken from the TeXbook.
168
%% It allows more symbols, but can't be used for the input
169
%% since the input can be ended with more than one delimiter.
171
\def\uncatcodespecials{\def\do##1{\catcode`##1=12 }\dospecials}
174
\def\obeyspaces{\catcode`\ =\active}
175
{\catcode`\^^M=\active %
176
\gdef\obeylines{\catcode`\^^M=\active \let^^M=\par}%
177
\global\let^^M=\par} %
180
\def\setupyac@sverbatim{\yacasoutputfont
181
\obeylines \uncatcodespecials \obeyspaces}
182
{\obeyspaces\global\let =\ }
185
\def\yac@soutputverbatim{\par\begingroup
186
\baselineskip = \yacasoutputbaselineskip
187
\setupyac@sverbatim\doyac@sverbatim}
188
{\catcode`\|=0 \catcode`\\=12 %
189
|obeylines|gdef|doyac@sverbatim^^M#1\endyacas{#1|endgroup|yac@sbottom|par|vskip 1.5ex|par|endgroup}}
191
%% Now we need to set up the actual environments.
192
%% We will need some "if"s to tell us where we are
196
\newif\ifyac@stexoutput
197
\newif\ifyac@sgraphics
201
%% The top delimiter depends on whether or not it is an initial cell,
206
\par \vskip \preyacasspace \par
207
\baselineskip = \yacasinputbaselineskip
209
\futurelet\nextchar\yac@s
214
\let\next = \yac@sinit
217
\let\next = \yac@spart
219
\let\next = \yac@sstart
231
\let\next = \yac@sinitpart
233
\let\next = \yac@sinitonly
259
\def\yac@spart<#1:#2>{
265
\def\yac@sparttext{Definition of package #1}
267
\def\yac@sparttext{<#1:#2>}
269
\yac@sparttop\yac@sparttext
270
\futurelet\nextchar\yac@sp@rt
279
\def\yac@sinitpart<#1:#2>{
285
\def\yac@sparttext{Definition of package #1}
287
\def\yac@sparttext{<#1:#2>}
289
\yac@sinitparttop\yac@sparttext
290
\futurelet\nextchar\yac@sp@rt
294
%% Now to take care of the various types of output
297
\endyac@sinputverbatim
307
\endyac@sinputverbatim
325
%% If the output is graphics, we'll need to load epsf.tex, but there's
326
%% no need to load it if there are no graphics, and there is no need
327
%% to load it more than once.
332
\endyac@sinputverbatim
344
\def\@ndoutputgraphics{}
346
%% We'll need to have a macro for the graphics
349
\centerline{ \epsfxsize = #1 \epsfbox{#2}}
355
\endyac@sinputverbatim
374
% Finally, to help with backslashes,
375
\def\bs{$\backslash$}