%%
%% This is file `gettitlestring.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% gettitlestring.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2009 by
%%    Heiko Oberdiek <heiko.oberdiek at googlemail.com>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%%    http://www.latex-project.org/lppl/lppl-1-3c.txt
%% and 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".
%% 
%% This Current Maintainer of this work is Heiko Oberdiek.
%% 
%% The Base Interpreter refers to any `TeX-Format',
%% because some files are installed in TDS:tex/generic//.
%% 
%% This work consists of the main source file gettitlestring.dtx
%% and the derived files
%%    gettitlestring.sty, gettitlestring.pdf, gettitlestring.ins,
%%    gettitlestring.drv, gettitlestring-test1.tex,
%%    gettitlestring-test2.tex.
%% 
\begingroup
  \catcode44 12 % ,
  \catcode45 12 % -
  \catcode46 12 % .
  \catcode58 12 % :
  \catcode64 11 % @
  \catcode123 1 % {
  \catcode125 2 % }
  \expandafter\let\expandafter\x\csname ver@gettitlestring.sty\endcsname
  \ifx\x\relax % plain-TeX, first loading
  \else
    \def\empty{}%
    \ifx\x\empty % LaTeX, first loading,
      % variable is initialized, but \ProvidesPackage not yet seen
    \else
      \catcode35 6 % #
      \expandafter\ifx\csname PackageInfo\endcsname\relax
        \def\x#1#2{%
          \immediate\write-1{Package #1 Info: #2.}%
        }%
      \else
        \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
      \fi
      \x{gettitlestring}{The package is already loaded}%
      \aftergroup\endinput
    \fi
  \fi
\endgroup
\begingroup
  \catcode35 6 % #
  \catcode40 12 % (
  \catcode41 12 % )
  \catcode44 12 % ,
  \catcode45 12 % -
  \catcode46 12 % .
  \catcode47 12 % /
  \catcode58 12 % :
  \catcode64 11 % @
  \catcode91 12 % [
  \catcode93 12 % ]
  \catcode123 1 % {
  \catcode125 2 % }
  \expandafter\ifx\csname ProvidesPackage\endcsname\relax
    \def\x#1#2#3[#4]{\endgroup
      \immediate\write-1{Package: #3 #4}%
      \xdef#1{#4}%
    }%
  \else
    \def\x#1#2[#3]{\endgroup
      #2[{#3}]%
      \ifx#1\@undefined
        \xdef#1{#3}%
      \fi
      \ifx#1\relax
        \xdef#1{#3}%
      \fi
    }%
  \fi
\expandafter\x\csname ver@gettitlestring.sty\endcsname
\ProvidesPackage{gettitlestring}%
  [2009/12/18 v1.3 Cleanup title references (HO)]
\begingroup
  \catcode123 1 % {
  \catcode125 2 % }
  \def\x{\endgroup
    \expandafter\edef\csname GTS@AtEnd\endcsname{%
      \catcode35 \the\catcode35\relax
      \catcode64 \the\catcode64\relax
      \catcode123 \the\catcode123\relax
      \catcode125 \the\catcode125\relax
    }%
  }%
