%%
%% This is file `xltxtra.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xltxtra.dtx  (with options: `package')
%% 
%%   ____________________________
%%   The xltxtra package
%%   (C) 2006-2008  Will Robertson
%%   License information appended
%% 
%% 
\ProvidesPackage{xltxtra}
  [2008/07/29 v0.4 Improvements for the "XeLaTeX" format]
\newif\if@xxt@nosscript@
\newif\if@xxt@nologos@
\newif\if@xxt@nohyphen@
\newif\if@xxt@noemph@
\newif\if@xxt@noverb@
\DeclareOption{no-sscript}{\@xxt@nosscript@true}
\DeclareOption{no-logos}{\@xxt@nologos@true}
\DeclareOption{no-hyphen}{\@xxt@nohyphen@true}
\DeclareOption{no-emph}{\@xxt@noemph@true}
\DeclareOption{no-verb}{\@xxt@noverb@true}
\ProcessOptions*
\RequirePackage{ifxetex}
\RequireXeTeX
\RequirePackage{graphicx}
\RequirePackage{fontspec}
\RequirePackage{xunicode}
\newcommand*\TeX@logo@spacing[6]{%
  \def\xxt@kern@Te{#1}%
  \def\xxt@kern@eX{#2}%
  \def\xxt@lower@e{#3}%
  \def\xxt@kern@La{#4}%
  \def\xxt@kern@aT{#5}%
  \def\xxt@kern@eL{#6}%
}
\unless\if@xxt@nologos@
\DeclareRobustCommand\TeX{%
  \leavevmode
  \smash{%
    T\kern\xxt@kern@Te
    \lower\xxt@lower@e\hbox{E}\kern\xxt@kern@eX X}%
  \spacefactor1000\relax}
\DeclareRobustCommand{\LaTeX}{%
  \leavevmode
  \smash{%
  L\kern\xxt@kern@La
  {\sbox\z@ T%
    \vbox to\ht\z@{\hbox{\check@mathfonts
      \fontsize\sf@size\z@
      \math@fontsfalse\selectfont
      A}%
    \vss}%
  }%
  \kern\xxt@kern@aT
  \TeX}}
\fi
\DeclareRobustCommand\XeTeX{%
  \leavevmode
  \smash{%
   X\lower\xxt@lower@e
   \hbox{\kern\xxt@kern@eX
     \ifnum\XeTeXfonttype\font>0
       \ifnum\XeTeXcharglyph"018E>0
         \char"018E\relax
       \else
         \ifdim\fontdimen1\font=0pt
           \reflectbox{E}%
         \else
           \XeTeXuseglyphmetrics=1%
           \setbox0=\hbox{E}\dimen0=\ht0\advance\dimen0by\dp0%
           \raise\dimen0\hbox{\rotatebox{180}{\box0}}%
         \fi
       \fi
     \else
       \setbox0=\hbox{E}\dimen0=\ht0\advance\dimen0by\dp0%
       \raise\dimen0\hbox{\rotatebox{180}{\box0}}%
     \fi
   }\kern\xxt@kern@Te\TeX}}%
\DeclareRobustCommand\XeLaTeX{%
   \leavevmode
   \smash{%
    X\lower\xxt@lower@e
    \hbox{\kern\xxt@kern@eX
      \ifnum\XeTeXfonttype\font>0\relax
        \ifnum\XeTeXcharglyph"018E>0\relax
          \char"018E\relax
        \else
          \ifdim\fontdimen1\font=0pt\relax
            \reflectbox{E}%
          \else
            \XeTeXuseglyphmetrics=1\relax
            \setbox0=\hbox{E}\dimen0=\ht0\advance\dimen0by\dp0\relax
            \raise\dimen0\hbox{\rotatebox{180}{\box0}}%
          \fi
        \fi
      \else
        \setbox0=\hbox{E}\dimen0=\ht0\advance\dimen0by\dp0\relax
        \raise\dimen0\hbox{\rotatebox{180}{\box0}}%
      \fi}\kern\xxt@kern@eL\LaTeX}}
\TeX@logo@spacing{-0.15em}{-0.15em}{0.5ex}{-0.36em}{-0.15em}{-0.1em}
\@ifpackageloaded{hyperref}{%
  \pdfstringdefDisableCommands{%
    \def\TeX{TeX}%
    \def\XeTeX{XeTeX}%
    \def\LaTeX{LaTeX}%
    \def\LaTeXe{LaTeX2e}
    \def\XeLaTeX{XeLaTeX}
}}{}
\RequirePackage{etex}
\RequirePackage{fixltx2e}[2006/03/24]
\unless\if@xxt@noemph@
\DeclareRobustCommand\em
  {\@nomath\em
   \edef\@tempa{\f@shape}%
   \edef\@tempb{\itdefault}%
   \ifx\@tempa\@tempb
     \eminnershape
   \else
     \emshape
   \fi}
\DeclareTextFontCommand{\emph}{\em}
\let\emshape\itshape
\let\eminnershape\upshape
\fi
\unless\if@xxt@nohyphen@
\DeclareRobustCommand{\-}{%
  \discretionary{%
    \char\ifnum\hyphenchar\font<\z@
           \xlx@defaulthyphenchar
         \else
           \hyphenchar\font
         \fi}{}{}}
\def\xlx@defaulthyphenchar{`\-}
\fi
\DeclareRobustCommand*\fakesubscript[1]{%
  \@textsubscript{\selectfont#1}}
\DeclareRobustCommand*\fakesuperscript[1]{%
  \@textsuperscript{\selectfont#1}}
\if@xxt@nosscript@
  \DeclareRobustCommand*\textsubscript{%
    \@ifstar{\realsubscript}{\fakesubscript}}
  \DeclareRobustCommand*\textsuperscript{%
    \@ifstar{\realsuperscript}{\fakesuperscript}}
\else
  \DeclareRobustCommand*\textsubscript{%
    \@ifstar{\fakesubscript}{\realsubscript}}
  \DeclareRobustCommand*\textsuperscript{%
    \@ifstar{\fakesuperscript}{\realsuperscript}}
\fi
\DeclareRobustCommand*\realsubscript[1]{%
  \begingroup
    \ifcsname zf@family@fontdef\f@family\endcsname
      \c@zf@script 1818326126\relax
      \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt
      \zf@set@font@type
      \ifzf@icu
        \zf@check@ot@feat{+subs}%
        \if@tempswa
          {\addfontfeature{VerticalPosition=Inferior}#1}%
        \else
          \zf@check@ot@feat{+sinf}%
          \if@tempswa
            {\addfontfeature{VerticalPosition=ScientificInferior}#1}%
          \else
            \fakesubscript{#1}%
          \fi
        \fi
      \else\ifzf@atsui
        \zf@make@aat@feature@string{10}{2}%
        \unless\ifx\@tempa\@empty
          {\addfontfeature{VerticalPosition=Inferior}#1}%
        \else
          \fakesubscript{#1}%
        \fi
      \fi\fi
    \else
      \fakesubscript{#1}%
    \fi
  \endgroup}
\DeclareRobustCommand*\realsuperscript[1]{%
  \begingroup
    \ifcsname zf@family@fontdef\f@family\endcsname
      \c@zf@script 1818326126\relax
      \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt
      \zf@set@font@type
      \ifzf@icu
        \zf@check@ot@feat{+sups}%
        \if@tempswa
          {\addfontfeature{VerticalPosition=Superior}#1}%
        \else
          \fakesuperscript{#1}%
        \fi
      \else\ifzf@atsui
        \zf@make@aat@feature@string{10}{1}%
        \unless\ifx\@tempa\@empty
          {\addfontfeature{VerticalPosition=Superior}#1}%
        \else
         \fakesuperscript{#1}%
        \fi
      \fi\fi
    \else
      \fakesuperscript{#1}%
    \fi
  \endgroup}
\def\@makefnmark{\mbox{\normalfont\textsuperscript{\@thefnmark}}}
\newcommand*\vfrac[2]{%
  \begingroup
    \c@zf@script 1818326126\relax
    \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt
    \zf@set@font@type
    \ifzf@icu
      {\addfontfeature{VerticalPosition=Numerator}#1}%
       \textfractionsolidus
      {\addfontfeature{VerticalPosition=Denominator}#2}%
    \else\ifzf@atsui
      {\addfontfeature{VerticalPosition=Superior}#1}%
       \textfractionsolidus
      {\addfontfeature{VerticalPosition=Inferior}#2}%
    \fi\fi
  \endgroup}
\newcommand\namedglyph[1]{%
  \@tempcnta=\XeTeXglyphindex "#1"\relax
  \ifnum\@tempcnta>0
    \XeTeXglyph\@tempcnta
  \else
    \xxt@namedglyph@fallback{#1}%
  \fi}
\newcommand\xxt@namedglyph@fallback[1]{[#1]}
\newbox\xxt@tempbox
\def\showhyphens#1{%
  \typeout{^^J***********************
           \string\showhyphens:
           ***********************}%
  \@for\@ii:=#1\do{\xxt@showhyphens{\@ii}}%
  \typeout{^^J***********************%
           ***************%
           ***********************^^J}}
\def\xxt@showhyphens#1{%
   \setbox\@tempboxa=\vbox{%
     \hsize1sp \hbadness10000 \hfuzz\maxdimen
     \everypar={} \leftskip\z@ \rightskip\leftskip
     \pretolerance\m@ne \noindent \hskip\z@ #1\par
     \global\setbox\xxt@tempbox=\hbox{}\xxt@sh@cat}%
   \setbox\@tempboxa=\hbox to \maxdimen{\unhbox\xxt@tempbox}}
\def\xxt@sh@cat{\unskip\unpenalty
   \setbox\@tempboxa=\lastbox
   \unless\ifvoid\@tempboxa
     \global\setbox\xxt@tempbox=\hbox{%
       \unhbox\@tempboxa
       \unskip\unskip
       \unhbox\xxt@tempbox}%
     \expandafter\xxt@sh@cat
   \fi}
\unless\if@xxt@noverb@
\def\xxt@visiblespace{%
  \iffontchar\font"2423
    \expandafter\textvisiblespace
  \else
    \expandafter\xxt@visiblespace@fallback
  \fi}
\def\xxt@visiblespace@fallback{{%
  \usefont{EU1}{lmtt}{\f@series}{\f@shape}%
  \textvisiblespace}}
\begingroup
  \catcode`\ =\active%
  \gdef\xxt@vprintspaces{\catcode`\ \active\let \xxt@visiblespace}%
\endgroup
\def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
  \bgroup
    \verb@eol@error \let\do\@makeother \dospecials
    \verbatim@font\@noligs
    \@ifstar\@@sverb\@verb}
\def\@@sverb{\xxt@vprintspaces\@sverb}
\AtBeginDocument{%
  \xxt@patch@verbatim
  \xxt@patch@moreverb
  \xxt@patch@fancyvrb
  \xxt@patch@listings}
\def\xxt@patch@verbatim{%
  \@ifpackageloaded{verbatim}{%
    \@namedef{verbatim*}{\begingroup\@verbatim\xxt@vprintspaces\verbatim@start}%
  }{%
    \@namedef{verbatim*}{\@verbatim\xxt@vprintspaces\@sxverbatim}%
  }}
\def\xxt@patch@moreverb{%
  \@ifpackageloaded{moreverb}{%
    \@namedef{listingcont*}{%
      \def\verbatim@processline{%
        \thelisting@line \global\advance\listing@line1
        \the\verbatim@line\par}%
      \@verbatim\xxt@vprintspaces\verbatim@start}%
  }{}}
\def\xxt@patch@fancyvrb{%
  \@ifpackageloaded{fancyvrb}{%
    \let\FancyVerbSpace\xxt@visiblespace
  }{}}
\def\xxt@patch@listings{%
  \@ifpackageloaded{listings}{%
    \let\lst@visiblespace\xxt@visiblespace
  }{}}
\fi
%% 
%% Copyright (C) 2006-2008 by Will Robertson <wspr81@gmail.com>
%% 
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status)
%% by Will Robertson.
%% 
%% This work consists of the file  xltxtra.dtx
%%           and the derived files xltxtra.sty,
%%                                 xltxtra.ins, and
%%                                 xltxtra.pdf.
%% 
%%
%% End of file `xltxtra.sty'.
