%%
%% This is file `letterspace.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% microtype.dtx  (with options: `letterspace')
%% 
%% ------------------------------------------------------------------------
%%                       The `microtype' package
%%        An interface to the micro-typographic extensions of pdfTeX
%%           Copyright (c) 2004--2007  R Schlicht <w.m.l@gmx.net>
%% 
%% 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. The latest version of this license is in:
%% http://www.latex-project.org/lppl.txt, and version 1.3c or later is part
%% of all distributions of LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `author-maintained'.
%% 
%% This work consists of the files microtype.dtx and microtype.ins and the
%% derived files microtype.sty and letterspace.sty.
%% 
%% ------------------------------------------------------------------------
%%   This is a stand-alone version that only provides the letterspacing
%%   commands. Do not use this package together with the `microtype' package.
%%   Please refer to section 7 of the `microtype' documentation.
%% ------------------------------------------------------------------------ 
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage
    {letterspace}
    [2007/01/21 v1.0 Robust letterspacing (RS)]
\newcommand*\lsstyle{}
\newcommand\textls[2][]{}
\def\textls#1#{\@firstofone}
\newcommand*\lslig[1]{#1}
\def\MT@warning{\PackageWarning{letterspace}}
\def\MT@warning@nl#1{\MT@warning{#1\@gobble}}
\def\MT@pdftex@no{0}
\ifx\normalpdftexversion\@undefined \else
  \let\pdftexversion \normalpdftexversion
  \let\pdftexrevision\normalpdftexrevision
  \let\pdfoutput     \normalpdfoutput
\fi
\ifx\pdftexversion\@undefined \else
  \ifx\pdftexversion\relax \else
    \def\MT@pdftex@no{6}
    \ifnum\pdftexversion < 140
      \def\MT@pdftex@no{5}
    \fi
  \fi
\fi
\ifnum\MT@pdftex@no<6
  \AtEndOfPackage{\let\@unprocessedoptions\relax}
  \let\CurrentOption\@empty
  \MT@warning@nl{%
    \ifcase\MT@pdftex@no
      You don't seem to be using pdftex.\MessageBreak
    \else
      You are using a pdftex version older than 1.40.\MessageBreak
      Sorry, but robust letterspacing doesn't work with\MessageBreak
      this version. Please upgrade%
    \fi
  }
\endinput\fi
\RequirePackage{keyval}[1997/11/10]
\def\MT@tr@min{-\@m}
\let\MT@tr@max\@m
\let\MT@letterspace\m@ne
\def\MT@letterspace@default{100}
\def\MT@glet{\global\let}
\def\MT@edef@n#1{\expandafter\edef\csname #1\endcsname}
\def\MT@let@nc#1{\expandafter\let\csname #1\endcsname}
\def\MT@exp@one@n#1#2{\expandafter#1\expandafter{#2}}
\def\MT@exp@two@c#1{\expandafter\expandafter\expandafter#1\expandafter}
  \def\MT@ifdefined@c@TF#1{\ifdefined#1%
    \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
  }
  \def\MT@ifdefined@n@T#1{\ifcsname#1\endcsname
    \expandafter\@firstofone\else\expandafter\@gobble\fi
  }
\begingroup
\catcode`\%=12
\catcode`\&=14
\gdef\MT@ifempty#1{&
  \if %#1%&
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\endgroup
  \def\MT@ifint#1{%
    \ifcase\pdfmatch{^-*[0-9]+ *$}{#1}\relax
      \expandafter\@secondoftwo
    \else
      \expandafter\@firstoftwo
    \fi
  }
\def\MT@map@clist@n#1#2{%
  \ifx\@empty#1\else
    \def\MT@clist@function##1{#2}%
    \MT@map@clist@#1,\@nil,\@nnil
  \fi
}
\def\MT@map@clist@c#1{\MT@exp@one@n\MT@map@clist@n#1}
\def\MT@map@clist@#1,{%
  \ifx\@nil#1%
    \expandafter\MT@clist@break
  \fi
  \MT@clist@function{#1}%
  \MT@map@clist@
}
\let\MT@clist@function\@gobble
\def\MT@clist@break#1\@nnil{}
\let\MT@setup@\@empty
\def\MT@addto@setup{\g@addto@macro\MT@setup@}
\AtBeginDocument{\MT@setup@ \MT@glet\MT@setup@\@empty}
\def\MT@with@package#1{\@ifpackageloaded{#1}\@firstofone\@gobble}
\MT@addto@setup{%
  \@ifpackageloaded{hyperref}{%
    \pdfstringdefDisableCommands{%
      \def\lsstyle{\pdfstringdefWarn\lsstyle}%
      \def\textls#1#{\pdfstringdefWarn\textls}%
    }%
  }{%
  }
  \MT@with@package{soul}{%
    \soulregister\lsstyle 0%
    \soulregister\textls  1%
  }
}
  \DeclareRobustCommand\lsstyle{%
    \let\MT@tracking\MT@tracking@
    \MT@let@nc{lslig }\MT@lslig
    \selectfont
    \MT@lskern=\dimexpr\MT@ifdefined@c@TF\MT@letterspace@
                         \MT@letterspace@\MT@letterspace sp
                      * \fontdimen6\MT@lsfont/2000\relax
    \MT@ls@adjust
  }
  \def\MT@tracking@{%
    \MT@set@tr@codes
  }
  \let\MT@tracking\relax
  \def\MT@set@tr@codes{%
    \MT@ifdefined@c@TF\MT@letterspace@\relax{%
      \let\MT@letterspace@\MT@letterspace
    }%
    \ifnum\MT@letterspace@=\z@\else
      \xdef\MT@lsfont{%
                      \csname\curr@fontshape\f@size
                                      /\number\MT@letterspace@ ls\endcsname}%
      \expandafter\ifx\MT@lsfont\relax
        \MT@get@ls@basefont
        \global\expandafter\letterspacefont\MT@lsfont\font@name \MT@letterspace@
        \fontdimen2\MT@lsfont=\dimexpr\numexpr 1000+\MT@letterspace@\relax sp
                                    * \fontdimen2\MT@lsfont/1000\relax
      \fi
      \MT@set@lsfont
    \fi
  }
  \def\MT@set@lsfont{\MT@exp@two@c\let\font@name\MT@lsfont}
  \DeclareRobustCommand\lslig{\@firstofone}
  \def\MT@lslig#1{%
    \MT@get@ls@basefont
    \kern\MT@lskern{\font@name #1}\kern\MT@lskern
  }
  \def\MT@get@ls@basefont{%
    \ifcase\pdfmatch{^select font (.*)[+-][0-9]*ls( at .*)?$}
                    {\expandafter\meaning\font@name}\relax
    \else
      \global\expandafter\font\font@name
        \expandafter\strip@prefix\pdflastmatch1
        \expandafter\strip@prefix\pdflastmatch2\relax
    \fi
  }
