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 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513
|
%% <PRE>
% Standard Maple Environments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ProvidesPackage{mapleenv}[1998/09/19 -- Maple Environments -- mapleenv.sty ]
\typeout{Defining Standard Maple Environemnts}
\RequirePackage{mapleutil}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 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 mapleenv and the file name used is different from
% mapleenv.sty
%
% 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.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Mapleenv.sty - Environments for Export to LaTeX
%
% This package defines the environments used by Maple's
% "Export to Latex" facility. In addition, each of the environments
% accepts an optional parameter. For example, for example,
% Maple Input lines accept any of:
%
% \begin{mapleinput}...\end{mapleinput}, (default)
%
% The contents of such an environment are in terms of mapleinline.
%
% The "Export to LaTeX" facility of the Maple worksheet does not use any
% of the optional parameters. They exist to provide the additional
% control needed for reprocessing long LaTeX manuscripts and which is
% carried out by a special "Maple Filter".
%
% Maple output can occur in several forms. Maple's "prettyprint" output,
% as well as error messages and warnings, is encapsulated as
%
% \begin{maplettyout}...\end{maplettyout}
%
% "Export to Latex" generates LaTeX code for the entire worksheet.
% The displayed mathematics output is controlled to fit a
% user specified line width and appears inside the environment
%
% \begin{maplelatex}...\end{maplelatex}
%
% Maple generated plots are exported as postscript files.
% The resulting files are included in the LaTeX document
% by using the macro call
%
% \mapleplot{filename}
%
% On processing by LaTeX, the postscript code from the
% indicated file is read into "dvi" file and a display is
% generated at that point in the document. The plot dimensions
% are specified as \MaplePlotHeight and \MaplePlotWidth.
%
% The actual embedding is accomplished using the LaTeX2e graphics
% package. This style file has been tested with the following dvi to
% PostScript conversion programs:
%
% dvips
% dvipsone
%
% ----------------------------------------------
% Environments that ignored by the Maple Filter
% ----------------------------------------------
% The Maple Filter is a special version of Maple that can read
% and update latex files which have been developed using these
% macros. There is a need, in such tex files, to display information
% in the same manner as the preceding manner and yet guarantee that
% the information is not changed by the Maple Filter.
% The macros are identical to those describe above, but with each
% name preceded by an "i".
%
% \begin{imapleinput}...\end{imapleinput} like mapleinput
% \begin{mapleinput}[p]...\end{imapleinput} as above, default case
% \begin{imaplelatex}...\end{imaplelatex} like maplelatex
% \imapleplot{filename} like mapleplot
% \imaplesepline like \maplesepline, but ignored by the filter.
%
% ----------------------------------------------
% Implementation Details
% ----------------------------------------------
% The mapleinput, and maplettyout environments are similar to
% \begin{verbatim}...\end{verbatim} but with several
% important differences.
%
% - The spacing relative to the surrounding environment is different.
%
% - Page breaks are encouraged before commands, or after results,
% and discouraged inbetween.
%
% - maplettyout and maplelatex environments are assumed to follow
% mapleinput regions and so have less space above. This allows us to
% reduce the space between adjacent Maple regions without any
% elaborate mechanism to detect when there have been intervening
% paragraphs of text.
%
% - the size of the font for text regions is definable. Use \MapleFont
% to reset the font.
%
% - the indentation of the environments can be indented by setting
% the value of \LeftMapleSkip .
%
% - a prompt is automatically generated at the start of each line in
% the case of the input environments.
%
% Much of the spacing and sizing information is parameterized.
% The following Macros control most of the spacing for the
% Maple environments. They are all resettable in the preamble of
% your document.
%
% \AboveMapleSkip - space above an environment
% \BelowMapleSkip - space below an environment
% \AboveMaplePlot - space above a Maple Plot
% \BelowMaplePlot - space below a Maple Plot
% \MaplePlotHeight - vertical space reserved for a plot
% \MaplePlotWidth - width reserved for a plot
% \MaplePlotAngle - angle of rotatation
% \LeftMapleSkip - the amount of left indentation
% \MapleFont - The Maple font
% \MapleSize - The size of the Maple font in mapleinput and
% maplettyout
% \MapleLatexSize - The size of the Maple fonts in maplelatex
% \MapleFirstLine - controls ingoring first line feed
% \MaplePrompttrue - controls insertion of prompt char
% \MaplePromptString - defines the prompt string
% \MaplePromptSecondary - defines the secondary prompt string
% \MapleSkip - amount of glue before and after
% displayed text
% \MapleTab - number of spaces per tab (8)
%
% Spacing, dimensions, etc.
%
% These are all defined and given default values in the file
% mapleenv.def Most may be changed in your document preamble.
%
\input{mapleenv.def}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Define those Maple environments that are to be ignored by
% the Maple Filter.
%
% \begin{imapleinput} ...\end{imapleinput}
% \begin{imaplettyout} ...\end{imaplettyout}
% \begin{imaplelatex} ...\end{imaplelatex}
% \imaplesepline
% \imapleplot
%
% These environments are ignored by the Maple Filter.
%
% -- imapleinput
%
\def\imapleinput{
\removelastskip%
\MaplePrompttrue% prompt is required in this environment.
\if@minipage\removelastskip\vskip-1.3ex%
\else\vskip\AboveMapleSkip\fi%
\@SetupMapleTty{0}% The 0 indicates ignore first new line
\@BeginIMapleInput%
}
%
\def\endimapleinput{%
\@EndMapleTty%
\removelastskip%
\edef\@MapleIOType{\MapleIOType}
\ifx\@MapleIOType\@MapleQuiet%
\typeout{ .............Quiet Maple Command finished}
\else
\vskip\BelowMapleSkip% not usually followed by output...
\fi%
\@endpetrue
\ignorespaces
}
%
% -- imaplettyout
%
\def\imaplettyout{
\removelastskip%
\nopagebreak[3]%
\MaplePromptfalse % No prompt is required in this environment.
\@SetupMapleTty{1} % The 1 indicates "respect first new line"
\@BeginIMapleTtyout % np indicates omit prompt
}
%
\def\endimaplettyout{%
\@EndMapleTty%
\removelastskip
\vskip\BelowMapleSkip%
\pagebreak[3]%
\@endpetrue
\ignorespaces
}%
%
% -- imaplelatex
%
% an inert maple latex environment (ignored by the filter)
%
\newenvironment{imaplelatex}%
{\vskip.5\AboveMapleSkip\vskip\z@\begin{maplelatex}}{\end{maplelatex}}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Define active mapleinput environments.
%
% \begin{mapleinput} ...\end{mapleinput}
% \begin{maplettyout} ...\end{maplettyout}
% \begin{maplelatex} ...\end{maplelatex}
%
% These parameterized environments are intended for reprocessing
% by the Maple Filter.
%
% The [a] case is used by default.
% The [q] is the quiet (suppressed) mode.
% The [ni] (no input) behaves the same as [q]
% The [no] behaves the same as [a]
%
% Page breaks are inhibited immediately following the input
% environment. This assumes that no extra space is
% required below the region as it is followed by some
% form of Maple output region.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% -- mapleinput
%
\newlength\newleftskip%
\newbox\mapleinputbox%
\newenvironment{mapleinput}{%
%\def\@gobblefirst##1{\relax\egroup\par}
%\def\@gobblesecond##1##2{##1\egroup\par}
\def\@gobblesemicolons##1{##1}
\advance\hsize by -\LeftMapleSkip%
\global\setbox\mapleinputbox=\vbox\bgroup%
\everypar{\the\MaplePromptString\MaplePromptString=\MaplePromptSecondary\ }
\leftskip=\z@%
\parindent=\z@%
\parfillskip=0pt plus 1fil
\lineskiplimit=0\normalbaselineskip
\baselineskip=.85\normalbaselineskip
}{%
\egroup% end of vbox
\par\removelastskip
\vskip\AboveMapleSkip%
\newleftskip=\leftskip%
\advance\newleftskip by \LeftMapleSkip%
\advance\newleftskip by \@totalleftmargin% needed for lists
\hbox{\hskip\newleftskip\box\mapleinputbox}
\vskip\BelowMapleSkip}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% -- maplettyout
%
\def\maplettyout{
\removelastskip%
\vskip 0pt plus 0pt minus 3pt%
\nopagebreak[3]%
\MaplePromptfalse % No prompt is required in this environment.
\@SetupMapleTty{1} % The 1 indicates "respect first new line"
\@ifnextchar [{\@BeginMapleTtyout}{\@BeginMapleTtyout[a]}%
}
%
\def\endmaplettyout{%
\@EndMapleTty%
\edef\@MapleIOType{\MapleIOType}
\ifx\@MapleIOType\@MapleQuiet%
\typeout{ .............Quiet Maple TTY finished}
\else
\vskip\BelowMapleSkip%
\pagebreak[3]%
\@endpetrue
\ignorespaces
\fi
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% -- maplelatex
%
% This is essentially a wrapper around a display math environment
% It gobbles its content if the [q] or [no] options are in
% effect.
%
\newbox\maplebox
\def\maplelatex{\@ifnextchar [{\@maplelatex}{\@maplelatex[a]}}
%
\def\@maplelatex[#1]{%
\edef\@MapleIOType{#1}%
\gdef\MapleIOType{#1}%% for \ifx test%
\ifx\@MapleIOType\@MapleNoOutput%
\typeout{ .............Output Option [no]}%
\gdef\MapleIOType{q}%% handle same as \@MapleQuiet
\fi%
\global\setbox\maplebox=\vbox\bgroup%
\MakeSuperScript{^}% Ensure these have normal interpretation
\MakeSubScript{_}%
}%
%
\def\endmaplelatex{\egroup%
\edef\@MapleIOType{\MapleIOType}%
\ifx\@MapleIOType\@MapleQuiet% End the same as the verbatim's
\par%
%\@endpetrue
\else%
%\ifvmode\removelastskip\fi%
\nopagebreak[3]%
\centerline{%
\vbox{%
\hbox{\vrule height4pt depth0pt width 0pt}%
\unvbox\maplebox}}%
\vskip\BelowMapleSkip%
\everypar{}%
\par%
%\pagebreak[3]%
%\@endpetrue
%\ignorespaces
\fi%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% -- maplesepline
%
\newcommand{\maplesepline}{\vskip \parskip%
\hrule\@height\MapleSepLineHeight\@width\MapleSepLineWidth%
\vskip \parskip\relax}
%
% -- imaplesepline ( the inert form )
%
\let\imaplesepline\maplesepline
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% -- \mapleIndent
%
% - Special Indentation Macro used to format procedures
%
\newdimen\Tab
\Tab=3ex
\def\mapleIndent#1{\hbox{\hskip#1\Tab\relax}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Special environments for in-line maple commands.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \begin{maplegroup} - maple exchange group
% ...
% ... and \mexpr{sin(x^2)} ... - inline maple code
% ...
% \mapleinline{Inert}{TwoD}{int(sin(x^2),x);}{% - for maple filter
% {mapletex}{$\int{ .... }$} - for latex
% ...
% ...
% \mapleresult - location of inline results
% \begin{maplelatex} - actual displayed results
% ...
% \end{maplelatex}
% \end{maplegroup}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% -- \mexpr
%
% \mexpr{int(sin(x^2),x)} --- \mapleexpr{int(sin(x^2),x)}
%
% To make { and } visible in this verbatim environment, use \{ and \}
% Also, to make \ visible, use \\.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\mexpr{\setbox\@inlinebox=\hbox\bgroup\ttfamily\dosetup\let\\\BackSlash\@domexpr}
%
\def\mapleexpr{\bgroup\ttfamily\dosetup\let\\\BackSlash\@domexpr}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \@dosetup sets up the character codes, etc. for verbatim
% \@domexpr completes the following inline math
% \@gobblefirst absorbs the inline math (not displaying it)
% \@gobblesecond absorbs the second following argument.
% \@gobblesemicolons absorbs semi-colons inside of the 1d mode.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\dosetup{\let\do\@makeother\dospecials\postdospecials}
%
%\def\@domexpr#1{#1\egroup\fbox{\box\@inlinebox}}
\def\@domexpr#1{#1\egroup\box\@inlinebox}
%
\def\@gobblefirst#1{%
\relax\egroup%
% \fbox{\box\@inlinebox}% %%% DEBUG %%%
\box\@inlinebox%
\setbox\@inlinebox=\hbox{}}
%
\def\@gobblesecond#1#2{%
#1\egroup\ignorespaces%
% \fbox{\box\@inlinebox}% %%% DEBUG %%%
\box\@inlinebox%
\setbox\@inlinebox=\hbox{}}
%
\def\@gobblesemicolons{\MakeActive{;}\@@gobblesemicolons}
%
{\MakeActive{;}\gdef\@@gobblesemicolons{\edef;{\relax}}}
%%% end of mexpr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% -- \mapleinline
%
% Essentially a four argument macro used to control the
% display of inline material generated by Maple.
%
% \mapleinline %
% <status> % "active", or "inert"
% <display mode> % 1d or 2d
% <verbatim source> % raw maple code as per \mexpr
% <latex 2-D source> % latex representation
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \mapleinline{inert}{2d}{int(sin(x^2),x)}{ % used to generate display
% $\int{\sin(x^2),dx}$} % updated by the filter
%
% Could use \@bsphack ... \@esphack for absorbing unwanted space not
% currently used, but spacing inside this macro definition is
% very important.
%
\edef\OneD{1d}\edef\TwoD{2d}% # tokens to identify modes
\newif\ifDisplay\Displayfalse
\newbox\@inlinebox\setbox\@inlinebox=\hbox{}%
\@ifundefined{@skiponetoken}{\gdef\@skiponetoken#1{\relax}}{\relax}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2-D output
% final output macro for mapleinline.
% include spacing above and below to ensure there is
% whitespace around the object when it occurs in
% a spreadsheet cell.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\@doTwoD#1{\egroup%
%\@ifnextchar\cr{\@skiponetoken}{\relax}%
\@@doTwoD}%
%
\newdimen\cellwidth%
\def\@@doTwoD#1{%
\ignorespaces%
\setbox\@inlinebox=\hbox{#1}%
\ifMapleTableCell% Used in maplespreadsheet
\cellwidth=\wd\@inlinebox%
\hbox{$\vcenter{\hsize=\cellwidth%
\hbox{\vrule height3pt depth0pt width 0pt}%
\box\@inlinebox%
\hbox{\vrule height0pt depth 3pt width 0pt}% Actual output
}$}%
\egroup%
\else% Used inline ...
%\fbox{\hbox{\unhbox\@inlinebox}}\egroup% Actual output
\box\@inlinebox\egroup%
\fi%
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1-D output
% Final output macro for mapleinline for 1-D output.
% The raw tokens must be dumped into the output stream so
% we use unhbox.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\@doOneD#1{\MakeOther{\ } #1\egroup\unvbox\@inlinebox\relax\@mgobbleone}
\def\@mgobbleone#1{\relax\egroup}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\mapleinline#1#2{%
% ignore first argument (inert or active)
\def\[{$}\def\]{$}% % needed for math mode.
\edef\DisplayType{#2}% % 1d or 2d
\ifx\DisplayType\TwoD%
\let\Display\@doTwoD% % display the 2-D representation
\global\Displaytrue%
\else%
\let\Display\@doOneD% % display the 1-D representation
\global\Displayfalse%
\fi%
\bgroup%
\global\setbox\@inlinebox=\vbox\bgroup%
\obeylines%
\everypar{\the\MaplePromptString\MaplePromptString=\MaplePromptSecondary\ }
\ttfamily\dosetup\obeyspaces\let\\\BackSlash\Display%
}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% -- \begin{maplegroup} ... \end{maplegroup}
% -- \mapleresult
%
% A environment used to group commands and result together into
% one unit. Inside, these are separated by \mapleresult.
% The maple filter automatically deletes the part of a maplegroup
% which follows \mapleresult and replaces it with new results.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newenvironment{maplegroup}{}{}
\def\maplegroup{\relax}
\def\endmaplegroup{\relax}
\let\mapleresult\relax
\endinput %%% mapleenv.sty
%%% </PRE>
|