%%
%% This is file `letterspace.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% microtype.dtx  (with options: `letterspace,plain')
%% 
%% ------------------------------------------------------------------------
%% 
%%                       The `microtype' package
%%        An interface to the micro-typographic extensions of pdfTeX
%%           Copyright (c) 2004--2010  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, microtype.lua 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}
  [2010/01/10 v2.4
   Robust letterspacing
  (RS)]
\def\MT@MT
  {letterspace}
\let\MT@restore@catcodes\@empty
\def\MT@fix@catcode#1#2{%
  \edef\MT@restore@catcodes{%
    \MT@restore@catcodes
    \catcode#1 \the\catcode#1\relax
  }%
  \catcode#1 #2\relax
}
\MT@fix@catcode{24} {9}% ^^X (ignore)
\MT@fix@catcode{36} {3}% $ (math shift)
\MT@fix@catcode{39}{12}% '
\MT@fix@catcode{42}{12}% *
\MT@fix@catcode{43}{12}% +
\MT@fix@catcode{44}{12}% ,
\MT@fix@catcode{45}{12}% -
\MT@fix@catcode{58}{12}% :
\MT@fix@catcode{60}{12}% <
\MT@fix@catcode{61}{12}% =
\MT@fix@catcode{62}{12}% >
\MT@fix@catcode{94} {7}% ^ (superscript)
\MT@fix@catcode{96}{12}% `
\newcommand*\lsstyle{}
\newcommand\textls[2][]{}
\def\textls#1#{}
\newcommand*\lslig[1]{#1}
\def\MT@warning{\PackageWarning\MT@MT}
\def\MT@warning@nl#1{\MT@warning{#1\@gobble}}
\def\MT@plain{2}
\ifx\documentclass\@undefined
  \def\MT@plain{1}
  \def\hmode@bgroup{\leavevmode\bgroup}
  \def\nfss@text#1{{\mbox{#1}}}
  \let\@typeset@protect\relax
  \ifx\eplain\@undefined
    \def\MT@plain{0}
    \def\PackageWarning#1#2{%
      \begingroup
        \newlinechar=10 %
        \def\MessageBreak{^^J(#1)\@spaces\@spaces\@spaces\@spaces}%
        \immediate\write16{^^JPackage #1 Warning: #2\on@line.^^J}%
      \endgroup
    }
    \def\on@line{ on input line \the\inputlineno}
    \def\@spaces{\space\space\space\space}
  \fi
\fi
\def\MT@requires@latex#1{%
  \ifnum\MT@plain<#1 \expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi
}
\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{7}
      \ifnum\pdftexversion < 140
        \def\MT@pdftex@no{5}
    \fi
  \fi
\fi
\def\MT@clear@options{%
  \MT@requires@latex1{%
  \AtEndOfPackage{\let\@unprocessedoptions\relax}%
  \let\CurrentOption\@empty
  }\relax
}
\ifnum\MT@pdftex@no <
    6
  \MT@warning@nl{You
    \ifcase\MT@pdftex@no
      don't seem to be using pdftex.\MessageBreak
      `\MT@MT' only works with pdftex.\MessageBreak
      Try running `pdflatex' instead of
        `\ifx\XeTeXversion\@undefined\else xe\fi latex'%
    \else
      are using a pdftex version older than
      1.40%
      .\MessageBreak
      `\MT@MT' does not work with this version.\MessageBreak
      Please install a newer version of pdftex%
    \fi
  }
  \MT@clear@options\MT@restore@catcodes
\endinput\fi
\ifx\directlua\@undefined \else
  \ifx\directlua\relax \else
    \MT@warning@nl
    {`\MT@MT'
     doesn't currently work with luatex.%
     \MessageBreak
     Bye bye%
    }
    \MT@clear@options\MT@restore@catcodes
    \expandafter\expandafter\expandafter\endinput
  \fi
\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@exp@cs#1#2{\expandafter#1\csname#2\endcsname}
\def\MT@edef@n{\MT@exp@cs\edef}
\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{%
^^X  \ifdefined#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
}
\def\MT@ifdefined@n@T#1{%
^^X  \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{}
\def\MT@loop#1\MT@repeat{%
  \def\MT@iterate{#1\relax\expandafter\MT@iterate\fi}%
  \MT@iterate \let\MT@iterate\relax
}
\let\MT@repeat\fi
\def\MT@while@num#1#2#3{%
  \@tempcnta#1\relax
  \MT@loop #3%
    \advance\@tempcnta \@ne
    \ifnum\@tempcnta < #2\MT@repeat
}
\def\MT@do@font{\MT@while@num\z@\@cclvi}
\MT@requires@latex1{
\let\MT@setup@\@empty
\def\MT@addto@setup{\g@addto@macro\MT@setup@}
}{\let\MT@addto@setup\@firstofone}
\def\MT@with@package@T#1{\@ifpackageloaded{#1}\@firstofone\@gobble}
\MT@addto@setup{%
  \MT@requires@latex2{
  \MT@with@package@T{hyperref}{%
    \pdfstringdefDisableCommands{%
      \def\lsstyle{\pdfstringdefWarn\lsstyle}%
      \def\textls#1#{\pdfstringdefWarn\textls}%
    }%
  }%
  }\relax
  \MT@requires@latex2{
  \MT@with@package@T{soul}{%
    \soulregister\lsstyle 0%
    \soulregister\textls  1%
  }%
  }{\ifx\SOUL@\@undefined\else
      \soulregister\lsstyle 0%
      \soulregister\textls  1%
    \fi}%
}
\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@
    \MT@set@tr@zero
  \else
    \MT@warn@tracking@DVI
    \xdef\MT@lsfont{\csname\expandafter\string\font@name
                           /\number\MT@letterspace@ ls\endcsname}%
    \expandafter\ifx\MT@lsfont\relax
      \MT@get@ls@basefont
      \global\expandafter\letterspacefont\MT@lsfont\font@name\MT@letterspace@
      % spacing = {<letterspace amount>*,,}
      \fontdimen2\MT@lsfont=\dimexpr\numexpr 1000+\MT@letterspace@\relax sp
                                            * \fontdimen2\MT@lsfont/1000\relax
      % no ligatures = {f}
      \tagcode\MT@lsfont`f=\m@ne
      \MT@do@font{\lpcode\MT@lsfont\@tempcnta=\numexpr\MT@letterspace@/2\relax
                  \rpcode\MT@lsfont\@tempcnta=\numexpr\MT@letterspace@/2\relax}%
    \fi
    \aftergroup\MT@set@lsfont
    \xdef\MT@set@curr@ls{\def\noexpand\MT@curr@ls{\MT@letterspace@}}%
    \aftergroup\MT@set@curr@ls
    \ifx\MT@ls@adjust\@empty
      % \textls : outer kerning = {*,*} ; \textls* : outer kerning = {0,0}
      \MT@outer@kern=-\dimexpr\MT@letterspace@ sp * \fontdimen6\font@name/2000\relax
      \MT@ls@outer@k
      \xdef\MT@set@curr@ok{\MT@outer@kern=\the\MT@outer@kern\relax}%
      \aftergroup\aftergroup\aftergroup\MT@ls@aftergroup
    \fi
  \fi
}
\def\MT@ls@aftergroup{\MT@set@curr@ok\MT@ls@outer@k}
\MT@requires@latex2{
\def\MT@set@lsfont{\MT@exp@two@c\let\font@name\MT@lsfont}
\DeclareRobustCommand\lsstyle{%
  \not@math@alphabet\lsstyle\textls
  \let\MT@tracking\MT@set@tr@codes
  \selectfont
}
}{
\def\MT@set@lsfont{\MT@lsfont}
\def\lsstyle{%
  \begingroup
  \escapechar\m@ne
  \xdef\font@name{\csname\expandafter\string\the\font\endcsname}%
  \MT@set@tr@codes
  \endgroup
}
\let\textls\@undefined
\let\lslig\@undefined
}
\DeclareRobustCommand\lslig[1]{%
  {\MT@ifdefined@c@TF\MT@curr@ls{%
     \escapechar\m@ne
     \MT@get@ls@basefont
     \MT@outer@kern=\dimexpr\MT@curr@ls sp * \fontdimen6\font@name/2000\relax
     \kern\MT@outer@kern
     \font@name #1%
     \kern\MT@outer@kern%
  }{#1}}%
}
\def\MT@get@ls@basefont{%
  \xdef\MT@ls@basefont{\csname\expandafter\string\font@name @base\endcsname}%
  \expandafter\ifx\MT@ls@basefont\relax
    \MT@exp@two@c\MT@glet\MT@ls@basefont\font@name
  \else
    \MT@exp@two@c\let\font@name\MT@ls@basefont
  \fi
}
\def\MT@set@lsbasefont{\MT@exp@two@c\let\font@name\MT@ls@basefont}
\def\MT@set@tr@zero{%
  \xdef\MT@ls@basefont{\csname\expandafter\string\font@name @base\endcsname}%
  \expandafter\ifx\MT@ls@basefont\relax \else
    \aftergroup\MT@set@lsbasefont
  \fi
}
\DeclareRobustCommand\textls{%
  \@ifstar{\let\MT@ls@adjust@\MT@ls@adjust@empty\MT@textls}%
          {\let\MT@ls@adjust@\MT@ls@adjust@relax\MT@textls}%
}
\newcommand\MT@textls[2][]{%
  \ifmmode
    \nfss@text{\MT@ls@set@ls{#1}\lsstyle#2}%
  \else
    \hmode@bgroup
      \MT@ls@set@ls{#1}%
      \lsstyle #2%
      \expandafter
    \egroup
  \fi
}
\def\MT@ls@adjust@empty{\let\MT@ls@adjust\@empty}
\def\MT@ls@adjust@relax{\let\MT@ls@adjust\relax}
\def\MT@ls@set@ls#1{%
  \MT@ifempty{#1}%
    {\let\MT@letterspace@\@undefined}%
    {\KV@@sp@def\MT@letterspace@{#1}%
     \MT@ls@too@large\MT@letterspace@}%
  \MT@ls@adjust@
}
\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@outer@kern
\def\MT@ls@outer@k{\ifhmode\kern\MT@outer@kern\relax\fi}
\MT@requires@latex2{
\MT@addto@setup{%
  \@ifpackageloaded{CJK}{%
    \@ifpackagelater{CJK}{2006/10/17}% 4.7.0
      {\def\MT@orig@pickupfont{\CJK@ifundefined\CJK@plane}}%
      {\def\MT@orig@pickupfont{\@ifundefined{CJK@plane}}}%
    \g@addto@macro\MT@orig@pickupfont
      {{\expandafter\ifx\font@name\relax\define@newfont\fi}}%
    \@ifpackageloaded{CJKutf8}%
      {\@ifpackagelater{CJKutf8}{2008/05/22}% 4.8.0
        {\ifpdf\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}%
        {\@firstoftwo}}%
      {\@firstoftwo}%
    {\g@addto@macro\MT@orig@pickupfont{%
      {\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}}}%
    {\g@addto@macro\MT@orig@pickupfont{%
      {\expandafter\ifx\csname \curr@fontshape/\f@size/\CJK@plane\endcsname\relax
         \define@newfont\def\CJK@temp{v}%
         \ifx\CJK@temp\CJK@plane
           \expandafter\ifx\csname CJK@cmap@\f@family\CJK@plane\endcsname\relax
           \else\csname CJK@cmap@\f@family\CJK@plane\endcsname\fi
         \else \CJK@addcmap\CJK@plane \fi
       \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.%
      \MessageBreak Patching it anyway. Some things may break%
    }%
  \fi
  \g@addto@macro\pickup@font{\begingroup}%
  \MT@with@package@T{trace}{\g@addto@macro\pickup@font{\conditionally@traceoff}}%
  \g@addto@macro\pickup@font{%
      \escapechar\m@ne
      \MT@tracking
    \endgroup
  }%
}
}\relax
\MT@requires@latex1{
\def\MT@optwarn@nan#1#2{%
  \MT@warning@nl{Value `#1' for option `#2' is not a\MessageBreak number.
                 Using default value of \number\@nameuse{MT@#2@default}}%
}
}\relax
\MT@requires@latex1{
\MT@map@clist@n{%
    letterspace}{%
  \define@key{MT}{#1}[\csname MT@#1@default\endcsname]{%
    \def\@tempa{##1 }%
    \MT@ifint\@tempa
      {\MT@edef@n{MT@#1}{\@tempa}}%
      {\MT@optwarn@nan{##1}{#1}}%
  }%
}
}\relax
\MT@requires@latex1{
\def\MT@ProcessOptionsWithKV#1{%
  \let\@tempc\relax
  \let\MT@temp\@empty
  \MT@requires@latex2{
    \MT@map@clist@c\@classoptionslist{%
      \def\CurrentOption{##1}%
      \MT@ifdefined@n@T{KV@#1@\expandafter\MT@getkey\CurrentOption=\@nil}{%
        \edef\MT@temp{\MT@temp,\CurrentOption,}%
        \@expandtwoargs\@removeelement\CurrentOption
          \@unusedoptionlist\@unusedoptionlist
      }%
    }%
    \edef\MT@temp{\noexpand\setkeys{#1}%
                    {\MT@temp\@ptionlist{\@currname.\@currext}}}%
  }{\edef\MT@temp{\noexpand\setkeys{#1}%
                    {\csname usepkg@options@\usepkg@pkg\endcsname}}}
  \MT@temp
  \MT@clear@options
}
\def\MT@getkey#1=#2\@nil{#1}
\MT@ProcessOptionsWithKV{MT}
}\relax
  \MT@addto@setup{%
    \ifnum\pdfoutput<\@ne
      \def\MT@warn@tracking@DVI{%
        \MT@warning@nl{%
            You are using tracking/letterspacing in DVI mode.\MessageBreak
            This will probably not work, unless the post-\MessageBreak
            processing program (dvips, dvipdfm(x), ...) is\MessageBreak
            able to create the virtual fonts on the fly}%
        \MT@glet\MT@warn@tracking@DVI\relax
      }%
    \else
      \def\MT@warn@tracking@DVI{%
        \ifnum\pdfprotrudechars<\@ne \global\pdfprotrudechars\@ne \fi
        \MT@glet\MT@warn@tracking@DVI\relax
      }%
    \fi
    \ifnum\MT@letterspace=\m@ne
      \let\MT@letterspace\MT@letterspace@default
    \else
      \MT@ls@too@large\MT@letterspace
    \fi
  }%
\MT@requires@latex1{
\AtBeginDocument{\MT@setup@ \MT@glet\MT@setup@\@empty}
}\relax
\MT@restore@catcodes
\endinput
%%
%% End of file `letterspace.sty'.
