summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-10-14 23:34:51 +0000
committerKarl Berry <karl@freefriends.org>2010-10-14 23:34:51 +0000
commit7c0254fc2d33331f7d8762cb7738c4b9f94f0964 (patch)
tree2fa6e3fb8ff5f50a268df76050c3a4560eb8d6a1 /Master/texmf-dist/tex
parentac155482e552dd85ebd61b7588e35ffa75a08222 (diff)
new latex package babeltools 0.2 (15oct10)
git-svn-id: svn://tug.org/texlive/trunk@20101 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/babeltools/accents.sty281
-rw-r--r--Master/texmf-dist/tex/latex/babeltools/arabicfront.sty60
-rw-r--r--Master/texmf-dist/tex/latex/babeltools/babeltools.sty362
-rw-r--r--Master/texmf-dist/tex/latex/babeltools/checkend.sty55
-rw-r--r--Master/texmf-dist/tex/latex/babeltools/dotlessi.sty59
-rw-r--r--Master/texmf-dist/tex/latex/babeltools/esindex.sty204
-rw-r--r--Master/texmf-dist/tex/latex/babeltools/subdocs.sty152
-rw-r--r--Master/texmf-dist/tex/latex/babeltools/tensind.sty284
8 files changed, 1457 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/babeltools/accents.sty b/Master/texmf-dist/tex/latex/babeltools/accents.sty
new file mode 100644
index 00000000000..d44b535b995
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/babeltools/accents.sty
@@ -0,0 +1,281 @@
+% +--------------------------------------------------+
+% | Typeset accents.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+%% Copyright (C) 1998, 1999, 2000, 2006 Javier Bezos
+%% All Rights Reserved
+%% http://www.tex-tipografia.com
+%%
+%% This work may be distributed and/or modified under the conditions
+%% of the LaTeX Project Public License, either version 1.3 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.3 or later is part of all distributions of LaTeX
+%% version 2003/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% This Current Maintainer of this work is Javier Bezos.
+%%
+%% This work consists of the files accents.tex and accents.sty.
+%
+% Changes
+% ~~~~~~~
+%
+% 2006-05-12. TeX converts to ord any symbol with a math accent.
+% Accents now emulates this behaviour with braces around the
+% nucleous; otherwise, the original category is preserved and
+% the accents could look misaligned. (Reported by Viet-TrungLuu.)
+%
+% Release
+% ~~~~~~~
+
+\ProvidesPackage{accents}[2006/05/12 v1.3 Math Accent Tools]
+
+\let\cc@palette\mathpalette
+
+\DeclareOption{nonscript}
+ {\renewcommand\cc@palette[2]{#1\textstyle{#2}}}
+
+\DeclareOption{single}
+ {\renewcommand\cc@accent[1]{\mathaccent#1}}
+
+\newdimen\cc@skew
+\newdimen\cc@wd
+
+\newcount\cc@code
+\newcount\cc@group
+\newcount\cc@skewchar
+
+\newif\ifcc@more
+
+% Code for real accents
+% ~~~~~~~~~~~~~~~~~~~~~
+
+\def\cc@accent#1#2{%
+ \begingroup
+ \cc@code=#1\relax
+ \let\math@bgroup\@empty
+ \def\math@egroup##1{\cc@setchar##1}%
+ \cc@palette\cc@@accent{#2}%
+ {\cc@nuc}%
+ \endgroup}
+
+\def\cc@iaccent#1#2{%
+ \cc@fetch{#2}%
+ \mathaccent#1{%
+ \ifcc@more#2\else
+ \cc@phant{#2}%
+ \gdef\cc@nuc{#2}%
+ \fi
+ \kern\cc@skew}%
+ \kern-\cc@skew}%
+
+\def\cc@@accent#1#2{%
+ \let\cc@style=#1%
+ \cc@fetch{#2}%
+ \mathaccent\cc@code{%
+ \ifcc@more#2\else
+ \cc@phant{#2}%
+ \gdef\cc@nuc{#2}%
+ \fi
+ \kern\cc@skew}%
+ \kern-\cc@skew
+ \kern\cc@wd}%
+
+% The accents are redefined:
+
+\begingroup
+
+\def\mathaccentV#1{\string"\noexpand\accentclass@}%
+\let\protect\@empty
+\let\mathaccent\@empty
+
+\def\cc@set#1{%
+ \xdef#1{\noexpand\protect\noexpand\cc@accent{#1}}}
+
+\cc@set\grave %{\protect\cc@accent{"7012\relax}}
+\cc@set\acute %{\protect\cc@accent{"7013\relax}}
+\cc@set\check %{\protect\cc@accent{"7014\relax}}
+\cc@set\breve %{\protect\cc@accent{"7015\relax}}
+\cc@set\bar %{\protect\cc@accent{"7016\relax}}
+\cc@set\hat %{\protect\cc@accent{"705E\relax}}
+\cc@set\dot %{\protect\cc@accent{"705F\relax}}
+\cc@set\tilde %{\protect\cc@accent{"707E\relax}}
+\cc@set\ddot %{\protect\cc@accent{"707F\relax}}
+\cc@set\vec %{\protect\cc@accent{"017E\relax}}
+\gdef\ring{\protect\cc@accent{"7017\relax}}
+
+\@ifundefined{mathring}{}{\cc@set\mathring}
+
+\endgroup
+
+% Faked accents
+% ~~~~~~~~~~~~~
+
+\newcommand\accentset[2]{%
+ \begingroup
+ \def\cc@a{#1}%
+ \let\math@bgroup\@empty
+ \def\math@egroup##1{\cc@setchar##1}%
+ \cc@palette\cc@accentset{#2}%
+ {\cc@nuc}%
+ \endgroup}
+
+\def\cc@accentset#1#2{%
+ \let\cc@style#1%
+ \cc@fetch{#2}%
+ \sbox\z@{$\m@th\cc@style\mathgroup\cc@group
+ \ifcc@more#2\else\cc@phant{#2}%
+ \gdef\cc@nuc{#2}\fi$}%
+ \cc@align{%
+ \hidewidth\kern\cc@skew
+ $\m@th\scriptscriptstyle\mathgroup\cc@group\cc@a$%
+ \hidewidth\cr{\box\z@}}%
+ \kern\cc@wd}%
+
+\def\cc@iaccentset#1#2{%
+ \cc@fetch{#2}%
+ \sbox\z@{$\m@th\cc@style\ifcc@more#2\else\cc@phant{#2}%
+ \gdef\cc@nuc{#2}\fi$}%
+ \cc@align{%
+ \hidewidth\kern\cc@skew
+ $\m@th\scriptscriptstyle#1$\hidewidth\cr
+ {\box\z@}}}%
+
+\def\cc@align#1{%
+ \vbox{%
+ \baselineskip\z@skip
+ \lineskip.25ex
+ \ialign{##\crcr#1\crcr}}}
+
+% Shared by real and faked accents
+% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+\def\cc@phant#1{%
+ \v@true\h@true
+ \finph@nt}% with \box0 from \cc@fetch
+
+\def\cc@setchar{%
+ \cc@skewchar\ifnum\mathgroup=\m@ne
+ \skewchar\textfont\@ne
+ \else\ifnum\skewchar\textfont\mathgroup=\m@ne
+ \skewchar\textfont\@ne
+ \else\skewchar\textfont\mathgroup\fi\fi
+ \advance\cc@skewchar"7100 }
+
+\def\cc@fetch#1{%
+ \cc@group=\the\mathgroup
+ \let\cc@accent\@gobble
+ \let\accentset\@gobble
+ \sbox\z@{$\m@th\mathgroup\cc@group\cc@setchar
+ \cc@style#1{}\mathchar\cc@skewchar$}%
+ \sbox\@ne{$\m@th\mathgroup\cc@group\cc@setchar
+ \cc@style#1\mathchar\cc@skewchar$}%
+ \cc@morefalse
+ \def\cc@accent##1{\global\cc@moretrue}%
+ \def\accentset##1{\global\cc@moretrue}%
+ \global\cc@skew2\wd\@ne
+ \global\advance\cc@skew-2\wd\z@
+ \sbox\z@{$\m@th\mathgroup\cc@group\cc@style#1$}%
+ \global\cc@wd-\wd\z@
+ \let\cc@accent\cc@iaccent
+ \let\accentset\cc@iaccentset}
+
+% Two useful faked accents
+% ~~~~~~~~~~~~~~~~~~~~~~~~
+
+\def\dddot{\accentset{{\cc@style.\mkern-1.7mu\textstyle.\mkern-1.7mu.}}}
+\def\ddddot{\accentset{{\cc@style.\mkern-2.1mu.\mkern-2.1mu.\mkern-2.1mu.}}}
+
+% Underaccents
+% ~~~~~~~~~~~~
+
+\newcommand\underaccent[2]{%
+ \begingroup
+ \def\cc@a{#2}% Stores the nucleous...
+ \cc@palette\cc@underaccent{#1}% ...and the accent is passed
+ #2%
+ \endgroup}%
+
+\def\cc@underaccent#1#2{%
+ \let\cc@style#1%
+ \expandafter\in@\expandafter\cc@accent\expandafter{#2}%
+ \ifin@
+ \expandafter\cc@uaccent#2\@@%
+ \else
+ \cc@uaccentset{#2}%
+ \fi}
+
+\def\cc@uaccent#1#2#3\@@{% #1 and #2 gobbles \protect\cc@accent
+ \cc@under{%
+ \vbox to.2ex{%
+ \hbox{%
+ $\m@th
+ \cc@style
+ \mathgroup\cc@group
+ \cc@shift
+ \mathchar#3$}%
+ \vss}}}
+
+\def\cc@uaccentset#1{%
+ \cc@under{%
+ \hbox{%
+ $\m@th
+ \cc@style
+ \mathgroup\cc@group
+ \cc@shift
+ \scriptscriptstyle#1$}}}
+
+\def\cc@under#1{%
+ \cc@group\the\mathgroup
+ \sbox\z@{$\m@th\cc@style\mathgroup\cc@group\cc@a$}%
+ \sbox\tw@{$\scriptspace\z@\m@th\cc@style\mathgroup\cc@group\cc@a_{}$}%
+ \rlap{%
+ \oalign{%
+ \vrule \@depth\dp\z@ \@width\z@
+ \kern\wd\tw@
+ \crcr
+ \hidewidth#1\hidewidth}}}
+
+\def\cc@shift{%
+ \dimen@=-.000008ex
+ \multiply\dimen@\ifnum\mathgroup=\m@ne
+ \fontdimen\@ne\textfont\@ne
+ \else
+ \fontdimen\@ne\textfont\cc@group\fi
+ \kern\dimen@}
+
+% And \undertilde
+% ~~~~~~~~~~~~~~~
+
+\newcommand\undertilde{\cc@palette\cc@undertilde}
+
+\def\cc@undertilde#1#2{%
+ \cc@group\the\mathgroup
+ \sbox\z@{$\m@th\mathgroup\cc@group#1#2$}%
+ \oalign{%
+ $\m@th\mathgroup\cc@group#1#2$%
+ \crcr
+ \hidewidth
+ \vbox to.5ex{%
+ \hbox{%
+ $\hss
+ #1%
+ \mathgroup\cc@group
+ \widetilde{\hbox to\wd\z@{\hss}}%
+ \hss$}%
+ \vss}%
+ \hidewidth}}
+
+% The following command is used by \DeclareMathAccent
+% and it's the only part requiring modification
+
+\def\set@mathaccent#1#2#3#4{%
+ \xdef#2{\noexpand\protect\noexpand\cc@accent
+ {"\mathchar@type#3\hexnumber@#1#4\relax}}}
+
+\ProcessOptions
+
+\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/babeltools/arabicfront.sty b/Master/texmf-dist/tex/latex/babeltools/arabicfront.sty
new file mode 100644
index 00000000000..1748dfb5fcc
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/babeltools/arabicfront.sty
@@ -0,0 +1,60 @@
+% +--------------------------------------------------+
+% | Documentation in clear text follows |
+% +--------------------------------------------------+
+%
+%% Copyright (C) 2006 Javier Bezos
+%% All Rights Reserved
+%% http://www.tex-tipografia.com
+%%
+%% This work may be distributed and/or modified under the conditions
+%% of the LaTeX Project Public License, either version 1.3 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.3 or later is part of all distributions of LaTeX
+%% version 2003/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% This Current Maintainer of this work is Javier Bezos.
+%%
+%% This work consists of this file.
+%
+% Usage
+% ~~~~~
+%
+% This package modifies the definitions of \frontmatter and
+% \mainmatter so that page numbering starts in arabic style from the
+% front matter while preserving the rest of the original definitions.
+% For it to work, \pagenumbering has to be inside these macros -- most
+% of classes do that, but there are exceptions like memoir.
+%
+% To use it, just \usepackage{arabicfront}.
+%
+% Code
+% ~~~~
+
+\def\fileversion{1.0}
+\def\filedate{2006/09/03}
+
+\ProvidesPackage{arabicfront}[2006/09/03 v1.0 Arabic page numbering]
+
+\def\arfr@rep#1\@@\@@#2#3{%
+ \in@{\pagenumbering}{#1}%
+ \ifin@
+ #2#1\@@\@@
+ \else
+ \PackageWarningNoLine{arabicfront}%
+ {Skipping \string#3 -- no \string\pagenumbering}%
+ \fi}
+
+\def\arfr@front#1\pagenumbering#2#3\@@\@@{%
+ \renewcommand\frontmatter{#1\pagenumbering{arabic}#3}}
+
+\def\arfr@main#1\pagenumbering#2#3\@@\@@{%
+ \renewcommand\mainmatter{#1#3}}
+
+\expandafter\arfr@rep\mainmatter\@@\@@\arfr@main\mainmatter
+\expandafter\arfr@rep\frontmatter\@@\@@\arfr@front\frontmatter
+
+\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/babeltools/babeltools.sty b/Master/texmf-dist/tex/latex/babeltools/babeltools.sty
new file mode 100644
index 00000000000..2818aa36519
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/babeltools/babeltools.sty
@@ -0,0 +1,362 @@
+% Copyright (c) 2010 by Javier Bezos.
+% All Rights Reserved.
+%
+% It may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% 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.3 or later is part of all distributions of LaTeX
+% version 2003/12/01 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% The Current Maintainer of this work is Javier Bezos.
+%
+% TODO:
+% noshorthands -> shorthands=off, nocitations, nocrossrefs
+
+\ProvidesPackage{babeltools}[2010/10/14 v0.2 Tools for the babel system (beta)]
+
+\edef\bbtl@savedcatcodes{%
+ \catcode`\noexpand\~=\the\catcode`\~
+ \catcode`\noexpand\:=\the\catcode`\:
+ \catcode`\noexpand\"=\the\catcode`\"}
+\catcode`\~=\active
+\catcode`\"=12
+\catcode`\:=12
+
+\def\bbtl@meaning{\expandafter\strip@prefix\meaning}
+
+\def\bbtl@ifshorthand#1{%
+ \@expandtwoargs\in@{#1}{\bbtl@o@shorthands}%
+ \ifin@
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
+
+\let\bbtl@afterbabelhook\@empty
+\newcommand\AfterBabel[1]{%
+ \g@addto@macro\bbtl@afterbabelhook{#1}}
+
+\let\bbtl@atendofbabelhook\@empty
+\newcommand\AtEndOfBabel[1]{%
+ \g@addto@macro\bbtl@atendofbabelhook{#1}}
+
+\let\bbtl@beforebabelhook\@empty
+\newcommand\BeforeBabel[1]{%
+ \g@addto@macro\bbtl@beforebabelhook{#1}}
+
+% Not to be redefined. The current value, saved by babel, is
+% restored. More robust code is necessary, I think.
+
+\def\bbtl@restore@org#1{%
+ \@ifundefined{#1 }% Not robust?
+ {\expandafter\let\csname #1\expandafter\endcsname
+ \csname org@#1\endcsname}%
+ {\expandafter\let\csname #1 \expandafter\endcsname
+ \csname org@#1\endcsname}}
+
+\def\bbtl@save@org#1{%
+ \expandafter\let\csname org@#1\expandafter\endcsname
+ \csname #1\endcsname}
+
+% Citations and cross refs
+% ~~~~~~~~~~~~~~~~~~~~~~~~
+
+\let\bbtl@ignorepackages\@empty
+
+\DeclareOption{nocitations}
+ {\g@addto@macro\bbtl@ignorepackages{,cite,natbib,}%
+ \AfterBabel{%
+ \bbtl@restore@org{nocite}%
+ \bbtl@restore@org{bibcite}%
+ \bbtl@restore@org{@bibitem}%S
+ \bbtl@restore@org{@citex}}}
+
+\DeclareOption{nocrossrefs}
+ {\g@addto@macro\bbtl@ignorepackages{,varioref,}%
+ \BeforeBabel{%
+ \bbtl@save@org{@newl@bel}}% babel DOESN'T save it!
+ \AfterBabel{%
+ \bbtl@restore@org{@newl@bel}%
+ \bbtl@restore@org{ref}% Robust
+ \bbtl@restore@org{pageref}}}% Robust
+
+% More cases are to be added, but they must be delayed at the end of
+% begin document, because they are related to loaded packages (see
+% babel.dtx)
+%
+% Shorthands
+% ~~~~~~~~~~
+% Some languages use the shortand mechanism for tools not defined
+% otherwise, so you can still use them with \babelshorthand{..}.
+% Then you can use it conveniently to define your own macros.
+
+% ~ is an special case, as it's defined in babel.def
+
+% New shorthands
+% --------------
+
+\DeclareOption{adaptive}%
+ {\AfterBabel{%
+ \let\bbtl@initiate@active@char\initiate@active@char
+ \let\initiate@active@char\bbtl@set@shorthand
+ \let\bbtl@declare@shorthand\declare@shorthand
+ \let\declare@shorthand\bbtl@declare
+ \let\bbl@activate\bbtl@activate
+ \let\bbtl@deactivate\bbl@deactivate
+ \let\bbl@deactivate\bbtl@restore}}
+
+% Do \bbtl@initiate@active@char but don't make the char active.
+% Not necessary and a source of bugs.
+
+\def\bbtl@set@shorthand#1{%
+ \expandafter\edef\csname bbtl@savecat\string#1\endcsname
+ {\the\catcode`#1}%
+ \bbtl@initiate@active@char{#1}%
+ \catcode`#1=\csname bbtl@savecat\string#1\endcsname\relax
+ \addto\bbtl@select{\shorthandon{#1}}}
+
+\def\bbtl@use@shorthand{%
+ \if@safe@actives
+ \bbl@afterelse
+ \string
+ \else
+ \bbl@afterfi
+ {\ifx\thepage\relax
+ \bbl@afterelse
+ \string
+ \else
+ \bbl@afterfi
+ \bbtl@use@sh
+ \fi}%
+ \fi}
+
+\def\bbtl@use@sh#1{%
+ \ifx\protect\@unexpandable@protect
+ \bbl@afterelse
+ \noexpand#1%
+ \else%
+ \bbl@afterfi
+ \textormath
+ {\csname active@char\string#1\endcsname}%
+ {\csname normal@char\string#1\endcsname}%
+ \fi}
+
+\gdef\bbtl@activate#1{%
+ \begingroup
+ \lccode`\~=`#1
+ \lowercase{%
+ \endgroup
+ \def~{\bbtl@use@shorthand~}}}
+
+\def\bbtl@restore#1{%
+ \shorthandon{#1}%
+ \begingroup
+ \lccode`\~=`#1
+ \lowercase{%
+ \endgroup
+ \bbtl@deactivate{~}}}
+
+\def\bbtl@declare#1#2{%
+ \@ifundefined{bbtl@savecat\expandafter\string\@firstoftwo#2\@empty}%
+ {\@gobble}%
+ {\bbtl@declare@shorthand{#1}{#2}}}
+
+% No shorthands
+% -------------
+
+% This is done after 'adaptive', if present.
+
+\DeclareOption{shorthands=off}%
+ {\AfterBabel{\bbl@doshorthands}}
+
+\def\babelshorthand#1{%
+ \def\bbtl@tempa{#1}%
+ \@ifundefined{bbtl@@\languagename @@\bbtl@meaning\bbtl@tempa}%
+ {#1}%
+ {\@nameuse{bbtl@@\languagename @@\bbtl@meaning\bbtl@tempa}}}
+
+% Select
+% ----------------------
+\let\bbtl@o@shorthands\@empty
+
+% TO DO: package options are expanded by LaTeX, and ~ raises
+% an error, but not \string~. Is there a way to fix it?
+
+% This is done after 'adaptive', if present.
+
+\def\bbl@doshorthands{%
+ \let\bbtl@s@initiate@active@char\initiate@active@char
+ \def\initiate@active@char##1{%
+ \bbtl@ifshorthand{\string##1}%
+ {\bbtl@s@initiate@active@char{##1}}%
+ {}}%
+ \let\bbtl@s@declare@shorthand\declare@shorthand
+ \def\declare@shorthand##1##2{%
+ \bbtl@ifshorthand{\expandafter\string\@firstoftwo##2\@empty}%
+ {\bbtl@s@declare@shorthand{##1}{##2}}%
+ {\def\bbtl@tempa{##2}%
+ \@namedef{bbtl@@##1@@\bbtl@meaning\bbtl@tempa}}}%
+ \let\bbtl@s@activate\bbl@activate
+ \def\bbl@activate##1{%
+ \bbtl@ifshorthand{\string##1}%
+ {\bbtl@s@activate{##1}}%
+ {}}%
+ \let\bbtl@s@deactivate\bbl@deactivate
+ \def\bbl@deactivate##1{%
+ \bbtl@ifshorthand{\string##1}%
+ {\bbtl@s@deactivate{##1}}%
+ {}}}
+
+% No config
+% ~~~~~~~~~
+% Make sure an unexpected local config doesn't spoil your document.
+% Use of config files is strongly discouraged, but some sites
+% use them
+
+\DeclareOption{noconfig}
+ {\AfterBabel{\let\loadlocalcfg\@gobble}}
+
+% Captions
+% ~~~~~~~~
+
+% redefining names. Somewhat experimental.
+
+\def\bbtl@captions{%
+ \bbtl@elt\prefacename\bbtl@elt\refname\bbtl@elt\abstractname
+ \bbtl@elt\bibname\bbtl@elt\chaptername\bbtl@elt\appendixname
+ \bbtl@elt\contentsname\bbtl@elt\listfigurename
+ \bbtl@elt\listtablename\bbtl@elt\indexname
+ \bbtl@elt\figurename\bbtl@elt\tablename\bbtl@elt\partname
+ \bbtl@elt\enclname\bbtl@elt\ccname\bbtl@elt\headtoname
+ \bbtl@elt\pagename\bbtl@elt\seename\bbtl@elt\alsoname
+ \bbtl@elt\proofname\bbtl@elt\glossaryname}
+
+% 1: \captions... expanded #2 repl fun bbtl@f #3 \...name
+% \lang...name
+\def\bbtl@rep#1\@@\@@#2#3#4{%
+ \in@{#3}{#1}%
+ \ifin@
+ #2#1\@@\@@#3#4%
+ \else
+ \PackageWarningNoLine{babeltools}%
+ {No \string#3 in \bbtl@l}%
+ \fi}
+
+% \bbtl@f is a helper macro:
+% 1 \...name
+% bbtl@f:
+% #1 prev, #2 def of \...name, #3 after
+% #4 \...name, #5 \lang...name
+\DeclareOption{langcaptions}
+ {\def\bbtl@repdef#1{%
+ \def\bbtl@f##1#1##2##3\@@\@@##4##5{%
+ \def##5{##2}%
+ \@namedef{captions\bbtl@l}{##1##4{##5}##3}}}%
+ \def\bbtl@elt#1{%
+ \bbtl@repdef#1%
+ \@temptokena\expandafter\expandafter\expandafter{%
+ \csname captions\bbtl@l\endcsname}%
+ % If \lang...name undefined
+ \edef\bbtl@t{%
+ \noexpand\bbtl@rep
+ \the\@temptokena
+ \noexpand\@@\noexpand\@@
+ \noexpand\bbtl@f
+ \noexpand#1
+ \expandafter\noexpand
+ \csname\bbtl@l\expandafter\@gobble\string#1\endcsname}%
+ \bbtl@t}%
+ \def\bbtl@repdo{%
+ \@for\bbtl@l:=\bbtl@options\do{%
+ \@ifundefined{captions\bbtl@l}{}{%
+ \bbtl@captions}}}%
+ \AtEndOfBabel{\bbtl@repdo}}
+
+% Key=value package options
+% ~~~~~~~~~~~~~~~~~~~~~~~~~
+
+\def\bbtl@process#1=#2\bbtl@process#3{%
+ \expandafter\ifx\csname bbtl@o@#1\endcsname\@empty
+ \expandafter\edef\csname bbtl@o@#1\endcsname{#2}%
+ \DeclareOption{\CurrentOption}{}%
+ \fi}
+
+\DeclareOption*{%
+ \@expandtwoargs\in@{\string=}{\CurrentOption}%
+ \ifin@
+ \expandafter\bbtl@process\CurrentOption\bbtl@process\CurrentOption
+ \fi}
+
+% Process options
+% ~~~~~~~~~~~~~~~~
+
+\ProcessOptions
+
+% shorthands=... option is handled here.
+
+\show\bbtl@o@shorthands
+
+\ifx\bbtl@o@shorthands\@empty\else
+ \edef\bbtl@o@shorthands{\bbtl@meaning\bbtl@o@shorthands}%
+ \bbtl@ifshorthand{'}%
+ {\PassOptionsToPackage{activeacute}{babel}}{}
+ \bbtl@ifshorthand{`}%
+ {\PassOptionsToPackage{activegrave}{babel}}{}
+ \bbtl@ifshorthand{:}{}%
+ {\g@addto@macro\bbtl@ignorepackages{,hhline,}}
+% After any redefinition, the shorthand mechanism comes.
+ \AfterBabel{\bbl@doshorthands}
+\fi
+
+% The first \LdfInit loads the babel core (the sty file doesn't!)
+% That means babeltools is not compatible with classes loading
+% a language:
+
+\@ifundefined{ldf@finish}%
+ {\def\LdfInit{%
+ \expandafter\let\expandafter\bbtl@options
+ \csname opt@babel.sty\endcsname
+ \bbtl@beforebabelhook
+ \AtBeginDocument{%
+ \let\bbtl@ifpackageloaded\@ifpackageloaded
+ \def\@ifpackageloaded##1{%
+ \@expandtwoargs\in@{,##1,}{\bbtl@ignorepackages}%
+ \ifin@
+ \expandafter\@gobbletwo
+ \else
+ \expandafter\bbtl@ifpackageloaded
+ \fi
+ {##1}}}%
+ \chardef\atcatcode =\catcode`\@
+ \catcode`\@=11\relax
+ \input babel.def\relax
+ \catcode`\@ =\atcatcode
+ \let\atcatcode\relax
+ \bbtl@afterbabelhook
+ \AtEndOfPackage{\bbtl@atendofbabelhook}%
+ \LdfInit}}
+ {\PackageError{babeltools}%
+ {Too late -- babel has been loaded}%
+ {babeltools can be used only before babel.\MessageBreak
+ Very likely a package or the class has loaded it.}}
+
+\AtEndOfBabel{%
+ \AtBeginDocument{\let\@ifpackageloaded\bbtl@ifpackageloaded}}
+
+\bbtl@savedcatcodes
+
+\endinput
+
+==============================
+==============================
+
+- Attributes?
+- Quotes ''
+
+
+
+
diff --git a/Master/texmf-dist/tex/latex/babeltools/checkend.sty b/Master/texmf-dist/tex/latex/babeltools/checkend.sty
new file mode 100644
index 00000000000..87b71517555
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/babeltools/checkend.sty
@@ -0,0 +1,55 @@
+% +--------------------------------------------------+
+% | Documentation in clear text follows |
+% +--------------------------------------------------+
+%
+% (c) 2002 Javier Bezos. All Rights Reserved.
+%
+% This file can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+%
+%
+% Usage
+% ~~~~~
+% When an environment is left open, LaTeX gives an error at the
+% end of the document. However it only informs about the first
+% of them, while the rest are shown with meaningless errors:
+%
+% (\end occurred inside a group at level N)
+%
+% This package replaces them with more useful messages
+% which show which environments (in reverse order) were
+% not closed.
+%
+% That's all. There are no user macros. Just use the package.
+%
+% Code
+% ~~~~
+
+\def\fileversion{1.0}
+\def\filedate{2002/04/20}
+
+\ProvidesPackage{checkend}[2002/04/20 v1.0 Environment checking]
+
+\def\chkend@checkend{%
+ \def\@tempa{document}%
+ \ifx\@currenvir\@tempa
+ \else
+ \count@\errorcontextlines
+ \errorcontextlines\z@
+ \PackageError{checkend}{%
+ \@currenvir \@currenvline \space open at
+ \string\end{document}}%
+ {The package has detected an open environment at the
+ end\MessageBreak
+ of the document}%
+ \errorcontextlines\count@
+ \csname end\@currenvir\endcsname
+ \endgroup
+ \chkend@checkend
+ \fi}
+
+\AtEndDocument{\chkend@checkend}
+
+\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/babeltools/dotlessi.sty b/Master/texmf-dist/tex/latex/babeltools/dotlessi.sty
new file mode 100644
index 00000000000..a2b646f9186
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/babeltools/dotlessi.sty
@@ -0,0 +1,59 @@
+% +--------------------------------------------------+
+% | Documentation in clear text follows |
+% +--------------------------------------------------+
+%
+% (c) 1999 Javier Bezos. All Rights Reserved.
+%
+% This file can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+%
+%
+% Usage
+% ~~~~~
+% This package defines two commands: \dotlessi and \dotlessj, which give
+% you access to dotless i's and j's in math mode. They are intended for
+% symbols in non English languages.
+%
+% If the default math font is used, they are equivalent to \imath and
+% \jmath; if a different font is used (like \mathrm, \mathbf, \mathsf)
+% these commands look in the corresponding font tables to find their
+% codes. In text mode, they expand to \i and \j. For example:
+%
+% $f_{\mathrm{m\acute{\dotlessj}n}}$
+%
+% Code
+% ~~~~
+
+\def\fileversion{1.0}
+\def\filedate{1999/10/12}
+
+\ProvidesPackage{dotlessi}[1999/10/12 v1.0 Dotless i/j for Math]
+
+\expandafter\def\expandafter\@uclclist\expandafter
+ {\@uclclist\dotlessi\i\dotlessj\j}
+
+\def\dotl@make#1#2{%
+ \ifmmode
+ {\ifnum\mathgroup=\m@ne
+ #2%
+ \else
+ \count@\escapechar \escapechar=\m@ne
+ \expandafter\expandafter\expandafter
+ \split@name\expandafter\string\the\textfont\mathgroup\@nil
+ \escapechar=\count@
+ \@ifundefined{\f@encoding\string#1}%
+ {\edef\f@encoding{\string?}}{}%
+ \expandafter\count@\the\csname\f@encoding\string#1\endcsname
+ \advance\count@"7000
+ \mathchar\count@
+ \fi}%
+ \else
+ #1%
+ \fi}
+
+\DeclareRobustCommand\dotlessi{\dotl@make\i\imath}
+\DeclareRobustCommand\dotlessj{\dotl@make\j\jmath}
+
+\endinput
diff --git a/Master/texmf-dist/tex/latex/babeltools/esindex.sty b/Master/texmf-dist/tex/latex/babeltools/esindex.sty
new file mode 100644
index 00000000000..3b2d61e02c0
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/babeltools/esindex.sty
@@ -0,0 +1,204 @@
+% +--------------------------------------------------+
+% | Typeset ensindex.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+%% Copyright (C) 1998-2004, 2006, 2008 Javier Bezos
+%% All Rights Reserved
+%% http://www.tex-tipografia.com
+%%
+%% This work may be distributed and/or modified under the conditions
+%% of the LaTeX Project Public License, either version 1.3 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.3 or later is part of all distributions of LaTeX
+%% version 2003/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% This Current Maintainer of this work is Javier Bezos.
+%%
+%% This work consists of the files esindex.tex and esindex.sty.
+
+% Changes
+%
+% 2006-05-12. Bug fixed. Missing accents in multilevel entries.
+% 2008-09-17. Made compatible with latest LaTeX versions (\IeC).
+% Added \'\i.
+% Package option ignorespaces.
+% Macro \ignorewords.
+% 2008-09-28. Added \everyesindex.
+% Macro \esindexsort.
+
+\ProvidesPackage{esindex}[2008/09/28 v1.4 Spanish indexes]
+
+\def\esx@level{`\!}
+\def\esx@actual{`\@}
+\def\esx@encap{`\|}
+\def\esx@quote{`\"}
+
+\def\esx@error{\PackageError{esindex}{Unknown index parameter}%
+ {Except for ignorespaces and replaceindex, options^^J%
+ in this package ave the form parameter=value, where^^J%
+ parameter stands for of the following MakeIndex ones:^^J%
+ encap, level, actual, quote}}
+
+\def\esx@process#1=#2\esx@process{%
+ \@ifundefined{esx@#1}{\esx@error}{%
+ \expandafter\edef\csname esx@#1\endcsname
+ {\string`\expandafter\noexpand\csname\string#2\endcsname}}}
+
+\DeclareOption*{%
+ \@expandtwoargs\in@{=}{\CurrentOption}%
+ \ifin@
+ \expandafter\esx@process\CurrentOption\esx@process
+ \else
+ \def\esx@a{ignorespaces}
+ \ifx\esx@a\CurrentOption
+ \def\esx@zapspace#1\esx@zapspace{\zap@space#1 \@empty}%
+ \else\def\esx@a{replaceindex}
+ \ifx\esx@a\CurrentOption
+ \AtBeginDocument{%
+ \let\esx@trueindex\index
+ \let\index\esindex}
+ \else
+ \esx@error
+ \fi
+ \fi
+ \fi}
+
+\let\esx@zapspace\@empty
+\def\esx@trueindex{\index}
+
+\ProcessOptions
+
+\begingroup
+
+\catcode`\|=\catcode\esx@encap \lccode`\|=\esx@encap\relax
+\catcode`\!=\catcode\esx@level \lccode`\!=\esx@level\relax
+\catcode`\&=\catcode\esx@actual \lccode`\&=\esx@actual\relax
+\catcode`\*=13 \lccode`\*=\esx@quote\relax
+
+\catcode`\'=13
+\catcode`\"=13
+\catcode`\~=13
+
+\gdef\esindex#1#{\esx@index{#1}}
+
+\lowercase{
+\gdef\esx@index#1#2{%
+ \let\esx@g\@empty
+ \esx@bar@idx#2|\@@
+ \expandafter\esx@@index\esx@b!\@@
+ \toks@\expandafter{\esx@g}%
+ \protected@edef\esx@g{\noexpand\esx@trueindex#1{\the\toks@\esx@a}}%
+ \esx@g}
+}
+
+\lowercase{
+\gdef\esx@bar@idx#1|#2\@@{%
+ \def\esx@b{#1}\def\esx@a{#2}%
+ \ifx\esx@a\@empty\else\esx@bar@eat#2\fi}
+}
+
+\lowercase{
+\gdef\esx@bar@eat#1|{\def\esx@a{|#1}}
+}
+
+\lowercase{
+\gdef\esx@@index#1!#2\@@{%
+ \begingroup
+ \let\IeC\@firstofone
+ \def\@tabacckludge##1{\csname\string##1\endcsname}%
+ \def\'##1{\@ifundefined{esx@index@q@\string##1}%
+ {##1}%
+ {\csname esx@index@q@\string##1\endcsname}}%
+ \ifnum\catcode`\'=\active
+ \let'\'%
+ \fi
+ \def\~##1{\string##1\string^^ff}%
+ \ifnum\catcode`\~=\active
+ \let~\~%
+ \fi
+ \def\"##1{\@ifundefined{esx@index@qq@\string##1}%
+ {\string"##1}%
+ {\csname esx@index@qq@\string##1\endcsname}}%
+ \ifnum\catcode`\"=\active
+ \let"\"%
+ \fi
+ \def\esx@a{#1}%
+ \@ifundefined{esx@sort@\expandafter\strip@prefix\meaning\esx@a}%
+ {\@temptokena{#1}}%
+ {\@temptokena\expandafter\expandafter\expandafter{%
+ \csname esx@sort@\expandafter\strip@prefix\meaning\esx@a\endcsname}}%
+ \the\everyesindex
+ % Particles
+ \@for\esx@a:=\esx@ignorewords\do{%
+ \expandafter\esx@remwords\expandafter{\esx@a}}%
+ \toks@\expandafter{\esx@g}%
+ % Adds @ and removes spaces.
+ \protected@xdef\esx@g{%
+ \the\toks@
+ \expandafter\esx@zapspace\the\@temptokena\esx@zapspace
+ \string &}%
+ \endgroup
+ \begingroup
+ \def*##1{% <- its lower case is the quote char (")
+ \ifcat##1a%
+ \@ifundefined{spanish@sh@\string*\string##1@}%
+ {\string*##1}%
+ {\string*\string*##1}%
+ \else
+ \string*\string##1%
+ \fi}%
+ \def\esx@b{#2}%
+ \toks@\expandafter{\esx@g}%
+ \ifx\esx@b\@empty
+ \protected@xdef\esx@g{\the\toks@#1}%
+ \else
+ \protected@xdef\esx@g{\the\toks@#1!}%
+ \esx@@index#2\@@
+ \fi
+ \endgroup}
+}
+\endgroup
+
+\def\ignorewords#1{%
+ \protected@edef\esx@ignorewords{\zap@space#1 \@empty}}
+
+\let\esx@ignorewords\@empty
+
+\def\esx@remwords#1{%
+ \def\esx@c##1 #1 \esx@c{\esx@a##1 #1 \esx@a}%
+ \def\esx@a##1 #1 ##2\esx@a{%
+ \ifx\@empty##2\@empty
+ \@firstofone##1##2%
+ \else
+ \@firstofone##1 \esx@c##2\esx@c
+ \fi}%
+ \expandafter\esx@remwords@ii\expandafter{\the\@temptokena}{#1}}%
+
+\def\esx@remwords@ii#1#2{%
+ \protected@xdef\esx@b{\expandafter\esx@a\space#1 #2 \esx@a}%
+ \@temptokena\expandafter{\esx@b}}
+
+\def\esindexsort#1{%
+ \def\esx@a{#1}%
+ \@namedef{esx@sort@\expandafter\strip@prefix\meaning\esx@a}}
+
+\newtoks\everyesindex
+
+\def\esx@index@q@n{n\string^^ff}
+\def\esx@index@q@N{N\string^^ff}
+\@namedef{esx@index@q@\string\i}{i}
+
+\def\esx@index@qq@o{.o}
+\def\esx@index@qq@O{.O}
+\def\esx@index@qq@a{.a}
+\def\esx@index@qq@A{.A}
+\def\esx@index@qq@u{u}
+\def\esx@index@qq@U{U}
+\def\esx@index@qq@c{c}
+\def\esx@index@qq@C{C}
+
+\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/babeltools/subdocs.sty b/Master/texmf-dist/tex/latex/babeltools/subdocs.sty
new file mode 100644
index 00000000000..374fab2a182
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/babeltools/subdocs.sty
@@ -0,0 +1,152 @@
+% +--------------------------------------------------+
+% | Documentation in clear text follows |
+% +--------------------------------------------------+
+%
+%% Copyright (C) 2009 Javier Bezos
+%% All Rights Reserved
+%% http://www.tex-tipografia.com
+%%
+%% This work may be distributed and/or modified under the conditions
+%% of the LaTeX Project Public License, either version 1.3 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.3 or later is part of all distributions of LaTeX
+%% version 2003/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% This Current Maintainer of this work is Javier Bezos.
+%%
+%% This work consists of this file.
+%
+% Usage
+% ~~~~~
+%
+% This is a tentative package aiming to provide a different approach
+% for multidocument works (mainly, books with a document per chapter).
+% Unlike the \include mechanism, every subdocument is a complete LaTeX
+% document and can be typeset separately. What the package does is
+% sharing the aux files. It's still an alpha version, and no attempt
+% has been done yet to make it to work with, say, hyperref.
+%
+% This approach has the following advantages:
+% 1) Packages can be loaded just when a part requires them.
+% 2) Generated pdf/dvi/ps files are kept.
+%
+% You need a driver tex file containing a \subdocuments command
+% listing the files. With an optional argument you can set
+% its behaviour:
+%
+% \subdocuments[clear=double]{file1, file2, file3}
+%
+% The option clear=double adds an empty page at the end to give a even
+% number of pages. clear=single doesn't and it's the default. Spaces
+% and new lines before and after commas are ignored, as well as empty
+% items. It relies on the keyval package, so names containing = must
+% be given within braces.
+%
+% This file can be used as a shared preample, with common settings
+% for all the documents.
+%
+% Documents must have the folowing line:
+%
+% \usepackage[master]{subdocs}
+%
+% where master is the name of the file described above.
+%
+% Since every subdocument reads all the aux files, \tableofcontents
+% may be used where desired.
+%
+% Code
+% ~~~~
+
+\ProvidesPackage{subdocs}[2009/06/12 v0.1 Subdocuments]
+
+\RequirePackage{keyval}
+
+% Los dos siguientes son lo encargados de hacer lo que
+% normalmente hace \include.
+
+\AtBeginDocument{%
+ \if@filesw
+ \immediate\write\@auxout{\noexpand\sdoc@readaux}%
+ \fi}
+
+% At end of document we write the counters using writeckpt
+% but with \@partaux redirected to \@auxout. Like \include
+% there is a \clearpage
+
+\AtEndDocument{%
+ \sdoc@clear
+ \let\@partaux\@auxout
+ \@writeckpt{\jobname}}
+
+\def\@wckptelt#1{%
+ \immediate\write\@partaux{%
+ \string\sdoc@setcounter{#1}{\the\@nameuse{c@#1}}}}
+
+\def\sdoc@setcounter#1{%
+ \@ifundefined{c@#1}%
+ {\@gobble}%
+ {\setcounter{#1}}}
+
+% Optional arguments
+
+\def\sdoc@opt@clearsingle{\let\sdoc@clear\clearpage}
+\def\sdoc@opt@cleardouble{\let\sdoc@clear\cleardoublepage}
+\sdoc@opt@clearsingle
+
+\define@key{sdoc@options}{clear}{\@nameuse{sdoc@opt@clear#1}}
+
+%
+
+\let\sdoc@loadaux\@empty
+
+\newcommand\subdocuments[2][]{%
+ \let\sdoc@save@kverrx\KV@errx
+ \def\KV@errx##1{% \@tempa contains the file name
+ {\let\sdoc@elt\relax % local
+ \edef\sdoc@a{\expandafter\strip@prefix\meaning\@tempa}%
+ \protected@xdef\sdoc@loadaux{\sdoc@loadaux\sdoc@elt{\sdoc@a}}}}%
+ \setkeys{sdoc@files}{#2}%
+ \let\KV@errx\sdoc@save@kverrx
+ \setkeys{sdoc@options}{#1}}
+
+% A "recursive" call. When a \jobname.aux file is
+% read the first thing is (or should be) \sdoc@readaux.
+% It reads all the aux files, and exits from the current
+% aux without further reading because it is already read.
+% This requires a file could \input itself, but, does
+% that work in all distributions?
+
+\def\sdoc@elt#1{%
+ \InputIfFileExists{#1.aux}{}%
+ {\PackageWarningNoLine{subdocs}{No file #1.aux -- Data may be wrong}}%
+ \sdoc@setcp{#1}}%
+
+\def\sdoc@readaux{%
+ \global\let\sdoc@readaux\relax
+ \sdoc@loadaux
+ \global\let\sdoc@readaux\sdoc@readaux@x
+ \endinput}
+
+\let\sdoc@readaux@x\sdoc@readaux
+
+\def\sdoc@setcp#1{%
+ \def\sdoc@a{#1}\edef\sdoc@b{\jobname}%
+ \ifx\sdoc@a\sdoc@b
+ \PackageInfo{subdocs}{Ignoring counters from #1 on, }%
+ \global\let\sdoc@setcp\@gobble
+ \else
+ \csname cp@#1\endcsname
+ \fi}
+
+% The master file name must be saved because it may contain
+% \usepackage's, not allowed before \ProcessOptions.
+
+\DeclareOption*{\edef\sdoc@a{\CurrentOption}}
+\ProcessOptions
+\InputIfFileExists{\sdoc@a}{}{}%
+
+\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/babeltools/tensind.sty b/Master/texmf-dist/tex/latex/babeltools/tensind.sty
new file mode 100644
index 00000000000..2c9cc1bbc8e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/babeltools/tensind.sty
@@ -0,0 +1,284 @@
+% +--------------------------------------------------+
+% | Typeset titlesec.tex to get the documentation. |
+% +--------------------------------------------------+
+%
+% This file is copyrighted (c) 1998 by Javier Bezos.
+% All Rights Reserved.
+%
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+%
+% Release
+% ~~~~~~~
+
+\ProvidesPackage{tensind}[1998/05/01 v1.0 Tensorial Indexes]
+
+\@tempcnta=\the\catcode`^
+\@tempcntb=\the\catcode`_
+\catcode`^=7\catcode`_=8
+
+\newdimen\tsi@dimen
+
+\newif\iftsi@sp
+\newif\iftsi@sb
+
+\newif\iftsi@e
+\newif\iftsi@b
+\newif\iftsi@l
+\newif\iftsi@r
+\newif\iftsi@o
+\newif\iftsi@c
+\newif\iftsi@s
+\newif\iftsi@nodot
+
+\def\tsi@thedots{}
+\def\tsi@theprimes{}
+\def\tsi@thesb{}
+\def\tsi@thesp{}
+\def\tsi@lastloc{x}
+\def\tsi@lastindex{}%
+\def\tsi@addindex{\tsi@addpr}
+
+\let\tsi@bl\relax
+\let\tsi@br\relax
+\let\tsi@bm\relax
+\let\tsi@tl\relax
+\let\tsi@tr\relax
+\let\tsi@tm\relax
+
+\let\tsi@choice\mathchoice
+
+\newif\iftsi@top
+\newif\iftsi@bot
+
+\let\tsi@gap\relax
+
+\def\tensorformat#1{\tsi@lfalse\tsi@rfalse\tsi@efalse
+ \tsi@bfalse\tsi@ofalse\tsi@cfalse\tsi@sfalse
+ \@tfor\tsi@a:=#1\do{\csname tsi@\tsi@a true\endcsname}}
+
+\tensorformat{}
+\def\indexdot{\cdot}
+
+\def\tsi@appendto#1#2{\protected@edef#2{#2#1}}
+
+\def\tensor{\catcode`_=8\catcode`^=7 %
+ \def\tsi@end{\end}\tsi@ifnextchar[{\tsi@otensor}{\tsi@xtensor}}
+
+\begingroup
+
+\catcode`?=13
+\gdef\tensordelimiter#1{\mathcode`#1="8000{\catcode`?=13\lccode`?=`#1
+ \lowercase{%
+ \gdef?{\begingroup\catcode`_=8 \catcode`^=7 %
+ \def\tsi@end{#1}\def?{\endtensor\endgroup}%
+ \@ifnextchar[{\tsi@otensor}{\tsi@xtensor}}}}}
+
+\endgroup
+
+\def\tsi@otensor[#1]{\tensorformat{#1}\tsi@xtensor}
+
+\gdef\tsi@xtensor#1{%
+ \def\tsi@nucl{#1}%
+ \futurelet\nxt\tsi@process}
+
+\def\tsi@process#1{%
+ \def\next{\futurelet\nxt\tsi@process}%
+ \def\tsi@theindex{#1}\def\tsi@a{_}%
+ \ifx\tsi@theindex\tsi@a
+ \if\tsi@lastloc x\let\tsi@first\@empty\fi
+ \if\tsi@lastloc b\else\tsi@switchsb\fi
+ \else
+ \def\tsi@a{^}%
+ \ifx\tsi@theindex\tsi@a
+ \if\tsi@lastloc p\else\tsi@switchsp\fi
+ \else
+ \ifx\tsi@theindex\tsi@end
+ \let\next\tsi@end
+ \else
+ \tsi@nodotfalse
+ \ifx\nxt\bgroup
+ \def\tsi@lastindex{}%
+ \else
+ \csname tsi@cmd\string#1\endcsname
+ \def\tsi@lastindex{#1}%
+ \fi
+ \tsi@addindex
+ \fi
+ \fi
+ \fi
+ \next}
+
+\def\tsi@switchsp{%
+ \let\tsi@addindex\tsi@addsp
+ \iftsi@top
+ \def\tsi@gap{\tsi@tm}%
+ \else
+ \def\tsi@gap{\tsi@tl}%
+ \fi
+ \tsi@appendto{\tsi@thedots}\tsi@thesp
+ \let\tsi@gap\relax
+ \def\tsi@thedots{}}
+
+\def\tsi@switchsb{%
+ \let\tsi@addindex\tsi@addsb
+ \iftsi@bot
+ \def\tsi@gap{\tsi@bm}%
+ \else
+ \def\tsi@gap{\tsi@bl}%
+ \fi
+ \tsi@appendto{\tsi@thedots}\tsi@thesb
+ \let\tsi@gap\relax
+ \def\tsi@thedots{}}
+
+\def\tsi@addpr{%
+ \tsi@appendto{\tsi@theindex}\tsi@theprimes}
+
+\def\tsi@addsp{%
+ \tsi@toptrue
+ \tsi@appendto{\tsi@theindex}\tsi@thesp
+ \iftsi@nodot
+ \tsi@appendto{\protect\tsi@phantom{\tsi@theindex}}\tsi@thedots
+ \else
+ \tsi@appendto{\tsi@gap{\tsi@theindex}}\tsi@thedots
+ \fi
+ \def\tsi@lastloc{p}}
+
+\def\tsi@addsb{%
+ \tsi@bottrue
+ \tsi@appendto{\tsi@theindex}\tsi@thesb
+ \iftsi@nodot
+ \tsi@appendto{\protect\tsi@phantom{\tsi@theindex}}\tsi@thedots
+ \else
+ \tsi@appendto{\tsi@gap{\tsi@theindex}}\tsi@thedots
+ \fi
+ \def\tsi@lastloc{b}}
+
+\def\tsi@dot#1{%
+ \setbox\z@\hbox{$\tsi@fam\m@th\tsi@index#1$}%
+ \hbox to\wd\z@{\hss$\tsi@fam\m@th\tsi@index\indexdot$\hss}}
+
+\newdimen\primes
+
+\def\endtensor{%
+ \if\tsi@lastloc p
+ \def\tsi@gap{\tsi@br}%
+ \tsi@appendto{\tsi@thedots}\tsi@thesb
+ \else
+ \def\tsi@gap{\tsi@tr}%
+ \tsi@appendto{\tsi@thedots}\tsi@thesp
+ \fi
+ \let\tsi@bl\tsi@phantom \let\tsi@br\tsi@phantom
+ \let\tsi@bm\tsi@phantom \let\tsi@tm\tsi@phantom
+ \def\tsi@tl##1{\tsi@phantom{##1}\global\advance\tsi@dimen\wd\z@}%
+ \iftsi@top
+ \let\tsi@tr\tsi@phantom
+ \else
+ \let\tsi@tr\tsi@tl
+ \fi
+ \iftsi@bot
+ \iftsi@l\let\tsi@bl\tsi@dot\let\tsi@bm\tsi@dot\fi
+ \iftsi@r\let\tsi@br\tsi@dot\let\tsi@bm\tsi@dot\fi
+ \else
+ \iftsi@e\let\tsi@br\tsi@dot\tsi@bottrue\fi
+ \fi
+ \iftsi@b\else
+ \iftsi@top
+ \iftsi@l\let\tsi@tl\tsi@dot\let\tsi@tm\tsi@dot\fi
+ \iftsi@r\let\tsi@tr\tsi@dot\let\tsi@tm\tsi@dot\fi
+ \else
+ \iftsi@e\let\tsi@tr\tsi@dot\tsi@toptrue\fi
+ \fi
+ \fi
+ \ifx\tsi@theprimes\@empty\else\tsi@toptrue\fi
+ \edef\tsi@fam{\fam\the\fam}%
+ \tsi@choice
+ {\tsi@endtensor\displaystyle\scriptstyle}%
+ {\tsi@endtensor\textstyle\scriptstyle}%
+ {\tsi@endtensor\scriptstyle\scriptscriptstyle}%
+ {\tsi@endtensor\scriptscriptstyle\scriptscriptstyle}}
+
+
+\def\tsi@endtensor#1#2{%
+ \let\tsi@text#1\let\tsi@index#2%
+ \setbox\z@ \hbox{$\tsi@fam\m@th#1\tsi@nucl_{x}$}%
+ \setbox\@ne\hbox{$\tsi@fam\m@th#1\tsi@nucl{}_{x}$}%
+ \tsi@dimen\wd\z@ \advance\tsi@dimen-\wd\@ne
+ \@tempdimb-\tsi@dimen
+ \setbox\z@ \hbox{$\kern\tsi@dimen\tsi@fam\m@th#2\tsi@thesp$}%
+ \setbox\@ne\hbox{$\tsi@fam\m@th#2\tsi@thesb$}%
+ \setbox\tw@\hbox{$\tsi@fam\m@th#2{\tsi@theprimes}$}%
+ \dp\z@\z@
+ \ifdim\tsi@dimen>\wd\tw@
+ \tsi@dimen\z@
+ \else
+ \advance\tsi@dimen-\wd\tw@
+ \fi
+ \wd\tw@\z@
+ \iftsi@s
+ \ifx\tsi@text\displaystyle
+ \tsi@otrue\tsi@cfalse
+ \else
+ \tsi@ofalse\tsi@ctrue
+ \fi
+ \fi
+ \let\tsi@a\@empty
+ \tsi@nucl
+ \iftsi@bot_{\kern-\tsi@dimen\copy\@ne}%
+ \iftsi@o\tsi@toptrue\else\iftsi@c\tsi@toptrue
+ \ifx\tsi@text\displaystyle\else
+ \def\tsi@a{\raise.1ex}%
+ \fi
+ \kern-\wd\@ne\kern\tsi@dimen
+ \kern\@tempdimb\kern-\scriptspace
+ \fi\fi
+ \fi
+ \iftsi@top^{\tsi@a\box\tw@\kern-\tsi@dimen\tsi@a\box\z@}\fi}
+
+\def\tsi@phantom#1{%
+ \setbox\tw@\null
+ \setbox\z@\hbox{$\tsi@fam\m@th\tsi@index#1$}%
+ \wd\tw@\wd\z@
+ \box\tw@}%
+
+\def\whenindex#1#2#3{%
+ \expandafter\def\csname tsi@cmd\expandafter\string#1\endcsname{%
+ \def\tsi@theindex{#2}#3}}
+
+\whenindex{'}{\prime}{}
+
+\def\spadjust#1#2{%
+ \def\tsi@a{#1}%
+ \ifx\tsi@a\tsi@lastindex
+ \iftsi@l\else
+ \iftsi@r\else
+ \ifx\tsi@addindex\tsi@addsp
+ \if\tsi@lastloc b%
+ \protected@edef\tsi@theindex{\mskip#2\thinmuskip\tsi@theindex}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi}
+
+\def\sbadjust#1#2{%
+ \def\tsi@a{#1}%
+ \ifx\tsi@a\tsi@lastindex
+ \iftsi@l\else
+ \iftsi@r\else
+ \ifx\tsi@addindex\tsi@addsb
+ \if\tsi@lastloc p%
+ \protected@edef\tsi@theindex{\mskip#2\thinmuskip\tsi@theindex}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi}
+
+
+\def\omitdot{\tsi@nodottrue}
+\def\finishdots{\tsi@nodottrue\let\tsi@nodotfalse\relax}
+
+\catcode`^=\@tempcnta\catcode`_=\@tempcntb