%%
%% This is file `expl3.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% expl3.dtx  (with options: `package')
%% 
%% EXPERIMENTAL CODE
%% 
%% Do not distribute this file without also distributing the
%% source files specified above.
%% 
%% Do not distribute a modified version of this file.
%% 
%% File: expl3.dtx Copyright (C) 1990-2012 The LaTeX3 Project
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
%% license or (at your option) any later version.  The latest version
%% of this license is in the file
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% This file is part of the "l3kernel bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%%
%% The released version of this bundle is available from CTAN.
%%
%% -----------------------------------------------------------------------
%%
%% The development version of the bundle can be found at
%%
%%    http://www.latex-project.org/svnroot/experimental/trunk/
%%
%% for those people who are interested.
%%
%%%%%%%%%%%
%% NOTE: %%
%%%%%%%%%%%
%%
%%   Snapshots taken from the repository represent work in progress and may
%%   not work or may contain conflicting material!  We therefore ask
%%   people _not_ to put them into distributions, archives, etc. without
%%   prior consultation with the LaTeX3 Project.
%%
%% -----------------------------------------------------------------------
\RequirePackage{l3names}[2012/07/15]
\@ifpackagelater{l3names}{2012/07/15}
  {}
  {%
    \PackageError{expl3}{Mismatched LaTeX3 packages detected.}
      {%
        Please install an up to date version of l3kernel
        using your TeX package manager or from CTAN.%
        \MessageBreak \MessageBreak
        Loading expl3 will abort!%
      }%
    \endinput
  }
