summaryrefslogtreecommitdiff
path: root/graphics/asymptote/doc/asy-latex.dtx
blob: cbd74e8e2d43d3908222564c052c172df6f14f77 (plain)
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
% \iffalse
%
%<*internal>
\begingroup
%</internal>
%<*batchfile>
\input docstrip.tex
\keepsilent
\preamble
____________________________
The ASYMPTOTE package

(C) 2003 Tom Prince
(C) 2003-2020 John Bowman
(C) 2010 Will Robertson

Adapted from comment.sty

Licence: GPL2+

\endpreamble
\nopostamble
\askforoverwritefalse
\generate{\file{asymptote.sty}{\from{\jobname.dtx}{pkg}}}
%</batchfile>
%<batchfile>\endbatchfile
%<*internal>
\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
\edef\tmpa{plain}
\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi
\endgroup
\immediate\write18{makeindex -s gind.ist -o \jobname.ind  \jobname.idx}
\immediate\write18{makeindex -s gglo.ist -o \jobname.gls  \jobname.glo}
%</internal>
%
%<*driver>
\ProvidesFile{asy-latex.dtx}
%</driver>
%<pkg>\ProvidesPackage{asymptote}
%<*pkg>
  [2020/01/12 v1.35 Asymptote style file for LaTeX]
