%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% This defines the TeX support for Axiom. %% Latex Chunk support %% This is the chunk environment that replaces the use of web-like tools %% %% \begin{verbatim} %% To use the command you would write %% \begin{chunk}{some random string} %% random code to be verbatim formatted %% \end{chunk} %% %% This version prints %% --- some random string --- %% random code to be verbatim formatted %% -------------------------- %% \end{verbatim} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% The verbatim package quotes everything within its grasp and is used to %%% hide and quote the source code during latex formatting. The verbatim %%% environment is built in but the package form lets us use it in our %%% chunk environment and it lets us change the font. %%% \usepackage{verbatim} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% %%% Make the verbatim font smaller %%% Note that we have to temporarily change the '@' to be just a character %%% because the \verbatim@font name uses it as a character %%% \chardef\atcode=\catcode`\@ \catcode`\@=11 \renewcommand{\verbatim@font}{\ttfamily\small} \catcode`\@=\atcode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% This declares a new environment named ``chunk'' which has one %%% argument that is the name of the chunk. All code needs to live %%% between the \begin{chunk}{name} and the \end{chunk} %%% The ``name'' is used to define the chunk. %%% Reuse of the same chunk name later concatenates the chunks %%% For those of you who can't read latex this says: %%% Make a new environment named chunk with one argument %%% The first block is the code for the \begin{chunk}{name} %%% The second block is the code for the \end{chunk} %%% The % is the latex comment character %%% We have two alternate markers, a lightweight one using dashes %%% and a heavyweight one using the \begin and \end syntax %%% You can choose either one by changing the comment char in column 1 \newenvironment{chunk}[1]{% we need the chunkname as an argument {\ }\newline\noindent% make sure we are in column 1 %{\small $\backslash{}$begin\{chunk\}\{{\bf #1}\}}% alternate begin mark \hbox{\hskip 2.0cm}{\bf --- #1 ---}% mark the beginning \verbatim}% say exactly what we see {\endverbatim% process \end{chunk} \par{}% we add a newline \noindent{}% start in column 1 \hbox{\hskip 2.0cm}{\bf ----------}% mark the end %$\backslash{}$end\{chunk\}% alternate end mark (commented) \par% and a newline \normalsize\noindent}% and return to the document %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% This declares the place where we want to expand a chunk \providecommand{\getchunk}[1]{% \noindent% {\small $\backslash{}$begin\{chunk\}\{{\bf #1}\}}}% mark the reference