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
|
%% <PRE>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Maple Table Support
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ProvidesPackage{mapletab}[1998/09/19 -- Maple Spreadsheets]
\typeout{Defining Maple Spreadsheet Environemnts}
\typeout{Maple Spreadsheet and Table Support}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Copyright (c) 1994--2003 by Waterloo Maple Inc., all rights reserved.
%
% Permission is granted to use this package without charge. It may
% be redistributed providing that it is distributed as is
% and without charge. You may modify these macros for your own use,
% and redistribute them, subject to the following conditions.
%
% 1. The package name used for any modified version of this file is
% different from mapletab and a file name other than mapletab.sty
% is used.
%
% 2. You acknowledge this copyright notice and this file as the source.
%
% 3. The new file is redistributed under the same terms and conditions
% as indicated here, including a version of this notice modified to
% refer to the new file and/or package name.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Maple Spreadsheets and Tables Package
%%%
%%% Maple displays its spreadsheets as a tabular arrays of cells.
%%%
%%% This is essentially a tabular environment
%%% with some pre and post processing.
%%% The format is:
%%% \begin{maplespreadsheet}[spreadsheet01.tab]{|c|c|}
%%% \hline
%%% entry 1 &
%%% entry 2 &
%%% \mapleinline{inert}{2d}{1;}{xx} \\
%%% \hline
%%% entry 2,21 &
%%% entry 2,3 &
%%% \mapleinline{{1;} \\
%%% \hline
%%%\end{maplespreadsheet}
%%%
%%% The cells are in typeset in text mode. The mathematics is
%%% usually provided in \mapleinline in order to provide both the
%%% Maple and the LaTeX encoding of the expression.
%%%
%%% Maple's \multiline macro is used in the latex portion
%%% of the \mapleinline macro in order to effect line wrapping.
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\ifMapleTableCell% % used to change vertical offset of a
% mapleinline inside table
\newdimen\multilinesep%
\multilinesep=1ex%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%% maplespreadsheet - tabular environment whose entries are encoded
%%% using mapleinline.
%%%
%%% \begin{maplespreadsheet}[filename]{format}
%%% ...
%%% \end{maplespreadsheet}
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\maplespreadsheet{%
\@ifnextchar [{\@maplespreadsheet}{\@maplespreadsheet[]}
}
\def\@maplespreadsheet[#1]#2{%
\par\MapleTableCelltrue\begin{center}\begin{tabular}{#2}}%
\def\endmaplespreadsheet{%
\end{tabular}%
\end{center}%
\MapleTableCellfalse%
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%% maplemultiline - Used for stacking lines of maple input and output
%%%
%%% An implementation of mapleinline based on vbox and hbox.
%%% The tokens are parsed and dropped into hboxes which are in turn
%%% collected into a vbox.
%%%
%%% Each line of the multiline is followed by some extra space
%%% No extra space is required at the top as the multiline is
%%% used inside of \mapleinline, which provide's its own space
%%%
%%% \maplemultiline{x^2 + y^2\\(x - y)^{100}\\}
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Tokens and utilities used by \maplemultiinline
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newbox\@linebuffer\setbox\@linebuffer=\vbox{\relax}
\newbox\@currentline\setbox\@currentline=\hbox{\relax}
\newdimen\@linebufferwidth %%% DEBUG %%%
\newtoks\EndMultiLine%
\@ifundefined{@skiponetoken}{\gdef\@skiponetoken#1{\relax}}{\relax}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% \maplemultiline -
%%% for use primarily inside of table cells.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\maplemultiline#1{%
{\def\\{\relax}%
\processcell#1\noexpand\\\EndMultiLine%
}%
%%% \@linebufferwidth=\wd\@linebuffer%%% DEBUG %%%
%\fbox{\@dumplinebuffer}% %%% DEBUG %%%
\@dumplinebuffer%
}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% \processcell -
%%% start processing the contents of the cell
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\processcell{\futurelet\@nexttoken\processline}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% \processline
%%% - invokes \processfullline unless at the
%%% end of the cell. (skips over \cr's to
%%% avoid spacing problems)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\processline{%
\ifx\@nexttoken\EndMultiLine%
\let\next\@skiponetoken% % at end of cell.
\else%
\let\next\processfullline%% grab next line
\fi%
% \cr's cause spacing problems.
\ifx\@nexttoken\cr\@skiponetoken\let\next\processline\fi%
\next%
}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% \processfullline -
%%% - Adds currentline (as identified by \\)
%%% to the vbox \@linebuffer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\processfullline #1\\{%
\global\setbox\@currentline=\hbox{$#1$}
\@extendlinebuffer{\@currentline}%
\processcell}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% \@extendlinebuffer - a stack of lines
%%% add currentline to end of \@linebuffer
%%%
%%% #1 is assumed to be a box. (hbox) and
%%% is reset at the end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\@extendlinebuffer#1{%
\ifvoid#1\else% % skip over blank lines
\ifvoid\@linebuffer% % first line ?
\global\setbox\@linebuffer=\vtop{\copy#1}%
\else% % add new lines
\global\setbox\@linebuffer=\vtop{%
\unvcopy\@linebuffer%
\copy#1%
\vskip\multilinesep%
}%
\fi%
\fi%
\global\setbox#1=\hbox{}% reset currentline
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% \@dumplinebuffer -
%%% place @linebuffer on the output stream as
%%% a vbox.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\@dumplinebuffer{%
\setbox\@linebuffer=\vtop{%
\hbox{\vrule height3pt depth0pt width 0pt}%
\unvbox\@linebuffer%
\unskip}%
\box\@linebuffer% A verticle box ...
\global\setbox\@linebuffer=\vbox{}%
\relax}
\endinput %%% mapletab.def
%%% </PRE>
|