diff options
author | Karl Berry <karl@freefriends.org> | 2008-02-24 18:22:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-02-24 18:22:07 +0000 |
commit | ac768be5ab2e638802806ac364ca4402e8e9935e (patch) | |
tree | bf26e0d972206f02cda2535e35dd8c2a33c04eaa /Master/texmf-dist/tex/generic/pgf/utilities | |
parent | bc195e7c0fe9d96cd9b6c0230da50da6fc28de26 (diff) |
pgf 2.0, third try
git-svn-id: svn://tug.org/texlive/trunk@6747 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/utilities')
8 files changed, 1748 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex new file mode 100644 index 00000000000..7cd2e4e1127 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex @@ -0,0 +1,717 @@ +% Copyright 2006 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgfcalendar.code.tex,v 1.11 2007/07/23 21:23:14 tantau Exp $ + + +% Translation stuff + +\ifx\translate\@undefined + \def\translate#1{#1} +\fi + +% Load month dictionary, if possible + +\ifx\usedictionary\@undefined +\else + \usedictionary{translator-months-dictionary} +\fi + + + + +% Typeset a calendar +% +% #1 = prefix for the calendar nodes +% #2 = begin date in ISO format +% #3 = end date in ISO format +% #4 = date rendering code +% +% Description: +% +% First note that this macro need not be called inside a pgfpicture +% (even though it often will be). You can use it to typeset +% calendars also using packages other than pgf. You do not even need +% to load pgf to use this file. +% +% A calendar is typeset as follows: You specify a range of dates (by +% providing a begin and an end date). Then, for each date the code #4 +% is executed. When the code is called, lots of information about the +% current date (like its day of week) is available. The job of +% #4 is to render the date. Typically, this is done by placing nodes +% somewhere, but the function could do other things as well. +% It is also the job of #4 to position the calendar correctly. +% +% The different calls of #4 are not surrounded by TeX groups (though +% you can do so yourself, of course). This means that settings can +% accumulate between different calls, which is often desirable and +% useful. +% +% Inside #4 code, different macros can be access: +% +% \pgfcalendarprefix +% The parameter #1. This prefix is recomended for nodes inside the +% calendar, but you have to use it yourself explicitly. +% +% \pgfcalendarbeginiso +% Start date of range being typeset in ISO format (like 2006-01-10) +% +% \pgfcalendarbeginjulian +% Julian day number of start date begin typeset +% +% \pgfcalendarendiso +% End date of range begin typeset +% +% \pgfcalendarendjulian +% Same as Julian day number +% +% \pgfcalendarcurrentjulian (a TeX-count) +% Julian day number of day to be rendered/considered +% +% \pgfcalendarcurrentweekday +% Weekday (0 = Monday) of day to be checked +% +% \pgfcalendarcurrentyear +% Year of day to be checked +% +% \pgfcalendarcurrentmonth +% Month of day to be chjeck +% +% \pgfcalendarcurrentday +% Day of monath of day to be checked +% +% +% Inside the \pgfcalendar macro the macro \ifdate is available, which +% has the same effect as \pgfcalendarifdate{\pgfcalendarcurrentjulian} +% (only faster). This means that you +% can write, say, \ifdate{Monday}{current date is a Monday}{Not a Monday}. +% +% Example: +% +% \begin{tikzpicture} +% \pgfcalendar{cal}{2007-01-20}{2007-02-10} +% {\node[anchor=base] {\pgfcalendaronday}; \pgftransformyshift{-1.5em}} +% \end{tikzpicture} +% +% \pgfcalendar{cal}{2007-01-20}{2007-02-10}{ \pgfcalendaronday\ } + +\long\def\pgfcalendar#1#2#3#4{% + \begingroup% + % Setup local \ifdate + \let\ifdate=\pgfcalendar@local@ifdate% + % Let's start with computing start and end dates... + \def\pgfcalendarprefix{#1}% + \pgfcalendardatetojulian{#2}{\pgfcalendarcurrentjulian}% + \edef\pgfcalendarbeginjulian{\the\pgfcalendarcurrentjulian}% + \edef\pgfcalendarbeginiso{#2}% + \pgfcalendardatetojulian{#3}{\pgfutil@tempcnta}% + \edef\pgfcalendarendjulian{\the\pgfutil@tempcnta}% + \advance\pgfutil@tempcnta by1\relax% + \edef\pgfcalendarendjulianplus{\the\pgfutil@tempcnta}% + \edef\pgfcalendarendiso{#3}% + % + % Start main loop + % + \loop% + \ifnum\pgfcalendarcurrentjulian<\pgfcalendarendjulianplus\relax% + % Setup information about current date + \pgfcalendarjuliantodate{\pgfcalendarcurrentjulian}% + {\pgfcalendarcurrentyear}{\pgfcalendarcurrentmonth}{\pgfcalendarcurrentday}% + \pgfcalendarjuliantoweekday{\pgfcalendarcurrentjulian}{\pgfutil@tempcntb}% + \edef\pgfcalendarcurrentweekday{\the\pgfutil@tempcntb}% + % Render: + #4% + % Advance day: + \advance\pgfcalendarcurrentjulian by1\relax% + \repeat% + \endgroup% +} + +\newcount\pgfcalendarcurrentjulian + +\def\pgfcalendar@local@ifdate{% + \let\pgfcalendarifdatejulian=\pgfcalendarcurrentjulian% + \let\pgfcalendarifdateyear=\pgfcalendarcurrentyear% + \let\pgfcalendarifdatemonth=\pgfcalendarcurrentmonth% + \let\pgfcalendarifdateday=\pgfcalendarcurrentday% + \let\pgfcalendarifdateweekday=\pgfcalendarcurrentweekday% + \pgfcalendar@launch@ifdate% +} + + + +% Execute on specific kinds of dates +% +% #1 = ISO-format date +% #2 = date specification +% #3 = code +% +% Description: +% +% The given code #3 is execute on every day that matches the date +% specification #2. This specification is a comma-separated list of +% key-value pairs with the path /pgf/calendar. The code for a +% key-value should check whether the given day matches its +% specification. If so, it should set \pgfcalendarmatches to true. +% +% When the key-value code is executed, the following macros will have +% been setup: +% +% \pgfcalendarifdatejulian +% Julian day number of day to be checked +% +% \pgfcalendarifdateweekday +% Weekday (0 = Monday) of day to be checked +% +% \pgfcalendarifdateyear +% Year of day to be checked +% +% \pgfcalendarifdatemonth +% Month of day to be chjeck +% +% \pgfcalendarifdateday +% Day of month of day to be checked +% +% The setting of these macros will persist after the call, so a +% sideeffect of callling this macro is to setup these macros. +% +% By setting \ifpgfcalendar@do@not@recompute to false, the computation +% of the year, month etc. is suppressed. +% +% Examples: +% +% \pgfcalendarifdate{2007-01-10}{all}{} +% % Simply setup the macros +% +% \pgfcalendarifdate{2007-01-10}{mondays}{Is a monday} +% +% \pgfcalendarifdate{\mydate}{date=05-01}{\mydate is a Worker's Day} + +\def\pgfcalendarifdate#1#2#3#4{% + \pgfcalendardatetojulian{#1}{\pgfutil@tempcnta}% + \pgfcalendarjuliantodate{\pgfutil@tempcnta} + {\pgfcalendarifdateyear}{\pgfcalendarifdatemonth}{\pgfcalendarifdateday}% + \edef\pgfcalendarifdatejulian{\the\pgfutil@tempcnta}% + % Compute info about date + \pgfcalendarjuliantoweekday{\pgfutil@tempcnta}{\pgfutil@tempcntb}% + \edef\pgfcalendarifdateweekday{\the\pgfutil@tempcntb}% + % + \pgfcalendar@launch@ifdate{#2}{#3}{#4}% +} + + +\long\def\pgfcalendar@launch@ifdate#1#2#3{% + % When this macro is called, the pgfcalendarifdatexxxx macros must + % be setup correctly + % + % Set match to false + \pgfcalendarmatchesfalse% + \pgfqkeys{/pgf/calendar}{#1}% + \ifpgfcalendarmatches% + #2% + \else% + #3% + \fi% +} + +\newif\ifpgfcalendarmatches + + +% Keys for matching + +\pgfkeys{/pgf/calendar/all/.code=\pgfcalendarmatchestrue} + +\pgfkeys{/pgf/calendar/Monday/.code={\ifnum\pgfcalendarifdateweekday=0\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/Tuesday/.code={\ifnum\pgfcalendarifdateweekday=1\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/Wednesday/.code={\ifnum\pgfcalendarifdateweekday=2\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/Thursday/.code={\ifnum\pgfcalendarifdateweekday=3\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/Friday/.code={\ifnum\pgfcalendarifdateweekday=4\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/Saturday/.code={\ifnum\pgfcalendarifdateweekday=5\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/Sunday/.code={\ifnum\pgfcalendarifdateweekday=6\relax\pgfcalendarmatchestrue\fi}} + +\pgfkeys{/pgf/calendar/workday/.code={\ifnum\pgfcalendarifdateweekday<5\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/weekend/.code={\ifnum\pgfcalendarifdateweekday>4\relax\pgfcalendarmatchestrue\fi}} + +\pgfkeys{/pgf/calendar/equals/.cd,.value required,.code={% + \pgfcalendar@special@datetojulian{#1}% + \ifnum\pgfcalendarifdatejulian=\pgfutil@tempcnta\relax% + \pgfcalendarmatchestrue% + \fi}% +} + +\pgfkeys{/pgf/calendar/day of month/.cd,.value required,.code={\ifnum#1=\pgfcalendarifdateday\relax\pgfcalendarmatchestrue\fi}} +\pgfkeys{/pgf/calendar/end of month/.cd,.default=1,.code={% + % Tricky and expensive ... do only if necessary + \ifpgfcalendarmatches% + \else% sigh + {% + \pgfutil@tempcnta=\pgfcalendarifdatejulian\relax% + \advance\pgfutil@tempcnta by#1\relax% + \pgfcalendarjuliantodate{\pgfutil@tempcnta}{\pgf@dummy}{\pgf@dummy}{\pgf@cal@temp}% + \global\let\pgf@cal@temp=\pgf@cal@temp% + }% + \ifnum\pgf@cal@temp=1\relax\pgfcalendarmatchestrue\fi% + \fi}% +} + +\pgfkeys{/pgf/calendar/at least/.cd,.value required,.code={% + \pgfcalendar@special@datetojulian{#1}% + \ifnum\pgfcalendarifdatejulian<\pgfutil@tempcnta\relax% + \else% + \pgfcalendarmatchestrue% + \fi% +}} + +\pgfkeys{/pgf/calendar/at most/.cd,.value required,.code={% + \pgfcalendar@special@datetojulian{#1}% + \ifnum\pgfcalendarifdatejulian>\pgfutil@tempcnta\relax% + \else% + \pgfcalendarmatchestrue% + \fi% +}} + +\pgfkeys{/pgf/calendar/between/.cd,.value required,.code args={#1and#2}{% + \pgfcalendar@special@datetojulian{#1}% + \ifnum\pgfcalendarifdatejulian<\pgfutil@tempcnta\relax% + \else% + \pgfcalendar@special@datetojulian{#2}% + \ifnum\pgfcalendarifdatejulian>\pgfutil@tempcnta\relax% + \else% + \pgfcalendarmatchestrue% + \fi% + \fi% +}} + +\def\pgfcalendar@special@datetojulian#1{% + \edef\pgf@temp{#1}% + \expandafter\pgfcalendar@special@split@test\pgf@temp-\relax{#1}% +} + +\def\pgfcalendar@special@split@test#1-#2-#3\relax#4{% + \def\pgf@temp{#3}% + \ifx\pgf@temp\pgfutil@empty% + \def\pgf@temp{\pgfcalendarifdateyear-#1-#2}% + \else% + \def\pgf@temp{#4}% + \fi% + \pgfcalendardatetojulian{\pgf@temp}{\pgfutil@tempcnta}% +} + + +% Suggested name for nodes inside a calendar +% +% Description: +% +% It is suggested that (main) nodes (if present) in a calendar should +% get this name. +% +% Example: +% +% \pgfcalendar{cal}{2007-01-20}{2007-02-10}{} +% { \node[anchor=base] (\pgfcalendarsuggestedname) {\pgfcalendarifdateday}; +% \pgftransformyshift{-1.5em} } +% +% \draw (cal-2007-01-30) -- (cal-2007-02-08); + +\def\pgfcalendarsuggestedname{% + \ifx\pgfcalendarprefix\pgfutil@empty\else\pgfcalendarprefix-% + \pgfcalendarcurrentyear-\pgfcalendarcurrentmonth-\pgfcalendarcurrentday\fi% +} + + + +% +% +% Date conversion functions +% +% + + + +% Convert a date to the Julian day number (number of days since +% January 1st, -4712) +% +% #1 = date specification +% #2 = counter that should be set to the number of days +% +% Description: +% +% The conversion is taken from the Wikipedia entry on Julian days. +% +% The date specification works as follows: +% +% - It starts with a year. Use \year for the current year (the year +% the file is being typeset). +% - Next comes a hyphen. +% - Next comes a month (number). Use \month for the current month. +% - Next comes a hyphen. +% - Next comes either a day of month (number, use \day for current +% day) or "last". The keyword "last" refers the last day of the +% month. Thus, 2006-01-last is the same as 2006-01-31 and +% 2000-02-last is the same as 2002-02-29. +% - Next may come a plus sign, followed by a number (positive or +% negative). This will adjust the date by the given number of +% days. Thus, 2006-01-31+1 is the same as 2006-02-01 and +% 2006-02-01+-2 is the same as 2006-01-30. And \year-\month-day+1 is +% tomorrow. You may add a space before the +. +% +% Example: +% +% \pgfcalendardatetojulian{2006-01-10}{\mycount} + +\def\pgfcalendardatetojulian#1#2{\edef\pgf@temp{#1}\expandafter\pgfcalendar@datetojulian\pgf@temp+/{#2}} +\def\pgfcalendar@datetojulian#1-#2-#3+#4/#5{% + {% + % + % Store year, month and days. + % + \count1=#1\relax% + \count2=#2\relax% + % If #3=="last", then calculate first day of next month + \edef\pgf@temp{#3}% + \ifx\pgf@temp\pgfcalendar@last@text% + \advance\count2 by1\relax% + \count3=1\relax% + \else% + \count3=#3\relax% + \fi% + % + % Store offset + % + \edef\pgf@@temp{#4}% + \ifx\pgf@@temp\pgfutil@empty% + \count8=0\relax% + \else% + \pgfcalendar@unpack#4% + \fi% + % + % + % 4) a = \lfloor (14-month) /12 \rfloor + % + \ifnum\count2<3\relax% + \count4=1\relax% + \else% + \count4=0\relax% + \fi% + % + % 5) y = year + 4800 - a + % + \count5=\count1\relax% + \advance\count5 by 4800\relax% + \advance\count5 by-\count4\relax% + % + % 6) m = month + 12a - 3 + % + \count6=\count2\relax% + \count0=\count4\relax% + \multiply\count0 by12\relax + \advance\count6 by\count0\relax% + \advance\count6 by-3\relax% + % + % 7) jdn = day + \floor{(153 m+2)/5} + 365y + \floor{y/4} - + % \floor{y/100} + \florr{y/400} - 32045 + % + \count7=\count3\relax% + % + \floor{(153 m+2)/5} : + \count0=\count6\relax% + \multiply\count0 by 153\relax% + \advance\count0 by 2\relax% + \divide\count0 by 5\relax% + \advance\count7 by \count0\relax% + % + 365y : + \count0=\count5% + \multiply\count0by365\relax% + \advance\count7 by\count0\relax% + % + \floor{y/4} + \count0=\count5\relax% + \divide\count0 by 4\relax% + \advance\count7 by\count0% + % - \floor{y/100} + \count0=\count5\relax% + \divide\count0 by 100\relax% + \advance\count7 by-\count0\relax% + % + \floor{y/400} + \count0=\count5\relax% + \divide\count0 by 400\relax% + \advance\count7 by\count0% + % - 32045 + \advance\count7 by-32045\relax% + % + % Undo "last" advance + \ifx\pgf@temp\pgfcalendar@last@text% + \advance\count7by-1\relax% + \fi% + % Add offset + \advance\count7by\count8\relax% + \expandafter% + }% + \expandafter#5\the\count7\relax% +} +\def\pgfcalendar@last@text{last} +\def\pgfcalendar@unpack#1+{% + \count8=#1\relax% +} + +% Convert Julian day number date. +% +% #1 = the number of Julian days +% #2 = a macro in which the year should be stored. +% #3 = a macro in which the month should be stored. +% #4 = a macro in which the day should be stored. +% +% Formula used: +% +% 1) J = Julian day number +% 2) j = J + 32044 +% 3) g = j div 146097 +% 4) dg = j mod 146097 +% 5) c = (dg div 36524 + 1) * 3 div 4 +% 6) dc = dg - c * 36524 +% 7) b = dc div 1461 +% 8) db = dc mod 1461 +% 9) a = (db div 365 + 1) * 3 div 4 +% 10)da = db - a * 365 +% 11)y = g * 400 + c * 100 + b * 4 + a +% 12)m = (da * 5 + 308) div 153 - 2 +% 13)d = da - (m + 4) * 153 div 5 + 122 +% 14)Y = y - 4800 + (m + 2) div 12 +% 15)M = (m + 2) mod 12 + 1 +% 16)D = d + 1 +% +% Example +% +% \pgfcalendarjuliantodate{\mynumber}{\myyear}{\mymonth}{\myday} + +\def\pgfcalendarjuliantodate#1#2#3#4{% + {% + % 1) J = Julian day number + \count1=#1\relax% + % 2) j = J + 32044 + \count2=\count1\relax% + \advance\count2 by 32044\relax% + % 3) g = j div 146097 + \count3=\count2\relax% + \divide\count3 by 146097\relax% + % 4) dg = j mod 146097 + \count4=\count3\relax% + \multiply\count4 by-146097\relax% + \advance\count4 by\count2\relax% + % 5) c = (dg div 36524 + 1) * 3 div 4 + \count5=\count4\relax% + \divide\count5 by36524\relax% + \advance\count5 by1\relax% + \multiply\count5 by3\relax% + \divide\count5 by4\relax% + % 6) dc = dg - c * 36524 + \count6=\count4\relax% + \count0=\count5\relax% + \multiply\count0 by-36524\relax% + \advance\count6 by\count0\relax% + % 7) b = dc div 1461 + \count7=\count6\relax% + \divide\count7 by1461\relax% + % 8) db = dc mod 1461 + \count8=\count7\relax% + \multiply\count8 by-1461\relax% + \advance\count8 by\count6\relax% + % 9) a = (db div 365 + 1) * 3 div 4 + \count9=\count8\relax% + \divide\count9 by 365\relax% + \advance\count9 by 1\relax% + \multiply\count9 by3\relax% + \divide\count9 by4\relax% + % 10)da = db - a * 365 + \count10=\count8\relax% + \count0=\count9\relax% + \multiply\count0 by-365\relax% + \advance\count10 by\count0\relax% + % 11)y = g * 400 + c * 100 + b * 4 + a + \count11=\count3\relax% + \multiply\count11 by400\relax% + \count0=\count5\relax% + \multiply\count0 by100\relax% + \advance\count11 by\count0\relax% + \count0=\count7\relax% + \multiply\count0 by4\relax% + \advance\count11 by\count0\relax% + \advance\count11 by\count9\relax% + % 12)m = (da * 5 + 308) div 153 - 2 + \count12=\count10\relax% + \multiply\count12 by5\relax% + \advance\count12 by 308\relax% + \divide\count12 by 153\relax% + \advance\count12 by -2\relax% + % 13)d = - (m + 4) * 153 div 5 + 122 + da + \count13=\count12\relax% + \advance\count13 by 4\relax% + \multiply\count13 by153\relax% + \divide\count13 by5\relax% + \count13=-\count13\relax% + \advance\count13 by 122\relax% + \advance\count13 by \count10\relax% + % 14)Y = (m + 2) div 12 + y - 4800 + \count14=\count12\relax% + \advance\count14 by 2\relax% + \divide\count14 by12\relax% + \advance\count14 by\count11\relax% + \advance\count14 by-4800\relax% + % 15)M = (m + 2) mod 12 + 1 + \count15=\count12\relax% + \advance\count15 by2\relax% + \count0=\count15\relax% + \divide\count0 by12\relax% + \multiply\count0 by12\relax% + \advance\count15 by-\count0\relax% + \advance\count15 by1\relax% + % 16)D = d + 1 + \count16=\count13% + \advance\count16by 1\relax% + % + \xdef\pgf@temp@year{\the\count14}% + \xdef\pgf@temp@month{\ifnum\count15<10 0\fi\the\count15}% + \xdef\pgf@temp@day{\ifnum\count16<10 0\fi\the\count16}% + }% + \let#2=\pgf@temp@year% + \let#3=\pgf@temp@month% + \let#4=\pgf@temp@day% +} + + + +% Returns the day of week as a number between 0 = Monday and 6 = +% Sunday +% +% #1 = a Julian day number +% #2 = a counter into which the weekday should be put. +% +% Example: +% +% \pgfcalendardatetojulian{2006-01-10}{\mycount} +% \pgfcalendarjuliantoweekday{\mycount}{\myweekday} + +\def\pgfcalendarjuliantoweekday#1#2{% + {% + \pgfutil@tempcnta=#1\relax% + #2=\pgfutil@tempcnta% + \divide#2by7\relax% + \multiply#2by-7\relax% + \advance#2by\pgfutil@tempcnta\relax% + \expandafter% + }% + \expandafter#2\the#2\relax% +} + + + +% Converts a day of week into a weekday name (long or short) +% +% #1 = a number representing a weekday (0=Monday) +% +% Example: +% +% \pgfcalendardatetojulian{2006-01-10}{\mycount} +% \pgfcalendarjuliantoweekday{\mycount}{\myweekday} +% October 1st, 2006 was a \pgfcalendarweekdayname{\myweekday} + +\def\pgfcalendarweekdayname#1{% + \translate{\ifcase#1Monday\or Tuesday\or Wednesday\or Thursday\or Friday\or Saturday\or Sunday\fi}% +} + +\def\pgfcalendarweekdayshortname#1{% + \translate{\ifcase#1Mon\or Tue\or Wed\or Thu\or Fri\or Sat\or Sun\fi}% +} + + +% Converts a month of year number into a month name (long or short) +% +% #1 = a number representing a month (1=January) +% +% Example: +% +% \pgfcalendarmonthname + +\def\pgfcalendarmonthname#1{% + \translate{\ifcase#1\or January\or February\or March\or April\or + May\or June\or July\or August\or September\or October\or + November\or December\fi}% +} + +\def\pgfcalendarmonthshortname#1{% + \translate{\ifcase#1\or Jan\or Feb\or Mar\or Apr\or + May\or Jun\or Jul\or Aug\or Sep\or Oct\or + Nov\or Dec\fi}% +} + + + + + + +% Macro for easy typesetting of days, etc. +% +% #1 = kind selection +% #2 = length and representation selection +% +% Description: +% +% Replaces the shorthand according to the following rules: The +% first letter of the shorthand describes the kind of +% shorthand. Possible kinds are: +% +% d = day of current date (in an invocation of \pgfcalendar) +% m = month of current date +% y = year of current date +% w = week day of current date +% +% The second parameter determines how the kind is represented: +% +% - = shortest possible numerical way (allowed only for d, m, y) +% = = same, but always of the same length (padded with blanks as +% needed, allowed only for d, m, y) +% 0 = numerical representation for d and m padded with leading zeros. +% t = textual representation (allowed only for d, m, w) +% . = abbreviated textual representation (allowed only for d, m, w) +% +% It is adivsed that you say, for example, +% \let\%=\pgfcalendarshorthand. +% +% With this setting, you can typeset an ISO-date by saying \%y0-\%m0-\%d0. +% For another example, on 2007-02-09, which is a +% Friday, you can write "\%wt, \%mt \%d-, \%y0" to get "Friday, February 9, 2007" + +\def\pgfcalendarshorthand#1#2{\csname pgfcalendar@shorthand@#1#2\endcsname} +\expandafter\def\csname pgfcalendar@shorthand@d-\endcsname{% + {\pgfutil@tempcnta=\pgfcalendarcurrentday\relax\the\pgfutil@tempcnta}} +\expandafter\def\csname pgfcalendar@shorthand@d=\endcsname{% + {\pgfutil@tempcnta=\pgfcalendarcurrentday\relax\ifnum\pgfutil@tempcnta<10\relax\setbox0=\hbox{1}\kern\wd0\relax\fi\the\pgfutil@tempcnta}} +\expandafter\def\csname pgfcalendar@shorthand@d0\endcsname{% + \pgfcalendarcurrentday} +\expandafter\def\csname pgfcalendar@shorthand@m-\endcsname{% + {\pgfutil@tempcnta=\pgfcalendarcurrentmonth\relax\the\pgfutil@tempcnta}} +\expandafter\def\csname pgfcalendar@shorthand@m=\endcsname{% + {\pgfutil@tempcnta=\pgfcalendarcurrentmonth\relax\ifnum\pgfutil@tempcnta<10\relax\setbox0=\hbox{1}\kern\wd0\relax\fi\the\pgfutil@tempcnta}} +\expandafter\def\csname pgfcalendar@shorthand@m0\endcsname{% + \pgfcalendarcurrentmonth} +\expandafter\def\csname pgfcalendar@shorthand@y-\endcsname{% + \pgfcalendarcurrentyear} +\expandafter\def\csname pgfcalendar@shorthand@y=\endcsname{% + \pgfcalendarcurrentyear} +\expandafter\def\csname pgfcalendar@shorthand@y0\endcsname{% + \pgfcalendarcurrentyear} +\expandafter\def\csname pgfcalendar@shorthand@w.\endcsname{% + \pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}} +\expandafter\def\csname pgfcalendar@shorthand@wt\endcsname{% + \pgfcalendarweekdayname{\pgfcalendarcurrentweekday}} +\expandafter\def\csname pgfcalendar@shorthand@m.\endcsname{% + \pgfcalendarmonthshortname{\pgfcalendarcurrentmonth}} +\expandafter\def\csname pgfcalendar@shorthand@mt\endcsname{% + \pgfcalendarmonthname{\pgfcalendarcurrentmonth}} + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternal.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternal.tex new file mode 100644 index 00000000000..ff53e5e182f --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternal.tex @@ -0,0 +1,32 @@ +% Copyright 2007 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. +% +% In addition to the above licenses, this particular file may also be +% directly inlined into other documents and this copyright notice may +% be removed. Additionally, when you inline this file, you may modify +% it as needed and you may remove comments. +% +% This file is intended to be distributed or even inlined into a file +% when a document needs to be typeset on a system that does not have +% pgf/TikZ installed. + +% "environment" for reading an external graphic. Note that there are +% no (!) braces around the "name" of the environment +% +% #1 = name of the graphics file +% +% Example: +% +% \beginpgfgraphicnamed{mygraph} +% \begin{tikzpicture} +% ... +% \end{tikzpicture} +% \endpgfgraphicnamed + +\long\def\beginpgfgraphicnamed#1#2\endpgfgraphicnamed{\includegraphics{#1}} diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex new file mode 100644 index 00000000000..46a62f31767 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex @@ -0,0 +1,236 @@ +% Copyright 2006 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgffor.code.tex,v 1.8 2007/11/07 23:21:48 tantau Exp $ + + + +\newdimen\pgffor@iter +\newdimen\pgffor@skip +\newif\ifpgffor@continue + +\let\pgffor@beginhook=\pgfutil@empty +\let\pgffor@endhook=\pgfutil@empty +\let\pgffor@afterhook=\pgfutil@empty + +\def\pgffor@emptyvalues{, \pgffor@stop,}% + +\def\foreach#1in{% + \def\pgffor@var{#1}% + \pgfutil@ifnextchar\bgroup{\pgffor@normal@list}{\pgffor@macro@list}} +\def\pgffor@macro@list#1{% + \expandafter\pgffor@normal@list\expandafter{#1}} +\def\pgffor@normal@list#1{% + \def\pgffor@values{#1, \pgffor@stop,}% + \ifx\pgffor@values\pgffor@emptyvalues + \def\pgffor@values{\pgffor@stop,}% + \fi% + \let\pgffor@body\pgfutil@empty% + \global\pgffor@continuetrue% + \pgffor@collectbody} + +\def\pgffor@collectbody{% + \pgfutil@ifnextchar\foreach{\pgffor@collectforeach}{% + \pgfutil@ifnextchar\bgroup{\pgffor@collectargument}{\pgffor@collectsemicolon}}% +} + +\def\pgffor@collectforeach\foreach#1in{% + \pgfutil@ifnextchar\bgroup{\pgffor@collectforeach@normal{#1}}{\pgffor@collectforeach@macro{#1}}} +\def\pgffor@collectforeach@macro#1#2{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body\foreach#1in#2}% + \pgffor@collectbody% +} +\def\pgffor@collectforeach@normal#1#2{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body\foreach#1in{#2}}% + \pgffor@collectbody% +} + +\long\def\pgffor@collectargument#1{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body{#1}}% + \pgffor@iterate% +} + + +\def\pgffor@collectsemicolon{% + \let\pgffor@next=\pgffor@collectnormalsemicolon% + \ifnum\the\catcode`\;=\active\relax% + \let\pgffor@next=\pgffor@collectactivesemicolon% + \fi% + \pgffor@next% +} + +\def\pgffor@collectnormalsemicolon#1;{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body#1;}% + \pgffor@iterate% +} + +{ + \catcode`\;=\active + + \gdef\pgffor@collectactivesemicolon#1;{% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body#1;}% + \pgffor@iterate% + } +} + +\def\pgffor@iterate{% + \let\pgffor@last\pgfutil@empty% + \let\pgffor@prevlast\pgfutil@empty% + \expandafter\pgffor@scan\pgffor@values} + +\def\pgffor@stop{\pgffor@stop}% +\def\pgffor@dots{...}% + +\def\pgffor@scan{\pgfutil@ifnextchar({\pgffor@scanround}{\pgffor@scanone}} +\def\pgffor@scanround(#1)#2,{\def\pgffor@value{(#1)}\pgffor@scanned} +\def\pgffor@scanone#1,{\def\pgffor@value{#1}\pgffor@scanned} + +\def\pgffor@scanned{% + \ifx\pgffor@value\pgffor@stop% + \let\pgffor@next=\pgffor@after% done! + \else% + \ifx\pgffor@value\pgffor@dots% + \let\pgffor@next=\pgffor@handledots% + \else% + \let\pgffor@next=\pgffor@handlevalue% + \fi% + \ifpgffor@continue% + \else% + \let\pgffor@next=\pgffor@scan% done! + \fi% + \fi% + \pgffor@next} + +\def\pgffor@after{% + \global\pgffor@continuetrue% + \pgffor@afterhook} + +\def\pgffor@handlevalue{% + \let\pgffor@prevlast\pgffor@last% + \let\pgffor@last\pgffor@value% + \pgffor@invokebody% + \pgffor@scan% +} + +\def\pgffor@invokebody{% + \begingroup% + \expandafter\pgfutil@in@\expandafter/\expandafter{\pgffor@var}% + \ifpgfutil@in@% + \expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@value//\relax}% + \expandafter\pgffor@multiassign\pgffor@var/\pgffor@stop/\pgffor@stop/\relax% + \else% + \expandafter\expandafter\expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@value}% + \fi% + \expandafter\pgffor@beginhook\pgffor@body\pgffor@endhook% + \endgroup% +} + + +\def\pgffor@multiassign#1/#2/\relax{% + \def\pgffor@currentvar{#1}% + \def\pgffor@rest{#2}% + \ifx\pgffor@currentvar\pgffor@stop% + \let\pgffor@next=\relax% + \else% + \let\pgffor@next=\pgffor@multiassignrest% + \fi% + \pgffor@next% +} + +\def\pgffor@multiassignrest{\expandafter\pgffor@multiassignfinal\pgffor@valuerest} +\def\pgffor@multiassignfinal#1/#2/\relax{% + \def\pgffor@test{#2}% + \ifx\pgffor@test\pgfutil@empty% + \def\pgffor@valuerest{#1//\relax}% repeat + \else% + \def\pgffor@valuerest{#2/\relax}% + \fi% + \expandafter\def\pgffor@currentvar{#1}% + \expandafter\pgffor@multiassign\pgffor@rest/\relax% +} + + + + +\def\pgffor@handledots{% + \ifx\pgffor@last\pgfutil@empty% + \PackageError{pgffor}{``...'' not allowed without prior value}{}% + \fi% + \pgffor@dotsscanend% +} +\def\pgffor@dotsscanend#1,{% + \def\pgffor@dotsend{#1}% + % calculate skip% + \ifx\pgffor@prevlast\pgfutil@empty% + \ifdim\pgffor@dotsend pt>\pgffor@last pt% + \pgffor@skip=1pt% + \else% + \pgffor@skip=-1pt% + \fi% + \else% + \pgffor@skip=\pgffor@last pt% + \pgffor@iter=\pgffor@prevlast pt% + \advance\pgffor@skip by-\pgffor@iter% + \fi% + \pgffor@iter=\pgffor@last pt% + % do loop + \pgffor@loop% +} + +\def\pgffor@loop{% + \advance\pgffor@iter by\pgffor@skip% + \let\pgffor@next=\pgffor@doloop% + \ifdim\pgffor@skip<0pt% + \ifdim\pgffor@iter<\pgffor@dotsend pt% + \let\pgffor@next=\pgffor@endloop% + \fi% + \else% + \ifdim\pgffor@iter>\pgffor@dotsend pt% + \let\pgffor@next=\pgffor@endloop% + \fi% + \fi% + \ifpgffor@continue% + \else% + \let\pgffor@next=\pgffor@endloop% done! + \fi% + \pgffor@next% +} + +\def\pgffor@endloop{% + \pgffor@scan% +} + +{\catcode`\p=12\catcode`\t=12\gdef\Pgffor@geT#1pt{#1}} + +\def\pgffor@doloop{% + \begingroup% + \edef\pgffor@temp{\expandafter\Pgffor@geT\the\pgffor@iter}% + \edef\pgffor@incheck{{.0/}{\pgffor@temp/}}% + \expandafter\pgfutil@in@\pgffor@incheck% + \ifpgfutil@in@% + \expandafter\pgffor@strip\pgffor@temp% + \fi% + \expandafter\pgfutil@in@\expandafter/\expandafter{\pgffor@var}% + \ifpgfutil@in@% + \expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@temp//\relax}% + \expandafter\pgffor@multiassign\pgffor@var/\pgffor@stop/\pgffor@stop/\relax% + \else% + \expandafter\expandafter\expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@temp}% + \fi% + \expandafter\pgffor@beginhook\pgffor@body\pgffor@endhook% + \endgroup% + \pgffor@loop% +} + +\def\pgffor@strip#1.0{\def\pgffor@temp{#1}} + + +\def\breakforeach{\global\pgffor@continuefalse} + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex new file mode 100644 index 00000000000..97727fdbeb7 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex @@ -0,0 +1,95 @@ +% Copyright 2006 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + + +% The purpose of this file is to define the command +% \ProvidesPackageRCS, which should be followed by an RCS id +% string. This command will also be available in plain TeX, where it +% prints out a message to the log. + + +\def\pgfversion{2.00} +\def\pgftypesetversion{\oldstylenums{2}.\oldstylenums{00}} + + +\ifx\pgfrcsloaded\undefined +\def\pgfrcsloaded{} + +\edef\pgfrcsatcode{\the\catcode`\@} +\catcode`\@=11 + +% Get date and version from RCS Ids +\def\pgf@parseid $#1: #2.#3,v #4 #5/#6/#7 #8${% + \pgf@parsercsfile$#2/$ + \def\pgf@rcssuffix{#3} + \def\pgf@rcsrevision{#4} + \def\pgf@rcsdate{#5/#6/#7} +} +\def\pgf@parsercsfile$#1/#2${ + \def\pgf@temp{#2} + \ifx\pgf@temp\pgfutil@empty + \def\pgf@rcsfile{#1} + \else + \pgf@parsercsfile$#2$ + \fi} + +\def\ProvidesFileRCS{% + \def\pgfrcs@marshal{\ProvidesFile{\pgf@rcsfile.\pgf@rcssuffix}}% + \pgfrcs@parserest% +} + +\def\ProvidesPackageRCS{% + \def\pgfrcs@marshal{\ProvidesPackage{\pgf@rcsfile}}% + \pgfrcs@parserest% +} + +\def\pgfrcs@parserest{% + \def\pgf@rcsadditional{}% + \afterassignment\pgfrcs@checkforoptional\let\next=} + +\def\pgfrcs@checkforoptional{% + \ifx\next[% + \let\next=\pgfrcs@getoptional% + \else + \let\next=\pgfrcs@package% + \fi% + \next}%} + +\def\pgfrcs@getoptional#1] ${% + \def\pgf@rcsadditional{#1}% + \pgfrcs@package% +} + +\def\pgfrcs@package#1${ + \pgf@parseid $#1$ + \pgfrcs@marshal[\pgf@rcsdate\space\pgf@rcsadditional\space(rcs-revision \pgf@rcsrevision)] +} + +\def\ProvidesClassRCS $#1$ [#2]{% + \pgf@parseid $#1$ + \ProvidesClass{\pgf@rcsfile}[\pgf@rcsdate\space#2\space (rcs-revision \pgf@rcsrevision)] +} + +\ifx\ProvidesPackage\@undefined + % plain tex + \def\ProvidesPackage#1[#2]{\wlog{Loading package #1 version #2.}} +\fi + +\ifx\ProvidesFile\@undefined + % plain tex + \def\ProvidesFile#1[#2]{\wlog{Loading file #1 version #2.}} +\fi + +\ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/utilities/pgfrcs.code.tex,v 1.21 2008/02/20 11:00:42 tantau Exp $ + +\catcode`\@=\pgfrcsatcode + +\fi + diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex new file mode 100644 index 00000000000..29c27b499c7 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex @@ -0,0 +1,133 @@ +% Copyright 2006 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +% +% This file provides utitiliy commands that are used throughout pgf. +% +% For most commands, the definition of these commands is just given +% below. We cannot use the LaTeX definition of these commands since +% LaTeX may not be the current format and since LaTeX packages tend to +% redefine these commands. +% +% For some commands the actual definition of the format (like latex or +% context) is to be preferred over the generic definition below. In +% this case, the definition of the format is installed when the file +% pgfutil-XXXX.tex is read, where XXXX is the format name (latex, +% plain, or context). + + + +\catcode`\@=11\relax + + +% Simple stuff + +\long\def\pgfutil@ifundefined#1{% + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi} +\def\pgfutil@firstofone#1{#1} +\def\pgfutil@firstoftwo#1#2{#1} +\def\pgfutil@secondoftwo#1#2{#2} +\def\pgfutil@empty{} +\def\pgfutil@gobble#1{} +\def\pgfutil@gobbletwo#1#2{} +\def\pgfutil@namedef#1{\expandafter\def\csname #1\endcsname} +\def\pgfutil@namelet#1{\expandafter\pgfutil@@namelet\csname#1\endcsname} +\def\pgfutil@@namelet#1#2{\expandafter\let\expandafter#1\csname#2\endcsname} +\long\def\pgfutil@g@addto@macro#1#2{% + \begingroup + \toks@\expandafter{#1#2}% + \xdef#1{\the\toks@}% + \endgroup} +\newif\ifpgfutil@tempswa + +% pgfutil@ifnextchar + +\long\def\pgfutil@ifnextchar#1#2#3{% + \let\pgfutil@reserved@d=#1% + \def\pgfutil@reserved@a{#2}% + \def\pgfutil@reserved@b{#3}% + \futurelet\pgfutil@let@token\pgfutil@ifnch} +\def\pgfutil@ifnch{% + \ifx\pgfutil@let@token\pgfutil@sptoken + \let\pgfutil@reserved@c\pgfutil@xifnch + \else + \ifx\pgfutil@let@token\pgfutil@reserved@d + \let\pgfutil@reserved@c\pgfutil@reserved@a + \else + \let\pgfutil@reserved@c\pgfutil@reserved@b + \fi + \fi + \pgfutil@reserved@c} +{% + \def\:{\global\let\pgfutil@sptoken= } \: + \def\:{\pgfutil@xifnch} \expandafter\gdef\: {\futurelet\pgfutil@let@token\pgfutil@ifnch} +} + +% pgfutil@in@ + +\newif\ifpgfutil@in@ +\def\pgfutil@in@#1#2{% + \def\pgfutil@in@@##1#1##2##3\pgfutil@in@@{% + \ifx\pgfutil@in@##2\pgfutil@in@false\else\pgfutil@in@true\fi}% + \pgfutil@in@@#2#1\pgfutil@in@\pgfutil@in@@} + + +% pgfutil@for + +\def\pgfutil@nnil{\pgfutil@nil} +\def\pgfutil@fornoop#1\@@#2#3{} +\long\def\pgfutil@for#1:=#2\do#3{% + \expandafter\def\expandafter\pgfutil@fortmp\expandafter{#2}% + \ifx\pgfutil@fortmp\pgfutil@empty \else + \expandafter\pgfutil@forloop#2,\pgfutil@nil,\pgfutil@nil\@@#1{#3}\fi} +\long\def\pgfutil@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\pgfutil@nnil \else + #5\def#4{#2}\ifx #4\pgfutil@nnil \else#5\pgfutil@iforloop #3\@@#4{#5}\fi\fi} +\long\def\pgfutil@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\pgfutil@nnil + \expandafter\pgfutil@fornoop \else + #4\relax\expandafter\pgfutil@iforloop\fi#2\@@#3{#4}} +\def\pgfutil@tfor#1:={\pgfutil@tf@r#1 } +\long\def\pgfutil@tf@r#1#2\do#3{\def\pgfutil@fortmp{#2}\ifx\pgfutil@fortmp\space\else + \pgfutil@tforloop#2\pgfutil@nil\pgfutil@nil\@@#1{#3}\fi} +\long\def\pgfutil@tforloop#1#2\@@#3#4{\def#3{#1}\ifx #3\pgfutil@nnil + \expandafter\pgfutil@fornoop \else + #4\relax\expandafter\pgfutil@tforloop\fi#2\@@#3{#4}} + + +% pgfutil@IfFileExists + +\chardef\pgfutil@inputcheck0 +\def\pgfutil@IfFileExists#1#2#3{% + \openin\pgfutil@inputcheck#1 % + \ifeof\pgfutil@inputcheck + #3\relax + \else + #2\relax + \fi + \closein\pgfutil@inputcheck} + +\def\pgfutil@InputIfFileExists#1#2#3{\pgfutil@IfFileExists{#1}{\input #1\relax#2}{#3}}% + + +% aux-read-hook + +\let\pgfutil@aux@read@hook=\relax + + +% Tokens for the end of the typesetting -- they will be added at the +% end of every job (hopefully...). + +\newtoks\pgfutil@everybye + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def new file mode 100644 index 00000000000..784cb59cdc9 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def @@ -0,0 +1,245 @@ +% Copyright 2006 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + + + +% The aux files, needed for reading back coordinates +\def\pgfutil@aux@read@hook{ + \pgfutil@IfFileExists{\jobname.pgf}{\input \jobname.pgf\relax}{} + \csname newwrite\endcsname\pgfutil@auxout + \csname openout\endcsname\pgfutil@auxout\jobname.pgf +} + +% XColor-like support for ConTeXt + +\def\pgfutil@definecolor#1#2#3{\csname pgfutil@emu@#2\endcsname{#1}#3\@nil} + +\def\pgfutil@emu@rgb#1#2,#3,#4\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#3,#4}}} +\def\pgfutil@emu@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#2,#2}}} + +\pgfutil@definecolor{white}{gray}{1} +\pgfutil@definecolor{black}{gray}{0} +\pgfutil@definecolor{gray}{gray}{0.5} +\pgfutil@definecolor{red}{rgb}{1,0,0} +\pgfutil@definecolor{green}{rgb}{0,1,0} +\pgfutil@definecolor{blue}{rgb}{0,0,1} +\pgfutil@definecolor{cyan}{rgb}{0,1,1} +\pgfutil@definecolor{magenta}{rgb}{1,0,1} +\pgfutil@definecolor{yellow}{rgb}{1,1,0} +\pgfutil@definecolor{orange}{rgb}{1,0.5,0} +\pgfutil@definecolor{violet}{rgb}{0.5,0,0.5} +\pgfutil@definecolor{purple}{rgb}{0.75,0,0.25} +\pgfutil@definecolor{brown}{rgb}{0.75,0.5,0.25} + +\def\pgfutil@color#1{% + \pgfutil@colorlet{.}{#1}% + \pgfsysprotocol@getcurrentprotocol\pgfutil@emu@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + \pgfsetcolor{.}% + \expandafter\pgfsys@outerinvoke\expandafter{\pgfsysprotocol@currentprotocol}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfutil@emu@temp% + \aftergroup\pgfutil@reset@color% +} + +\def\pgfutil@extractcolorspec#1#2{% + \def#2{{#1}}% +} + +\def\pgfutil@convertcolorspec#1#2#3{% + \edef#3{\expandafter\expandafter\expandafter\pgfutil@emu@select\csname\string\color@#1\endcsname}% +} + +\let\pgfutil@doifcolorelse=\doifcolorelse + + +\def\pgfutil@reset@color{% + \pgfsysprotocol@getcurrentprotocol\pgfutil@emu@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + \pgfsetcolor{.}% + \expandafter\pgfsys@outerinvoke\expandafter{\pgfsysprotocol@currentprotocol}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfutil@emu@temp% +} +\expandafter\def\csname\string\color@.\endcsname{\xcolor@{}{}{rgb}{0,0,0}} + +\def\pgfutil@colorlet#1#2{% + \edef\pgf@marshal{#2}% + \expandafter\pgfutil@in@\expandafter!\expandafter{\pgf@marshal}% + \ifpgfutil@in@% + % compute mixture + {% + \expandafter\pgfutil@emu@mix\pgf@marshal!white!\@nil% + \xdef\pgf@marshal{\noexpand\def\expandafter\noexpand\csname\string\color@#1\endcsname{% + \noexpand\xcolor@{}{}{rgb}{\pgf@sys@tonumber\pgf@xa,\pgf@sys@tonumber\pgf@xb,\pgf@sys@tonumber\pgf@xc}}}% + }% + \pgf@marshal% + \else% + \expandafter\ifx\csname\string\color@#2\endcsname\relax% + \pgfutil@registercolor{#2}% + \fi% + \edef\pgf@marshal{\noexpand\let\expandafter\noexpand\csname\string\color@#1\endcsname=% + \expandafter\noexpand\csname\string\color@#2\endcsname}% + \pgf@marshal% + \fi% +} +\def\pgfutil@emu@mix#1!#2!#3!#4\@nil{% + \expandafter\ifx\csname\string\color@#1\endcsname\relax% + \pgfutil@registercolor{#1}% + \fi% + \expandafter\ifx\csname\string\color@#3\endcsname\relax% + \pgfutil@registercolor{#3}% + \fi% + \expandafter\expandafter\expandafter\pgfutil@emu@unpack\csname\string\color@#1\endcsname% + \pgf@ya=\pgf@xa% + \pgf@yb=\pgf@xb% + \pgf@yc=\pgf@xc% + \expandafter\expandafter\expandafter\pgfutil@emu@unpack\csname\string\color@#3\endcsname% + \c@pgf@counta=#2\relax% + \c@pgf@countb=100\relax% + \advance\c@pgf@countb by-\c@pgf@counta\relax% + \pgf@xa=\c@pgf@countb\pgf@xa% + \advance\pgf@xa by\c@pgf@counta\pgf@ya% + \divide\pgf@xa by 100\relax% + \pgf@xb=\c@pgf@countb\pgf@xb% + \advance\pgf@xb by\c@pgf@counta\pgf@yb% + \divide\pgf@xb by 100\relax% + \pgf@xc=\c@pgf@countb\pgf@xc% + \advance\pgf@xc by\c@pgf@counta\pgf@yc% + \divide\pgf@xc by 100\relax% +} +\def\pgfutil@emu@unpack#1#2#3#4#5{% + \pgfutil@emu@@unpack#5\@nil% +} +\def\pgfutil@emu@@unpack#1,#2,#3\@nil{% + \pgf@xa=#1pt% + \pgf@xb=#2pt% + \pgf@xc=#3pt% +} + +\def\pgfutil@emu@select#1#2#3#4#5{#5} + + +\def\pgfutil@registercolor#1{% + \edef\pgf@temp{\PDFcolor{#1}}% + \edef\pgf@marshal{\noexpand\pgfutil@in@{ g}{\pgf@temp}}% + \pgf@marshal% + \ifpgfutil@in@% + \expandafter\pgfutil@context@parse@gray\pgf@temp{#1}% + \else% + \edef\pgf@marshal{\noexpand\pgfutil@in@{ rg}{\pgf@temp}}% + \pgf@marshal% + \ifpgfutil@in@% + \expandafter\pgfutil@context@parse@rgb\pgf@temp{#1}% + \else% + \PackageError{pgf}{Color #1 has an unsupported color model.}{}% + \pgfutil@definecolor{#1}{gray}{0} + \fi% + \fi% +} + +\def\pgfutil@context@parse@gray#1 g#2{% + \pgfutil@definecolor{#2}{gray}{#1} +} + +\def\pgfutil@context@parse@rgb#1 #2 #3 rg#4{% + \pgfutil@definecolor{#4}{rgb}{#1,#2,#3} +} + + + +% pgfutil@minipage + +\def\pgfutil@minipage[#1]#2{% + \hbox to#2\bgroup% + \hsize=#2\relax% + \vbox\bgroup\leavevmode% +} +\def\pgfutil@endminipage{\egroup\egroup} + + + +% Driver detector (how should we do this in ConTeXt?) : + +\ifx\pdfoutput\@undefined\newcount\pdfoutput\fi +\ifx\pdfoutput\relax\newcount\pdfoutput\fi +\ifcase\pdfoutput% + \gdef\Gin@driver{dvips.def}% +\else% + \gdef\Gin@driver{pdftex.def}% +\fi% + + + +% Global colors + +\let\pgfutil@globalcolorsfalse=\relax +\let\pgfutil@globalcolorstrue=\relax + + + +% Font stuff + +\def\pgfutil@font@tiny{\tfxx} % How to do this correctly? +\def\pgfutil@font@scriptsize{\tfxx} +\def\pgfutil@font@footnotesize{\tfx} +\def\pgfutil@font@small{\tfx} +\def\pgfutil@font@normalsize{\tf} +\def\pgfutil@font@large{\tfa} +\def\pgfutil@font@Large{\tfb} +\def\pgfutil@font@huge{\tfc} +\def\pgfutil@font@Huge{\tfc} + +\def\pgfutil@font@itshape{\it} +\def\pgfutil@font@bfseries{\bf} + +\let\pgfutil@font@normalfont=\rm + +\let\pgfutil@selectfont=\rm + + +% Extra counters, registers, boxes + +\newcount\pgfutil@tempcnta +\newcount\pgfutil@tempcntb + +\newbox\pgfutil@tempboxa + +\newdimen\pgfutil@tempdima +\newdimen\pgfutil@tempdimb + + +% Module stuff + +\def\pgfutil@usemodule#1{\usemodule[#1]} + + + +% End of job stuff + +\appendtoks \the\pgfutil@everybye \to \everybye + + + + +% The following is still messy and needs to be cleanup up (everything +% prefixed by pgfutil@): + +\def\PackageInfo#1#2{} +\def\PackageWarning#1#2{\immediate\write-1{Package #1: Warning! #2.}}% +\def\PackageError#1#2#3{\immediate\write-1{Package #1: Error! #2.}}% +\long\def\AtBeginDocument#1{#1}% +\long\def\AtBeginDvi#1{#1}% + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def new file mode 100644 index 00000000000..b50830db666 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def @@ -0,0 +1,64 @@ +% Copyright 2006 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + +\catcode`\@=11\relax + +\let\pgfutil@auxout=\@auxout +\let\pgfutil@tempcnta=\@tempcnta +\let\pgfutil@tempcntb=\@tempcntb + +\def\pgfutil@definecolor{\definecolor} +\def\pgfutil@color{\color} +\def\pgfutil@colorlet{\colorlet} +\def\pgfutil@extractcolorspec{\extractcolorspec} +\def\pgfutil@convertcolorspec{\convertcolorspec} + +\def\pgfutil@globalcolorsfalse{\let\ifglobalcolors\iffalse} +\def\pgfutil@globalcolorstrue{\let\ifglobalcolors\iftrue} + +\let\pgfutil@minipage=\minipage +\let\pgfutil@endminipage=\endminipage + +\def\pgfutil@doifcolorelse#1#2#3{% + \expandafter\ifx\csname\string\color@#1\endcsname\relax% + \let\pgf@next=\pgfutil@secondoftwo% + \else + \let\pgf@next=\pgfutil@firstoftwo% + \fi% + \pgf@next{#2}{#3}% +} + +\def\pgfutil@font@tiny{\tiny} +\def\pgfutil@font@scriptsize{\scriptsize} +\def\pgfutil@font@footnotesize{\footnotesize} +\def\pgfutil@font@small{\small} +\def\pgfutil@font@normalsize{\normalsize} +\def\pgfutil@font@large{\large} +\def\pgfutil@font@Large{\Large} +\def\pgfutil@font@huge{\huge} +\def\pgfutil@font@Huge{\Huge} + +\def\pgfutil@font@itshape{\itshape} +\def\pgfutil@font@bfseries{\bfseries} + +\def\pgfutil@font@normalfont{\normalfont} + +\def\pgfutil@usemodule#1{\usepackage{#1}} + +\let\pgfutil@selectfont=\selectfont + +\let\pgfutil@tempboxa=\@tempboxa + +\let\pgfutil@tempdima=\@tempdima +\let\pgfutil@tempdimb=\@tempdimb + +\AtEndDocument{\the\pgfutil@everybye} + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def new file mode 100644 index 00000000000..9128021faa7 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def @@ -0,0 +1,226 @@ +% Copyright 2006 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + + + + + +% The aux files, needed for reading back coordinates +\def\pgfutil@aux@read@hook{ + \pgfutil@IfFileExists{\jobname.pgf}{\input \jobname.pgf\relax}{} + \csname newwrite\endcsname\pgfutil@auxout + \csname openout\endcsname\pgfutil@auxout\jobname.pgf +} + + +% XColor-like support for plain TeX + +\def\pgfutil@definecolor#1#2#3{\csname pgfutil@emu@#2\endcsname{#1}#3\@nil} + +\def\pgfutil@emu@rgb#1#2,#3,#4\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#3,#4}}} +\def\pgfutil@emu@gray#1#2\@nil{\expandafter\def\csname\string\color@#1\endcsname{\xcolor@{}{}{rgb}{#2,#2,#2}}} + +\pgfutil@definecolor{white}{gray}{1} +\pgfutil@definecolor{black}{gray}{0} +\pgfutil@definecolor{gray}{gray}{0.5} +\pgfutil@definecolor{red}{rgb}{1,0,0} +\pgfutil@definecolor{green}{rgb}{0,1,0} +\pgfutil@definecolor{blue}{rgb}{0,0,1} +\pgfutil@definecolor{cyan}{rgb}{0,1,1} +\pgfutil@definecolor{magenta}{rgb}{1,0,1} +\pgfutil@definecolor{yellow}{rgb}{1,1,0} +\pgfutil@definecolor{orange}{rgb}{1,0.5,0} +\pgfutil@definecolor{violet}{rgb}{0.5,0,0.5} +\pgfutil@definecolor{purple}{rgb}{0.75,0,0.25} +\pgfutil@definecolor{brown}{rgb}{0.75,0.5,0.25} + +\def\pgfutil@color#1{% + \pgfutil@colorlet{.}{#1}% + \pgfsysprotocol@getcurrentprotocol\pgfutil@emu@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + \pgfsetcolor{.}% + \expandafter\pgfsys@outerinvoke\expandafter{\pgfsysprotocol@currentprotocol}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfutil@emu@temp% + \aftergroup\pgfutil@reset@color% +} + +\def\pgfutil@extractcolorspec#1#2{% + \def#2{{#1}}% +} + +\def\pgfutil@convertcolorspec#1#2#3{% + \edef#3{\expandafter\expandafter\expandafter\pgfutil@emu@select\csname\string\color@#1\endcsname}% +} + + +\def\pgfutil@doifcolorelse#1#2#3{% + \expandafter\ifx\csname\string\color@#1\endcsname\relax% + \let\pgf@next=\pgfutil@secondoftwo% + \else + \let\pgf@next=\pgfutil@firstoftwo% + \fi% + \pgf@next{#2}{#3}% +} + + +\def\pgfutil@reset@color{% + \pgfsysprotocol@getcurrentprotocol\pgfutil@emu@temp% + {% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + \pgfsysprotocol@bufferedtrue% + \pgfsetcolor{.}% + \expandafter\pgfsys@outerinvoke\expandafter{\pgfsysprotocol@currentprotocol}% + }% + \pgfsysprotocol@setcurrentprotocol\pgfutil@emu@temp% +} +\expandafter\def\csname\string\color@.\endcsname{\xcolor@{}{}{rgb}{0,0,0}} + +\def\pgfutil@colorlet#1#2{% + \edef\pgf@marshal{#2}% + \expandafter\pgfutil@in@\expandafter!\expandafter{\pgf@marshal}% + \ifpgfutil@in@% + % compute mixture + {% + \expandafter\pgfutil@emu@mix\pgf@marshal!white!\@nil% + \xdef\pgf@marshal{\noexpand\def\expandafter\noexpand\csname\string\color@#1\endcsname{% + \noexpand\xcolor@{}{}{rgb}{\pgf@sys@tonumber\pgf@xa,\pgf@sys@tonumber\pgf@xb,\pgf@sys@tonumber\pgf@xc}}}% + }% + \pgf@marshal% + \else% + \edef\pgf@marshal{\noexpand\let\expandafter\noexpand\csname\string\color@#1\endcsname=% + \expandafter\noexpand\csname\string\color@#2\endcsname}% + \pgf@marshal% + \fi% +} +\def\pgfutil@emu@mix#1!#2!#3!#4\@nil{% + \expandafter\expandafter\expandafter\pgfutil@emu@unpack\csname\string\color@#1\endcsname% + \pgf@ya=\pgf@xa% + \pgf@yb=\pgf@xb% + \pgf@yc=\pgf@xc% + \expandafter\expandafter\expandafter\pgfutil@emu@unpack\csname\string\color@#3\endcsname% + \c@pgf@counta=#2\relax% + \c@pgf@countb=100\relax% + \advance\c@pgf@countb by-\c@pgf@counta\relax% + \pgf@xa=\c@pgf@countb\pgf@xa% + \advance\pgf@xa by\c@pgf@counta\pgf@ya% + \divide\pgf@xa by 100\relax% + \pgf@xb=\c@pgf@countb\pgf@xb% + \advance\pgf@xb by\c@pgf@counta\pgf@yb% + \divide\pgf@xb by 100\relax% + \pgf@xc=\c@pgf@countb\pgf@xc% + \advance\pgf@xc by\c@pgf@counta\pgf@yc% + \divide\pgf@xc by 100\relax% +} +\def\pgfutil@emu@unpack#1#2#3#4#5{% + \pgfutil@emu@@unpack#5\@nil% +} +\def\pgfutil@emu@@unpack#1,#2,#3\@nil{% + \pgf@xa=#1pt% + \pgf@xb=#2pt% + \pgf@xc=#3pt% +} + +\def\pgfutil@emu@select#1#2#3#4#5{#5} + + + +\let\definecolor=\pgfutil@definecolor +\let\color=\pgfutil@color +\let\colorlet=\pgfutil@colorlet +\let\extractcolorspec=\pgfutil@extractcolorspec +\let\convertcolorspec=\pgfutil@convertcolorspec + + + + +% pgfutil@minipage + +\def\pgfutil@minipage[#1]#2{% + \hbox to#2\bgroup% + \hsize=#2\relax% + \vbox\bgroup\leavevmode% +} +\def\pgfutil@endminipage{\egroup\egroup} + + + +% Driver detector (not so good): + +\ifx\pdfoutput\@undefined\alloc@0\count\countdef\insc@unt\pdfoutput\fi +\ifx\pdfoutput\relax\alloc@0\count\countdef\insc@unt\pdfoutput\fi +\ifcase\pdfoutput% + \gdef\Gin@driver{dvips.def}% +\else% + \gdef\Gin@driver{pdftex.def}% +\fi% + + +% Global colors + +\let\pgfutil@globalcolorsfalse=\relax +\let\pgfutil@globalcolorstrue=\relax + + + +% Font stuff + +\def\pgfutil@font@tiny{\fam\z@\fiverm} % How to do this correctly? +\def\pgfutil@font@scriptsize{\fam\z@\sevenrm} +\def\pgfutil@font@footnotesize{\rm} +\def\pgfutil@font@small{\fam\z@\ninerm} +\def\pgfutil@font@normalsize{\rm} +\def\pgfutil@font@large{\rm} +\def\pgfutil@font@Large{\rm} +\def\pgfutil@font@huge{\rm} +\def\pgfutil@font@Huge{\rm} + +\def\pgfutil@font@itshape{\it} +\def\pgfutil@font@bfseries{\bf} + +\let\pgfutil@font@normalfont=\rm + +\let\pgfutil@selectfont=\rm + + +% Extra counters, registers, boxes + +\newcount\pgfutil@tempcnta +\newcount\pgfutil@tempcntb + +\newbox\pgfutil@tempboxa + +\newdimen\pgfutil@tempdima +\newdimen\pgfutil@tempdimb + + +% Module stuff + +\def\pgfutil@usemodule#1{\input #1.tex} + + + +% End of file stuff + +\let\pgfutil@origend=\end +\def\end{\the\pgfutil@everybye\pgfutil@origend} + + +% The following is still messy and needs to be cleanup up (everything +% prefixed by pgfutil@): + +\def\PackageInfo#1#2{} +\def\PackageWarning#1#2{\immediate\write-1{Package #1: Warning! #2.}}% +\def\PackageError#1#2#3{\immediate\write-1{Package #1: Error! #2.}}% +\long\def\AtBeginDocument#1{#1}% +\long\def\AtBeginDvi#1{#1}% + +\endinput |