summaryrefslogtreecommitdiff
path: root/support/mctex/mctex.tex
blob: 58763b3f283f54746cb64e6b11517833d6572a8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
\documentstyle{article}
\textwidth=6.25in
\oddsidemargin=0.25in
\title{{Mc\TeX} User's Guide}
\author{Chokchai Leangsuksun}

\author{Revised by Paul Wang, November, 1989}

% macros for verbatim scanning
\chardef\other=12
\def\ttverbatim{\begingroup
\parindent=0pt
\def\par{\leavevmode\endgraf}%leave blank lines alone in verbatim
  \catcode`\\=\other \catcode`\{=\other \catcode`\}=\other \catcode`\$=\other
  \catcode`\&=\other \catcode`\#=\other \catcode`\%=\other \catcode`\~=\other
  \catcode`\_=\other \catcode`\^=\other \catcode`\^^A=\other \catcode`\^^K=\other
  \catcode`\^^M=\other\obeyspaces\obeylines\fixspace\tt}
\outer\def\begintt{$$
%\let\par=\endgraf 
\ttverbatim \parskip=\z@
  \catcode`\|=0  \ttfinish}
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
  |obeylines % end of line is active
  |gdef|ttfinish#1^^M#2\endtt{#1|vbox{#2}|endgroup$$}}
\catcode`\|=\active
{\obeylines\gdef|{\ttverbatim\let|=\endgroup}}
{\catcode`\ =\active
\gdef\fixspace{\catcode`\ =\active\def {~}}}
  
\begin{document}
\maketitle
\section{Introduction}
\paragraph{}
{Mc\TeX} is a software package written in FRANZ LISP for VAXIMA,
a version of MACSYMA written in FRANZ LISP.
{Mc\Tex} converts VAXIMA output into
correct \TeX~ or \LaTeX~ codes that are ready either to be processed by
\TeX or to be included in documents without retouching.
The package defines two sets of VAXIMA commands one for \TeX~ output and another
for \LaTex~ output.  This document introduces {Mc\TeX} and
explains the usage of its facilities from the VAXIMA top-level.\\

\section{The primary commands}
\paragraph{}
There are two primary commands
\begin{itemize}
\item {\bf tex}({\it expression},["{\it filename}.tex"]);
\item {\bf latex}({\it expression},["{\it filename}.tex"]);
\end{itemize}
\newline\newline
where {\it exparession} is any valid VAXIMA variable, label or
expression.   This expression will be converted into \TeX or
La\TeX code respectively.
The produced codes will be displayed on your terminal unless the
optional second argument is given, in which case the ouput will
be sent to the file specified.  If the file does not already exist,
it is created.  If the file is already there, the output is appended
to the end of the file.  Therefore, repeated use of the
commands will of course put multiple \TeX or La\TeX codes in a file. 
\paragraph{}
It is possible to use the {\bf tex} or {\bf latex} command
on any single VAXIMA expression except a VAXIMA programm construct
such as {\tt block, for, do} etc.\\

The above two commands can also be used for converting multiple exprerssions.
To do that you simply supply a VAXIMA list of expressions
as the first argument.  For example,

{\bf latex}([exp1, exp2, ...],["{\it filename}.tex"]);

{Mc\Tex} also provides commands to convert all Macsyma command and display
lines (the (Ci) and (Di) lines) so far into a file ready to be processed by \TeX or La\Tex. This file
will include all necessary header and trailer codes  so that it does
not have to be part of another \TeX or La\Tex file for printing.
\newline
\begin{itemize}
\item {\bf texall}("filename.tex");\\ 
\item {\bf latexall}("filename.tex");\\ 
\end{itemize}
\section{Merging {Mc\TeX} output files}
After we get the expressions in {\tt ``filename.tex''}, we 
can insert {\tt ``filename.tex''} into the document directly or use 
{\tt $\backslash${input}\{filename\}} command to merge an external file into
the a document. The second method is recommended,
because it does not unnecessarily complicates the document and
the expressions in the {\tt ``filename.tex''} can be treated separately.\\

\section{Autolabeling Mode}

When autolabeling mode is set, program generated equation numbers
will be automatically supplied for each output experssion. 
To set autolabeling mode for {\TeX} , the starting 
number of a label must be an integer and in display style.
For Example, to set autolabeling mode with starting label 4 we use
\newline
\noindent{\bftexautolabeli}(4);
\newline
It is possible to have all labels either on the right or on the left of
the equations.  This is controlled by the commands

{\bf label}(left);
{\bf label}(right);

For example,
|(c1) label(left);|

|(c2) x^3+345*x^2-12;|

|(c3) latex(d2);|
\newline
{\em result in the output}\newline\newline

$$x^{3}+345\>x^{2}-12\leqno{\tt (d2)}$$
\newline
And for right labeling, the commands\newline\newline
|(c4) label(right);|


|(c6) taylor(sqrt(omega+1),omega,0,5);|

|(c7) latex(d6);|
\newline
{\em produce}\newline\newline
$$1+{{\omega}\over {2}}-{{\omega^{2}}\over {8}}+{{\omega^{3}}\over {
 16}}-{{5\>\omega^{4}}\over {128}}+{{7\>\omega^{5}}\over {256}}
 +\cdots \eqno{\tt (d6)}$$

\section{User-specified display type}
\paragraph{}
There are two output style modes for {Mc\TeX}: {\it display} and {\it text}.
In display mode output generated puts the equation or expression
on lines separated from preceeding and succeeding text by blank
lines (as a display).
In text mode, on the other hand, the output can be combined in-line with other text.
The following commands sets the modes

{\bf style}(display);
{\bf style}(text);

The default output mode is display.  CHOKCHAI: Do you see what I am
doing now.  Please revise the remaining part of the document and
revise the programs accordingly.

\section{Evaluation mode}
\paragraph{}
    At c-line in VAXIMA, whether an expression can be evaluated or not is depended on {\TeX}etting evaluation mode. This mode works with {Mc\TeX} or {Mc\LaTeX}.
\newline
\newline
{\em Example for evaluate mode}\newline\newline
|(c2) texeval();|

|(c3) latex(integrate(3*triangle^3-4,triangle));|
\newline\newline	
{\em We get}\newline
$${{3\>\triangle^{4}}\over {4}}-4\>\triangle$$
{\em Example for non-evaluate mode}\newline
\newline
|(c2) texnoeval();|

|(c3) latex(integrate(3*triangle^3-4,triangle));|
\newline\newline	
{\em We get}\newline
$${\int_{}{3\>\triangle^{3}-4}\,d\>\triangle}$$
\section{Worksheet mode}
\paragraph{}
    The worksheet mode does like {\tt playback();} command ,but instead of
playing back on the screen, it translates the worksheet to {\TeX} or {\LaTeX}
form into a file.
\begin{itemize}
\item {\tt latexezwks("filename");}, an easy worksheet for {Mc\LaTeX}. 
\item {\tt texezwks("filename");}, an easy worksheet for {Mc\TeX}. 
\item {\tt worksheet("filename"[,'[list of labels]]);}, a user customized 
worksheet, is a command for both {\TeX} and {\LaTeX}. Before we issue it, we 
have to specify a mode for {\TeX} or {\LaTeX} by issuing {\tt texworksheet();}
or {\tt latexworksheet();} respectively. The worksheet mode for {\TeX} need to
have a macro file named {\tt verbatim.tex}, we have to initialize a file 
which will obtains {\TeX}etting outputs as the follwing in {\TeX}etting's file preparation section. 
\end{itemize}
\subsection{{\TeX}etting's file preparation}
\paragraph{}
To use {\tt worksheet("filename"[,'[list of labels]])} , we have to prepare a file to obtain a header and a macro ,named {\tt verbatim.tex}. 
\newline\newline
{\bf For {Mc\TeX}}\newline\newline
{\tt (c10) texinit("file.tex");}
\paragraph{}
   The {\tt texinit("file.tex")} copies a macro file,
named {\tt verbatim.tex}, to a {\TeX} file, named {\tt "file.tex"}.
This macro takes care a code which {\TeX}etting generates from c-line input in 
worksheet mode. So it is important to issue these commands to initialize a output file.\newline\newline
{\bf For {Mc\LaTeX}}\newline\newline
{\tt (c10) latexinit("file.tex");}
\paragraph{}
   The {\tt latexinit("file.tex");} prepares a header of {\LaTeX} document such
   as putting some commands like {\tt $\backslash$documentstyle\{article\}} and {\tt $\backslash$begin\{document\}} at the top of a file. Therefore if you would like to merge a worksheet into {\LaTeX}
   document, you may need to customize your own document style. So {\tt latexinit} command may not be needed. But if we need it, we can select a {\LaTeX} document style and point size from it too
. If we say \newline\newline
{\tt (c11) latexinit("file.tex",article);}\newline\newline
{Mc\LaTeX} will initialize a file, named {\tt "file.tex"}, by assigning a documentstyle to be 
article with the default point size. We also can say {\tt latexinit("file.tex",book,12)}. This is for book style and 12 point size.
\subsection{For {Mc\TeX}}
\paragraph{}
After we satisfy with the VAXIMA output and want to produce it in book-quality form. There are two ways as the following:\\
\begin{enumerate}
\item  A user customized worksheet.\\
{\em For example}\\

|(c12) texworksheet();|

$$done$$

|(c13) texinit("wks1.tex");|

$$wks1.tex$$

|(c14) matrix([gamma,lambda],[Gamma,Lambda]);|

$$\pmatrix{\gamma&\lambda\cr \Gamma&\Lambda\cr }\leqno{\tt (d14)}$$

|(c15) texworksheet();|

$$done$$

|(c16) worksheet("wks1.tex",'[c14,d14]);|

$$wks1.tex$$
\newline
\item An easy worksheet. All we have to do just say:\\
\newline
|(c6) texezwks("hw6.tex");|

\end{enumerate}
\subsection{For {Mc\LaTeX}}
\begin{enumerate}
\item A user customized worksheet. {\em We just say}\newline
\newline
|(c5) latexworksheet();|

$$done$$

|(c6) worksheet("wks2.tex");|

\item An easy worksheet.  We just simply say\\
\newline
|(c6) latexezwks("hw6.tex");|
\end{enumerate}

\section{More examples}
\paragraph{}
There are some examples in the directory {\tt /user/vaxima/ksu/new/chokchai/} available on VAX 11/780. 
To test it just say {\tt load("filename.test");} at VAXIMA c-line.
\newline
\newline
{\bf Where:} {\tt filename.test} are {\tt tex1.test} , {\tt tex2.test} , $\cdots$, etc.

\section{Comments}
\begin{itemize}
  \item {\TeX}etting package has pros 
and cons. Pros is a high quality of a final product which is produced by \TeX~
or \LaTeX~ package. Cons, in the other hand, is that there is no ability to
break up a large expression automatically. So the user has to do it manually
if the {\TeX}etting output expression is larger than one line. For this 
problem we can consult a {\em The {\TeX}book} on page 190-195  
and {\em A Document Preparation System \LaTeX~} on page 49-50. \\
\end{itemize}

\end{document}