%</pkg>
%
%<*driver>
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \GetFileInfo{asy-latex.dtx}
% \title{The \textsf{asymptote} package}
% \author{%
%    John Bowman, Tom Prince, and Will Robertson
% }
% \date{\filedate\qquad\fileversion}
% \maketitle
% \begin{abstract}
% This package provides integration of inline and external Asymptote
% graphics within a \LaTeX\ document.
% \end{abstract}
%
% \tableofcontents
%
% \section{Introduction}
%
% This is the documentation for the \LaTeX\ package \texttt{asymptote}
% which accompanies the Asymptote drawing package. For further details on
% Asymptote, please see its documentation in \texttt{asymptote.pdf}.
%
% \section{User syntax}
%
% \subsection{Package loading and options}
%
% The package may take two options at load time: \texttt{inline} or
% \texttt{attach}.
% These options can also be set at any time with the
% \cmd\asysetup\marg{options} command, or specified individually in the
% optional argument to each \texttt{asy} environment or \texttt{asyinclude}
% command.
%
% The \texttt{inline} option uses Asymptote's `inline' mode whereby
% included graphics have their labels typeset in the environment of the
% document they are contained within. Otherwise the Asymptote graphics are
% self-contained and their formatting is independent of the document.
%
% The \texttt{attach} option allows generated graphics to be embedded
% within the PDF using the \texttt{attachfile2} package; please load that
% package separately if you wish to use it. The \texttt{attach} option
% takes precedence over the \texttt{inline} option.
%
% This package produces quite a number of output files, which by default
% are created in the same directory as the \LaTeX\ document that is being
% compiled. To keep things more tidy, you can specify an output directory
% for these files by defining the \cmd\asydir\ command. For example, if you
% wish to store the figure files in the subdirectory \texttt{asytmp/}, the
% you would write \verb|\renewcommand\asydir{asytmp}|.
%
% Alternatively (and tentatively), you may write \verb|dir=asytmp| in
% either the \texttt{asy} environment options or the options to
% \cmd\asysetup.
%
% \subsection{Commands for inserting Asymptote graphics}
%
% The main environment defined by the package is the \texttt{asy}
% environment, in which verbatim Asymptote code is placed that will be
% compiled for generating a graphic in the document. For example,
% \begin{verbatim}
% \begin{figure}
% \begin{asy}[ <options> ]
% <ASYMPTOTE CODE>
% \end{asy}
% \caption{...}\label{...}
% \end{verbatim}
%
% If you have Asymptote code in a separate file, you can include it with
% the \cmd\asyinclude\oarg{options}\marg{filename}\ command.
%
% For Asymptote code that should be included in \emph{every} graphic,
% define it using the \texttt{asydef} environment.
%
% \subsection{Graphics options}
%
% Both the \texttt{asy} environment and the \cmd\asyinclude\ command take
% optional parameters for controlling aspects of the graphics creation. In
% addition to locally setting \texttt{inline} and \texttt{attach}, the
% following options may also be used:
% \begin{description}
% \item[width] Width of the figure
% \item[height] Height of the figure
% \item[keepAspect] Maintain aspect ratio [default true]
% \item[viewportwidth] Viewport width for 3D figures
% \item[viewportheight] Viewport height for 3D figures
% \end{description}
% These may also be set globally using the \cmd\asysetup\ command.
%
% \section{Processing the document}
%
% After running \LaTeX\ on the document, it is necessary to process the
% Asymptote graphics so they can be included in the next compilation. The
% simplest procedure is a recipe such as
% \begin{verbatim}
% pdflatex mydoc
% asy mydoc-*.asy
% pdflatex mydoc
% \end{verbatim}
% This technique will recompile each graphic every time, however. To only
% recompile graphics that have changed, use the \texttt{latexmk}
% tool. Asymptote is distributed with a \texttt{latexmkrc} configuration
% file; place this file in a place where \texttt{latexmk} will find it and
% your document may be compiled, including the \texttt{asy} compilations,
% with \texttt{latexmk mydoc} or \texttt{latexmk --pdf mydoc}.
%
% \section{Implementation}
%
% \iffalse
%<*pkg>
% \fi
%
%    \begin{macrocode}
\def\Asymptote{{\tt Asymptote}}
%    \end{macrocode}
%
%    \begin{macrocode}
\InputIfFileExists{\jobname.pre}{}{}
%    \end{macrocode}
%
% \subsection{Allocations}
%
% \paragraph{Allocations}
%
%    \begin{macrocode}
\newbox\ASYbox
\newdimen\ASYdimen
\newcounter{asy}
%    \end{macrocode}
%
%    \begin{macrocode}
\newwrite\AsyStream
\newwrite\AsyPreStream
%    \end{macrocode}
%
%    \begin{macrocode}
\newif\ifASYinline
\newif\ifASYattach
\newif\ifASYkeepAspect
\ASYkeepAspecttrue
%    \end{macrocode}
%
% \subsection{Packages}
%
%    \begin{macrocode}
\RequirePackage{keyval}
\RequirePackage{ifthen}
\RequirePackage{color,graphicx}
%    \end{macrocode}
%
% \paragraph{Emulating packages}
% We cannot assume that Asymptote users have recent
% \TeX\ distributions. (E.g., Fedora until recently still shipped teTeX.)
% So load \textsf{ifpdf} and \textsf{ifxetex} if they exist; otherwise,
% emulate them.
%
% In due course, delete this code and just load the packages.
%    \begin{macrocode}
\IfFileExists{ifpdf.sty}{
  \RequirePackage{ifpdf}
}{
  \expandafter\newif\csname ifpdf\endcsname
  \ifx\pdfoutput\@undefined\else
    \ifcase\pdfoutput\else
      \pdftrue
    \fi
  \fi
}
%    \end{macrocode}
%
%    \begin{macrocode}
\IfFileExists{ifxetex.sty}{
  \RequirePackage{ifxetex}
}{
  \expandafter\newif\csname ifxetex\endcsname
  \ifx\XeTeXversion\@undefined\else
    \xetextrue
  \fi
}
%    \end{macrocode}
%
% \begin{macro}{\CatchFileDef}
% Used for \cmd\asyinclude.
% Note that the fallback definition is not as robust as the one provided by catchfile.
%    \begin{macrocode}
\IfFileExists{catchfile.sty}{
  \RequirePackage{catchfile}
}{
  \newcommand\CatchFileDef[3]{%
    \begingroup
    \everyeof{%
      \ENDCATCHFILEMARKER
      \noexpand
    }%
    \long\def\@tempa####1\ENDCATCHFILEMARKER{%
      \endgroup
      \def##1{####1}%
    }%
    ##3%
    \expandafter\@tempa\@@input ##2\relax
  }
}
%    \end{macrocode}
% \end{macro}
%
% \paragraph{Ensuring attachfile2 is loaded if [attach] is requested}
%    \begin{macrocode}
\newif\if@asy@attachfile@loaded
%    \end{macrocode}
%
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifpackageloaded{attachfile2}{\@asy@attachfile@loadedtrue}{}%
  \let\asy@check@attachfile\asy@check@attachfile@loaded
}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcommand\asy@check@attachfile@loaded{%
  \if@asy@attachfile@loaded\else
    \PackageError{asymptote}{You must load the attachfile2 package}{^^J%
      You have requested the [attach] option for some or all of your^^J%
      Asymptote graphics, which requires the attachfile2 package.^^J%
      Please load it in the document preamble.^^J%
    }%
  \fi
}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcommand\asy@check@attachfile{%
  \AtBeginDocument{\asy@check@attachfile@loaded}%
  \let\asy@check@attachfile\@empty
}
%    \end{macrocode}
%
% \paragraph{Macros}
%    \begin{macrocode}
\def\csarg#1#2{\expandafter#1\csname#2\endcsname}
%    \end{macrocode}
%
% \subsection{Package options}
%
%    \begin{macrocode}
\DeclareOption{inline}{%
  \ASYinlinetrue
}
\DeclareOption{attach}{%
  \asy@check@attachfile
  \ASYattachtrue
}
\ProcessOptions*
%    \end{macrocode}
%
%    \begin{macrocode}
\def\asylatexdir{}
\def\asydir{}
\def\ASYasydir{}
\def\ASYprefix{}
%    \end{macrocode}
%
%
% \subsection{Testing for PDF output}
% Note this is not quite the same as \cs{ifpdf}, since we still want PDF
% output when using XeTeX.
%    \begin{macrocode}
\newif\ifASYPDF
\ifxetex
  \ASYPDFtrue
  \usepackage{everypage}