\DeclareRobustCommand\textls{%
  \hmode@bgroup
  \@ifstar{\let\MT@ls@adjust\MT@ls@adjust@\MT@textls}%
          {\let\MT@ls@adjust\relax        \MT@textls}%
}
\newcommand\MT@textls[2][]{%
  \MT@ifempty{#1}%
    {\let\MT@letterspace@\@undefined}%
    {\KV@@sp@def\MT@letterspace@{#1}%
     \MT@ls@too@large\MT@letterspace@}%
  \lsstyle #2%
  \MT@ls@adjust
  \egroup
}
\def\MT@ls@too@large#1{%
  \ifnum#1>\MT@tr@max
    \MT@warning{Maximum for option `letterspace' is \number\MT@tr@max}%
    \let#1\MT@tr@max
  \else
    \ifnum#1<\MT@tr@min
      \MT@warning{Minimum for option `letterspace' is \number\MT@tr@min}%
      \let#1\MT@tr@min
    \fi
  \fi
}
\newdimen\MT@lskern
\let\MT@ls@adjust\relax
\def\MT@ls@adjust@{\kern-\MT@lskern}
\MT@addto@setup{%
  \@ifpackageloaded{CJK}{
    \@ifpackagelater{CJK}{2006/10/17}
      {\def\MT@orig@pickupfont{\CJK@ifundefined\CJK@plane}} % 4.7.0
      {\def\MT@orig@pickupfont{\@ifundefined{CJK@plane}}}
    \g@addto@macro\MT@orig@pickupfont{%
      {\expandafter\ifx\font@name\relax\define@newfont\fi}%
      {\expandafter\ifx\csname\curr@fontshape/\f@size/\CJK@plane\endcsname\relax
         \define@newfont\else\xdef\font@name
            {\csname \curr@fontshape/\f@size/\CJK@plane\endcsname}\fi}}
  }{
    \def\MT@orig@pickupfont{\expandafter\ifx\font@name\relax\define@newfont\fi}
  }
  \ifx\pickup@font\MT@orig@pickupfont \else
    \MT@warning@nl{%
      Command \string\pickup@font\space is not defined as expected.%
    }
  \fi
  \g@addto@macro\pickup@font{%
    \MT@tracking
  }
}
\def\MT@def@num@opt#1{%
  \define@key{MT}{#1}[]{%
    \MT@ifempty{##1}%
      {\MT@let@cn\@tempa{MT@#1@default}}%
      {\def\@tempa{##1 }}%
    \MT@ifint\@tempa{%
      \MT@edef@n{MT@#1}{\@tempa}%
    }{\MT@warning@nl{%
        Value `##1' for option `#1' is not a number.\MessageBreak
        Using default value of \number\@nameuse{MT@#1@default}}%
    }%
  }%
}
\MT@def@num@opt{letterspace}
\def\MT@ProcessOptionsWithKV#1{%
  \let\@tempc\relax
  \let\MT@temp\@empty
  \MT@map@clist@c\@classoptionslist{%
    \def\CurrentOption{##1}%
    \MT@ifdefined@n@T{KV@#1@\CurrentOption}{%
      \edef\MT@temp{\MT@temp,\CurrentOption,}%
      \@expandtwoargs\@removeelement\CurrentOption
        \@unusedoptionlist\@unusedoptionlist
    }%
  }%
  \edef\MT@temp{%
    \noexpand\setkeys{#1}{%
      \MT@temp\@ptionlist{\@currname.\@currext}%
    }%
  }%
  \MT@temp
  \AtEndOfPackage{\let\@unprocessedoptions\relax}%
  \let\CurrentOption\@empty
}
\MT@ProcessOptionsWithKV{MT}
\MT@addto@setup{%
    \ifnum\MT@letterspace=\m@ne
      \let\MT@letterspace\MT@letterspace@default
    \else
      \MT@ls@too@large\MT@letterspace
    \fi
  }
\endinput
%%
%% End of file `letterspace.sty'.
