diff options
author | Karl Berry <karl@freefriends.org> | 2009-06-29 00:19:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-06-29 00:19:38 +0000 |
commit | 50d15141640d062a1528132d10af8ae1e4d0279a (patch) | |
tree | f8a017d6ca1871838ab37260856d10b3931fad38 /Master/texmf | |
parent | d9b69c486ff463e30179a9e8bdacf6710f0ebc91 (diff) |
asymptote latex inputs
git-svn-id: svn://tug.org/texlive/trunk@13995 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rw-r--r-- | Master/texmf/tex/latex/asymptote/asycolors.sty | 72 | ||||
-rw-r--r-- | Master/texmf/tex/latex/asymptote/asymptote.sty | 272 | ||||
-rw-r--r-- | Master/texmf/tex/latex/asymptote/ocg.sty | 127 |
3 files changed, 471 insertions, 0 deletions
diff --git a/Master/texmf/tex/latex/asymptote/asycolors.sty b/Master/texmf/tex/latex/asymptote/asycolors.sty new file mode 100644 index 00000000000..31031c730fd --- /dev/null +++ b/Master/texmf/tex/latex/asymptote/asycolors.sty @@ -0,0 +1,72 @@ +\usepackage{color} +\definecolor{cyan}{cmyk}{1,0,0,0} +\definecolor{magenta}{cmyk}{0,1,0,0} +\definecolor{yellow}{cmyk}{0,0,1,0} +\definecolor{black}{cmyk}{0,0,0,1} + +\definecolor{white}{cmyk}{0,0,0,0} +\definecolor{gray}{cmyk}{0,0,0,0.5} + +\definecolor{red}{cmyk}{0,1,1,0} +\definecolor{green}{cmyk}{1,0,1,0} +\definecolor{blue}{cmyk}{1,1,0,0} + +\definecolor{palered}{cmyk}{0,0.25,0.25,0} +\definecolor{palegreen}{cmyk}{0.25,0,0.25,0} +\definecolor{paleblue}{cmyk}{0.25,0.25,0,0} +\definecolor{palecyan}{cmyk}{0.25,0,0,0} +\definecolor{palemagenta}{cmyk}{0,0.25,0,0} +\definecolor{paleyellow}{cmyk}{0,0,0.25,0} +\definecolor{palegray}{cmyk}{0,0,0,0.05} +\definecolor{lightred}{cmyk}{0,0.5,0.5,0} +\definecolor{lightgreen}{cmyk}{0.5,0,0.5,0} +\definecolor{lightblue}{cmyk}{0.5,0.5,0,0} +\definecolor{lightcyan}{cmyk}{0.5,0,0,0} +\definecolor{lightmagenta}{cmyk}{0,0.5,0,0} +\definecolor{lightyellow}{cmyk}{0,0,0.5,0} +\definecolor{lightgray}{cmyk}{0,0,0,0.1} +\definecolor{mediumred}{cmyk}{0,0.75,0.75,0} +\definecolor{mediumgreen}{cmyk}{0.75,0,0.75,0} +\definecolor{mediumblue}{cmyk}{0.75,0.75,0,0} +\definecolor{mediumcyan}{cmyk}{0.75,0,0,0} +\definecolor{mediummagenta}{cmyk}{0,0.75,0,0} +\definecolor{mediumyellow}{cmyk}{0,0,0.75,0} +\definecolor{mediumgray}{cmyk}{0,0,0,0.25} +\definecolor{heavyred}{cmyk}{0,1,1,0.25} +\definecolor{heavygreen}{cmyk}{1,0,1,0.25} +\definecolor{heavyblue}{cmyk}{1,1,0,0.25} +\definecolor{heavycyan}{cmyk}{1,0,0,0.25} +\definecolor{heavymagenta}{cmyk}{0,1,0,0.25} +\definecolor{lightolive}{cmyk}{0,0,1,0.25} +\definecolor{heavygray}{cmyk}{0,0,0,0.75} +\definecolor{deepred}{cmyk}{0,1,1,0.5} +\definecolor{deepgreen}{cmyk}{1,0,1,0.5} +\definecolor{deepblue}{cmyk}{1,1,0,0.5} +\definecolor{deepcyan}{cmyk}{1,0,0,0.5} +\definecolor{deepmagenta}{cmyk}{0,1,0,0.5} +\definecolor{olive}{cmyk}{0,0,1,0.5} +\definecolor{deepgray}{cmyk}{0,0,0,0.9} +\definecolor{darkred}{cmyk}{0,1,1,0.75} +\definecolor{darkgreen}{cmyk}{1,0,1,0.75} +\definecolor{darkblue}{cmyk}{1,1,0,0.75} +\definecolor{darkcyan}{cmyk}{1,0,0,0.75} +\definecolor{darkmagenta}{cmyk}{0,1,0,0.75} +\definecolor{darkolive}{cmyk}{0,0,1,0.75} +\definecolor{darkgray}{cmyk}{0,0,0,0.95} +\definecolor{orange}{cmyk}{0,0.5,1,0} +\definecolor{fuchsia}{cmyk}{0,1,0.5,0} +\definecolor{chartreuse}{cmyk}{0.5,0,1,0} +\definecolor{springgreen}{cmyk}{1,0,0.5,0} +\definecolor{purple}{cmyk}{0.5,1,0,0} +\definecolor{royalblue}{cmyk}{1,0.5,0,0} +\definecolor{salmon}{cmyk}{0,0.5,0.5,0} +\definecolor{brown}{cmyk}{0,1,1,0.5} +\definecolor{darkbrown}{cmyk}{0,1,1,0.75} +\definecolor{pink}{cmyk}{0,0.25,0,0} +\definecolor{palegrey}{cmyk}{0,0,0,0.05} +\definecolor{lightgrey}{cmyk}{0,0,0,0.1} +\definecolor{mediumgrey}{cmyk}{0,0,0,0.25} +\definecolor{grey}{cmyk}{0,0,0,0.5} +\definecolor{heavygrey}{cmyk}{0,0,0,0.5} +\definecolor{deepgrey}{cmyk}{0,0,0,0.9} +\definecolor{darkgrey}{cmyk}{0,0,0,0.95} diff --git a/Master/texmf/tex/latex/asymptote/asymptote.sty b/Master/texmf/tex/latex/asymptote/asymptote.sty new file mode 100644 index 00000000000..e1f059bf46d --- /dev/null +++ b/Master/texmf/tex/latex/asymptote/asymptote.sty @@ -0,0 +1,272 @@ +%%% Asymptote style file for LaTeX +%%% Contributed by Tom Prince 14 May 2003 +%%% Modified by John Bowman +%%% Adapted from comment.sty (Under GPL v2) + +\ProvidesPackage{asymptote}[2009/06/18 v1.08 Asymptote style file for LaTeX] +\RequirePackage{keyval} +\RequirePackage{ifthen} +\newif\ifASYinline +\DeclareOption{inline}{\ASYinlinetrue} +\ProcessOptions* + +% Work around jobname bug in MiKTeX 2.5 and 2.6: +% Turn stars in file names (resulting from spaces, etc.) into minus signs +\def\fixstar#1*#2\relax{\def\argtwo{#2}\ifx\argtwo\empty\gdef\Jobname{#1}\else +\fixstar#1-#2\relax\fi} +\expandafter\fixstar\jobname*\relax + +\RequirePackage{color,graphicx} + +\def\makeinnocent#1{\catcode`#1=12 } +\def\csarg#1#2{\expandafter#1\csname#2\endcsname} +\newwrite\AsyStream +\newread\AsyTestStream +\newread\AsyTestTeXStream +\def\AsyFile{\jobname.asy} + +\openin\AsyTestStream=\jobname_.pre +\ifeof\AsyTestStream +\else +\input \jobname_.pre +\fi +\closein\AsyTestStream% + +\immediate\openout\AsyStream=\AsyFile +\immediate\write\AsyStream{if(!settings.multipleView)}% +\immediate\write\AsyStream{ settings.batchView=false;}% + +\newif\ifASYattach +\newif\ifASYtex + +\newif\ifASYPDF +\ifx\pdfoutput\undefined +\else +\ifcase\pdfoutput +\else +\ASYPDFtrue +\fi +\fi +\ifx\XeTeXversion\undefined +\else +\ASYPDFtrue +\immediate\write\AsyStream{settings.texcommand="xelatex";}% +\fi +\ifASYPDF +\immediate\write\AsyStream{settings.tex="pdflatex";}% +\fi + +\ifASYinline +\immediate\write\AsyStream{settings.inlinetex=true;}% +\immediate\write\AsyStream{deletepreamble();}% +\fi + +\newbox\ASYbox +\newcounter{asy} + +\def\ProcessAsymptote#1% start it all off +{\begingroup + \def\CurrentAsymptote{#1}% + \let\do\makeinnocent \dospecials + \makeinnocent\^^L% and whatever other special cases + \endlinechar`\^^M \catcode`\^^M=12 \xAsymptote} +{\catcode`\^^M=12 \endlinechar=-1 % + \gdef\xAsymptote{% + \expandafter\ProcessAsymptoteLine} + \gdef\ProcessAsymptoteLine#1^^M{\def\test{#1} + \csarg\ifx{End\CurrentAsymptote Test}\test + \edef\next{\noexpand\EndOfAsymptote{\CurrentAsymptote}}% + \else \ThisAsymptote{#1}\let\next\ProcessAsymptoteLine + \fi \next} +} + +\def\ASYstringmeaning#1{\expandafter\ASYgobblearrow\meaning#1} +\def\ASYstringcsnoescape#1{\expandafter\ASYgobbleescape\string#1} +{\escapechar-1 + \expandafter\expandafter\expandafter\gdef + \expandafter\expandafter\expandafter\ASYgobblearrow + \expandafter\string\csname macro:->\endcsname{} +} +\def\ASYgobbleescape#1{\ifnum`\\=`#1 \else #1\fi} + +\def\WriteAsyLine#1{\def\ASYtmp{#1}% + \immediate\write\AsyStream{\ASYstringmeaning\ASYtmp}} + +\def\gedefappend#1#2{% + \toks@ = \expandafter{#1}% + \global\edef#1{\the\toks@ #2}% +}% +\def\globalASYdefs{} +\def\WriteGlobalAsyLine#1{\def\ASYtmp{#1^^J}% +\gedefappend\globalASYdefs{\ASYstringmeaning\ASYtmp}} + +\def\EndOfAsymptote#1{\endgroup\end{#1}% + \csname After#1Asymptote\endcsname} +\def\AsymptoteEndDef#1{{\escapechar=-1\relax + \csarg\xdef{End#1Test}{\string\\end\string\{#1\string\}}% + }} + +\def\AfterasyAsymptote{% + \ifx\ASYwidth\empty + \ifx\ASYheight\empty + \else + \immediate\write\AsyStream{size(0,\ASYheight);}% + \fi + \else + \ifx\ASYheight\empty + \immediate\write\AsyStream{size(\ASYwidth,0);}% + \else + \immediate\write\AsyStream{size(\ASYwidth,\ASYheight);}% + \fi + \fi + \ASYtexfalse + \ifASYattach + \def\ASYdefaultviewportwidth{0} + \else + \def\ASYdefaultviewportwidth{\the\linewidth} + \ifASYinline + \ASYtextrue + \fi + \fi + \ifx\ASYviewportwidth\empty + \ifx\ASYviewportheight\empty + \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 + \gdef\ASYwidth{} + \gdef\ASYheight{} + \gdef\ASYviewportwidth{\ASYdefaultviewportwidth} + \gdef\ASYviewportheight{} + \immediate\write\AsyStream{\@charrb);}% + \immediate\write\AsyStream{// End of Asymptote Figure \the\c@asy}% + \ifASYtex + \openin\AsyTestStream=\Jobname-\the\c@asy_.tex + \else + \ifASYPDF + \openin\AsyTestStream=\Jobname-\the\c@asy.pdf + \else + \openin\AsyTestStream=\Jobname-\the\c@asy.eps + \fi + \fi + \ifeof\AsyTestStream + \ifASYtex + \PackageWarning{asymptote}{file \Jobname-\the\c@asy_.tex does not exist}% + \else + \openin\AsyTestTeXStream=\Jobname-\the\c@asy_.tex + \ifeof\AsyTestTeXStream + \ifASYPDF + \PackageWarning{asymptote}{file \Jobname-\the\c@asy.pdf does not exist}% + \else + \PackageWarning{asymptote}{file \Jobname-\the\c@asy.eps does not exist}% + \fi + \else + \catcode`:=12 + \input \Jobname-\the\c@asy_.tex% + \fi + \closein\AsyTestTeXStream% + \fi + \closein\AsyTestStream% + \else + \closein\AsyTestStream% + \ifASYtex + \catcode`:=12 + \input \Jobname-\the\c@asy_.tex% + \else + \ifASYattach + \ifASYPDF + \openin\AsyTestStream=\Jobname-\the\c@asy+0.pdf + \fi + \ifeof\AsyTestStream + \setbox\ASYbox=\hbox{\includegraphics[hiresbb]{\Jobname-\the\c@asy}}% + \else + \setbox\ASYbox=\hbox{\includegraphics[hiresbb]{\Jobname-\the\c@asy+0}}% + \fi + \textattachfile{\Jobname-\the\c@asy.pdf}{\phantom{\copy\ASYbox}}% + \vskip-\ht\ASYbox% + \indent% + \box\ASYbox% + \closein\AsyTestStream% + \else + \includegraphics[hiresbb]{\Jobname-\the\c@asy}% + \fi + \fi + \fi + \global\ASYattachfalse + \relax% + \endgroup} +\gdef\ASYwidth{}% +\define@key{ASYkeys}{width}{% + \gdef\ASYwidth{#1}% +} +\gdef\ASYheight{}% +\define@key{ASYkeys}{height}{% + \gdef\ASYheight{#1}% +} +\gdef\ASYviewportwidth{\ASYdefaultviewportwidth}% +\define@key{ASYkeys}{viewportwidth}{% + \gdef\ASYviewportwidth{#1}% +} +\gdef\ASYviewportheight{}% +\define@key{ASYkeys}{viewportheight}{% + \gdef\ASYviewportheight{#1}% +} +\define@key{ASYkeys}{attach}[true]{% + \ifthenelse{\equal{#1}{true}}{\global\ASYattachtrue}{\global\ASYattachfalse}% +} +\newcommand\asy[1][]{% + \begingroup + \let\par\empty + \stepcounter{asy}% + \setkeys{ASYkeys}{#1}% + \immediate\write\AsyStream{}% + \immediate\write\AsyStream{// Beginning of Asymptote Figure \the\c@asy}% + \immediate\write\AsyStream{eval(quote\@charlb}% + \immediate\write\AsyStream{defaultfilename='\Jobname-\the\c@asy';}% + \immediate\write\AsyStream{if(settings.render < 0) settings.render=4;}% + \ifASYattach + \immediate\write\AsyStream{settings.inlineimage=false;}% + \immediate\write\AsyStream{settings.embed=false;}% + \immediate\write\AsyStream{settings.outformat='pdf';}% + \immediate\write\AsyStream{settings.toolbar=true;}% + \else + \immediate\write\AsyStream{settings.inlineimage=true;}% + \immediate\write\AsyStream{settings.embed=true;}% + \immediate\write\AsyStream{settings.outformat='';}% + \immediate\write\AsyStream{settings.toolbar=false;}% + \immediate\write\AsyStream{viewportmargin=(1,1);}% + \fi + \immediate\write\AsyStream{\globalASYdefs}% + \let\ThisAsymptote\WriteAsyLine% + \ProcessAsymptote{asy}% +} +\AsymptoteEndDef{asy} +\def\asydef{% + \let\ThisAsymptote\WriteGlobalAsyLine% + \ProcessAsymptote{asydef}} +\AsymptoteEndDef{asydef} +\def\AfterasydefAsymptote{} + +\AtEndDocument{\immediate\closeout\AsyStream} + +\newcommand{\ASYanimategraphics}[5][]{% +\openin\AsyTestStream=_#3.pdf +\ifeof\AsyTestStream% +\else% +\animategraphics[{#1}]{#2}{_#3}{#4}{#5}% +\fi% +} + +\def\Asymptote{{\tt Asymptote}} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: "shared" +%%% End: diff --git a/Master/texmf/tex/latex/asymptote/ocg.sty b/Master/texmf/tex/latex/asymptote/ocg.sty new file mode 100644 index 00000000000..3ba555b58e8 --- /dev/null +++ b/Master/texmf/tex/latex/asymptote/ocg.sty @@ -0,0 +1,127 @@ +%% Copyright (C) 2007 by Michael Ritzert <michael.ritz...@gmail.com> +%% Spurious spaces removed by John Bowman [2009/06/01]. + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{ocg}[2009/06/01] + +\RequirePackage{ifpdf} +\ifpdf +\else + \PackageWarningNoLine{ocg}{% + Loading aborted, because pdfTeX is not running in PDF mode% + }% + \expandafter\endinput +\fi + +\DeclareOption*{}\ProcessOptions*\relax %allow anything as option for the moment + +%testing for correct pdfTeX version +%TODO: find out minimum required version! +\ifnum\pdftexversion<120 + \PackageError{ocg}{% + pdfeTeX, version >= 1.20, required% + }{% + Install a newer version!% + }% +\fi + +% Next OCG id -- TODO: autogenerate. but keep possibility to reopen an OCG. +\newcount\@ocg@num\@ocg@num=0 + +\gdef\@ocg@layersnames{} + +% called from the aux file +\def\@ocg@makeknown#1#2#3{% #1: OCG name, #2: OC id, #3: on/off + \@ifundefined{OCG#2}{% + \message{OCG#2} + \expandafter\gdef\csname OCG#2\endcsname{#1}% + \immediate\pdfobj{<< /Type /OCG /Name (#1) >>}% new ocg + \xdef\@ocg@curocg{\the\pdflastobj\space 0 R}% reference to id + \xdef\@ocg@ocgs{\@ocg@ocgs\space\@ocg@curocg}% list of all OCGs in "first defined" order + \ifnum#3=1 %on + \xdef\@ocg@ocgson{\@ocg@ocgson\space\@ocg@curocg}% list of all default-on OCGs + \else% + \xdef\@ocg@ocgsoff{\@ocg@ocgsoff\space\@ocg@curocg}% list of all default-off OCGs + \fi% + \xdef\@ocg@layersnames{% + \@ocg@layersnames\space/OC#2\space\@ocg@curocg% name-to-id mapping + }% + }{% + \message{OCG#2 reopened} + % layer reopened + } +} + +\AtBeginDocument{% + % the auxfile has been read if available. register the OCGs in the page resources. + \@ocg@addresource + \let\@ocg@makeknown\@gobble +} + +% set page resources to include the layers defined in the aux file +\def\@ocg@addresource{% + \immediate\pdfobj{<<\@ocg@layersnames\space>>}% + \xdef\@ocg@namesobj{\the\pdflastobj\space 0 R}% + % append to pageresources + \begingroup + \edef\x{\endgroup + \pdfpageresources{% + \the\pdfpageresources + /Properties \@ocg@namesobj% + }% + }% + \x +} + +\newcount\@ocg@@ocgs +\pdfobj reserveobjnum +\@ocg@@ocgs=\pdflastobj + +\newcount\@ocg@@layersconfig +\pdfobj reserveobjnum +\@ocg@@layersconfig=\pdflastobj + +\pdfcatalog{% + /OCProperties << + /OCGs \the\@ocg@@ocgs\space0 R\space + /D \the\@ocg@@layersconfig\space0 R\space + >>% +} +\def\@ocg@ocgs{} +\def\@ocg@ocgson{} +\def\@ocg@ocgsoff{} +\AtEndDocument{% + \immediate\pdfobj useobjnum \@ocg@@ocgs {% + [\@ocg@ocgs\space]% + }% + \immediate\pdfobj useobjnum \@ocg@@layersconfig {% + << + /Order [\@ocg@ocgs\space] + /ON [\@ocg@ocgson\space] + /OFF [\@ocg@ocgsoff\space] + >>% + }% +}% + +% schedule a OCG for creation on the next pdflatex run (via the auxfile) +\def\@ocg@newocg#1#2#3{% #1:name, #2:num, #3:on + \if@filesw% + \immediate\write\@auxout{% + \string\@ocg@makeknown{#1}{#2}{#3}% + }% + \fi% +} + +% TODO: Are nested OCGs allowed? +\newenvironment{ocg}[3]{% + \@ocg@newocg{#1}{#2}{#3}% + \gdef\@ocg@curnum{#2}% + \pdfliteral{/OC /OC\@ocg@curnum\space BDC}% + \message{/OC\@ocg@curnum}% + \ignorespaces +}{% + \pdfliteral{EMC}% + %\unskip% + %\endgroup% + \ignorespacesafterend +} |