%%
%% This is file `svn-multi.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% svn-multi.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2006-2009 by Martin Scharrer <martin@scharrer-online.de>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Martin Scharrer.
%% 
%% This work consists of the files svn-multi.dtx, svn-multi-pl.dtx, svn-multi.ins
%% and the derived files svn-multi.sty, svnkw.sty and svn-multi.pl.
%% 
\makeatletter
\def\svnmulti@version{v2.3}
\RequirePackage{svn-prov}
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackageSVN
  {$Id: svn-multi.dtx 1866 2010-07-19 11:17:15Z martin $}
  [\svnmulti@version\space SVN Keywords for multi-file LaTeX documents]

\RequirePackage{kvoptions}

\SetupKeyvalOptions{%
  family = svn-multi,
  prefix = @svnmulti@
}
\newif\if@svnmulti@anygraphic
\newif\if@svnmulti@autoload
\newif\if@svnmulti@autokw
\newif\if@svnmulti@autokwall

\DeclareVoidOption{old}{%
  \@svnmulti@verbatimtrue
  \@svnmulti@groupsfalse
  \@svnmulti@externalfalse
  \@svnmulti@graphicsfalse
  \@svnmulti@pgfimagesfalse
  \@svnmulti@autoloadfalse
  \@svnmulti@tablefalse
  \@svnmulti@filehooksfalse
  \@svnmulti@subgroupsfalse
}
\DeclareVoidOption{all}{%
  \@svnmulti@verbatimtrue
  \@svnmulti@groupstrue
  \@svnmulti@externaltrue
  \@svnmulti@graphicstrue
  \@svnmulti@pgfimagestrue
  \@svnmulti@autoloadtrue
  \@svnmulti@tabletrue
  \@svnmulti@filehookstrue
  \@svnmulti@subgroupstrue
}
\DeclareBoolOption[true]{verbatim}
\DeclareBoolOption[false]{groups}
\DeclareBoolOption[false]{external}
\DeclareBoolOption[false]{subgroups}
\DeclareBoolOption[false]{graphics}
\DeclareBoolOption[false]{pgfimages}
\DeclareStringOption{autoload}[true]
\DeclareBoolOption[false]{table}
\DeclareBoolOption[false]{filehooks}
\DeclareStringOption[false]{autokw}[all]

\ExecuteOptions{old}
\ProcessKeyvalOptions{svn-multi}
\def\svn@depoption#1{%
  \csname if@svnmulti@#1\endcsname\else
  \message{svn-multi: Required option '#1' enabled.}%
  \csname @svnmulti@#1true\endcsname
  \fi
}

\if@svnmulti@groups
  \svn@depoption{filehooks}
\fi
\if@svnmulti@external
  \svn@depoption{filehooks}
\fi
\if@svnmulti@subgroups
  \svn@depoption{groups}
  \svn@depoption{filehooks}
\fi
\if@svnmulti@graphics
  \svn@depoption{external}
  \svn@depoption{autoload}
  \svn@depoption{filehooks}
\fi
\if@svnmulti@pgfimages
  \svn@depoption{external}
  \svn@depoption{autoload}
  \svn@depoption{filehooks}
\fi
\if@svnmulti@autoload
  \svn@depoption{external}
  \svn@depoption{filehooks}
\fi
\if@svnmulti@table
  \svn@depoption{groups}
  \svn@depoption{filehooks}
\fi
\ifx\@svnmulti@autoload\@undefined
\else
\ifx\@svnmulti@autoload\empty
\else
\def\svn@temp{true}
\ifx\@svnmulti@autoload\svn@temp
  \@svnmulti@autoloadtrue
  \svn@depoption{external}
  \svn@depoption{filehooks}
\else
\def\svn@temp{false}
\ifx\@svnmulti@autoload\svn@temp
  \if@svnmulti@autoload
  \PackageWarning{svn-multi}{Option 'autoload' disabled.}
  \fi
  \@svnmulti@autoloadfalse
\else
  \PackageError{svn-multi}%
    {Invalid value for 'autoload' option: '\@svnmulti@autoload'^^J%
     ! Only 'true','false' or empty (='true') are allowed!}
\fi\fi\fi\fi

\def\svn@temp{true}
\ifx\@svnmulti@autokw\svn@temp
  \@svnmulti@autokwtrue
  \@svnmulti@autokwalltrue
  \svn@depoption{filehooks}
\fi
\def\svn@temp{all}
\ifx\@svnmulti@autokw\svn@temp
  \@svnmulti@autokwtrue
  \@svnmulti@autokwalltrue
  \svn@depoption{filehooks}
\fi
\def\svn@temp{ext}
\ifx\@svnmulti@autokw\svn@temp
  \@svnmulti@autokwtrue
  \@svnmulti@autokwallfalse
\fi
\def\svn@temp{false}
\ifx\@svnmulti@autokw\svn@temp
  \@svnmulti@autokwfalse
  \@svnmulti@autokwallfalse
\fi

\if@svnmulti@graphics
  \@svnmulti@anygraphictrue
\fi
\if@svnmulti@pgfimages
  \@svnmulti@anygraphictrue
\fi

\def\svn@ifempty#1{%
  \begingroup
  \edef\svn@temp{#1}%
  \ifx\svn@temp\empty
    \endgroup
    \expandafter
    \@firstoftwo
  \else
    \endgroup
    \expandafter
    \@secondoftwo
  \fi
}

\def\svn@ifequal#1#2{%
  \begingroup
  \edef\svn@stringa{#1}%
  \edef\svn@stringb{#2}%
  \ifx\svn@stringa\svn@stringb
    \endgroup
    \expandafter
    \@firstoftwo
  \else
    \endgroup
    \expandafter
    \@secondoftwo
  \fi
}

\def\svn@ifvalidrev#1{%
  \begingroup
  \@ifundefined{#1}%
    {\let\svn@temp\svn@revinit}%
    {\expandafter\edef
     \expandafter\svn@temp\expandafter{\csname #1\endcsname}}%
  \ifnum\svn@temp=\svn@revinit\relax
    \endgroup
    \expandafter
    \@secondoftwo
  \else
    \endgroup
    \expandafter
    \@firstoftwo
  \fi
}

\def\svn@ifeof#1{%
  \ifeof#1%
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}

\def\svn@ifonlyone#1{%
  \expandafter\expandafter\expandafter
  \svn@@ifonlyone\csname @svng@#1@files\endcsname,\relax
}

\def\svn@@ifonlyone#1,#2\relax{%
  \svn@ifempty{#2}
}

\def\svn@input#1{%
  \begingroup
    \let\svn@rg\svn@g
    \IfFileExists{#1}{\@@input #1\relax}{}%
    \global\let\svn@g\svn@rg
  \endgroup
}

\def\svn@inputsvx#1{%
  \svn@pushfilestack
  \begingroup
  \svn@normalcatcodes
  \svn@input{#1.svx}%
  \endgroup
  \svn@popfilestack
}

\def\svn@normalcatcodes{%
  \catcode`\\=0\relax
  \catcode`\{=1\relax
  \catcode`\}=2\relax
  \catcode`\$=3\relax
  \catcode`\&=4\relax
  \catcode`\^^M=5\relax
  \catcode`\#=6\relax
  \catcode`\^=7\relax
  \catcode`\_=8\relax
  \catcode`\ =10\relax
  \catcode`\@=12\relax
  \catcode`\~=13\relax
  \catcode`\%=14\relax
}