\def\ExplFileName{expl3}
\def\ExplFileDescription{L3 Experimental code bundle wrapper}
\def\ExplFileDate{2012/11/21}
\def\ExplFileVersion{4332}
\RequirePackage{etex}
\reserveinserts{32}
\ProvidesExplPackage
  {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
\newcommand \expl@create@bool@option [ 2 ]
  {
    \DeclareOption {#1}            { \renewcommand* #2 { 1 } }
    \DeclareOption { #1 =  true }  { \renewcommand* #2 { 1 } }
    \DeclareOption { #1 =  false } { \renewcommand* #2 { 0 } }
    \newcommand* #2 { 0 }
  }
\expl@create@bool@option { check-declarations } \l@expl@check@declarations@bool
\expl@create@bool@option { log-functions }      \l@expl@log@functions@bool
\let \expl@create@bool@option \@undefined
\newcommand* \l@expl@options@clist { }
\DeclareOption*
  {
    \ifx \l@expl@options@clist \@empty
      \let \l@expl@options@clist \CurrentOption
    \else
      \edef \l@expl@options@clist
        {
          \unexpanded \expandafter \expandafter \expandafter
            {
              \expandafter \l@expl@options@clist \expandafter , \CurrentOption
            }
        }
    \fi
  }
\ProcessOptions \relax
\RequirePackage { l3basics, l3expan, l3tl }
\ifodd \l@expl@check@declarations@bool \relax
  \cs_new_protected:Npn \__cs_check_exists:N #1
    {
      \cs_if_exist:NF #1
        {
          \__msg_kernel_error:nnx { check } { non-declared-variable }
            { \token_to_str:N #1 }
        }
    }
  \cs_set_protected:Npn \__cs_tmp:w #1
    {
      \if_meaning:w ? #1
        \exp_after:wN \use_none_delimit_by_q_recursion_stop:w
      \fi:
      \use:x
        {
          \cs_set_protected:Npn #1 \exp_not:n { ##1 ##2 }
            {
              \__cs_check_exists:N \exp_not:n {##1}
              \exp_not:o { #1 {##1} {##2} }
            }
        }
      \__cs_tmp:w
    }
  \__cs_tmp:w
    \tl_set:Nn  \tl_set:No  \tl_set:Nx
    \tl_gset:Nn \tl_gset:No \tl_gset:Nx
    \tl_put_left:Nn   \tl_put_left:NV
    \tl_put_left:No   \tl_put_left:Nx
    \tl_gput_left:Nn  \tl_gput_left:NV
    \tl_gput_left:No  \tl_gput_left:Nx
    \tl_put_right:Nn  \tl_put_right:NV
    \tl_put_right:No  \tl_put_right:Nx
    \tl_gput_right:Nn \tl_gput_right:NV
    \tl_gput_right:No \tl_gput_right:Nx
    ? \q_recursion_stop
  \cs_set_protected:Npn \tl_set_eq:NN #1#2
    {
      \__cs_check_exists:N #1
      \__cs_check_exists:N #2
      \cs_set_eq:NN #1 #2
    }
  \cs_set_protected:Npn \tl_gset_eq:NN #1#2
    {
      \__cs_check_exists:N #1
      \__cs_check_exists:N #2
      \cs_gset_eq:NN #1 #2
    }
  \cs_set_protected:Npn \tl_concat:NNN #1#2#3
    {
      \__cs_check_exists:N #1
      \__cs_check_exists:N #2
      \__cs_check_exists:N #3
      \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} }
    }
  \cs_set_protected:Npn \tl_gconcat:NNN #1#2#3
    {
      \__cs_check_exists:N #1
      \__cs_check_exists:N #2
      \__cs_check_exists:N #3
      \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} }
    }
\fi
\RequirePackage { l3seq, l3int, l3quark, l3prg }
\ifodd \l@expl@check@declarations@bool \relax
  \cs_set_protected:Npn \bool_set_true:N #1
    {
      \__cs_check_exists:N #1
      \cs_set_eq:NN #1 \c_true_bool
    }
  \cs_set_protected:Npn \bool_set_false:N #1
    {
      \__cs_check_exists:N #1
      \cs_set_eq:NN #1 \c_false_bool
    }
  \cs_set_protected:Npn \bool_gset_true:N #1
    {
      \__cs_check_exists:N #1
      \cs_gset_eq:NN #1 \c_true_bool
    }
  \cs_set_protected:Npn \bool_gset_false:N #1
    {
      \__cs_check_exists:N #1
      \cs_gset_eq:NN #1 \c_false_bool
    }
  \cs_set_protected:Npn \bool_set_eq:NN  #1
    {
      \__cs_check_exists:N #1
      \cs_set_eq:NN #1
    }
  \cs_set_protected:Npn \bool_gset_eq:NN  #1
    {
      \__cs_check_exists:N #1
      \cs_gset_eq:NN #1
    }
  \cs_set_protected:Npn \bool_set:Nn #1#2
    {
      \__cs_check_exists:N #1
      \tex_chardef:D #1 = \bool_if_p:n {#2}
    }
  \cs_set_protected:Npn \bool_gset:Nn #1#2
    {
      \__cs_check_exists:N #1
      \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2}
    }
\fi
\RequirePackage
  {
    l3clist,
    l3token,
    l3prop,
    l3msg,
    l3file,
    l3skip,
    l3keys,
    l3fp,
    l3box,
    l3coffins,
    l3color,
    l3luatex,
    l3candidates
  }
\bool_if:nT { \l@expl@check@declarations@bool }
  {
    \__msg_kernel_new:nnnn { check } { non-declared-variable }
      { The~variable~#1~has~not~been~declared~\msg_line_context:. }
      {
        Checking~is~active,~and~you~have~tried~do~so~something~like: \\
        \ \ \tl_set:Nn ~ #1 ~ \{ ~ ... ~ \} \\
        without~first~having: \\
        \ \ \tl_new:N ~ #1  \\
        \\
        LaTeX~will~create~the~variable~and~continue.
      }
  }
\AtBeginDocument
  {
    \cs_if_exist:NF \color
      { \DeclareRobustCommand \color [2] [ ] { } }
  }
\RequirePackage{ifpdf}
\__msg_kernel_new:nnnn { expl } { wrong-driver }
  { Driver~request~inconsistent~with~engine:~using~'#2'~driver. }
  {
    You~have~requested~driver~'#1',~but~this~is~not~suitable~for~use~with~the~
    active~engine.~LaTeX3~will~use~the~'#2'~driver~instead.
  }
\tl_new:N \l__expl_driver_tl
\keys_define:nn { expl }
  {
    driver .choice:,
    driver / auto .code:n =
      {
        \xetex_if_engine:TF
          { \tl_set:Nn \l__expl_driver_tl { xdvipdfmx } }
          {
            \ifpdf
              \tl_set:Nn \l__expl_driver_tl { pdfmode }
            \else
              \tl_set:Nn \l__expl_driver_tl { dvips }
            \fi
          }
      },
    driver / dvipdfmx .code:n =
      {
        \tl_set:Nn \l__expl_driver_tl { dvipdfmx }
        \xetex_if_engine:TF
          {
            \__msg_kernel_error:nnnn { expl } { wrong-driver }
              { dvipdfmx } { xdvipdfmx }
            \tl_set:Nn \l__expl_driver_tl { xdvipdmx }
          }
          {
            \ifpdf
              \__msg_kernel_error:nnnn { expl } { wrong-driver }
                { dvipdfmx } { pdfmode }
              \tl_set:Nn \l__expl_driver_tl { pdfmode }
            \fi
          }
      },
    driver / dvips .code:n =
      {
        \tl_set:Nn \l__expl_driver_tl { dvips }
        \xetex_if_engine:TF
          {
            \__msg_kernel_error:nnnn { expl } { wrong-driver }
              { dvips } { xdvipdfmx }
            \tl_set:Nn \l__expl_driver_tl { xdvipdfmx }
          }
          {
            \ifpdf
              \__msg_kernel_error:nnnn { expl } { wrong-driver }
                { dvips } { pdfmode }
              \tl_set:Nn \l__expl_driver_tl { pdfmode }
            \fi
          }
      },
    driver / latex2e .code:n =
      { \tl_set:Nn \l__expl_driver_tl { latex2e } },
    driver / pdfmode .code:n =
      {
        \tl_set:Nn \l__expl_driver_tl { pdfmode }
        \xetex_if_engine:TF
          {
            \__msg_kernel_error:nnnn { expl } { wrong-driver }
              { pdfmode } { xdvipdfmx }
            \tl_set:Nn \l__expl_driver_tl { xdvipdfmx }
          }
          {
            \ifpdf
            \else
              \__msg_kernel_error:nnnn { expl } { wrong-driver }
                { pdfmode } { dvips }
              \tl_set:Nn \l__expl_driver_tl { dvips }
            \fi
          }
      },
    driver / xdvipdfmx .code:n =
      {
        \tl_set:Nn \l__expl_driver_tl { xdvipdfmx }
        \xetex_if_engine:F
          {
            \ifpdf
              \__msg_kernel_error:nnnn { expl } { wrong-driver }
                { xdvipdfmx } { pdfmode }
              \tl_set:Nn \l__expl_driver_tl { pdfmode }
            \else
              \__msg_kernel_error:nnnn { expl } { wrong-driver }
                { xdvipdfmx } { dvips }
              \tl_set:Nn \l__expl_driver_tl { dvips }
            \fi
          }
      },
    driver         .initial:n      = { latex2e } ,
    native-drivers .choice:,
    native-drivers .default:n      = { true },
    native-drivers / false .meta:n = { driver = latex2e },
    native-drivers / true  .meta:n = { driver = auto }
  }
\keys_define:nn { expl }
  {
    check-declarations .bool_set:N = \l@expl@check@declarations@bool,
    log-functions      .bool_set:N = \l@expl@log@functions@bool
  }
\keys_set:nV { expl } \l@expl@options@clist
\str_if_eq:nVTF { latex2e } \l__expl_driver_tl
  {
    \tl_gput_left:Nn \@begindocumenthook { \RequirePackage { graphics } }
    \__msg_kernel_new:nnnn { box } { clipping-not-available }
      { Box~clipping~not~available. }
      {
        The~\box_clip:N~function~is~only~available~when~loading~expl3~
        with~the~"native-drivers"~option.
      }
    \cs_set_protected:Npn \box_clip:N #1
      {
        \hbox_set:Nn #1 { \box_use:N #1 }
        \__msg_kernel_error:nn { box } { clipping-not-available }
      }
    \cs_set_protected:Npn \box_rotate:Nn #1#2
      { \hbox_set:Nn #1 { \rotatebox {#2} { \box_use:N #1 } } }
    \cs_set_protected:Npn \box_resize:Nnn #1#2#3
      {
        \hbox_set:Nn #1
          {
            \resizebox *
              { \__dim_eval:w #2 \__dim_eval_end: }
              { \__dim_eval:w #3 \__dim_eval_end: }
              { \box_use:N #1 }
          }
      }
    \cs_set_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2
      {
        \hbox_set:Nn #1
          {
            \resizebox * { ! } { \__dim_eval:w #2 \__dim_eval_end: }
              { \box_use:N #1 }
          }
      }
    \cs_set_protected:Npn \box_resize_to_wd:Nn #1#2
      {
        \hbox_set:Nn #1
          {
            \resizebox * { \__dim_eval:w #2 \__dim_eval_end: } { ! }
              { \box_use:N #1 }
          }
      }
    \cs_set_protected:Npn \box_scale:Nnn #1#2#3
      {
        \hbox_set:Nn #1
          {
            \exp_last_unbraced:Nx \scalebox
              { { \fp_eval:n {#2} } [ \fp_eval:n {#3} ] }
              { \box_use:N #1 }
          }
      }
  }
  {
    \tl_const:Nn \c__expl_def_ext_tl { def }
    \@onefilewithoptions { l3 \l__expl_driver_tl } [ ] [ ] \c__expl_def_ext_tl
  }
\cs_set_protected_nopar:Npn \ExplSyntaxOn
  {
    \bool_if:NF \l__kernel_expl_bool
      {
        \cs_set_protected_nopar:Npx \ExplSyntaxOff
          {
            \char_set_catcode:nn { 9 }   { \char_value_catcode:n { 9 } }
            \char_set_catcode:nn { 32 }  { \char_value_catcode:n { 32 } }
            \char_set_catcode:nn { 34 }  { \char_value_catcode:n { 34 } }
            \char_set_catcode:nn { 36 }  { \char_value_catcode:n { 36 } }
            \char_set_catcode:nn { 38 }  { \char_value_catcode:n { 38 } }
            \char_set_catcode:nn { 58 }  { \char_value_catcode:n { 58 } }
            \char_set_catcode:nn { 94 }  { \char_value_catcode:n { 94 } }
            \char_set_catcode:nn { 95 }  { \char_value_catcode:n { 95 } }
            \char_set_catcode:nn { 124 } { \char_value_catcode:n { 124 } }
            \char_set_catcode:nn { 126 } { \char_value_catcode:n { 126 } }
            \tex_endlinechar:D = \tex_the:D \tex_endlinechar:D \scan_stop:
            \bool_set_false:N \l__kernel_expl_bool
            \cs_set_protected_nopar:Npn \ExplSyntaxOff { }
          }
      }
    \char_set_catcode_ignore:n           { 9 }   % tab
    \char_set_catcode_ignore:n           { 32 }  % space
    \char_set_catcode_other:n            { 34 }  % double quote
    \char_set_catcode_math_toggle:n      { 36 }  % dollar
    \char_set_catcode_alignment:n        { 38 }  % ampersand
    \char_set_catcode_letter:n           { 58 }  % colon
    \char_set_catcode_math_superscript:n { 94 }  % circumflex
    \char_set_catcode_letter:n           { 95 }  % underscore
    \char_set_catcode_other:n            { 124 } % pipe
    \char_set_catcode_space:n            { 126 } % tilde
    \tex_endlinechar:D = 32 \scan_stop:
    \bool_set_true:N \l__kernel_expl_bool
  }
\cs_set_protected_nopar:Npx \ExplSyntaxOff
  {
    \exp_not:o \ExplSyntaxOff
    \cs_set_protected_nopar:Npn \ExplSyntaxOff { }
  }
%% 
%%
%% End of file `expl3.sty'.