\else
  \ifpdf
    \ASYPDFtrue
  \fi
\fi
\ifASYPDF
  \def\AsyExtension{pdf}
\else
  \def\AsyExtension{eps}
\fi
%    \end{macrocode}
%
% \subsection{Bug squashing}
%
%    \begin{macrocode}
\def\unquoteJobname#1"#2"#3\relax{%
  \def\rawJobname{#1}%
  \ifx\rawJobname\empty
    \def\rawJobname{#2}%
  \fi
}
\expandafter\unquoteJobname\jobname""\relax
%    \end{macrocode}
% Work around jobname bug in MiKTeX 2.5 and 2.6:
% Turn stars in file names (resulting from spaces, etc.) into minus signs
%    \begin{macrocode}
\def\fixstar#1*#2\relax{%
  \def\argtwo{#2}%
  \ifx\argtwo\empty
    \gdef\Jobname{#1}%
  \else
    \fixstar#1-#2\relax
  \fi
}
\expandafter\fixstar\rawJobname*\relax
%    \end{macrocode}
%
% Work around bug in dvips.def: allow spaces in file names.
%    \begin{macrocode}
\def\Ginclude@eps#1{%
  \message{<#1>}%
  \bgroup
  \def\@tempa{!}%
  \dimen@\Gin@req@width
  \dimen@ii.1bp\relax
  \divide\dimen@\dimen@ii
  \@tempdima\Gin@req@height
  \divide\@tempdima\dimen@ii
    \special{PSfile=#1\space
      llx=\Gin@llx\space
      lly=\Gin@lly\space
      urx=\Gin@urx\space
      ury=\Gin@ury\space
      \ifx\Gin@scalex\@tempa\else rwi=\number\dimen@\space\fi
      \ifx\Gin@scaley\@tempa\else rhi=\number\@tempdima\space\fi
      \ifGin@clip clip\fi}%
  \egroup
}
%    \end{macrocode}
%
% \subsection{Input/Output}
%
%    \begin{macrocode}
\immediate\openout\AsyPreStream=\jobname.pre\relax
\AtEndDocument{\immediate\closeout\AsyPreStream}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\WriteAsyLine#1{%
  \immediate\write\AsyStream{\detokenize{#1}}%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\globalASYdefs{}
\def\WriteGlobalAsyLine#1{%
  \expandafter\g@addto@macro
  \expandafter\globalASYdefs
  \expandafter{\detokenize{#1^^J}}%
}
%    \end{macrocode}
%
% \subsection{Commands for verbatim processing environments}
%
%    \begin{macrocode}
\def\ProcessAsymptote#1{%
  \begingroup
  \def\CurrentAsymptote{#1}%
  \let\do\@makeother \dospecials
  \@makeother\^^L% and whatever other special cases
  \catcode`\ =10
  \endlinechar`\^^M \catcode`\^^M=12 \xAsymptote
}
%    \end{macrocode}
% Need lots of comment chars here because \meta{line end} is no longer a
% space character.
%    \begin{macrocode}
\begingroup
  \catcode`\^^M=12 \endlinechar=-1\relax%
  \gdef\xAsymptote{%
    \expandafter\ProcessAsymptoteLine%
  }
  \gdef\ProcessAsymptoteLine#1^^M{%
    \def\@tempa{#1}%
    {%
      \escapechar=-1\relax%
      \xdef\@tempb{\string\\end\string\{\CurrentAsymptote\string\}}%
    }%
    \ifx\@tempa\@tempb%
      \edef\next{\endgroup\noexpand\end{\CurrentAsymptote}}%
    \else%
      \ThisAsymptote{#1}%
      \let\next\ProcessAsymptoteLine%
    \fi%
    \next%
  }
\endgroup
\def\asy@init{%
  \def\ASYlatexdir{}%
  \ifx\asylatexdir\empty\else
    \def\ASYlatexdir{\asylatexdir/}%
  \fi
  \ifx\asydir\empty\else
    \def\ASYasydir{\asydir/}%
  \fi
  \def\ASYprefix{\ASYlatexdir\ASYasydir}%
}
%    \end{macrocode}
%
% \subsection{User interface}
%
%    \begin{macrocode}
\newcommand\asy[1][]{%
  \stepcounter{asy}%
  \setkeys{ASYkeys}{#1}%
%    \end{macrocode}
% Disable the "inline" option if "attach" is enabled:
%    \begin{macrocode}
  \ifASYattach
    \ASYinlinefalse
  \fi
%    \end{macrocode}
%
%    \begin{macrocode}
  \asy@init
  \immediate\write\AsyPreStream{%
    \noexpand\InputIfFileExists{%
      \ASYprefix\noexpand\jobname-\the\c@asy.pre}{}{}%
  }%
  \asy@write@graphic@header
  \let\ThisAsymptote\WriteAsyLine
  \ProcessAsymptote{asy}%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\endasy{%
  \asy@finalise@stream
  \asy@input@graphic
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\asy@write@graphic@header{%
  \immediate\openout\AsyStream=\ASYasydir\jobname-\the\c@asy.asy\relax
  \gdef\AsyFile{\ASYprefix\Jobname-\the\c@asy}%
  \immediate\write\AsyStream{%
    if(!settings.multipleView) settings.batchView=false;^^J%
    \ifxetex
      settings.tex="xelatex";^^J%
    \else\ifASYPDF
        settings.tex="pdflatex";^^J%
    \fi\fi
    \ifASYinline
      settings.inlinetex=true;^^J%
      deletepreamble();^^J%
    \fi
    defaultfilename="\Jobname-\the\c@asy";^^J%
    if(settings.render < 0) settings.render=4;^^J%
    settings.outformat="";^^J%
    \ifASYattach
      settings.inlineimage=false;^^J%
      settings.embed=false;^^J%
      settings.toolbar=true;^^J%
    \else
      settings.inlineimage=true;^^J%
      settings.embed=true;^^J%
      settings.toolbar=false;^^J%
      viewportmargin=(2,2);^^J%
    \fi
    \globalASYdefs
  }%
}
\def\asy@expand@keepAspect{%
  \ifASYkeepAspect keepAspect=true%
  \else keepAspect=false%
  \fi%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\asy@finalise@stream{%
%    \end{macrocode}
% Setting \verb|size()|. Only inserted if one of the dimensions is
% set explicitly (i.e., if both height and width are not empty).
%    \begin{macrocode}
  \ifx\ASYwidth\@empty
    \ifx\ASYheight\@empty
      % write nothing!
    \else
      \immediate\write\AsyStream{size(0,\ASYheight,\asy@expand@keepAspect);}%
    \fi
  \else
    \ifx\ASYheight\@empty
      \immediate\write\AsyStream{size(\ASYwidth,0,\asy@expand@keepAspect);}%
    \else
      \immediate\write\AsyStream{size(\ASYwidth,\ASYheight,\asy@expand@keepAspect);}%
    \fi
  \fi
%    \end{macrocode}
% Setting \verb|viewportsize=()|. Same logic as for \verb|size()|.
%    \begin{macrocode}
  \ifx\ASYviewportwidth\@empty
    \ifx\ASYviewportheight\@empty
      % write nothing!
    \else
      \immediate\write\AsyStream{viewportsize=(0,\ASYviewportheight);}%
    \fi
  \else
    \ifx\ASYviewportheight\@empty
      \immediate\write\AsyStream{viewportsize=(\ASYviewportwidth,0);}%
    \else
      \immediate\write\AsyStream{%
        viewportsize=(\ASYviewportwidth,\ASYviewportheight);}%
    \fi
  \fi
  \immediate\closeout\AsyStream
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\asy@input@graphic{%
  \ifASYinline
    \IfFileExists{"\AsyFile.tex"}{%
      \catcode`:=12\relax
      \@@input"\AsyFile.tex"\relax
    }{%
      \PackageWarning{asymptote}{file `\AsyFile.tex' not found}%
    }%
  \else
    \IfFileExists{"\AsyFile.\AsyExtension"}{%
      \ifASYattach
        \ifASYPDF
          \IfFileExists{"\AsyFile+0.pdf"}{%
            \setbox\ASYbox=\hbox{\includegraphics[hiresbb]{\AsyFile+0.pdf}}%
          }{%
            \setbox\ASYbox=\hbox{\includegraphics[hiresbb]{\AsyFile.pdf}}%
          }%
        \else
          \setbox\ASYbox=\hbox{\includegraphics[hiresbb]{\AsyFile.eps}}%
        \fi
        \textattachfile{\AsyFile.\AsyExtension}{\phantom{\copy\ASYbox}}%
        \vskip-\ht\ASYbox
        \indent
        \box\ASYbox
      \else
        \ifASYPDF
          \includegraphics[hiresbb]{\AsyFile.pdf}%
        \else
          \includegraphics[hiresbb]{\AsyFile.eps}%
        \fi
      \fi
    }{%
%    \end{macrocode}
% 3D PRC figures require inline mode.
%    \begin{macrocode}
      \IfFileExists{"\AsyFile.tex"}{%
        \catcode`:=12
        \@@input"\AsyFile.tex"\relax
      }{%
        \PackageWarning{asymptote}{%
          file `\AsyFile.\AsyExtension' not found%
        }%
      }%
    }%
  \fi
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\asydef{%
  \let\ThisAsymptote\WriteGlobalAsyLine
  \ProcessAsymptote{asydef}%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcommand\asyinclude[2][]{%
  \begingroup
  \stepcounter{asy}%
  \setkeys{ASYkeys}{#1}%
  \ifASYattach
    \ASYinlinefalse
  \fi
  \asy@init
  \immediate\write\AsyPreStream{%
    \noexpand\InputIfFileExists{%
      \ASYprefix\noexpand\jobname-\the\c@asy.pre}{}{}%
  }%
  \asy@write@graphic@header
  \IfFileExists{#2.asy}{%
    \CatchFileDef\@tempa{#2.asy}{%
      \let\do\@makeother
      \dospecials
      \endlinechar=10\relax
    }%
  }{%
    \IfFileExists{#2}{%
      \CatchFileDef\@tempa{#2}{%
        \let\do\@makeother
        \dospecials
        \endlinechar=10\relax
      }%
    }{%
      \PackageWarning{asymptote}{file #2 not found}%
      \def\@tempa{}%
    }%
  }%
  \immediate\write\AsyStream{\unexpanded\expandafter{\@tempa}}%
  \asy@finalise@stream
  \asy@input@graphic
  \endgroup
}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcommand{\ASYanimategraphics}[5][]{%
  \IfFileExists{_#3.pdf}{%
    \animategraphics[{#1}]{#2}{_#3}{#4}{#5}%
  }{}%
}
%    \end{macrocode}
%
% \subsection{Keys for graphics processing}
%
%    \begin{macrocode}
\newcommand\asysetup[1]{\setkeys{ASYkeys}{#1}}
%    \end{macrocode}
%
%    \begin{macrocode}
\define@key{ASYkeys}{dir}{%
  \def\asydir{#1}%
}
\def\ASYwidth{}
\define@key{ASYkeys}{width}{%
  \edef\ASYwidth{\the\dimexpr#1\relax}%
}
\def\ASYheight{}
\define@key{ASYkeys}{height}{%
  \edef\ASYheight{\the\dimexpr#1\relax}%
}
\define@key{ASYkeys}{keepAspect}[true]{%
  \ifthenelse{\equal{#1}{true}}
    {\ASYkeepAspecttrue}
    {\ASYkeepAspectfalse}%
}
\def\ASYviewportwidth{}
\define@key{ASYkeys}{viewportwidth}{%
  \edef\ASYviewportwidth{\the\dimexpr#1\relax}%
}
\def\ASYviewportheight{}
\define@key{ASYkeys}{viewportheight}{%
  \edef\ASYviewportheight{\the\dimexpr#1\relax}%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\define@key{ASYkeys}{inline}[true]{%
  \ifthenelse{\equal{#1}{true}}
    {\ASYinlinetrue}
    {\ASYinlinefalse}%
}
\define@key{ASYkeys}{attach}[true]{%
  \ifthenelse{\equal{#1}{true}}
    {\ASYattachtrue}
    {\ASYattachfalse}%
}
%    \end{macrocode}
%
% \iffalse
%</pkg>
% \fi
%
% \Finale
%