\def\svn@revinit{-2}
\let\svnrev\svn@revinit     \let\@svn@rev\svn@revinit
\let\ifsvnmodified\@secondoftwo
\def\@svn@modified{@secondoftwo}%
\def\svndate{}              \def\@svn@date{}
\def\svnauthor{}            \def\@svn@author{}
\def\svnyear{0000}          \def\@svn@year{0000}
\def\svnmonth{00}           \def\@svn@month{00}
\def\svnday{00}             \def\@svn@day{00}
\def\svnhour{00}            \def\@svn@hour{00}
\def\svnminute{00}          \def\@svn@minute{00}
\def\svnsecond{00}          \def\@svn@second{00}
\def\svntimezonehour{+00}   \def\@svn@timezonehour{+00}
\def\svntimezoneminute{00}  \def\@svn@timezoneminute{00}
\def\svnmainurl{NOT SET}    \def\svnmainfilename{NOT SET}
\def\svnurl{} \def\svnfname{}
\def\svn@temp{}

\def\svn@pg{} \def\svn@g{} \def\svn@cg{\svn@g} \def\svn@rg{\svn@pg}
\let\@svng@@files\relax

\def\svn@initfile{%
  \global\let\svnfilerev\svn@revinit
  \global\let\ifsvnfilemodified\@secondoftwo
  \gdef\svnfiledate{}%
  \gdef\svnfileauthor{}%
  \gdef\svnfileyear{0000}%
  \gdef\svnfilemonth{00}%
  \gdef\svnfileday{00}%
  \gdef\svnfilehour{00}%
  \gdef\svnfileminute{00}%
  \gdef\svnfilesecond{00}%
  \gdef\svnfiletimezonehour{+00}%
  \gdef\svnfiletimezoneminute{00}%
  \gdef\svnfileurl{}%
  \gdef\svnfilefname{}%
  \gdef\svnfiledir{}%
}
\svn@initfile

\newif\ifsvn@modified


\begingroup
\@makeother\^^L
\if@svnmulti@autokw
\gdef\svne@ff{^^L}
\fi
\endgroup

\if@svnmulti@autokw
\newread\svne@read

\newcommand*{\svne@catcodes}{%
  \let\do\@makeother
  \endlinechar=-1%
  \dospecials
  \do\-\do\:\do\.\do\^^L%
}

\def\svne@readline#1{%
  \ifeof\svne@read
    \def#1{}%
  \else
    \read\svne@read to #1\relax
  \fi
}

\def\svne@gobblerest{%
  \ifeof\svne@read
    \let\next\relax
  \else
    \read\svne@read to \svn@temp
    \ifx\svn@temp\svne@ff
      \let\next\relax
    \else
      \let\next\svne@gobblerest
    \fi
  \fi
  \next
}

\def\svne@endread{%
  \closein\svne@read
}

\newcommand*{\svne@parseentriesfile}[1]{%
  \begingroup
    \let\next\relax
    \def\svne@version{8}%
    \openin\svne@read=#1format\relax
    \ifeof\svne@read\else
      \svne@readline\svne@version
      \closein\svne@read
    \fi
      \ifnum\svne@version>7\relax
        \openin\svne@read=#1entries\relax
        \ifeof\svne@read\else
          \svne@catcodes
          \svne@readline\svne@version
          \ifnum\svne@version>7\relax
            \def\next{\svne@parsedirentry
                      \svne@parseentries}%
          \else
            \closein\svne@read
          \fi
        \fi
      \fi
    \next
  \endgroup
}

\newcommand*{\svne@parsedirentry}{%
  \svne@readline\svne@name
  \svne@readline\svne@kind
  \svn@ifempty{\svne@name}%
    {\svn@ifequal{\svne@kind}{dir}%
      {%
        {\svne@readline\svn@temp}%
        \svne@readline\svne@baseurl
        \svne@gobblerest
      }{}%
    }{}%
}

\begingroup

\@makeother\-
\@makeother\:
\@makeother\.

\gdef\svne@scandate#1{%
  \expandafter\svne@scandate@#1\empty
  0000-00-00T00:00:00.00000Z\empty\empty
}

