%%
%% This is file `spanglish.ldf',
%% Copyright 2008 Luis Rivera and any individual authors
%% listed elsewhere in this file.  All rights reserved.
%% 
%    The 'spanglish' pseudo-language was originally adapted from the 'galician' 
%    language (v1.2l 2005/03/30), by Manuel Carriba (mcarriba at eunetcom.net),
%    based on the original spanish.sty, written by Julio Sanchez,
%    (jsanchez at gmv.es)
%    Additional code borrowed from spanish.ldf v4.2, by Javier Bezos.
%%
%% This file 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 Luis Rivera.
%%                                        jlrn77 at gmail dot com
%% 
%% The list of derived (unpacked) files belonging to the distribution
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension .ins) which are part of the distribution.
%% 
%% \changes{2010/12/28}{Release version, from 2007/01/26 code}
\ProvidesLanguage{spanglish}
    [2013/03/01 v0.1a Spanglish: simple Spanish support]
\LdfInit{spanglish}\captionsspanglish
\ifx\l@spanglish\@undefined
 \ifx\l@spanish\@undefined
  \@nopatterns{spanglish}
  \adddialect\l@spanglish0\fi
 \adddialect\l@spanglish\l@spanish\fi
%
\addto\captionsspanglish{%
  \def\prefacename{Prefacio}%
  \def\refname{Referencias}%
  \def\abstractname{Resumen}%
  \def\bibname{Bibliograf\'{\i}a}%
  \def\chaptername{Cap\'{\i}tulo}%
  \def\appendixname{Ap\'endice}%
  \def\contentsname{Contenido}%
  \def\listfigurename{\'Indice de Figuras}%
  \def\listtablename{\'Indice de Cuadros}%
  \def\indexname{\'Indice Alfab\'etico}%
  \def\figurename{Figura}%
  \def\tablename{Cuadro}%
  \def\partname{Parte}%
  \def\enclname{Anexo}%
  \def\ccname{Copia a}%
  \def\headtoname{A}%
  \def\pagename{P\'agina}%
  \def\seename{v\'ease}%
  \def\alsoname{v\'ease tambi\'en}%
  \def\proofname{Demostraci\'on}%
  \def\glossaryname{Glosario}%
}
%
\def\datespanglish{%
  \def\today{\number\day\space de \ifcase\month\or
    enero\or febrero\or marzo\or abril\or mayo\or junio\or
    julio\or agosto\or septiembre\or octubre\or noviembre\or diciembre\fi
    \space de \number\year}}
\addto\extrasspanglish{\bbl@frenchspacing}
\addto\noextrasspanglish{\bbl@nonfrenchspacing}
%
\newif\ifxp@latex
\@ifundefined{documentclass}
 {\xp@latexfalse}
 {\xp@latextrue}
%
\addto\extrasspanglish{\languageshorthands{spanglish}}
\initiate@active@char{"}
\addto\extrasspanglish{%
  \bbl@activate{"}}
\@ifpackagewith{babel}{activeacute}{%
  \initiate@active@char{'}}{}
\@ifpackagewith{babel}{activeacute}{%
  \addto\extrasspanglish{\bbl@activate{'}}}{}
\addto\noextrasspanglish{%
  \bbl@deactivate{"}}
\@ifpackagewith{babel}{activeacute}{%
  \addto\noextrasspanglish{\bbl@deactivate{'}}}{}
\addto\extrasspanglish{%
  \babel@save\"%
  \def\"{\protect\@umlaut}}
\@ifpackagewith{babel}{activeacute}{%
  \babel@save\'%
  \addto\extrasspanglish{\def\'{\protect\@acute}}
  }{}
\let\dieresis\"
\@ifpackagewith{babel}{activeacute}{\let\textacute\'}{}
\def\@umlaut#1{\allowhyphens\dieresis{#1}\allowhyphens}
\@ifpackagewith{babel}{activeacute}{%
  \def\@acute#1{\allowhyphens\textacute{#1}\allowhyphens}}{}
\declare@shorthand{spanglish}{"-}{\nobreak-\bbl@allowhyphens}
\declare@shorthand{spanglish}{"|}{\discretionary{-}{}{\kern.03em}}
\declare@shorthand{spanglish}{"u}{\@umlaut{u}}
\declare@shorthand{spanglish}{"U}{\@umlaut{U}}
\declare@shorthand{spanglish}{"i}{\@umlaut{\i}}
\declare@shorthand{spanglish}{"I}{\@umlaut{I}}
\declare@shorthand{spanglish}{"r}
  {\bbl@allowhyphens\discretionary{\char\hyphenchar\font}%
       {}{r}\bbl@allowhyphens}
\declare@shorthand{spanglish}{"R}
  {\bbl@allowhyphens\discretionary{\char\hyphenchar\font}%
       {}{R}\bbl@allowhyphens}
\declare@shorthand{spanglish}{"<}{\guillemotleft{}}
\declare@shorthand{spanglish}{">}{\guillemotright{}}
\ifxp@latex% this code, by javier bezos (jb)
  \DeclareTextCommand{\guillemotleft}{OT1}{%
    \ifmmode\ll
    \else
      \save@sf@q{\penalty\@M
        \leavevmode\hbox{\usefont{U}{lasy}{m}{n}%
          \char40 \kern-0.19em\char40 }}%
    \fi}%
  \DeclareTextCommand{\guillemotright}{OT1}{%
    \ifmmode\gg
    \else
      \save@sf@q{\penalty\@M
          \leavevmode\hbox{\usefont{U}{lasy}{m}{n}%
            \char41 \kern-0.19em\char41 }}%
    \fi}%
\fi% end jb
\declare@shorthand{spanglish}{"`}{\textquotedblleft{}}
\declare@shorthand{spanglish}{"'}{\textquotedblright{}}
\@ifpackagewith{babel}{activeacute}{%
  \declare@shorthand{spanglish}{'a}{\textormath{\@acute a}{^{\prime} a}}
  \declare@shorthand{spanglish}{'e}{\textormath{\@acute e}{^{\prime} e}}
  \declare@shorthand{spanglish}{'i}{\textormath{\@acute\i{}}{^{\prime}i}}
  \declare@shorthand{spanglish}{'o}{\textormath{\@acute o}{^{\prime} o}}
  \declare@shorthand{spanglish}{'u}{\textormath{\@acute u}{^{\prime} u}}
  \declare@shorthand{spanglish}{'A}{\textormath{\@acute A}{^{\prime} A}}
  \declare@shorthand{spanglish}{'E}{\textormath{\@acute E}{^{\prime} E}}
  \declare@shorthand{spanglish}{'I}{\textormath{\@acute I}{^{\prime} I}}
  \declare@shorthand{spanglish}{'O}{\textormath{\@acute O}{^{\prime} O}}
  \declare@shorthand{spanglish}{'U}{\textormath{\@acute U}{^{\prime} U}}
  \declare@shorthand{spanglish}{'n}{\textormath{\~n}{^{\prime} n}}
  \declare@shorthand{spanglish}{'N}{\textormath{\~N}{^{\prime} N}}
  \declare@shorthand{spanglish}{''}{%
    \textormath{\textquotedblright}{\sp\bgroup\prim@s'}}
  }{}
\def\xp@plain@esabrv#1{.$^{{\rm #1}}$}
\def\xp@ltx@esabrv#1{.\textsuperscript{#1}}
\def\xp@esabrv@r#1#2{\esabrv{#1#2}}% nice trick by Bezos
\ifxp@latex
 \addto\extrasxpanish{\let\esabrv=\xp@ltx@esabrv}
  \else
 \addto\extrasxpanish{\let\esabrv=\xp@plain@esabrv}
\fi
%\addto\extrasspanglish{% this code should state ordinal 1"o as 1o.
%  \def\xp@usabrv#1{#1.}
%  \let\esabrv\xp@usabrv
%  \def\xp@esabrv@r#1#2{\esabrv{#1#2}}
%}
\declare@shorthand{spanglish}{"a}{\esabrv{a}}
\declare@shorthand{spanglish}{"o}{\esabrv{o}}
\declare@shorthand{spanglish}{"e}{\protect\xp@esabrv@r{e}}
\declare@shorthand{spanglish}{"A}{\esabrv{A}}
\declare@shorthand{spanglish}{"O}{\esabrv{O}}
\declare@shorthand{spanglish}{"E}{\protect\xp@esabrv@r{E}}
\declare@shorthand{spanglish}{"/}% by Bezos
 {\setbox\z@\hbox{/}%
  \dimen@\ht\z@
  \advance\dimen@-1ex
  \advance\dimen@\dp\z@
  \dimen@.31\dimen@
  \advance\dimen@-\dp\z@
  \ifdim\dimen@>0pt
   \kern.01em\lower\dimen@\box\z@\kern.03em
  \else
   \box\z@
  \fi}
\declare@shorthand{spanglish}{"?}
 {\setbox\z@\hbox{?`}%
  \leavevmode\raise\dp\z@\box\z@}
\declare@shorthand{spanglish}{"!}
 {\setbox\z@\hbox{!`}%
  \leavevmode\raise\dp\z@\box\z@}
\addto\extrasspanglish{%
  \babel@save{\-}%
  \def\-{\bbl@allowhyphens\discretionary{-}{}{}\bbl@allowhyphens}}
% the following code from spanish.ldf 5.x, by Bezos
%
\ifxp@latex
\addto\mathspanglish{\xp@sdef\dotlessi{\protect\xp@dotlessi}}
\let\nomathspanglish\relax
 \def\xp@texti{\i}
 \addto\@uclclist{\dotlessi\xp@texti}
\fi
%
\ifxp@latex
 \def\xp@dotlessi{%
  \ifmmode
   {\ifnum\mathgroup=\m@ne
     \imath
    \else
     \count@\escapechar \escapechar=\m@ne
     \expandafter\expandafter\expandafter
      \split@name\expandafter\string\the\textfont\mathgroup\@nil
     \escapechar=\count@
     \@ifundefined{\f@encoding\string\i}%
      {\edef\f@encoding{\string?}}{}%
     \expandafter\count@\the\csname\f@encoding\string\i\endcsname
     \advance\count@"7000
     \mathchar\count@
    \fi}%
  \else
   \i
  \fi}
\else
 \def\xp@dotlessi{\textormath{\i}{\mathchar"7010}}
\fi
%
\ifxp@latex
\def\accentedoperators{%
 \def\xp@op@ac##1{\acute{\if i##1\dotlessi\else##1\fi}}}
\def\unaccentedoperators{%
 \def\xp@op@ac##1{##1}}
\accentedoperators
\def\spacedoperators{\let\xp@op@sp\,}
\def\unspacedoperators{\let\xp@op@sp\@empty}
\spacedoperators
\addto\mathspanglish{\xp@operators}
%
\else
 \let\operator@font\rm
\fi
%
\def\xp@operators{%
 \xp@sdef\bmod{\nonscript\mskip-\medmuskip\mkern5mu
  \mathbin{\operator@font m\xp@op@ac od}\penalty900\mkern5mu
  \nonscript\mskip-\medmuskip}%
 \@ifundefined{@amsmath@err}%
  {\xp@sdef\pmod##11{\allowbreak\mkern18mu
    ({\operator@font m\xp@op@ac od}\,\,##11)}}%
  {\xp@sdef\mod##1{\allowbreak\if@display\mkern18mu
    \else\mkern12mu\fi{\operator@font m\xp@op@ac od}\,\,##1}%
   \xp@sdef\pmod##1{\pod{{\operator@font m\xp@op@ac od}%
    \mkern6mu##1}}}%
 \def\xp@a##1 {%
  \if^##1^% empty? continue
   \bbl@afterelse
   \xp@a
  \else
   \bbl@afterfi
   {\if&##1% &? finish
   \else
    \bbl@afterfi
    \begingroup
    \let\,\@empty % ignore when def'ing name
    \let\acute\@firstofone % id
    \edef\xp@b{\expandafter\noexpand\csname##1\endcsname}%
    \def\,{\noexpand\xp@op@sp}%
    \def\acute{\noexpand\xp@op@ac}%
    \edef\xp@a{\endgroup
     \noexpand\xp@sdef\expandafter\noexpand\xp@b{%
       \mathop{\noexpand\operator@font##1}\nolimits}}%
    \xp@a % restores itself
   \xp@a
  \fi}%
 \fi}%
 \let\xp@b\spanglishoperators
 \addto\xp@b{ }%
 \expandafter\xp@a\xp@b l\acute{i}m l\acute{i}m\,sup
  l\acute{i}m\,inf m\acute{a}x \acute{i}nf m\acute{i}n
  sen tg arc\,sen arc\,cos arc\,tg & }
\def\spanglishoperators{cotg cosec senh tgh }
\DeclareTextCompositeCommand{\'}{OT1}{i}{\@tabacckludge'{\i}}
%
\addto\extrasspanglish{%
 \def\@alph#1%
  {\ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or
   k\or l\or m\or n\or \~n\or o\or p\or q\or r\or s\or t\or u\or v\or
   w\or x\or y\or z\else\@ctrerr\fi}%
 \def\@Alph#1%
  {\ifcase#1\or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or
   K\or L\or M\or N\or \~N\or O\or P\or Q\or R\or S\or T\or U\or V\or
   W\or X\or Y\or Z\else\@ctrerr\fi}
 }
%
\ifxp@latex
  \addto\textspanish{%
    \babel@save\lsc
    \def\lsc{\protect\xp@lsc}}
%
  \def\xp@lsc#1{%
    \leavevmode
    \hbox{\scshape\selectfont
       \expandafter\ifx\csname\f@encoding/\f@family/\f@series
           /n/\f@size\expandafter\endcsname
         \csname\curr@fontshape/\f@size\endcsname
         \csname S@\f@size\endcsname
         \fontsize\sf@size\z@\selectfont
           \PackageInfo{spanglish}{Replacing undefined sc font\MessageBreak
                                 shape by faked small caps}%
         \MakeUppercase{#1}%
       \else
         \MakeLowercase{#1}%
       \fi}}
\fi
            %<<<<<<
\ifxp@latex
 \def\spanglishlayout{% nothing fancy
 \def\theenumii{\alph{enumii}}
 \def\theenumiii{\arabic{enumiii}}
 \def\theenumiv{\alph{enumiv}}
 \def\labelenumii{{\itshape\theenumii})}
 \def\labelenumiii{{\upshape\theenumiii})}
 \def\labelenumiv{{\itshape\theenumiv}\ensuremath{'}}
 \def\p@enumii{{\itshape\theenumii}}
 \def\p@enumiii{{\theenumiii}}
 \def\p@enumiv{{\itshape\theenumiv}\ensuremath{'}}
 \let\@afterindentfalse\@afterindenttrue%
 \@afterindenttrue%
 \def\@fnsymbol##1%
  {\ifcase##1\or*\or**\or***\or****\or
   *****\or******\else\@ctrerr\fi}%
  \def\@roman##1{\protect\xp@roman{\number##1}}%
  \def\xp@roman##1{\protect\xp@lsc{\romannumeral##1}}%
  \def\esromanindex##1##2{##1{\protect\xp@lsc{##2}}}
  }
\AtEndOfPackage{%
  \RequirePackage{esindex}%
  \def\bbl@tempa{spanglish}%
  \ifx\bbl@main@language\bbl@tempa%
  \AtBeginDocument{\spanglishlayout}\fi%
  }
\fi
%%
%% This patch fixes a bug in \bbl@activate; 
%% it may be removed as soon as \bbl@activate 
%% is fixed in the kernel of babel.
%% Thanks to Javier Bezos for fixing this one.
%% 
\gdef\bbl@activate#1{%
 \begingroup
  \lccode`\~=`#1
  \lowercase{%
 \endgroup
 \def~{\bbl@use@shorthand~}}}

\def\bbl@use@shorthand{%
 \ifx\thepage\relax
  \bbl@afterelse
  \string
 \else
  \bbl@afterfi
  {\ifx\protect\@unexpandable@protect
   \bbl@afterelse
   \noexpand
  \else
   \bbl@afterfi
   \bbl@use@sh
  \fi}%
 \fi}

\def\bbl@use@sh#1{%
 \if@safe@actives
  \bbl@afterelse
  \string#1%
 \else%
  \bbl@afterfi
  \textormath
   {\csname active@char\string#1\endcsname}%
   {\csname normal@char\string#1\endcsname}%
 \fi}

%%
%% End of patch.
\ldf@finish{spanglish}
\endinput
%%
%% End of file `spanglish.ldf'.