|
From: Jay B. <bel...@us...> - 2001-11-08 22:26:40
|
Update of /cvsroot/maxima/maxima-pre59/emacs
In directory usw-pr-cvs1:/tmp/cvs-serv12220
Added Files:
maximadoc.sty
Log Message:
Initial commit of LaTeX style file for maximadoc.
--- NEW FILE: maximadoc.sty ---
%% Macros needed for EMaxima.
%% Jay Belanger (bel...@tr...)
%%
%% Some of this was taken from Dan Dill's TeX/MMA (in modified
%% form, of course), and some was taken from other sources. Some
%% I may even have written myself.
\def\Maxima{{\sffamily\slshape Maxima\/}}
\def\maximadocheadersize{\tiny}
%% An if to allow the lines to be turned on and off
\newif\ifmaximadoclines
\maximadoclinesfalse
%% Let's use some local macros
\catcode`\@=11\relax
\newdimen\maximadocbaselineskip
\newdimen\premaximadocspace
\newdimen\postmaximadocspace
%% Here are the values that the user may wish to change.
%% They can be changed here or in the main TeX file.
\font\maximadocfont = cmtt10
\maximadocbaselineskip = 14pt
\premaximadocspace = 0pt
\postmaximadocspace = 1.5ex
%% First of all, set up some delimiters
%% The units are in terms of em and ex, so if the font size is
%% changed, the units will be changed accordingly
%% To make things line up, we'll need the size of "Initial"
\font\m@ximadocheaderfont=cmtt8 scaled 800
\def\sm@llsk{\vskip 1ex}
\def\m@ximadoctop{
\vskip -1ex
\hbox to \hsize{\vrule depth 1ex height .3pt width .4pt
\vrule height .4pt depth 0pt width 1.1em
\lower .4ex \hbox{\maximadocheadersize\ \Maxima}
\hrulefill
\vrule depth 1ex height .3pt width .4pt}
\vskip 1ex}
\def\m@ximadocbottom{
\hbox to \hsize{\vrule depth 0ex height 1ex width .4pt
\hrulefill
\vrule depth 0ex height 1ex width .4pt}
}
%% Next, it is necessary to have a verbatim environment for the Maximadoc
%% session.
%% The verbatim environment for the input is based mostly on the
%% environment from "TeX for the Impatient" and Tim Morgan's verbtim2.tex
\def\deactivate{%
\catcode`\{ = 12
\catcode`\} = 12
\catcode`\$ = 12
\catcode`\& = 12
\catcode`\# = 12
\catcode`\% = 12
\catcode`\~ = 12
\catcode`\^ = 12
\catcode`\_ = 12
\catcode`\ = 12
}
{\catcode`\^^M=13
{\catcode`\ =13\gdef\verbatimdefs{\def^^M{\ \par}\let =\ }}
\gdef\verbatimgobble#1^^M{}}
\def\nothing{}
\def\m@ximadocinputskip{
\ifx \nexttok \session
\let \next=\nothing
\else
\ifx \nexttok \endmaximadoc
\let \next=\nothing
\else
\let \next=\m@ximadocinputskiptwo
\fi
\fi
\next}
\def\m@ximadocinputskiptwo#1{\m@ximadocinput}
\def\m@ximadocinput{\begingroup\obeylines\futurelet\nexttok\m@ximadocinputskip}
\let\endm@ximadocinputskip=\endgroup
%% The verbatim for Maximadoc session is taken from the TeXbook.
%% It allows more symbols, but can't be used for the input
%% since the input can be ended with more than one delimiter.
\def\uncatcodespecials{\def\do##1{\catcode`##1=12 }\dospecials}
\chardef\active=13
\def\obeyspaces{\catcode`\ =\active}
{\catcode`\^^M=\active %
\gdef\obeylines{\catcode`\^^M=\active \let^^M=\par}%
\global\let^^M=\par} %
\def\setupm@ximadocverbatim{\maximadocfont
\obeylines \uncatcodespecials \obeyspaces}
{\obeyspaces\global\let =\ }
\def\m@ximadocsessionverbatim{\par\begingroup
\baselineskip = \maximadocbaselineskip
\setupm@ximadocverbatim\dom@ximadocverbatim}
{\catcode`\|=0 \catcode`\\=12 %
|obeylines|gdef|dom@ximadocverbatim^^M#1\endmaximadoc{#1|endgroup|ifmaximadoclines|m@ximadocbottom|fi|par|vskip 1.5ex|par|endgroup}}
%% Now we need to set up the actual environments.
%% We will need some "if"s to tell us where we are
\newif\ifm@ximadocinput
\newif\ifm@ximadocsession
\def\not@k{}
%% The top delimiter depends on whether or not it is an initial cell,
%% etc.
\def\maximadoc{
% \begingroup
\m@ximadocinputtrue
\m@ximadocinput
% \futurelet\nexttok\m@ximadocinputskip
}
%% Now to take care of the session
\def\session{
\endm@ximadocinputskip
% \sm@llsk
\par \vskip \premaximadocspace \par
\par
\vskip 1.5ex
\par
\ifmaximadoclines\m@ximadoctop\fi
\m@ximadocinputfalse
\m@ximadocsessiontrue
\m@ximadocsessionverbatim
}
\def\endmaximadoc{
\ifm@ximadocinput
\endm@ximadocinputskip
\m@ximadocinputfalse
\else
\ifm@ximadocsession
\ifmaximadoclines\m@ximadocbottom\fi
\par
\vskip \postmaximadocspace
\par
\sm@llsk
\fi
\fi
\endgroup
}
% Finally, to help with backslashes,
\def\bs{$\backslash$}
\catcode`\@=12\relax
\endinput
|