forked from dmiranda2/vector-calculus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maplestd2e.sty
1462 lines (1430 loc) · 46.1 KB
/
maplestd2e.sty
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
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% <PRE>
\def\MapleNameDef $#1: #2.#3${\expandafter\gdef\csname Maple@#1\endcsname{#2}}
\def\MapleInfoDef $#1: #2 #3${\expandafter\gdef\csname Maple@#1\endcsname{#2}}
\MapleNameDef $RCSfile: maple2e.sty,v $
\MapleInfoDef $Revision: 1.16 $
\MapleInfoDef $Date: 2005/03/17 15:58:14 $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\typeout{Package: \Maple@RCSfile\space \Maple@Date\space v\Maple@Revision}
\ProvidesPackage{maplestd2e}[\Maple@Date\space\Maple@RCSfile
Maple Latex Style Package -- \Maple@Date\space\Maple@RCSfile]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (c) 1994--2005 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 maple2e and the file name used is different from
% maple2e.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.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Package: maple2e
%
% This package defines the latex macros used by "Export to LaTeX"
% It makes use of several sub-packages.
%
% mapleenv - Maple Environments used to mark mapleinput, mapleoutput,
% mapletab - Maple Macros to display tables (spreadsheets)
% mapleplots - Maple macros to display plots.
%
% See the comments in maplenv.sty for a more detailed discussion of
% the special environments such as
%
% \begin{mapleinput} ... \end{mapleinput}
% \begin{maplelatex} ... \end{maplelatex}
%
% and for details about macros such as
%
% \mapleinline <status> <type> <verbatim code> <latex code>
% \maplemultiline{ ... }
%
% which are used to control style and to embed raw Maple data.
%
% USAGE:
%
% To use this package, add the line
%
% \usepackage{maple2e} to
%
% your document preamble. If you are using a specific plot
% driver such as dvipsone, then add its name as an option as
% in:
%
% \usepackage[dvipsone]{maple2e}
%
% The default option value is "dvips".
%
% If you wish to preview your document, ignoring plots, use
% the "noplots" option.
%
% The only options available are precisely those needed to
% control plotting. Plots are handled by the standard LaTeX2e
% graphics package and for LaTeX are restricted to postscript.
%
% NOTES:
%
% It is an easy extension of this code to other plot file formats.
% All that is needed is a new definition of \mapleplot
% to invoke the graphics code of your choice.
%
% To adjust the spacing around the Maple environemnts, edit
% change the entries in the file mapleenv.def
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Package Options
%
\newif\ifnoplots\noplotsfalse
\DeclareOption{noplots}{
% \PassOptionsToPackage{dvips}{epsfig}
\noplotstrue
}
\DeclareOption{dvips}{
% \PassOptionsToPackage{dvips}{epsfig}
\edef\Driver{dvips}
\AtEndOfPackage{
\typeout{ ...configuring graphics for dvips driver}
\usepackage[dvips]{epsfig}
\let\mapleplot\epsfigmapleplot
\let\imapleplot\mapleplot
}
}
\DeclareOption{dvi2ps}{
\edef\Driver{dvi2ps}
\AtEndOfPackage{
\typeout{ ...configuring graphics for dvips driver}
\usepackage[dvi2ps]{epsfig}
\let\mapleplot\epsfigmapleplot
\let\imapleplot\mapleplot
}
}
\DeclareOption{dvilaser}{
\edef\Driver{dvilaser}
\AtEndOfPackage{
\typeout{ ...configuring graphics for dvilaser driver}
\usepackage[dvilaser]{epsfig}
\let\mapleplot\epsfigmapleplot
\let\imapleplot\mapleplot
}
}
\DeclareOption{dvipsone}{
\edef\Driver{dvipsone}
\AtEndOfPackage{
\typeout{ ...configuring graphics for dvipsone driver}
\usepackage[dvipsone]{epsfig}
%%% \let\mapleplot\mapleplotname %%%
\let\mapleplot\epsfigmapleplot
\let\imapleplot\mapleplot
}
}
\DeclareOption{dvitops}{
\edef\Driver{dvitops}
\AtEndOfPackage{
\typeout{ ...configuring graphics for dvitops driver}
\usepackage[dvitops]{epsfig}
\let\mapleplot\epsfigmapleplot
\let\imapleplot\mapleplot
}
}
\DeclareOption{dviwindo}{
\edef\Driver{dviwindo}
\AtEndOfPackage{
\typeout{ ...configuring graphics for dviwindo driver}
\usepackage[dviwindo]{epsfig}
\let\mapleplot\epsfigmapleplot
\let\imapleplot\mapleplot
}
}
\DeclareOption{emtex}{
\edef\Driver{emtex}
\AtEndOfPackage{
\typeout{ ...configuring graphics for emtex driver}
\usepackage[emtex]{epsfig}
\let\mapleplot\epsfigmapleplot
\let\imapleplot\mapleplot
}
}
\DeclareOption{pubps}{
\edef\Driver{pubps}
\AtEndOfPackage{
\typeout{ ...configuring graphics for pubps driver}
\usepackage[pubps]{epsfig}
\let\mapleplot\epsfigmapleplot
\let\imapleplot\mapleplot
}
}
\DeclareOption{textures}{
\edef\Driver{textures}
\AtEndOfPackage{
\typeout{ ...configuring graphics for textures driver}
\usepackage[textures]{epsfig}
\let\mapleplot\epsfigmapleplot
\let\imapleplot\mapleplot
}
}
\DeclareOption{xdvi}{
\edef\Driver{xdvi}
\AtEndOfPackage{
\typeout{ ...configuring graphics for xdvi driver}
\usepackage[xdvi]{epsfig}
\let\mapleplot\epsfigmapleplot
\let\imapleplot\mapleplot
}
}
\DeclareOption{dvitps}{
\edef\Driver{dvitps}
\AtEndOfPackage{
\typeout{ ...configuring graphics for dvitps driver}
\usepackage[dvitps]{epsfig}
\let\mapleplot\epsfigmapleplot
\let\imapleplot\mapleplot
}
}
\DeclareOption{dviwin}{
\edef\Driver{dviwin}
\AtEndOfPackage{
\typeout{ ...configuring graphics for dviwin driver}
\usepackage[dviwin]{epsfig}
\let\mapleplot\epsfigmapleplot
\let\imapleplot\mapleplot
}
}
\DeclareOption{oztex}{
\edef\Driver{oztex}
\AtEndOfPackage{
\typeout{ ...Configuring graphics for OzTex, rotation not supported}
\usepackage[oztex]{epsfig}
\let\mapleplot\oztexmapleplot
\let\imapleplot\mapleplot
}%
}
\DeclareOption{SWP}{
\edef\Driver{SWP}
\AtEndOfPackage{
\typeout{ ...Configuring graphics for Scientific Work Place}
\let\mapleplot\swpmapleplot
\let\imapleplot\mapleplot
}
}
% \ExecuteOptions{dvips} % default's to dvips driver
\ProcessOptions*
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Utilities and Environments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Miscelaneous utilities used to define the main Maple environments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\typeout{Defining Maple Utility Macros}
%
% Utilities for changing character codes
%
\def\MakeTab#1{\catcode `#1 = 4 } % &
\def\MakeParameter#1{\catcode `#1 = 6 } % #
\def\MakeSuperScript#1{\catcode `#1 = 7 } % ^
\def\MakeSubScript#1{\catcode `#1 = 8 } % _
\def\MakeLetter#1{\catcode `#1 = 11 }
\def\MakeOther#1{\catcode`#1 = 12 }
\def\MakeActive#1{\catcode `#1 = \active\relax }
\def\MakeTabActive{\MakeActive{\^^I}}
\def\MakeEolActive{\MakeActive{\^^M}}
%
\@ifundefined{dospecials}{%
\gdef\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&\do\#\do\^\do\_\do\%\do\~}%
}{\relax}%
\@ifundefined{postdospecials}{%
\gdef\postdospecials{%
\catcode`\\\z@%
\catcode`\{\@ne%
\catcode`\}\tw@%
\catcode`\ 10%
\catcode`\&11}%
}{\relax}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% In a Maple tty environment every line is treated as a paragraph.
% The behavior at the end of every Maple paragraph (line) is given
% by, thereby inhibiting page breaks in such environments.
\def\@MaplePar{\nopagebreak[3]\par\@@par}%
% \def\@MaplePar{\nopagebreak[3]\EveryParZ\@@par}%
%
\newif\if@IgnoreNewLine
\@IgnoreNewLinetrue
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Characters requiring special treatment
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-- Spaces
\def\MapleSpace{\ }
\def\@ObeySpaces{\MakeActive{\ }\@@ObeySpaces\relax}
{\MakeActive{\ }\gdef\@@ObeySpaces{\edef {\MapleSpace}}}
%-- BackSlashes
{\catcode`| = 0 |catcode`\\ = 12 |gdef|BackSlash{\}}
%-- Tabs
\newdimen\@MapleTabSize
\def\@ObeyTabs{\MakeTabActive\@@ObeyTabs\relax}
{\MakeTabActive\gdef\@@ObeyTabs{\def^^I{\@MapleTab}}}
\def\@MapleTab{%
\leavevmode % ensure that we are in horizontal mode
\egroup % Terminate box register 0
\dimen0=\wd0 % store its length and round up to next stop
\divide\dimen0 by \@MapleTabSize
\advance\dimen0 by 1sp
\multiply \dimen0 by \@MapleTabSize
\wd0 = \dimen0
\box0
\setbox0 = \hbox\bgroup
}
%-- End of Line Character
\def\@ObeyEol{\MakeEolActive\@@ObeyEol\relax}%
{\MakeEolActive\gdef\@@ObeyEol{\let^^M=\@MapleEol}}
\def\@MapleEol{%
\if@IgnoreNewLine
\else
\leavevmode%
\egroup%
\box 0%
\@MaplePar%
\fi
\@IgnoreNewLinefalse
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Definitions of Utilities for the Main Maple Environments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% These Macros are the common elements of the verbatim like environents.
% The spacing above and below the environment should is done in the
% environment preamble instead of here to enable this to be used in a
% variety of such environments.
% \newtoks\MapleIOType \MapleIOType = {a}
\edef\@MapleQuiet{q} % indicates a silent command or result
\edef\@MapleVerbose{a} % The standard behavior in which
% results are generated and displayed.
\edef\@MapleNoPrompt{np} % specify no prompts in environment
\edef\@MaplePrompt{p} % specify prompts for this environment
\edef\@MapleNoInput{ni} % No input appears in output stream.
\edef\@MapleNoOutput{no} % No output appears in outputstream.
% The next macro is used by the verbatim like environments to
% reset character codes, and change the treatment of new lines, etc.
% Actions can be made conditional on the value of \@MapleIOType which
% is always set to 'a' , or to 'q' as in the value of the
% optional parameter used in \begin{mapleinput}[q]
\newtoks\MapleListCorrection \MapleListCorrection={}
\def\@SetupMapleTty#1{%
\par\@endpefalse %% to clear the \@endpetrue done in \mapleinput
\begingroup %% this is the real start of the special environment.
%%% Compute and set tab positions
\setbox 0 = \hbox{\@MapleFont X}
\@MapleTabSize = \wd0
\multiply\@MapleTabSize by \MapleTab
\setbox0 = \hbox{\relax} % Clearing \box 0
%%% paragraph dimensions and line spacing
\rightskip = 0pt
\parindent = 0pt
\parskip = 0pt
\ifnum\@listdepth>0%
\MapleListCorrection={\hskip-\@totalleftmargin\relax }
\LeftMapleSkip= 0em
\else
\MapleListCorrection={\hskip 0ex\relax }
\fi
\setlength{\leftskip}{\LeftMapleSkip}
\addtolength{\leftskip}{\@totalleftmargin}
\parfillskip = 0pt plus 1fil
%
%%% The next two parameters may have been changed
%%% by a \raggedright so they are reset here.
\spaceskip = 0pt \xspaceskip = 0pt
%
%%% Set this flag to 0 if the \begin{...} is to appear on a
%%% separate line of the source file.
\ifnum #1 = 0 \@IgnoreNewLinetrue\else\@IgnoreNewLinefalse\fi%
%
%%% Describe how to handle every paragraph (recall paragraph == line )
%% \@MapleFont%
\everypar = {\EveryParZ}%
\def\EveryParZ{%
\ifMaplePrompt
\the\MapleListCorrection
\the\MaplePromptString
\MaplePromptString = \MaplePromptSecondary
\MapleListCorrection = {\hskip 0pt\relax}
\fi
\setbox0 = \hbox \bgroup
}%
%
%%% Choose the type size and font - The order of these commands
%%% may be important.
\@MapleFont%
\lineskiplimit=0\normalbaselineskip%
\baselineskip=0.85\normalbaselineskip%
\@noligs%
\let\do\@makeother\dospecials%
\catcode ``=\active%
\frenchspacing%
\@ObeySpaces%
\@ObeyTabs%
\@ObeyEol%
}
% Exit the special tty environments
\def\@EndMapleTty{%
\endgroup%% matches the \begingroup inside of @SetupMapleTty
}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following Macros start the various Verbatim like environments
% for special Maple regions. These calls set up the
% scanning for the environment terminator.
%
% A conditional parameter as in \begin{...}[q] etc. denotes a
% special class of Maple Regions.
\begingroup
\catcode`| = 0 % becomes the escape character
\catcode`( = 1 % becomes a begin group
\catcode`) = 2 % becomes an end group
\catcode`@ = 11 % becomes a regular character (for macro names)
\catcode`\{ = 12 % becomes an other character
\catcode`\} = 12 % becomes a other character
\catcode`\\ = 12 % becomes a other character
%
% type a standard (verbose) usage
% type q quiet command
% type np no prompt (imapleinput only at this time...)
% type ni no input
% type no no output
%
% -- Maple Inert Input
|gdef|@BeginIMapleInput#1\end{imapleinput}(%
|MaplePrompttrue%
#1%
|end(imapleinput))%
%
% -- Inert TTY Output
|gdef|@BeginIMapleTtyout#1\end{imaplettyout}(%
|vskip|AboveMapleSkip% extra vspace is needed here
|MaplePromptfalse
#1%
|end(imaplettyout))%
%
% -- Fixed Width
|gdef|@BeginMapleFixedWidth#1\end{MapleFixedWidth}(%
|vskip|AboveMapleSkip% extra vspace is needed here
|MaplePromptfalse
#1%
|end(MapleFixedWidth))%
% -- TTY Input
|gdef|@BeginMapleInput[#1]#2\end{mapleinput}(%
|edef|@MapleIOType(#1)%
|gdef|MapleIOType(#1)%
|ifx|@MapleIOType|@MapleNoPrompt|MaplePromptfalse|fi%
|ifx|@MapleIOType|@MapleNoInput|edef|@MapleIOType(q)|fi%
|ifx|@MapleIOType|@MapleQuiet%
|typeout(.............Quiet Maple Command #1)%
|removelastskip%
|else%
%|typeout(.............Verbose Maple Command)%
#2%
|fi%
|end(mapleinput))%
%
% -- TTY Output
|gdef|@BeginMapleTtyout[#1]#2\end{maplettyout}(%
%%|typeout(TTYout Environment of type #1)%
|edef|@MapleIOType(#1)%
|gdef|MapleIOType(#1)%
|ifx|@MapleIOType|@MaplePrompt|MaplePromptfalse|fi%
|ifx|@MapleIOType|@MapleNoOutput|edef|@MapleIOType(q)|fi%
|ifx|@MapleIOType|@MapleQuiet%
|typeout(.............Quiet Maple Tty Out)%
|else%
#2%
|fi%
|end(maplettyout))%
%
% -- Suppressed Latex Output
|gdef|@GobbleMapleLatex#1\end{maplelatex}(%
|end(maplelatex))%
|endgroup
%
\@ifundefined{]}{\gdef\[{$}}{\relax}
\@ifundefined{[}{\gdef\]{$}}{\relax}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Standard Maple Environments
%
% 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Various Plot Configurations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\typeout{Defining Maple Plot Environemnts}
%
% -- noplots -- No Driver Available ?
%
\def\mapleplotname#1{
\typeout{ ...using Plot file #1}%
\vskip.5\MaplePlotHeight
\centerline{\Large \bfseries Plot: #1}
\vskip.5\MaplePlotHeight
}
%
% -- epsfig.sty (used by dvips, etc)
%
\def\epsfigmapleplot#1{
\parindent=0ex%
\MaplePlotWidth = 0.900\textwidth%
\MaplePlotHeight = 0.651\textwidth%
\MaplePlotHeight@Fudge=0.90\MaplePlotHeight%
\MaplePlotWidth@Fudge =0.90\MaplePlotWidth%
\ifvmode \removelastskip \else \par \parindent=0ex\removelastskip\fi
%% \par
\vskip \AboveMaplePlot
%
% Plot sizes must be fudged because Maple .eps plots
% generated using Maple's built-in PostScript plot driver
% are 6.5 x 9 inches landscape, but included in portrait
% mode to a much smaller scale.
%
\IfFileExists{#1}{%
\typeout{ ...including Plot #1 at size
\the\MaplePlotWidth\space by \the\MaplePlotHeight}%
\hbox{%
\relax
{}\hskip \LeftMapleSkip
\epsfig{figure=#1,%