\gdef\svne@scandate@#1-#2-#3T#4:#5:#6.#7\empty#8\empty{%
  \xdef\svnfileyear{#1}%
  \gdef\svnfilemonth{#2}%
  \gdef\svnfileday{#3}%
  \gdef\svnfilehour{#4}%
  \gdef\svnfileminute{#5}%
  \gdef\svnfilesecond{#6}%
  \gdef\svnfiletimezonehour{+00}%
  \gdef\svnfiletimezoneminute{00}%
  \gdef\svnfiledate{#1-#2-#3 #4:#5:#6Z}%
  \def\svne@date{#1-#2-#3 #4:#5:#6Z}%
}

\endgroup

\newcommand*{\svne@parseentries}{%
  \svn@ifeof{\svne@read}%
  {}%
  {%
    \svne@readline\svne@name
    \@onelevel@sanitize\svne@name
    \svn@ifeof{\svne@read}%
    {}%
    {%
    \svne@readline\svne@kind
    \svn@ifequal{\svne@kind}{file}%
      {%
      \svne@readline\svn@temp
      \svne@readline\svn@temp
      \svne@readline\svn@temp
      \svne@readline\svn@temp
      \svne@readline\svn@temp
      \svne@readline\svn@temp
      \svne@readline\svne@date
      \svne@readline\svne@rev
      \svne@readline\svne@author
      %\@onelevel@sanitize\svne@date
      \svne@scandate{\svne@date}%
      \edef\svne@url{\svne@baseurl/\svne@name}%
      \svne@handleentry
      }{}%
    \svne@gobblerest
    \svne@parseentries
    }%
  }%
}

\def\svne@handleentry{%
  \ifx\svne@rev\empty
    \let\svne@rev\svn@revinit
  \fi
  \svn@ifequal{\svne@name}{\svnfilefname}%
    {%
      \message{^^J%
        Read from '.svn/entries' file:^^J%
        Filename:  \svne@name^^J%
        Date:      \svne@date^^J%
        Revision:  \svne@rev^^J%
        Author:    \svne@author^^J%
        HeadURL:   \svne@url^^J%
        ^^J%
      }%
      \svnkwdef{Filename}{\svne@name}%
      \svnkwdef{Date}{\svne@date}%
      \svnkwdef{Revision}{\svne@rev}%
      \svnkwdef{Author}{\svne@author}%
      \svnkwdef{HeadURL}{\svne@url}%
      \@svn@updateid{\svne@rev}{\svne@date}{\svne@author}{\svne@url}%
      \svne@endread
    }{}%
}%

\def\svnegetfile#1{%
  \begingroup
    \svn@getfilename{#1}%
    \edef\svnfilefname{\svnfilefname}%
    \@onelevel@sanitize\svnfilefname
    \svne@parseentriesfile{\svnfiledir .svn/}%
    \svne@parseentriesfile{\svnfiledir _svn/}%
  \endgroup
}

\if@svnmulti@autokwall
\AtBeginDocument{%
    \svnegetfile{\jobname.\svn@mainext}%
}
\fi

\fi

\def\svntimezone{\svntimezonehour\svntimezoneminute\svn@gobblezeros}
\def\svnfiletimezone{\svnfiletimezonehour\svnfiletimezoneminute\svn@gobblezeros}
\def\svncgtimezone{\svncgtimezonehour\svncgtimezoneminute}

\def\svn@gobblezeros{%
  \futurelet\svn@nextchar\svn@gobblezeros@
}
\def\svn@gobblezeros@{%
  \let\@tempa=\relax
  \def\@tempb{0}%
  \ifx0\svn@nextchar
    \let\@tempa=\@gobbletwo
  \fi
  \@tempa
}

\def\svntime{\svnhour:\svnminute:\svnsecond}
\def\svnfiletime{\svnfilehour:\svnfileminute:\svnfilesecond}
\def\svncgtime{\svncghour:\svncgminute:\svncgsecond}

\newcommand*{\svntoday}{%
  \begingroup
    \year\svnyear \month\svnmonth \day\svnday
    \relax \today
  \endgroup
}
\newcommand*{\svnfiletoday}{%
  \begingroup
    \year\svnfileyear \month\svnfilemonth \day\svnfileday
    \relax \today
  \endgroup
}
\newcommand*{\svncgtoday}{%
  \@ifundefined{svng@\svn@cg @year}{??}{%
    \begingroup
      \year\svncgyear \month\svncgmonth \day\svncgday
      \relax \today
    \endgroup
  }%
}%

\newcommand*{\svnid}{%
  \@svnidswtrue
  \svnkwsave
}
\newif\if@svnidsw
\@svnidswfalse

\def\svn@scanId#1 #2 #3 #4 #5\relax{%
  \@svn@scandate{#3 #4}%
  \@svn@updateid{#2}{#3 #4}{#5}{#1}%
  \svnkwdef{Filename}{#1}%
  \svnkwdef{Date}{#3 #4}%
  \svnkwdef{Revision}{#2}%
  \svnkwdef{Author}{#5}%
}

\def\@svn@updateid#1#2#3#4{%
  \xdef\svnfilerev{#1}%
  \ifsvn@modified
    \global\let\ifsvnfilemodified\@firstoftwo
  \else
    \global\let\ifsvnfilemodified\@secondoftwo
  \fi
  \xdef\svnfiledate{#2}%
  \xdef\svnfileauthor{#3}%
  \xdef\svnfileurl{#4}%
  \svn@getfilename\svnfileurl%
  \ifx\svnfilerev\empty\else
    \ifnum\@svn@rev<\svnfilerev
      \xdef\@svn@rev{\svnfilerev}%
      \xdef\@svn@modified{\ifsvnfilemodified{@firstoftwo}{@secondoftwo}}%
      \xdef\@svn@date{\svnfiledate}%
      \xdef\@svn@author{\svnfileauthor}%
      \xdef\@svn@year{\svnfileyear}%
      \xdef\@svn@month{\svnfilemonth}%
      \xdef\@svn@day{\svnfileday}%
      \xdef\@svn@hour{\svnfilehour}%
      \xdef\@svn@minute{\svnfileminute}%
      \xdef\@svn@second{\svnfilesecond}%
      \xdef\@svn@timezonehour{\svnfiletimezonehour}%
      \xdef\@svn@timezoneminute{\svnfiletimezoneminute}%
      \xdef\@svn@url{\svnfileurl}%
      \xdef\@svn@fname{\svnfilefname}%
    \fi

    \if@svnmulti@groups
      \ifx\svn@g\empty\else
        \svn@updategroup{\svn@g}%
      \fi
      \if@svnmulti@subgroups
        \ifsvnsubgroups
          \svn@updategroup{\svn@filedir\svn@filebase}%
        \fi
      \fi
    \fi
  \fi
}

\def\@svncg@save#1#2{%
  \expandafter\xdef\csname @svng@\svn@g @#1\endcsname{#2}%
}


\newcommand{\svnidlong}{%
  \svnkwdef{URL}{}%
  \svnkwdef{Date}{}%
  \svnkwdef{Revision}{0}%
  \svnkwdef{Author}{}%
  \if@svnmulti@verbatim
    \expandafter\svnidlong@readverb
  \else
    \expandafter\svnidlong@readargs
  \fi
}
\def\svnidlong@readverb{%
  \@ifnextchar\bgroup
    {\svnidlong@readverb@\svnidlong@readverb@a}%
    {\PackageError{svn-multi}{Wrong syntax for \string\svnidlong}{}}%
}
\def\svnidlong@readverb@#1{%
  \begingroup
  \svn@catcodes
  \catcode`\{=1\relax
  \catcode`\}=2\relax
  #1%
}
\def\svnidlong@readverb@a#1{%
  \endgroup
  \svnkwsave@read #1\relax
  \@ifnextchar\bgroup
    {\svnidlong@readverb@\svnidlong@readverb@b}%
    {\PackageError{svn-multi}{Wrong syntax for \string\svnidlong}{}}%
}
\def\svnidlong@readverb@b#1{%
  \endgroup
  \svnkwsave@read #1\relax
  \@ifnextchar\bgroup
    {\svnidlong@readverb@\svnidlong@readverb@c}%
    {\PackageError{svn-multi}{Wrong syntax for \string\svnidlong}{}}%
}
\def\svnidlong@readverb@c#1{%
  \endgroup
  \svnkwsave@read #1\relax
  \@ifnextchar\bgroup
    {\svnidlong@readverb@\svnidlong@readverb@d}%
    {\PackageError{svn-multi}{Wrong syntax for \string\svnidlong}{}}%
}
\def\svnidlong@readverb@d#1{%
  \endgroup
  \svnkwsave@read #1\relax
  \ifx\svnkwDate\empty\else
    \@svn@scanlongdate{\svnkwDate}%
  \fi
  \@svn@updateid{\svnkw{Revision}}{\svnkw{Date}}%
  {\svnkw{Author}}{\svnkw{URL}}%
  \ignorespaces
}

\if@svnmulti@verbatim
\def\svn@catcodes{%
  \let\do\@makeother
  \dospecials
  \catcode`\^^M9
  \catcode`\ 10
  \catcode`\{1
  \catcode`\}2
}
\else
  \def\svn@catcodes{}
\fi
\def\svnidlong@readargs#1#2#3#4{%
    \svnkwsave@read #1\relax
    \svnkwsave@read #2\relax
    \svnkwsave@read #3\relax
    \svnkwsave@read #4\relax
  \endgroup
  \ifx\svnkwDate\empty\else
    \@svn@scanlongdate{\svnkwDate}%
  \fi
  \@svn@updateid{\svnkw{Revision}}{\svnkw{Date}}%
  {\svnkw{Author}}{\svnkw{URL}}%
  \ignorespaces
}%

\def\svnkwsave{%
  \begingroup
    \svn@catcodes
    \svnkwsave@readargs
}

\gdef\svnkwsave@readargs#1{%
    \svnkwsave@read#1\relax
  \endgroup
  \if@svnidsw
    \ifx\svnkwId\empty\else
      \expandafter
      \svn@scanId\svnkwId\relax
      \@svnidswfalse
    \fi
  \fi
  \ignorespaces
}

\begingroup
\if@svnmulti@verbatim
\catcode`\$=12
\fi
\gdef\svnkwsave@read $#1$\relax{%
  \svn@checkcolon#1:\relax
}
\endgroup

\begingroup
\catcode`\$=11
\gdef\svnkwsave@parse$#1:#2${%
  \expandafter\xdef\csname svnkw#1\endcsname{#2}%
}%
\endgroup

\newcommand{\svnkwdef}[2]{%
  \@ifundefined{svnkwdef@#1}%
    {\svnkwdef@{#1}{#2}}%
    {\csname svnkwdef@#1\endcsname{#2}}%
}

\newcommand{\svnkwdef@}[2]{%
  \expandafter\xdef\csname svnkw#1\endcsname{#2}%
}

\def\svnkwdef@Rev#1{%
  \svn@ifempty{#1}%
    {\svnkwdef@{Rev}{0}}%
    {%
     \afterassignment\svnkwdef@Rev@
     \@tempcnta=#1\relax
    }%
}
\def\svnkwdef@Rev@#1\relax{%
  \svnkwdef@{Rev}{\the\@tempcnta}%
  \def\svn@temp{#1}%
  \if M\svn@temp\relax
    \global\svn@modifiedtrue
  \else
    \if *\svn@temp\relax
      \global\svn@modifiedtrue
    \else
      \global\svn@modifiedfalse
    \fi
  \fi
}
\def\svnkwdef@Author#1{\svnkwdef@{Author}{#1}}
\def\svnkwdef@Date#1{\svnkwdef@{Date}{#1}}
\def\svnkwdef@URL#1{\svnkwdef@{HeadURL}{#1}}
\let\svnkwdef@Revision=\svnkwdef@Rev
\let\svnkwdef@LastChangedRevision=\svnkwdef@Rev
\let\svnkwdef@LastChangedBy=\svnkwdef@Author
\let\svnkwdef@LastChangedDate=\svnkwdef@Date
\def\svnkwRevision{\svnkwRev}
\def\svnkwLastChangedRevision{\svnkwRev}
\def\svnkwLastChangedBy{\svnkwAuthor}
\def\svnkwLastChangedDate{\svnkwDate}
\def\svnkwURL{\svnkwHeadURL}

\svnkwdef{Rev}{0}
\svnkwdef{Date}{}
\svnkwdef{Author}{}
\svnkwdef{Filename}{}
\svnkwdef{HeadURL}{}

\newcommand{\svnkw}[1]{%
  \@ifundefined{svnkw#1}%
    {\PackageWarning{svn-multi}{SVN keyword '#1' not defined (typo?)}}%
    {\csname svnkw#1\endcsname}%
}%

\def\svn@checkcolon#1:#2\relax{%
  \svn@ifempty{#2}%
    {\svnkwdef{#1}{}}%
    {\svn@stripcolon#2\relax\svnkwdef{#1}{\svn@value}}%
}

\def\svn@stripcolon#1:\relax{%
  \svn@ifempty{#1}%
    {\gdef\svn@value{}}%
    {\svn@ifequal{#1}{ }%
      {\gdef\svn@value{}}%
      {\svn@stripspace#1\relax\relax}%
    }%
}

\def\svn@stripspace#1#2\relax{%
  \svn@ifequal{#1}{ }%
    {\gdef\svn@value{#2}}%
    {\svn@striptrailingspace#1#2\relax}%
}

\def\svn@striptrailingspace#1 \relax{%
  \gdef\svn@value{#1}%
}

\def\svn@gdefverb#1{%
  \begingroup
    \def\svn@temp{#1}%
    \begingroup
      \if@svnmulti@verbatim
        \svn@catcodes
      \fi
      \svn@gdefverb@
}

\def\svn@gdefverb@#1{%
    \endgroup
    \expandafter\gdef\svn@temp{#1}%
  \endgroup
}

\def\svn@namegdefverb#1{%
  \begingroup
    \expandafter\def
    \expandafter\svn@temp
    \expandafter{\csname #1\endcsname}%
    \begingroup
      \if@svnmulti@verbatim
        \svn@catcodes
      \fi
      \svn@gdefverb@
}

\def\@svn@scandate#1{\@svn@scandate@#1\relax}

\def\@svn@scandate@#1-#2-#3 #4:#5:#6#7#8\relax{%
  \gdef\svnfileyear{#1}%
  \gdef\svnfilemonth{#2}%
  \gdef\svnfileday{#3}%
  \gdef\svnfilehour{#4}%
  \gdef\svnfileminute{#5}%
  \gdef\svnfilesecond{#6#7}%
  \gdef\svnfiletimezonehour{+00}%
  \gdef\svnfiletimezoneminute{00}% #8 always 'Z' for Zulu-time (UTC)
}

\def\@svn@scanlongdate#1{\expandafter\@svn@scanlongdate@#1\relax}
\def\@svn@scanlongdate@#1-#2-#3 #4:#5:#6 #7 #8\relax{%
  \gdef\svnfileyear{#1}%
  \gdef\svnfilemonth{#2}%
  \gdef\svnfileday{#3}%
  \gdef\svnfilehour{#4}%
  \gdef\svnfileminute{#5}%
  \gdef\svnfilesecond{#6}%
  \@svn@parsetimezone#7\relax%
}

\def\@svn@parsetimezone#1#2#3#4#5\relax{%
  \gdef\svnfiletimezonehour{#1#2#3}%
  \gdef\svnfiletimezoneminute{#4#5}%
}

\def\svnpdfdate{%
  \svnyear\svnmonth\svnday
  \svnhour\svnminute\svnsecond\svntimezonehour'\svntimezoneminute'%
}

\newcommand{\svnsetmainfile}{%
  \xdef\svnmainurl{\svnfileurl}%
  \xdef\svnmainfilename{\svnfilefname}%
}
\AtBeginDocument{\svnsetmainfile}

\newcommand{\svnRegisterAuthor}[2]{%
  \expandafter\def\csname svn@author@#1\endcsname{#2}%
}

\newcommand{\svnFullAuthor}{%
  \@ifnextchar{*}%
    {\svnFullAuthor@star}%
    {\svnFullAuthor@normal}%
}%
\def\svnFullAuthor@star*#1{%
  \edef\svn@temp{#1}%
  \svnFullAuthor@{\svn@temp}{~(\svn@temp)}%
}%
\def\svnFullAuthor@normal#1{%
  \edef\svn@temp{#1}%
  \svnFullAuthor@{\svn@temp}{}%
}%
\def\svnFullAuthor@#1#2{%
  \@ifundefined{svn@author@#1}%
    {#1}%
    {\csname svn@author@#1\endcsname #2}%
}

\newcommand{\svnRegisterRevision}[2]{%
  \expandafter\def\csname svn@revision@#1\endcsname{#2}%
}

\newcommand{\svnFullRevision}{%
  \@ifnextchar{*}%
    {\svnFullRevision@star}%
    {\svnFullRevision@normal}%
}
\def\svnFullRevision@star*#1{%
  \edef\svn@temp{#1}%
  \svnFullRevision@{\svn@temp}{~(r\svn@temp)}%
}
\def\svnFullRevision@normal#1{%
  \edef\svn@temp{#1}%
  \svnFullRevision@{\svn@temp}{}%
}
\def\svnFullRevision@#1#2{%
  \@ifundefined{svn@revision@#1}%
    {Revision #1}%
    {\csname svn@revision@#1\endcsname #2}%
}

\if@svnmulti@filehooks

\RequirePackage{fink}[2008/02/27]
\begingroup
\def\svn@finkerror{%
\PackageError{svn-multi}{Your installed version of the 'fink' package does not
provide the needed macros. It is either too old or too new.
Try a different version, e.g. v2.1.1 from 2008/02/27}{}%
\let\svn@finkerror\relax
}
\@ifundefined{finkpath}{\svn@finkerror}{}%
\@ifundefined{finkdir}{\svn@finkerror}{}%
\@ifundefined{finkbase}{\svn@finkerror}{}%
\@ifundefined{fink@prepare}{\svn@finkerror}{}%
\@ifundefined{fink@restore}{\svn@finkerror}{}%
\@ifundefined{fnk@maindir}{\svn@finkerror}{}%
\@ifundefined{fnk@mainext}{\svn@finkerror}{}%
\endgroup

\def\svn@removedotslash#1{%
  \def\svn@removedotslash@##1##2##3\relax{%
    \svn@ifequal{./}{##1##2}%
      {\def\next{\svn@removedotslash@##3\empty\empty\empty\relax}}%
      {\xdef#1{##1##2##3}\let\next\relax}%
    \next
  }%
  \expandafter\svn@removedotslash@#1\empty\empty\empty\relax
}

\let\svn@mainext\fnk@mainext
\let\svn@maindir\fnk@maindir
\svn@removedotslash\svn@maindir
\edef\svn@filebase{\jobname}%
\edef\svn@fileext{\svn@mainext}%
\edef\svn@filedir{\svn@maindir}%
\def\svn@filename{\fink@file\svn@filebase\svn@fileext}%
\def\svn@filepath{\svn@filedir\svn@filename}%

\def\svnmulti@begininputfilehook{}
\message{Package svn-multi: patching macro '\string\fink@prepare' from the
'fink' package!}%
\let\svnmulti@fink@prepare\fink@prepare
\renewcommand*{\fink@prepare}[1]{%
  \svnmulti@fink@prepare{#1}%
  \svn@pushfilestack
  \if@svnmulti@groups
    \svn@ifequal{\svn@filepath}{\jobname.\svn@mainext}%
      {\xdef\svn@pg{\svn@g}}%
      {\xdef\svn@pg{\svn@filedir\svn@filebase}}%
  \fi
  \xdef\svn@filebase{\fink@nextbase}%
  \xdef\svn@fileext{\fink@nextext}%
  \xdef\svn@filedir{\fink@nextdir}%
  \svn@removedotslash\svn@filedir
  \svnmulti@begininputfilehook
}%

\def\svnmulti@endinputfilehook{}
\message{Package svn-multi: patching macro '\string\fink@restore' from the
'fink' package!}%
\let\svnmulti@fink@restore\fink@restore
\def\fink@restore#1{%
  \svnmulti@endinputfilehook
  \svnmulti@fink@restore{#1}%
  \svn@popfilestack
  \xdef\svn@filebase{\finkbase}%
  \xdef\svn@fileext{\finkext}%
  \xdef\svn@filedir{\finkdir}%
  \svn@removedotslash\svn@filedir
}%

\def\svnmulti@atbegininputfile{%
  \g@addto@macro\svnmulti@begininputfilehook
}

\long\def\svnmulti@atendinputfile#1{%
  \begingroup
    \@temptokena\expandafter{\svnmulti@endinputfilehook}%
    \toks@{#1}%
    \xdef\svnmulti@endinputfilehook{\the\toks@\the\@temptokena}%
  \endgroup
}

\def\svn@filestack{{}}

\def\svn@pushfilestack{%
  \xdef\svn@filestack{{%
    {\svnfilerev}%
    {\svnfiledate}%
    {\svnfileauthor}%
    {\svnfileyear}%
    {\svnfilemonth}%
    {\svnfileday}%
    {\svnfilehour}%
    {\svnfileminute}%
    {\svnfilesecond}%
    {\svnfiletimezonehour}%
    {\svnfiletimezoneminute}%
    {\svnfileurl}%
    {\svnfilefname}%
    {\svn@g}%
    {\svn@pg}%
    {\ifsvnfilemodified{@firstoftwo}{@secondoftwo}}%
  }\svn@filestack}%
}

\def\svn@restorefilekws#1#2\relax{%
  \svn@restorefilekws@#1\empty
  \empty \empty \empty \empty
  \empty \empty \empty \empty
  \empty \empty \empty \empty \empty
  \svn@ifempty{#2}%
    {\gdef\svn@filestack{{}}}%
    {\gdef\svn@filestack{#2}}%
}
\def\svn@restorefilekws@#1#2#3#4#5#6#7#8#9{%
  \gdef\svnfilerev{#1}%
  \gdef\svnfiledate{#2}%
  \gdef\svnfileauthor{#3}%
  \gdef\svnfileyear{#4}%
  \gdef\svnfilemonth{#5}%
  \gdef\svnfileday{#6}%
  \gdef\svnfilehour{#7}%
  \gdef\svnfileminute{#8}%
  \gdef\svnfilesecond{#9}%
  \svn@restorefilekws@@
}

\def\svn@restorefilekws@@#1#2#3#4#5#6#7{%
  \gdef\svnfiletimezonehour{#1}%
  \gdef\svnfiletimezoneminute{#2}%
  \gdef\svnfileurl{#3}%
  \gdef\svnfilefname{#4}%
  \gdef\svn@g{#5}%
  \gdef\svn@pg{#6}%
  \expandafter\global\expandafter\let
  \expandafter\ifsvnfilemodified\csname#7\endcsname%
}

\def\svn@popfilestack{%
  \ifx\svn@filestack\empty
    \PackageWarning{svn-multi}{Underflow of file keyword stack!}%
  \else
    \svn@ifequal{\svn@filestack}{{}}%
      {\PackageWarning{svn-multi}{Underflow of file keyword stack!}}%
      {\expandafter\svn@restorefilekws\svn@filestack\relax}%
  \fi
}


\fi

\if@svnmulti@groups
\let\svn@glist=\empty

\def\svngroup#1{%
  \svn@ifequal{#1}{*}%
    {\PackageError{svn-multi}%
      {The group name '*' is invalid for '\string\svngroup'}{}{}%
    }{}%
  \xdef\svn@g{#1}%
  \let\svn@pg\svn@g
  \ifx\svn@g\empty\else%
    \expandafter
    \ifx\csname @svng@\svn@g @rev\endcsname\relax%
      \svn@initgroup{\svn@g}%
      \ifx\svn@glist\empty
        \xdef\svn@glist{#1}%
      \else
        \xdef\svn@glist{\svn@glist,#1}%
      \fi
    \fi
  \fi
}

\def\thesvngroup{\svn@g}

\def\svnsetcg#1{%
  \svn@ifequal{#1}{*}%
    {\def\svn@cg{\svn@g}}%
    {\def\svn@cg{#1}}%
}

\def\svncg@def#1{%
  \expandafter
  \def\csname svncg#1\endcsname{%
    \@ifundefined{svng@\svn@cg @#1}{??}{%
    \csname svng@\svn@cg @#1\endcsname}%
  }%
}

\@for\@tempa:=%
  rev,author,date,year,month,day,hour,minute,second,%
  timezonehour,timezoneminute,url,fname%
\do{%
  \expandafter\svncg@def\expandafter{\@tempa}%
}

\def\thesvncg{\svn@cg}

\def\svng#1#2{%
  \@ifundefined{svng@\svn@temp @#2}%
    {??}%
    {\csname svng@\svn@temp @#2\endcsname}%
}

\def\svn@addfiletogroup#1#2{%
  \expandafter
  \ifx\csname @svng@#2@files@#1\endcsname\relax%
    \expandafter\gdef\csname @svng@#2@files@#1\endcsname{1}%
    %
    \@ifundefined{@svng@#2@files}%
      {\expandafter\xdef\csname @svng@#2@files\endcsname{#1}}%
      {\expandafter\xdef\csname @svng@#2@files\endcsname{%
        \csname @svng@#2@files\endcsname,#1%
       }%
      }%
  \fi
}

\svnmulti@atbegininputfile{%
  \svn@ifequal{\svn@filepath}{\svn@maindir\jobname.\svn@mainext}%
    {}%
    {\svn@initfile}%
  \svn@ifequal{\svn@fileext}{\svn@mainext}%
    {\svn@addfiletogroup{\svn@filedir\svn@filebase}{\svn@pg}}{}%
  \svn@ifequal{\svn@fileext}{sty}%
    {\svn@addfiletogroup{\svn@filedir\svn@filebase}{\svn@pg}}{}%
  \svn@ifequal{\svn@fileext}{cls}%
    {\svn@addfiletogroup{\svn@filedir\svn@filebase}{\svn@pg}}{}%
  \svn@addfiletogroup{\svn@filepath}{\svn@filedir\svn@filebase}%
}

\def\svn@writegroup#1{%
  \def\svn@writekw##1{%
   \immediate\write\svn@write{%
     \noexpand\@namedef{svng@#1@##1}{\csname @svng@#1@##1\endcsname}%
   }%
  }%
  \svn@writekw{rev}%
  \svn@writekw{date}%
  \svn@writekw{author}%
  \svn@writekw{year}%
  \svn@writekw{month}%
  \svn@writekw{day}%
  \svn@writekw{hour}%
  \svn@writekw{minute}%
  \svn@writekw{second}%
  \svn@writekw{timezonehour}%
  \svn@writekw{timezoneminute}%
  \@ifundefined{@svng@#1@files}{}{%
    \immediate\write\svn@write{%
      \noexpand
      \svn@namegdefverb{svng@#1@files}{\csname @svng@#1@files\endcsname}%
    }%
  }%
  \immediate\write\svn@write{%
    \noexpand
    \svn@namegdefverb{svng@#1@url}{\csname @svng@#1@url\endcsname}^^J%
    \noexpand
    \svn@namegdefverb{svng@#1@fname}{\csname @svng@#1@fname\endcsname}^^J%
  }%
}
\def\svn@writeallgroups#1{%
  \begingroup
    \ifx\relax#1\relax\else
      \@for\svn@temp:=#1\do{%
        \svn@ifvalidrev{@svng@\svn@temp @rev}%
          {%
            \expandafter
            \svn@cleanfilelist\csname @svng@\svn@temp @files\endcsname
            \svn@writegroup{\svn@temp}%
            \@ifundefined{@svng@\svn@temp @files}{}%
              {\expandafter\svn@writeallgroups
               \csname @svng@\svn@temp @files\endcsname
              }%
          }{}%
      }%
    \fi
  \endgroup
}

\def\svn@updategroup#1{%
  \@ifundefined{@svng@#1@rev}%
    {\svn@initgroup{#1}}%
    {}%
  \expandafter
  \ifnum\csname @svng@#1@rev\endcsname<\svnfilerev
    \svn@gkwset{#1}{rev}{\svnfilerev}%
    \svn@gkwset{#1}{date}{\svnfiledate}%
    \svn@gkwset{#1}{author}{\svnfileauthor}%
    \svn@gkwset{#1}{year}{\svnfileyear}%
    \svn@gkwset{#1}{month}{\svnfilemonth}%
    \svn@gkwset{#1}{day}{\svnfileday}%
    \svn@gkwset{#1}{hour}{\svnfilehour}%
    \svn@gkwset{#1}{minute}{\svnfileminute}%
    \svn@gkwset{#1}{second}{\svnfilesecond}%
    \svn@gkwset{#1}{timezonehour}{\svnfiletimezonehour}%
    \svn@gkwset{#1}{timezoneminute}{\svnfiletimezoneminute}%
    \svn@gkwset{#1}{url}{\svnfileurl}%
    \svn@gkwset{#1}{fname}{\svnfilefname}%
  \fi
}

\def\svn@definegroup#1{%
  \svn@gkwdef{#1}{rev}%
  \svn@gkwdef{#1}{date}%
  \svn@gkwdef{#1}{author}%
  \svn@gkwdef{#1}{year}%
  \svn@gkwdef{#1}{month}%
  \svn@gkwdef{#1}{day}%
  \svn@gkwdef{#1}{hour}%
  \svn@gkwdef{#1}{minute}%
  \svn@gkwdef{#1}{second}%
  \svn@gkwdef{#1}{timezonehour}%
  \svn@gkwdef{#1}{timezoneminute}%
  \svn@gkwdef{#1}{url}%
  \svn@gkwdef{#1}{fname}%
}

\def\svn@initgroup#1{%
  \svn@gkwset{#1}{rev}{\svn@revinit}%
  \svn@gkwset{#1}{date}{}%
  \svn@gkwset{#1}{author}{}%
  \svn@gkwset{#1}{year}{0000}%
  \svn@gkwset{#1}{month}{00}%
  \svn@gkwset{#1}{day}{00}%
  \svn@gkwset{#1}{hour}{00}%
  \svn@gkwset{#1}{minute}{00}%
  \svn@gkwset{#1}{second}{00}%
  \svn@gkwset{#1}{timezonehour}{+00}%
  \svn@gkwset{#1}{timezoneminute}{00}%
  \svn@gkwset{#1}{url}{}%
  \svn@gkwset{#1}{fname}{}%
}

\def\svn@gkwset#1#2#3{%
  \expandafter
  \xdef\csname @svng@#1@#2\endcsname{#3}%
}

\def\svn@gkwdef#1#2{%
  \expandafter
  \xdef\csname svng@#1@#2\endcsname{\csname @svng@#1@#2\endcsname}%
}

\def\svn@cleanfilelist#1{
  \begingroup
    \def\svn@tmplist{}%
    \ifx\relax#1\relax\else
      \@for\svn@temp:=#1\do{%
        \expandafter\svn@ifvalidrev
        \expandafter{@svng@\svn@temp @rev}%
          {\edef\svn@tmplist{\svn@tmplist,\svn@temp}}%
          {}%
      }%
      \xdef#1{\expandafter\@gobble\svn@tmplist\empty}%
    \fi
  \endgroup
}

\fi


\newif\ifsvnsubgroups
\svnsubgroupsfalse

\if@svnmulti@subgroups
\svnsubgroupstrue

\def\svnsubgroup{%
  \begingroup
    \svn@removedotslash\svn@filedir
    \svn@subgroup{\svn@filedir\svn@filebase}%
    \svn@subgroup{\svn@filepath}%
  \endgroup
}

\def\svn@subgroup#1{%
  \ifnum\svnfilerev=\svn@revinit\else
    \expandafter\ifx\csname svn@g@#1\endcsname\relax%
      \expandafter\gdef\csname svn@g@#1\endcsname{1}%
      \svn@updategroup{#1}%
    \fi
  \fi
}

\def\svnignoreextensions#1{%
  \@for\svn@temp:=#1\do{%
    \expandafter\def\csname svn@ignore@ext@\svn@temp\endcsname{}%
  }%
}

\def\svnconsiderextensions#1{%
  \@for\svn@temp:=#1\do{%
  \expandafter\let\csname svn@ignore@ext@\svn@temp\endcsname\relax%
  }%
}

\svnignoreextensions{aux,bbl,fd,enc,fls,glo,idx,ilg,ind,ist,%
lof,log,lot,out,svn,svt,svx,toc}

\svnmulti@atendinputfile{%
  \if@svnmulti@subgroups
    \ifsvnsubgroups
      \expandafter\ifx\csname svn@ignore@ext@\svn@fileext\endcsname\relax
      \svnsubgroup
      \fi
    \fi
  \fi
}

\if@svnmulti@subgroups
  \ifsvnsubgroups
    \svn@addfiletogroup{\jobname .\svn@mainext}{\jobname}%
    \svnsubgroup
  \fi
\fi
\AtBeginDocument{%
  \if@svnmulti@subgroups
    \ifsvnsubgroups
    \@ifundefined{@svng@\svn@g @files@\jobname}%
      {%
      \@namedef{@svng@\svn@g @files@\jobname}{1}%
      \@ifundefined{@svng@\svn@g @files}%
        {%
          \expandafter
          \xdef\csname @svng@\svn@g @files\endcsname{\jobname}%
        }%
        {%
          \expandafter
          \xdef\csname @svng@\svn@g @files\endcsname
            {\jobname,\csname @svng@\svn@g @files\endcsname}%
        }%
      }{}%
      \svnsubgroup
    \fi
  \fi
}

\fi

\if@svnmulti@external

\if@svnmulti@groups
\def\svnexternalgroup#1{%
  \svn@ifequal{#1}{*}%
    {\def\svn@externalgroup{\svn@pg}}%
    {\def\svn@externalgroup{#1}}%
}
\def\svn@externalgroup{\svn@pg}
\else
\def\svn@externalgroup{}
\fi

\if@svnmulti@autokw
\newcommand*\svnexternal[2][]{%
  \svn@pushfilestack
  \svn@ifequal{#1}{*}%
    {\edef\svn@eg{\svn@pg}}%
    {\svn@ifempty{#1}%
      {\edef\svn@eg{\svn@externalgroup}}%
      {\edef\svn@eg{#1}}%
    }%
  \svne@@external#2\relax
  \svn@popfilestack
}

\def\svne@@external#1{%
  \ifx\relax#1\empty\else
    \svnegetfile{#1}%
    \begingroup\svn@externalfile{\svn@eg}{#1}%
    \expandafter\svne@@external
  \fi
}
\else
\newcommand*\svnexternal[2][]{%
  \if@filesw
    \svn@checkwrite
    \begingroup
      \svn@ifequal{#1}{*}%
        {\def\svn@temp{\svn@pg}}%
        {\svn@ifempty{#1}%
          {\def\svn@temp{\svn@externalgroup}}%
          {\def\svn@temp{#1}}%
        }%
      \immediate\write\svn@write{%
        \noexpand\@svnexternal[\svn@temp]{\svn@filepath}{#2}%
      }%
    \endgroup
  \fi
  \svn@inputsvx{\svn@filedir\svn@filebase}%
}
\fi

\def\svnexternalpath#1{%
  \if@filesw
    \svn@checkwrite
    \immediate\write\svn@write{%
      \noexpand\@svnexternalpath{#1}%
    }%
  \fi
}

\newcommand*\@svnexternal[3][]{}
\def\@svnexternalpath#1{}

\newcommand*\svnexternalfile[1][\svn@filedir\svn@filebase]{%
  \begingroup % TODO: maybe use \svn@catcodes
    \catcode`\_=12
    \catcode`\&=12
    \catcode`\^=12
    \catcode`\$=12
    \catcode`\#=12
    \svn@externalfile{#1}%
}

\def\svn@externalfile#1#2{%
  \endgroup
  \if@svnmulti@subgroups
    \ifsvnsubgroups
      \svn@ifequal{#1}{\svn@rg}%
        {\svn@addfiletogroup{#2}{\svn@filedir\svn@filebase}}%
        {\svn@addfiletogroup{#2}{#1}}%
      \svn@subgroup{#2}%
    \fi
  \fi
}

\else
  \def\svnexternalfile#1{}%
\fi

\if@svnmulti@autoload

\svnmulti@atbegininputfile{%
  \svn@ifequal{\svn@fileext}{tex}%
    {\svn@inputsvx{\svn@filedir\svn@filebase}}%
    {}%
}

%%\AtEndOfPackage{%
\AtBeginDocument{%
  \svn@inputsvx{\jobname}%
}

\fi


\if@svnmulti@anygraphic

\def\svngraphicsgroup#1{%
  \svn@ifequal{#1}{*}%
    {\def\svn@graphicsgroup{\svn@pg}}%
    {\def\svn@graphicsgroup{#1}}%
}
\def\svn@graphicsgroup{\svn@externalgroup}

\def\svnignoregraphic#1{%
  \expandafter\def\csname svn@ignoregraphic@#1\endcsname{}%
}

\def\svnconsidergraphic#1{%
  \expandafter\let\csname svn@ignoregraphic@#1\endcsname\relax%
}

\fi

\if@svnmulti@graphics
\RequirePackage{graphics}[2006/02/20]

\message{Package svn-multi: patching macro '\string\Gin@setfile' from the
'graphics' package!}%
\let\svnmulti@Gin@setfile\Gin@setfile
\renewcommand*{\Gin@setfile}[3]{%
  \expandafter\ifx\csname svn@ignoregraphic@#3\endcsname\relax%
    \svnexternal[\svn@graphicsgroup]{{#3}}%
  \fi
  \svnmulti@Gin@setfile{#1}{#2}{#3}%
}

\fi

\if@svnmulti@pgfimages
\RequirePackage{pgf}[2008/01/15]

\message{Package svn-multi: patching macro '\string\pgf@declareimage' and will
patch generated macros '\string\pgf@image@<name>!' from the 'pgf' package!}%
\let\svnmulti@pgf@declareimage\pgf@declareimage
\renewcommand*{\pgf@declareimage}[3][]{%
  \svnmulti@pgf@declareimage[#1]{#2}{#3}%
  \ifx\pgf@filename\empty\else
    \expandafter\ifx\csname svn@ignoregraphic@\pgf@filename\endcsname\relax%
      \expandafter\global\expandafter%
      \let\csname svnmulti@pgf@image@#2!\endcsname=\pgf@image%
      \expandafter\xdef\csname pgf@image@#2!\endcsname{%
        \noexpand\svnexternal[\noexpand\svn@graphicsgroup]{{\pgf@filename}}%
        \csname svnmulti@pgf@image@#2!\endcsname
      }%
    \fi
  \fi
}
\fi
\if@svnmulti@table
\ifx\tableofcontents\relax\else
\def\svnrevisionsname{Table of Revisions}%
\def\svn@svt{svt}

\AtBeginDocument{%
\ifx\chapter\relax
  \let\chapter\@undefined
\fi
\ifx\chapter\@undefined

%% Adapted from the \tableofcontents macro, LaTeX `article' class [2005/09/16]
\newcommand\tableofrevisions{%
  \section*{\svnrevisionsname
  \@mkboth{\MakeUppercase\svnrevisionsname}{\MakeUppercase\svnrevisionsname}}%
  \svn@input{\jobname .\svn@svt}%
}

\else

%% Adapted from the \tableofcontents macro, LaTeX `book' class [2005/09/16]
\newcommand\tableofrevisions{%
  \expandafter\ifx
  \csname if@twocolumn\expandafter\endcsname
  \csname iftrue\endcsname
    \@restonecoltrue\onecolumn
  \else
    \@restonecolfalse
  \fi
  \chapter*{\svnrevisionsname
    \@mkboth{\MakeUppercase\svnrevisionsname}{\MakeUppercase\svnrevisionsname}}%
  \svn@input{\jobname .\svn@svt}%
  \expandafter\ifx
  \csname if@restonecol\expandafter\endcsname
  \csname iftrue\endcsname
    \twocolumn
  \fi
}

\fi
}
\fi % defined \tableofcontents

\def\svn@writerow#1#2#3{%
  \immediate\write\svn@svtwrite{%
    \expandafter\noexpand\csname svn#1row\endcsname
    \expandafter\noexpand\csname svntab#1\endcsname{#2}{#3}\space
    \@ampersamchar\space
    \svn@tabcell{rev}\space\@ampersamchar\space
    \svn@tabcell{author}\space\@ampersamchar\space
    \noexpand\svntabdate%
    \svn@tabcellarg{year}%
    \svn@tabcellarg{month}%
    \svn@tabcellarg{day}%
    \svn@tabcellarg{hour}%
    \svn@tabcellarg{minute}%
    \svn@tabcellarg{second}%
    \svn@tabcellarg{timezonehour}%
    \svn@tabcellarg{timezoneminute}%
    \space\@backslashchar\@backslashchar
    \expandafter\noexpand\csname endsvn#1row\endcsname
  }%
}

\def\svn@writegrouprow#1{%
  \begingroup
    \def\svn@tabcellarg##1{{\csname @svng@#1@##1\endcsname}}%
    \def\svn@tabcell##1{\expandafter\noexpand\csname svntab##1\endcsname%
      \svn@tabcellarg{##1}%
    }%
    \svn@writerow{group}{#1}{}%
  \endgroup
}

\def\svn@writesubgrouprow#1#2{%
  \begingroup
    \def\svn@tabcellarg##1{{\csname @svng@#2@##1\endcsname}}%
    \def\svn@tabcell##1{\expandafter\noexpand\csname svntab##1\endcsname%
      \svn@tabcellarg{##1}%
    }%
    \svn@writerow{subgroup}{#1}{#2}%
  \endgroup
}

\def\svn@writefilerow#1#2{%
  \begingroup
    \def\svn@tabcellarg##1{{\csname @svng@#2@##1\endcsname}}%
    \def\svn@tabcell##1{\expandafter\noexpand\csname svntab##1\endcsname%
      \svn@tabcellarg{##1}%
    }%
    \svn@writerow{file}{#1}{#2}%
  \endgroup
}

\def\svn@writeglobalrow{%
  \begingroup
  \def\svn@tabcellarg##1{{\csname @svn@##1\endcsname}}%
  \def\svn@tabcell##1{\expandafter\noexpand\csname svntab##1\endcsname%
    \svn@tabcellarg{##1}%
  }%
  \svn@writerow{global}{}{}%
  \endgroup
}

\def\svntable{%
  \begin{tabular}{p{0.425\textwidth}rll}%
    \hline
}
\def\endsvntable{\hline\end{tabular}}

\def\svntablehead{%
    Name & Rev & Last Author & Last Changed At \\\hline
}
\def\svntablefoot{}

\def\svnbeforetable{}
\def\svnaftertable{\clearpage}

\def\svnglobalrow{}
\def\endsvnglobalrow{}
\def\svngrouprow{}
\def\endsvngrouprow{}
\def\svnsubgrouprow{}
\def\endsvnsubgrouprow{}
\def\svnfilerow{}
\def\endsvnfilerow{}

\def\svntabglobal{Document}
\def\svntabgroup#1{Group `#1'}

\def\svntabsubgroup#1{%
  \raggedright
  \addtolength{\leftskip}{#1\medskipamount}%
  \begingroup
  \catcode`\_=12
  \catcode`\&=12
  \catcode`\^=12
  \catcode`\$=12
  \catcode`\#=12
  \svn@tabsubgroup
}
\def\svn@tabsubgroup#1{\endgroup Subgroup `\texttt{\small #1}'}

\def\svntabfile#1{%
  \raggedright
  \addtolength{\leftskip}{#1\medskipamount}%
  \begingroup
  \catcode`\_=12
  \catcode`\&=12
  \catcode`\^=12
  \catcode`\$=12
  \catcode`\#=12
  \svn@tabfile
}
\def\svn@tabfile#1{\endgroup File `\texttt{\small #1}'}

\def\svntabrev{}
\def\svntabauthor#1{\svnFullAuthor{#1}}
\def\svntabdate#1#2#3#4#5#6#7#8{%
    #1-#2-#3 #4:#5:#6% #7#8%
}

\fi

\newcommand{\svn}{\@ifnextchar{*}{\svn@s}{\svn@n}}
\def\svn@n#1{\@svn@n#1}
\def\svn@s*#1{\@svn@s#1}
\def\@svn@n$#1${#1}
\def\@svn@s$#1 ${#1}

%% Adapted from the \url macro of the `hyperref` package.
\DeclareRobustCommand*{\svnnolinkurl}{%
  \@ifundefined{hyper@normalise}%
    {\PackageWarning{svn-multi}{Package hyperref is needed for \noexpand
     \svnnolinkurl.}}%
    {\hyper@normalise\svnnolinkurl@}%
}%
\def\svnnolinkurl@#1{\Hurl{#1}}%

\def\svn@getfilename#1{%
  \begingroup
    \gdef\svnfiledir{}%
    \edef\svn@temp{#1}%
    \expandafter\@svn@getfilename\svn@temp/{}\relax
}%

\def\@svn@getfilename#1/#2\relax{%
  \svn@ifempty{#2}%
    {%
      \endgroup
      \gdef\svnfilefname{#1}%
    }%
    {%
      \xdef\svnfiledir{\svnfiledir#1/}%
      \@svn@getfilename#2\relax
    }%
}%

\@input{\jobname .svn}

\def\svn@checkwrite{%
 \@ifundefined{svn@write}{%
   \newwrite\svn@write
   \immediate\openout\svn@write=\jobname.svn\relax%
   \immediate\write\svn@write{\@percentchar\space SVN Keyword cache}%
   %\immediate\write\svn@write{\noexpand\makeatletter}%
 }{}%
 \let\svn@checkwrite=\relax
}
{\catcode`\&=12
\gdef\@ampersamchar{&}
}
\def\svn@writesvn{%
    \if@svnmulti@groups
    \fi
    \svn@checkwrite
    \immediate\write\svn@write{^^J%
      \@percentchar\space Global values:^^J%
      \noexpand\def\noexpand\svnrev{\@svn@rev}^^J%
      \noexpand\let\noexpand\ifsvnmodified\@backslashchar\@svn@modified^^J%
      \noexpand\def\noexpand\svndate{\@svn@date}^^J%
      \noexpand\def\noexpand\svnauthor{\@svn@author}^^J%
      \noexpand\def\noexpand\svnyear{\@svn@year}^^J%
      \noexpand\def\noexpand\svnmonth{\@svn@month}^^J%
      \noexpand\def\noexpand\svnday{\@svn@day}^^J%
      \noexpand\def\noexpand\svnhour{\@svn@hour}^^J%
      \noexpand\def\noexpand\svnminute{\@svn@minute}^^J%
      \noexpand\def\noexpand\svnsecond{\@svn@second}^^J%
      \noexpand\def\noexpand\svntimezonehour{\@svn@timezonehour}^^J%
      \noexpand\def\noexpand\svntimezoneminute{\@svn@timezoneminute}^^J%
      \noexpand\svn@gdefverb\noexpand\svnurl{\@svn@url}^^J%
      \noexpand\svn@gdefverb\noexpand\svnfname{\@svn@fname}^^J%
    }%
    \if@svnmulti@groups
      \svn@cleanfilelist\@svng@@files
      \immediate\write\svn@write{%
        \noexpand\def\noexpand\svng@@files{\@svng@@files}^^J%
      }%
      \svn@writeallgroups\@svng@@files
      \ifx\svn@glist\empty\else
        \begingroup
          \immediate\write\svn@write{^^J%
            \@percentchar\space SVN File Groups: \svn@glist
          }%
          \svn@writeallgroups\svn@glist
        \endgroup
      \fi
    \else
      \immediate\write\svn@write{^^J}%
    \fi
    \immediate\closeout\svn@write%
}

\def\svn@writegroupfiles#1{%
  \begingroup
    \advance\svn@grouplevel by 1\relax
    \expandafter\let
    \expandafter\svn@files\csname @svng@#1@files\endcsname
    \ifx\svn@files\relax\else
      \svn@cleanfilelist\svn@files
      \@for\svn@file:=\svn@files\do{%
        \svn@ifvalidrev{@svng@\svn@file @rev}%
          {%
            \@ifundefined{@svng@\svn@file @files}%
              {\svn@writefilerow{\the\svn@grouplevel}{\svn@file}}%
              {\svn@ifonlyone{\svn@file}%
                {\svn@writefilerow{\the\svn@grouplevel}%
                  {\csname @svng@\svn@file @files\endcsname}}%
                {\svn@ifempty{\csname @svng@\svn@file @files\endcsname}%
                  {}%
                  {%
                    \svn@writesubgrouprow{\the\svn@grouplevel}{\svn@file}%
                    \svn@writegroupfiles{\svn@file}%
                  }%
                }%
              }%
          }{}%
      }%
    \fi
  \endgroup
}%

\def\svn@writesvt{%
  \if@svnmulti@table
    \newwrite\svn@svtwrite
    \immediate\openout\svn@svtwrite=\jobname.\svn@svt\relax
    \@onelevel@sanitize\svntable%
    \immediate\write\svn@svtwrite{%
      \noexpand\svnbeforetable^^J%
      \svntable
      \noexpand\svntablehead^^J%
    }%
    \let\svn@grouplevel\@tempcnta
    \svn@grouplevel=0\relax
    \svn@writeglobalrow{}%
    \svn@writegroupfiles{}%
    \@for\svn@g:=\svn@glist\do{%
      \@ifundefined{@svng@\svn@g @rev}{}%
      {%
        \expandafter
        \ifnum\csname @svng@\svn@g @rev\endcsname>0\relax
          \svn@writegrouprow{\svn@g}%
          \svn@writegroupfiles{\svn@g}%
        \fi
      }%
    }%

    \@onelevel@sanitize\endsvntable%
    \immediate\write\svn@svtwrite{%
      \noexpand\svntablefoot^^J%
      \endsvntable^^J%
      \noexpand\svnaftertable
    }%
    \immediate\closeout\svn@svtwrite%
  \fi
}

\if@svnmulti@autokwall

\svnmulti@atbegininputfile{%
  \expandafter
  \ifx\csname svn@ignore@ext@\svn@fileext\endcsname\relax
    \svnegetfile{\svn@filepath}%
  \fi
}

\fi

\AtEndDocument{%
  \if@filesw
    \ifx\@svn@rev\empty\else
      \ifnum\@svn@rev<1\else
        \svn@writesvn
        \svn@writesvt
      \fi
    \fi
  \fi
}
\endinput
%%
%% End of file `svn-multi.sty'.
