talks/20091108-Riverside/xypdfpdf.tex
changeset 153 f58334ec3d1d
equal deleted inserted replaced
152:85428d871089 153:f58334ec3d1d
       
     1 %% xypdfpdf.tex from $Id: xypdfpdf.doc,v $
       
     2 %%
       
     3 %% Xy-pic ``PDF-PDF'' PDF support.
       
     4 %% Copyright (c) 1999-1999 Ross Moore <ross@mpce.mq.edu.au>
       
     5 %%
       
     6 %% This file is part of the Xy-pic package for graphs and diagrams in TeX.
       
     7 %% See the companion README and INSTALL files for further information.
       
     8 %% Copyright (c) 1991-1999 Kristoffer H. Rose <krisrose@ens-lyon.fr>
       
     9 %%
       
    10 %% The Xy-pic package is free software; you can redistribute it and/or modify
       
    11 %% it under the terms of the GNU General Public License as published by the
       
    12 %% Free Software Foundation; either version 2 of the License, or (at your
       
    13 %% option) any later version.
       
    14 %%
       
    15 %% The Xy-pic package is distributed in the hope that it will be useful, but
       
    16 %% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
       
    17 %% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
       
    18 %% for more details.
       
    19 %%
       
    20 %% You should have received a copy of the GNU General Public License along
       
    21 %% with this package; if not, write to the Free Software Foundation, Inc.,
       
    22 %% 675 Mass Ave, Cambridge, MA 02139, USA.
       
    23 %%
       
    24 %% As a special exception, you may use this file and all files derived
       
    25 %% from it without restrictions. This special exception was added with
       
    26 %% version 3.7 of Xy-pic.
       
    27 %%
       
    28 \expandafter\ifx\csname xypdf-pdfloaded\endcsname\empty
       
    29  \message{not reloaded}\endinput \fi
       
    30 \expandafter\let\csname xypdf-pdfloaded\endcsname=\empty \xycatcodes
       
    31 \global\newif\ifPDFspecials@
       
    32 \xylet@\PDFmacro@@=\eat@
       
    33 \xylet@\PDFdict@@=\eat@
       
    34 \xylet@\PDFspecial@@=\eat@
       
    35 \xylet@\PDFread@@=\eat@
       
    36 \xylet@\PDFinclude@@=\eat@
       
    37 \xylet@\PDFraw@@=\eat@
       
    38 \xylet@\xyPDFobeylines@@=\relax
       
    39 \xylet@\PDFspecialdict@@=\eat@
       
    40 \xydef@\UnloadPDFpdf@{%
       
    41  \let\PDFmacro@@=\eat@
       
    42  \let\PDFdict@@=\eat@
       
    43  \let\PDFspecial@@=\eat@
       
    44  \let\PDFread@@=\eat@
       
    45  \let\PDFinclude@@=\eat@
       
    46  \let\PDFraw@@=\eat@
       
    47  \let\xyPDFobeylines@@=\relax
       
    48  \let\PDFspecialdict@@=\eat@
       
    49 }
       
    50 \xydef@\UnloadPDF@{\UnloadPDFpdf@
       
    51  \expandafter\ifx\csname xypdfloaded\endcsname\unknown\PDFspecials@false
       
    52  \else\expandafter\NoPDFspecials\fi}
       
    53 \xylet@\UnloadPDF@@=\UnloadPDF@
       
    54 \ifx\undefined\dvitype@\xydef@\dvitype@{null}\fi
       
    55 \xylet@\xyrealshipout@=\shipout
       
    56 \xydef@\xyPDFshipout@{\xyrealshipout@}
       
    57 \xydef@\firstPDF@{%
       
    58  \global\let\firstPDF@@=\relax \global\let\firstPDF@=\relax}
       
    59 \xylet@\firstPDF@@=\firstPDF@
       
    60 \xylet@\dumpPDFdict@@=\relax
       
    61 \xydef@\installxypdf@{%
       
    62  \xyinputorelse@{xypdfpdf}{\xydrivernoload@{pdfpdf}}\xycatcodes
       
    63  \installxypdf@@ \installxypdf@x }
       
    64 \xylet@\installxypdf@@=\relax
       
    65 \xylet@\setupxyPDF@@=\PDFspecials@true
       
    66 \xywithoption{pdf}{\let\setupxyPDF@@=\setupxyPDF@}
       
    67 \xydef@\installxypdf@x{
       
    68  \let\firstPDF@=\relax
       
    69  \let\XYpredict@=\relax
       
    70  \setupxyPDF@@ }
       
    71 \xydef@\setupxyPDF@{\PDFspecials@true}
       
    72 \let\realinstallxypdf@x=\installxypdf@x
       
    73 \ifx\undefined\AfterBeginDocument
       
    74  \def\installxypdf@x{\xysetup@@{\realinstallxypdf@x}}%
       
    75 \else
       
    76  \def\installxypdf@x{\AfterBeginDocument{\realinstallxypdf@x}}%
       
    77 \fi
       
    78 \xydef@\xydefaultdriver@{dvipdf}
       
    79 \xydef@\xyPDFdriver#1{\def\xydefaultdriver@{#1}}
       
    80 \xydef@\installxypdf@orig{\DN@{}%
       
    81  \ifx\xydriversselected@@\empty
       
    82  \DN@{\expandafter\defaultinstallpdf@\expandafter{\xydefaultdriver@}}%
       
    83  \else \def\do##1{%
       
    84  \expandafter\ifx\csname##1@xy@pdf\endcsname\relax
       
    85  \DN@{\defaultinstallpdf@{##1}}}%
       
    86  \xydriversselected@@ 
       
    87  \else \DN@##1{}\fi\fi \next@ }
       
    88 \xydef@\defaultinstallpdf@#1#2{%
       
    89  \xywarning@{no driver specified, using #1 }%
       
    90  \xyrequire{#1}\csname #1@xy@pdf\endcsname{}}
       
    91 \xydef@\null@xy@pdf{\installxypdf@}
       
    92 \xydefcsname@{shape [!...]}#1{%
       
    93  \expandafter\ifx\csname xypdf-sloaded\endcsname\empty \DN@{\xyPDFescapestyle@{#1}@@}%
       
    94  \else\ifxyPDFshapes@\DN@{\xyPDFshapechar@{#1}@@}%
       
    95  \else \DN@{\xyPDFcharwarning@}\fi\fi \next@ }
       
    96 \xydefcsname@{shape [pdfxy]}{\ifxyPDFshapes@\DN@{\xyPDFpdfxy@}%
       
    97  \else \DN@{\xyPDFcharwarning@}\fi \next@ }
       
    98 \xydef@\xyPDFpdfxy@{%
       
    99  \setboxz@h{\dimen@=\L@p \advance\dimen@-\R@p 
       
   100  \dimen@ii=-\U@p \raise\dimen@ii\hbox to\z@{%
       
   101  \kern\dimen@\xyPDFcurrpt@\kern-\dimen@}\boxz@}}%
       
   102 \xydef@\xyPDFcurrpt@{\ifxyPDFshapes@\expandafter\xyPDFcurrpt@@\fi}
       
   103 \xydef@\xyPDFcurrpt@@@{\PDFspecial@@{xyi}\PDFraw@@{userdict begin xyx end}}%%%%<<<<<--- here
       
   104 \ifx\undefined\xyPDFcurrpt@@ \xylet@\xyPDFcurrpt@@=\xyPDFcurrpt@@@ \fi
       
   105 \xywarnifdefined\xyPDFshapechar@
       
   106 \xywarnifdefined\xyPDFsplitshape@
       
   107 {\xyuncatcodes \catcode`@=11
       
   108  \gdef\xyPDFshapechar@#1@@{\xyPDFsplitshape@#1<><>@@}%
       
   109  \gdef\xyPDFsplitshape@#1<>#2<>#3@@{\xyPDFsplitPDF@{#1}{#2}}}
       
   110 \xydef@\xyPDFrawA@#1{\expandafter\xyPDFrawAA@ #1{}{}}%
       
   111 \xydef@\xyPDFrawAA@#1#2{\PDFraw@@{ #1 #2}\PDFmessage{ #1 #2 }}%
       
   112 \xydef@\xyPDFrawZ@#1{\PDFraw@@{ #1}\PDFmessage{ #1 }}%
       
   113 \xydef@\modPDFboxz@{%
       
   114  \expandafter\DN@\expandafter{\xyPDFpre@{}}\ifx\next@\empty\else
       
   115  \setboxz@h{\expandafter\xyPDFrawA@\expandafter{\xyPDFpre@{}}\boxz@
       
   116  \expandafter\xyPDFrawZ@\expandafter{\xyPDFpost@}}\DN@{}\fi}%
       
   117 \xydef@\modPDFdrop@{%
       
   118  \expandafter\DNii@\expandafter{%
       
   119  \expandafter\xyPDFrawA@\expandafter{\xyPDFpre@{}}}%
       
   120  \DN@##1{\expandafter\def\expandafter\tmp@\expandafter{\nextii@ ##1}}%
       
   121  \expandafter\next@\expandafter{\Drop@@}%
       
   122  \expandafter\DNii@\expandafter{%
       
   123  \expandafter\xyPDFrawZ@\expandafter{\xyPDFpost@}}%
       
   124  \DN@##1{\expandafter\def\expandafter\Drop@@\expandafter{\tmp@ ##1}}%
       
   125  \expandafter\next@\expandafter{\nextii@}}%
       
   126 \xydef@\modPDFconnect@{%
       
   127  \expandafter\DNii@\expandafter{%
       
   128  \expandafter\xyPDFrawA@\expandafter{\xyPDFpre@{}}}%
       
   129  \DN@##1{\expandafter\def\expandafter\tmp@\expandafter{\nextii@ ##1}}%
       
   130  \expandafter\next@\expandafter{\Connect@@}%
       
   131  \expandafter\DNii@\expandafter{%
       
   132  \expandafter\xyPDFrawZ@\expandafter{\xyPDFpost@}}%
       
   133  \DN@##1{\expandafter\def\expandafter\Connect@@\expandafter{\tmp@ ##1}}%
       
   134  \expandafter\next@\expandafter{\nextii@}}%
       
   135 \xydef@\xyPDFpre@{{}{}}
       
   136 \xydef@\xyPDFpost@{}
       
   137 \xydef@\PDFmessage@#1{\W@{PDF: #1}}
       
   138 \xydef@\PDFignore@#1{}%
       
   139 \xydef@\showPDFmessages{\let\PDFmessage=\PDFmessage@}
       
   140 \xydef@\hidePDFmessages{\let\PDFmessage=\PDFignore@}
       
   141 \xylet@\PDFtracing=\showPDFmessages
       
   142 \hidePDFmessages
       
   143 \xydef@\PDFmacro@#1{\PDFmacro@@{#1}\PDFmessage{#1}}
       
   144 \xydef@\includeXYPDFdict@{\relax}
       
   145 \xydef@\xyPDFdictknown@{}
       
   146 \xywarnifdefined\obeyoutlines@
       
   147 {\catcode`\^^M=\active%
       
   148  \gdef\obeyoutlines@{\catcode`\^^M=\active \def^^M{^^J}%
       
   149  \newlinechar=`\^^J\obeyspaces}}
       
   150 \xynew@{if}\ifxyPDFshapes@ \xyPDFshapes@true 
       
   151 \xydef@\xyPDFcharwarning@@{\xyPDFcharmessage@
       
   152  \gdef\xyPDFcharwarning@@{\xyPDFcharmessage@
       
   153  \xywarning@{...no further PDF warnings will be given}%
       
   154  \global\let\xyPDFcharwarning@@=\relax }}
       
   155 \xydef@\xyPDFcharmessage@{\xywarning@{%
       
   156  the current <driver> does not fully support PDF effects}}%
       
   157 \xydef@\newxyshape#1#2#3{%
       
   158  \DN@{#3}\ifx\next@\empty
       
   159  \xydefcsname@{shape [#1]}{\csname xyshape@#1@\endcsname}%
       
   160  \else \expandafter\def\csname shape [#1]\endcsname{%
       
   161  \csname xyshape@#1@\endcsname}\fi
       
   162  \DN@{#2}\ifx\next@\empty
       
   163  \expandafter\def\csname xyshape@#1@\endcsname{%
       
   164  \xyundefinedEffect@{#1}{}@@}%
       
   165  \else \expandafter\def\csname xyshape@#1@\endcsname{#2}\fi }
       
   166 \xydef@\xyundefinedEffect@#1#2@@{%
       
   167  \xywarning@{The #1 #2 effect is not implemented with the current driver}}%
       
   168 \xydef@\newxyPDFshape#1#2{%
       
   169  \expandafter\DN@\expandafter{\csname shape [#1]\endcsname}%
       
   170  \DNii@{\relax}\ifx\next@\nextii@ \newxyshape{#1}{}\relax\fi
       
   171  \expandafter\DNii@\expandafter{\csname xyPDFshape@#1@\endcsname}%
       
   172  \expandafter\def\nextii@{#2}%
       
   173  \ifx\nextii@\empty\expandafter\def\next@{\xyPDFnotimplemented@@`#1'@@}%
       
   174  \else
       
   175  \edef\tmp@{\noexpand\let\expandafter\noexpand\next@
       
   176  \expandafter\noexpand\nextii@}%
       
   177  \expandafter\tmp@\fi }
       
   178 \xydef@\xyPDFnotimplemented@@#1@@{%
       
   179  \xywarning@{This PostScript effect is not implemented yet}}%
       
   180 \xydef@\xyPDFnotfinished@@{%
       
   181  \xywarning@{This effect is not reliable yet; box sizes may be wrong}}%
       
   182 \installxypdf@
       
   183 \endinput
       
   184 
       
   185 
       
   186 
       
   187 
       
   188 
       
   189