\x
\catcode35 6 % #
\catcode64 11 % @
\catcode123 1 % {
\catcode125 2 % }
\def\TMP@EnsureCode#1#2{%
  \edef\GTS@AtEnd{%
    \GTS@AtEnd
    \catcode#1 \the\catcode#1\relax
  }%
  \catcode#1 #2\relax
}
\TMP@EnsureCode{42}{12}% *
\TMP@EnsureCode{44}{12}% ,
\TMP@EnsureCode{45}{12}% -
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{47}{12}% /
\TMP@EnsureCode{61}{12}% =
\TMP@EnsureCode{91}{12}% [
\TMP@EnsureCode{93}{12}% ]
\RequirePackage{kvoptions}[2009/07/17]
\SetupKeyvalOptions{%
  family=gettitlestring,%
  prefix=GTS@%
}
\newcommand*{\GetTitleStringSetup}{%
  \setkeys{gettitlestring}%
}
\DeclareBoolOption{expand}
\InputIfFileExists{gettitlestring.cfg}{}{}
\ProcessKeyvalOptions*\relax
\newcommand*{\GetTitleString}{%
  \ifGTS@expand
    \expandafter\GetTitleStringExpand
  \else
    \expandafter\GetTitleStringNonExpand
  \fi
}
\newcommand{\GetTitleStringExpand}[1]{%
  \def\GetTitleStringResult{#1}%
  \begingroup
    \GTS@DisablePredefinedCmds
    \GTS@DisableHook
    \edef\x{\endgroup
      \noexpand\def\noexpand\GetTitleStringResult{%
        \GetTitleStringResult
      }%
    }%
  \x
}
\newcommand{\GetTitleStringNonExpand}[1]{%
  \def\GetTitleStringResult{#1}%
  \global\let\GTS@GlobalString\GetTitleStringResult
  \begingroup
    \GTS@RemoveLeft
    \GTS@RemoveRight
  \endgroup
  \let\GetTitleStringResult\GTS@GlobalString
}
\def\GTS@DisablePredefinedCmds{%
  \let\label\@gobble
  \let\zlabel\@gobble
  \let\zref@label\@gobble
  \let\zref@labelbylist\@gobbletwo
  \let\zref@labelbyprops\@gobbletwo
  \let\index\@gobble
  \let\glossary\@gobble
  \let\markboth\@gobbletwo
  \let\@mkboth\@gobbletwo
  \let\markright\@gobble
  \let\phantomsection\@empty
  \def\addcontentsline{\expandafter\@gobble\@gobbletwo}%
  \let\raggedright\@empty
  \let\raggedleft\@empty
  \let\centering\@empty
  \let\protect\@unexpandable@protect
}
\providecommand*{\GTS@DisableHook}{}
\def\GetTitleStringDisableCommands{%
  \begingroup
    \makeatletter
    \GTS@DisableCommands
}
\long\def\GTS@DisableCommands#1{%
    \toks0=\expandafter{\GTS@DisableHook}%
    \toks2={#1}%
    \xdef\GTS@GlobalString{\the\toks0 \the\toks2}%
  \endgroup
  \let\GTS@DisableHook\GTS@GlobalString
}
\def\GTS@RemoveLeft{%
  \toks@\expandafter\expandafter\expandafter{%
    \expandafter\GTS@Car\GTS@GlobalString{}{}{}{}\GTS@Nil
  }%
  \edef\GTS@Token{\the\toks@}%
  \GTS@PredefinedLeftCmds
  \expandafter\futurelet\expandafter\GTS@Token
  \expandafter\GTS@TestLeftSpace\GTS@GlobalString\GTS@Nil
  \GTS@End
}
\def\GTS@End{}
\long\def\GTS@TestLeft#1#2{%
  \def\GTS@temp{#1}%
  \ifx\GTS@temp\GTS@Token
    \toks@\expandafter\expandafter\expandafter{%
      \expandafter#2\GTS@GlobalString\GTS@Nil
    }%
    \expandafter\GTS@TestLeftEnd
  \fi
}
\long\def\GTS@TestLeftEnd#1\GTS@End{%
  \xdef\GTS@GlobalString{\the\toks@}%
  \GTS@RemoveLeft
}
\long\def\GTS@Car#1#2\GTS@Nil{#1}
\long\def\GTS@Cdr#1#2\GTS@Nil{#2}
\long\def\GTS@CdrTwo#1#2#3\GTS@Nil{#3}
\long\def\GTS@CdrThree#1#2#3#4\GTS@Nil{#4}
\long\def\GTS@CdrFour#1#2#3#4#5\GTS@Nil{#5}
\long\def\GTS@TestLeftSpace#1\GTS@Nil{%
  \ifx\GTS@Token\@sptoken
    \toks@\expandafter{%
      \romannumeral-0\GTS@GlobalString
    }%
    \expandafter\GTS@TestLeftEnd
  \fi
}
\def\GTS@PredefinedLeftCmds{%
  \GTS@TestLeft\Hy@phantomsection\GTS@Cdr
  \GTS@TestLeft\Hy@SectionAnchor\GTS@Cdr
  \GTS@TestLeft\Hy@SectionAnchorHref\GTS@CdrTwo
  \GTS@TestLeft\label\GTS@CdrTwo
  \GTS@TestLeft\zlabel\GTS@CdrTwo
  \GTS@TestLeft\index\GTS@CdrTwo
  \GTS@TestLeft\glossary\GTS@CdrTwo
  \GTS@TestLeft\markboth\GTS@CdrThree
  \GTS@TestLeft\@mkboth\GTS@CdrThree
  \GTS@TestLeft\addcontentsline\GTS@CdrFour
}
\def\GTS@RemoveRight{%
  \toks@{}%
  \expandafter\GTS@TestRightLabel\GTS@GlobalString
      \label{}\GTS@Nil\@nil
  \GTS@RemoveRightSpace
}
\begingroup
  \def\GTS@temp#1{\endgroup
    \def\GTS@RemoveRightSpace{%
      \expandafter\GTS@TestRightSpace\GTS@GlobalString
          \GTS@Nil#1\GTS@Nil\@nil
    }%
  }%
\GTS@temp{ }
\def\GTS@TestRightSpace#1 \GTS@Nil#2\@nil{%
  \ifx\relax#2\relax
  \else
    \gdef\GTS@GlobalString{#1}%
    \expandafter\GTS@RemoveRightSpace
  \fi
}
\def\GTS@TestRightLabel#1\label#2#3\GTS@Nil#4\@nil{%
  \def\GTS@temp{#3}%
  \ifx\GTS@temp\@empty
    \expandafter\gdef\expandafter\GTS@GlobalString\expandafter{%
      \the\toks@
      #1%
    }%
    \expandafter\@gobble
  \else
    \expandafter\@firstofone
  \fi
  {%
    \toks@\expandafter{\the\toks@#1}%
    \GTS@TestRightLabel#3\GTS@Nil\@nil
  }%
}
\GTS@AtEnd
\endinput
%%
%% End of file `gettitlestring.sty'.
