% \iffalse meta-comment
%
% Copyright (C) 1997 - 2021
%        Javier Bezos (www.texnia.com)
%     and
%        CervanTeX (www.cervantex.es)
%
% 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
%
% 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.
% \fi
%
% \ProvidesFile{spanish.dtx}
%       [2021/05/27 v5.0q Spanish support from the babel system]
%\iffalse
%% File `spanish.dtx'
%
%% Spanish Language Definition File
%% Copyright (C) 1997 - 2016
%%        Javier Bezos (www.tex-tipografia.com)
%%     and
%%        CervanTeX (www.cervantex.es)
%
%% Please report errors to: Javier Bezos (preferably)
%%                          www.tex-tipografia.com
%
%    This file is part of the babel system, it provides the source
%    code for the Spanish language definition file.
%    The original version of this file was written by Javier Bezos.
%    The latest release is available on CTAN:/language/spanish/
% \fi
%
% \iffalse
%<*filedriver>
\let\ooverb\verb
\documentclass[spanish,a4paper]{ltxdoc}
\let\verb\ooverb
\usepackage{babel}
\usepackage{hyperref}

\let\meta\emph

\usepackage{pslatex,mathptmx,color}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\newcommand\act[1]{%
 \\%
 \makebox[1.5pc][l]{\textcolor{green}{$\surd$}}%
 \textsf{#1}\ignorespaces}
\newcommand\deact[1]{%
 \\%
 \makebox[1.5pc][l]{\textcolor{red}{$\times$}}%
 \texttt{#1}\ignorespaces}
\newcommand\txt{\makebox[1.5pc][l]{\textcolor{blue}{$\Rightarrow$}}\ignorespaces}
\newcommand\con{\makebox[1.5pc][l]{\textcolor{magenta}{$\star$}}\ignorespaces}
\newcommand\alw{%
 \\%
 \makebox[1.5pc][l]{\textcolor{green}{$\surd$}}%
 Se define siempre, sin depender de un grupo.}
\newcommand\opp{\qquad Opción de paquete}

\newcommand*\babel{\textsf{babel}}
\newcommand*\file[1]{\texttt{#1}}

\setlength{\arrayrulewidth}{2\arrayrulewidth}
\newcommand\toprule[1]{\cline{1-#1}\\[-2ex]}
\newcommand\botrule[1]{\\[.6ex]\cline{1-#1}}
\newcommand\hmk{$\string|$}

\newenvironment{decl}[1][]%
 {\par\small\addvspace{4.5ex plus 1ex}%
  \vskip-\parskip
  \ifx\relax#1\relax
    \def\@decl@date{}%
  \else
    \def\@decl@date{\NEWfeature{#1}}%
  \fi
  \noindent
  \begin{tabular}{|l|}\hline\ignorespaces}%
 {\\\hline\end{tabular}\nobreak\@decl@date\par\nobreak
  \vspace{2.3ex}\vskip-\parskip}

\newcommand\New[1]{%
 \leavevmode\marginpar{\raggedleft\sffamily Nuevo en #1}}

\newcommand\nm[1]{\unskip\,$^{#1}$}
\newcommand\nt[1]{\quad$^{#1}$\,\ignorespaces}

\makeatletter
 \renewcommand\@biblabel{}
\makeatother

\newcommand\DOT[1]{\lsc{DOT},~#1}
\newcommand\DTL[1]{\lsc{DTL},~#1}
\newcommand\MEA[1]{\lsc{MEA},~#1}

\raggedright
\setlength{\parindent}{0em}
\setlength{\parskip}{3pt}

\addtolength{\oddsidemargin}{-4pc}
\addtolength{\textwidth}{7pc}

\OnlyDescription
\begin{document}

\title{Estilo \textsf{spanish}\\
para el sistema \babel.\footnote{Este archivo está actualmente
en la versión 5.0q con fecha 3 de mayo del 2021.
Esta copia del manual se compuso el~\today.}}

\author{Javier Bezos\footnote{Por favor, envíen comentarios y
sugerencias en http://www.texnia.com/spanish.html, donde se puede
encontrar más información sobre este estilo, cómo usarlo y las
decisiones tomadas. Han colaborado de una u otra forma muchas personas,
a las cuales agradezco sus comentarios y sugerencias; en particular,
han sido muy activos Juan Luis Varona y José Luis Rivera. Para errores:
https://github.com/jbezos/babel-spanish.}}

\date{27 de mayo del 2021}

\maketitle

{\small\tableofcontents}

\section*{Símbolos empleados}

\begin{itemize}
\item[\textcolor{blue}{$\Rightarrow$}] Macros para ser usadas en el
 texto (generan texto o lo estructuran).
\item[\textcolor{magenta}{$\star$}] Macros de configuración y
 preferencias.
\item[\textcolor{green}{$\surd$}] Grupo que activa la orden.
\item[\textcolor{red}{$\times$}] Opciones de paquete que anulan la
 orden. En redonda van las destinadas específicamente a anular ese
 punto, y en cursiva las que además anulan otros aspectos del estilo.
\end{itemize}

\section{Uso de \textsf{spanish} para babel}

El estilo \textsf{spanish} para babel adapta una serie de elementos de
los documentos de \LaTeX\ al castellano, tanto en las traducciones
como en la tipografía.  Para usarlo, basta con dar la opción
\textsf{spanish} al cargar babel:
\begin{verbatim}
\usepackage[spanish]{babel}
\end{verbatim}

Esto es todo lo que hace falta para conseguir que el documento tenga
un aspecto español. En caso de estar en México, véase, además, el
apartado \ref{paises} (<<Opciones por países>>):\footnote{En próximas
versiones se añadirán más países.}
\begin{verbatim}
\usepackage[spanish,mexico]{babel}
\end{verbatim}

El estilo \textsf{spanish} se puede cargar junto con otras lenguas
(véase el manual de babel). Si \textsf{spanish} es la última de las
lenguas cargadas, entonces se considera la lengua principal y se hacen
ajustes tipográficos adicionales. En particular, se
modifican órdenes y entornos como:
\begin{center}
\begin{tabular}{lll}
|enumerate| &  |\roman|    &  |\section|\\
|itemize|   &  |\fnsymbol| &  |\subsection|\\
|\%|        &  |\alph|     &  |\subsubsection|\\
                &  |\Alph|     & \\
\end{tabular}
\end{center}

El estilo está pensado para que sea fácilmente configurable.  Para
ello, se proporcionan una serie de opciones de paquete, que en caso de
emplearse deben ir \textit{después} de \textsf{spanish}.  Por ejemplo:
\begin{verbatim}
\usepackage[french, spanish,es-noindentfirst]{babel}
\end{verbatim}
carga los estilos para el francés y el español, esta última como
lengua principal; además, evita que \textsf{spanish} sangre el
primer párrafo tras un título.  Otras opciones se pueden ajustar por
medio de macros, en particular aquellas que se puede desear cambiar
en medio del documento (por ejemplo, el formato de la fecha). Todas
estas opciones se pueden pasar como modificadores de la lengua:
\begin{verbatim}
\usepackage[french spanish.noindentfirst]{babel}
\end{verbatim}

Los cambios están organizados en una serie de grupos:
\textsf{captions, date, text, math} y \textsf{shorthands}.  Los tres
ultimos corresponden a lo que en babel sería normalmente
\textsf{extras}.

\section{\textsf{spanish} como lengua principal}

Si la lengua principal es \textsf{spanish}, se introducen una serie de
cambios en el momento de cargar la lengua para adaptar varios
elementos a los usos tipográficos españoles.  Estos cambios funcionan
con las clases estándar "+--con otras tal vez alguno de ellos no tenga
efecto--- y perduran todo el documento.  Ninguno de ellos es necesario
para componer el documento, aunque naturalmente el resultado será
distinto.

\subsection{Listas}

\begin{decl} \txt |\begin{enumerate} ... \end{enumerate}|%
\deact{es-nolists, es-noenumerate, \textit{es-nolayout, es-minimal,
es-sloppy}} \end{decl}

Usa la siguiente secuencia:\\
\quad 1.\\
\qquad \emph{a})\\
\quad\qquad 1)\\
\qquad\qquad \emph{a$'$})

\begin{decl} \txt |\begin{itemize} ... \end{itemize}|%
\deact{es-nolists, es-noitemize, \textit{es-nolayout, es-minimal,
es-sloppy}} \end{decl}

Usa la siguiente secuencia:\\
\quad\leavevmode\hbox to 1.2ex
   {\hss\vrule height .95ex width .8ex depth -.15ex\hss}\\
\qquad\textbullet\\
\quad\qquad $\circ$\\
\qquad\qquad $\diamond$

\begin{decl}
\con  |\spanishdashitems    \spanishsignitems|
\end{decl}

Dos órdenes para cambiar a otros estilos en |itemize|: rayas en todos
los niveles y \textbullet{} $\circ$ $\diamond$ $\triangleright$,
respectivamente.

\begin{decl}
\con  |es-nolists|\opp
\end{decl}

Desactiva los cambios en las listas (aunque |\es@enumerate| y
|\es@itemize| siguen disponibles).

\subsection{Contadores}

\begin{decl}
\txt |\alph    \Alph|\deact{\textit{es-nolayout, es-sloppy}}
\end{decl}

Incluyen la eñe.

\begin{decl}
\txt  |\fnsymbol|\deact{\textit{es-nolayout, es-sloppy}}
\end{decl}

Se emplean uno, dos, tres... asteriscos (*, **, ***, etc.), en lugar
de la sucesión angloamericana de cruces, barras,
etc.\footnote{\DOT{162}.}

\begin{decl}
\txt  |\roman|\deact{es-ucroman, es-lcroman, \textit{es-nolayout, es-minimal, es-sloppy}}
\end{decl}

Como en castellano no se usan números romanos en minúscula, |\roman|
se redefine para que los dé en versalitas.\footnote{\DTL{197}.} La
opción de paquete |es-minimal| los desactiva con |es-ucroman|, y
|es-sloppy| con |es-lcroman|.

\begin{decl}
\con  |es-ucroman|\opp
\end{decl}

Opción de paquete adicional, que pasa los romanos a versales, en
caso de que no se quiera la versalita o por incompatibilidad con algún
paquete que use de forma indebida |\roman|.\footnote{En el momento de
escribir esto, como mínimo son: \textsf{dramatist, epiolmec,
flashcards, lipsum, ntheorem, ntheorem-hyper, texmate.} Otros paquetes
como \textsf{hyperref, easy} y \textsf{exam} ya han sido corregidos.}

\begin{decl}
\con  |es-lcroman|\opp
\end{decl}

Como último recurso, de haber problemas con el valor predeterminado o
con |es-ucroman|, con esta opción de paquete puede dejarse la
definición de \LaTeX, aunque en español los romanos en minúscula sean
una falta ortográfica.

\begin{decl}
\con  |es-preindex|\opp
\end{decl}

\textit{MakeIndex} no puede entender cómo escribe |\roman|
el número de página, por lo que elimina las líneas afectadas.  Por
ello, el archivo |.idx| ha de ser convertido antes de procesarlo con
\textit{MakeIndex}.  Con este paquete se proporciona la utilidad
|romanidx.sty| que se encarga de ello.  Simplemente se compone ese
archivo con \LaTeX{} y a continuación se responde a las preguntas que
se formulan; el archivo resultante, es decir, el que hay que procesar
con \textit{MakeIndex,} tiene la extensión \texttt{eix}.

Este proceso no es necesario si no se introdujo ninguna entrada de
índice en páginas numeradas con |\roman| (lo cual será lo más normal).
Si un símbolo propio de \emph{MakeIndex} generara problemas, debe
encerrarse entre llaves: \verb={"|}=.

Con la opción de paquete |es-preindex| se llama desde el documento
|romanidx.sty|, de forma que no es necesaria su ejecución
aparte. Tampoco pide ningún dato, sino que ha de darse en el documento
principal con la siguiente orden.

\begin{decl}
\con  |\spanishindexchars|\marg{encap}\marg{open\_range}\marg{close\_range}
\end{decl}

De usarse |es-preindex| con un estilo de índice que no tiene los
valores predeterminados de estos tres caracteres especiales, hay que
darlos con esta orden (es decir, por omisión es
\verb+\spanishindexchars{|}{(}{)}+).

\begin{decl}
\con  |\spanishscroman    \spanishlcroman    \spanishucroman|
\end{decl}

Estas tres macros permiten cambios temporales en el documento de
|\roman| a versalitas, minúsculas y mayúsculas, respectivamente.

\subsection{Otros}

\begin{decl}
\txt  |\guillemotleft    \guillemotright|\deact{\textit{es-nolayout, es-sloppy}}
\end{decl}

Las comillas latinas para |OT1| son menos angulosas y se generan con
unas puntas de flecha de |lasy|. En |T1| no hay cambios.

\begin{decl}
\txt  |\section|, |\subsection|, etc.,
|\tableofcontents|\deact{es-nosectiondot, es-noindentfirst, \textit{es-nolayout,
es-mininal, es-sloppy}}
\end{decl}

Los números en los títulos están seguidos de un punto tanto en el
texto como en el índice. Además, el primer párrafo tras el título no
elimina la sangría.

\begin{decl}
\con  |es-nolayout|\opp
\end{decl}

Si no se desea ninguno de estos cambios, basta con usar esta opción de
paquete.

\section{Traducciones}

\subsection{Nombres}

\begin{decl}
\txt  |\refname|, |\tablename|, |\contentsname|, etc.\\
\con  |\spanishrefname|, |\spanishtablename|, |\spanishcontentsname|, etc.
\act{captions}
\end{decl}

Establecen las traducciones al castellano de algunos términos, tal y
como se describe en el cuadro 1.  Para cambiar el texto de ellas,
conviene redefinir la forma que empieza con |\spanish...|, ya que, al
contrario que las órdenes |\refname|, |\abstractname|, etc., se pueden
redefinir cuando se desee y entran en acción al momento y de forma
permanente, sin necesidad de |\addto|.

\begin{table}
\center\small
\newcommand\name[2]{%
\texttt{\textbackslash#1name}&%
\texttt{\textbackslash spanish#1name}&}
\caption{Traducciones}
\vspace{1.5ex}
\begin{tabular}{l@{\hspace{3em}}l@{\hspace{3em}}l}
\toprule3
\name{ref}        & Referencias\\
\name{abstract}   & Resumen\\
\name{bib}        & Bibliografía\\
\name{chapter}    & Capítulo\\
\name{appendix}   & Apéndice\\
\name{contents}   & índice general\nm{a}\\
\name{listfigure} & índice de figuras\\
\name{listtable}  & índice de cuadros\\
\name{index}      & índice alfabético\\
\name{figure}     & Figura\\
\name{table}      & Cuadro\\
\name{part}       & Parte\\
\name{encl}       & Adjunto\\
\name{cc}         & Copia a\\
\name{headto}     & A\\
\name{page}       & página\\
\name{see}        & véase\\
\name{also}       & véase también\\
\name{proof}     & Demostración
\botrule3
\end{tabular}

\vspace{1.5ex}

\begin{minipage}{10cm}\footnotesize
\nt{a} Pero solo <<índice>> en \textsf{article}.
\end{minipage}
\end{table}

\begin{decl}
\con  |es-uppernames|\opp
\end{decl}

Aunque sea un anglicismo,\footnote{\DOT{197}.} con esta opción de
paquete los sustantivos tienen mayúscula inicial.

\begin{decl}
\con  |es-tabla|\opp
\end{decl}

En caso de que todos los cuadros sean tablas, esta opción permite
cambiar \textit{cuadro} por \textit{tabla} (en cierto modo,
\textit{cuadro} es a \textit{tabla} lo que \texttt{table} es a
\texttt{tabular}).

\subsection{Fechas}

\begin{decl}
\txt  |\today    \Today|
\act{date}
\end{decl}

Fecha actual, en la forma \textit{1 de enero de 2004.} Con |\Today| el
mes va en mayúscula. Estas macros se definen a su vez con las siguientes.

\begin{decl}
\txt  |\spanishdate|\marg{año}\marg{mes}\marg{día}
 |    \spanishDate|\marg{año}\marg{mes}\marg{día}\alw
\end{decl}

El orden de los datos es el de la ISO. Así, |\today| es lo mismo que
|\spanishdate{\year}{\month}{\day}|. Solo maneja bien (de momento) los
años de nuestra era.

\begin{decl}
\con  |\spanishdatedel    \spanishdatede|
\end{decl}

Con la primera se cambia el formato para que a partir del 2000 se
emplee \textit{del} y no \textit{de} (recomendado).  La segunda hace
justo lo contrario (predeterminado).

\begin{decl}
\con  |\spanishreverseddate|
\end{decl}

Cambia el formato de |\today| a la forma \textit{enero 1 del 2004.}
Con |\Today| el mes va en mayúscula.

\begin{decl}
\con  |\spanishdatefirst|\marg{día-uno}
\end{decl}

Establece el formato del primer día. Por defecto es \textit{1}, pero
se puede cambiar a \textit{1.º}, por ejemplo.

\section{Abreviaciones (\textit{shorthands})}

La lista completa se puede encontrar en el cuadro 2.  En los
siguientes apartados sedarán más detalles sobre algunas de ellas.

\begin{table}[!t]
\center\small
\caption{Abreviaciones}
\vspace{1.5ex}
\begin{tabular}{l@{\hspace{3em}}l@{\hspace{3em}}l}
\toprule2
|á é í ó ú| & á é í ó ú\\
|á é í ó ú| & á é í ó ú\\
|ñ ñ|          & ñ ñ\nm{a}\\
|"u "U|          & "u "U\\
|"i "I|          & "i "I\\
|"a "A "o "O|    & Ordinales: 1"a, 1"A, 1"o, 1"O\\
|"er "ER|        & Ordinales: 1"er, 1"ER\\
|"c "C|          & "c "C\\
|"rr "RR|        & rr, pero -r cuando se divide\\
|"y|             & El antiguo signo para <<y>>\\
|"-|             & Como |\-|, pero permite más divisiones\\
|"=|             & Como |-|, pero permite mas divisiones\nm{b}\\
|"~|             & Guión estilístico\nm{c}\\
|"+ "+- "+--|    & Como |-|, |--| y |---|, pero sin división\\
|~- ~-- ~---|    & Lo mismo que el anterior.\\
|""|             & Permite mas divisiones antes y después\nm{d}\\
|"/|             & Una barra algo más baja\\
\verb+"|+        & Divide un logotipo\nm{e}\\
|"< ">|          & "< ">\\
|"` "'|          & |\begin{quoting}| |\end{quoting}|\nm{f}\\
|<< >>|          & Lo mismo que el anterior.\\
|?` !`|          & ?` !`\nm{g}\\
|"? "!|           & "? "! alineados con la linea base\nm{h}
\botrule2
\end{tabular}

\vspace{1.5ex}

\begin{minipage}{11cm}
\footnotesize
\nt{a} La forma |~n| no está activada por omisión a partir de
la versión 5.
\nt{b} |"=| es lo mismo que |""-""|.
\nt{c} Esta abreviación tiene un uso distinto en otras lenguas
de babel.
\nt{d} Como en <<entrada/salida>>.
\nt{e} Carece de uso en castellano.
\nt{f} Véase sec.~2.7.
\nt{g} No proporcionadas por este paquete, sino por cada tipo;
figuran aquí como simple recordatorio.
\nt{h} útiles en rótulos en mayúsculas.
\end{minipage}
\end{table}

Los caracteres usados como abreviaciones se comportan como otras
órdenes de \TeX{} y por tanto se hace caso omiso de los espacios que
les puedan seguir: \verb*|' a| es lo mismo que |á|. Eso también implica
que tras esos caracteres no puede ir una llave de cierre y que deberá
escribirse |{... '{}}| en lugar de |{... '}|; en modo matemático no
hay ningún problema y |$x^{a'}$| ($x^{a'}$) es válido.

\begin{decl}
\con  |activeacute|\opp
\end{decl}

Para poder usar apóstrofos como abreviaciones de acentos es necesaria
esta opción en |\usepackage|.  Puede cambiarse este comportamiento con
|\es@acuteactive| en el archivo de configuración |spanish.cfg|; en ese
caso los apóstrofos se activan siempre.

\begin{decl}
\con  |es-tilden|\opp
\end{decl}

Esta orden activa las abreviaciones |~n| y |~N| por compatibilidad con
versiones anteriores de \textsf{spanish} (y siempre que no se emplee
también |es-notilde|). En la versión 5 no están activadas de forma
predeterminada.

\begin{decl}
\con  |\spanishdeactivate|\marg{caracteres}
\end{decl}

Permite desactivar las abreviaciones correspondientes a los caracteres
dados. Para evitar entrar en conflicto con otras lenguas, al salir de
\textsf{spanish} se reactivan,\footnote{El punto para los decimales no
es estrictamente una abreviación y no se reactiva.} por lo que si se
desea que persistan hay que añadir la orden a |\shorthandsspanish| con
|\addto|. La orden |\renewcommand\shorthandsspanish{}| es una variante
optimizada de
\begin{verbatim}
\addto\shorthandsspanish{\spanishdeactivate{.'"~<>}}
\end{verbatim}

\begin{decl}
\con  |es-noshorthands|\opp
\end{decl}

No activa ninguna abreviación.

\subsection{Coma decimal}

\begin{decl}
\txt  |.|\textit{número}\act{shorthands}\deact{es-nodecimaldot,
\textit{es-noshorthands, es-minimal, es-sloppy}}
\end{decl}

En \textsf{spanish}, el punto en matemáticas sirve como marca decimal
genérica que puede representarse como coma o punto; funciona por tanto
como marcado lógico del signo para decimales. Por omisión, se siguen
las normas internacionales ISO y la legislación de diversos países
(como de España y México), tal como eran hasta el 2009, de emplear la
coma; desde el año 2010 las Academias de la Lengua recomiendan el
punto. Ya que \TeX\ usa la coma como separador en intervalos o
expresiones similares, lo que añade un espacio fino, \textsf{spanish}
interpreta todo punto en modo matemático de esta forma siempre que
esté seguido de una cifra, pero no en otras circunstancias:
\begin{quote}\small\begin{tabbing}
|$1\,234.567\,890$|     \quad \=  $1\,234.567\,890$\\
|$f(1,2)=12.34.$|        \> $f(1,2)=12.34.$\\
|$1{.}000$|              \> $1{.}000$, pero\\
|1.000|                  \> 1.000, pues no es modo matemático.
\end{tabbing}\end{quote}

\begin{decl}
\con  |\decimalcomma    \decimalpoint    \spanishdecimal|\marg{math}
\end{decl}

Las dos primeras establecen si se usa una coma (predeterminado) o un
punto, mientras que |\spanishdecimal|\marg{math} permite darle una
definición arbitraria.

\begin{decl}
\con  |es-nodecimaldot|\opp
\end{decl}

Cancela el mecanismo del punto decimal.

\subsection{División de palabras}

\textsf{Spanish} comprueba la codificación en el momento en que se
usa un acento: si es |OT1|, se toman medidas para facilitar la
división (que pese a todo nunca será perfecta), y si es |T1|,
se accede directamente al carácter correspondiente.

\begin{decl}
\txt  |"-    "=    "~|\act{shorthands}
\deact{\textit{es-noshorthands, es-sloppy}}
\end{decl}

Para matizar la división de palabras hay cuatro posibilidades, dos de
ellas con el método de abreviaciones:
\begin{itemize}
\item |\-| es un guión opcional que no permite más divisiones,
\item |"-| es similar pero permite más divisiones,
\item |-| es un guión que no permite más divisiones ni antes ni
 después, y
\item |"=| es el equivalente que sí las permite.\footnote{No es una
 buena idea usar esta orden, pero en medidas muy cortas puede
 resultar necesario.}
\end{itemize}
Por ejemplo (con las posibles divisiones marcadas con \hmk):
\begin{quote}\small\begin{tabbing}
|Zaragoza-Barcelona|\qquad \= Zaragoza-\hmk Barcelona\\
|Zaragoza"=Barcelona| \>
  Za\hmk ra\hmk go\hmk za-\hmk Bar\hmk ce\hmk lo\hmk na\\
|semi\-abierto| \> semi\hmk abierto\\
|semi"-abierto| \> se\hmk mi\hmk abier\hmk to.\footnotemark
\end{tabbing}\footnotetext{Justo antes y después de
{\ttfamily\string"\string-} y {\ttfamily\string"\string=} se aplican
los correspondientes valores de {\ttfamily\string\...hyphenmin} lo que
implica que la divisón semia\hmk bierto no es posible.  Este es un
comportamiento correcto.}
\end{quote}

Con la abreviación |"~|, el guión también aparece al comienzo de la
siguiente línea. Por ejemplo:
\begin{quote}\small\begin{tabbing}
|infra"~rojo|  \quad \= in\hmk fra-ro\hmk jo, pero infra-\hmk-rojo.
\end{tabbing}\end{quote}

\begin{decl}
\txt  |"+  "+-  "+--|\act{shorthands}\deact{\emph{no-shorthands,
es-sloppy}}
\end{decl}
\vskip-1.5pc\vskip0pt
\begin{decl}
\txt  |~-  ~--  ~---|\act{shorthands}\deact{es-notilde, \emph{no-shorthands,
es-minimal, es-sloppy}}
\end{decl}

Evitan divisiones: |~-|, que resulta útil para expresar una serie de
números sin que el guión los divida (12~-14, |12~-14|), y |~---|, que
es la forma que debe usarse para abrir incisos con rayas, ya que de lo
contrario puede haber una división entre la raya de abrir y la palabra
que le sigue:
\begin{quote}\small\begin{tabbing}
|Los conciertos ~---o % academias--- que organizó...|
\end{tabbing}\end{quote}

También pueden emplearse para esta misma función las abreviaciones
|"+|, |"+-| y |"+---|.  Mientras que este guión evita toda posible
división en los elementos que une, la raya (---) y la semirraya (--)
las permiten en las palabras que le precedan o le sigan.

Otra abreviación es |"rr| que sirve para el único cambio de escritura
que ha tenido algo de uso en una división.  La {RAE} indica que al
añadir un prefijo que termina en vocal a una palabra que comienza con
\emph{r}, esta última debe doblarse a menos que se unan por un
guión. Por ejemplo:
\begin{quote}\small\begin{tabbing}
|extra"rradio|  \quad \= ex\hmk trarra\hmk dio, pero extra-\hmk
  radio.
\end{tabbing}\end{quote}
Actualmente, este cambio se suele rechazar y la {RAE} no lo
considera.

\subsection{Otros}

\begin{decl}
\txt  |"/|\act{shorthands}\deact{\textit{es-noshorthands, es-sloppy}}
\end{decl}

Es una utilidad tipográfica más que específicamente española.  En
ciertos tipos, como Times, el extremo inferior de la barra está en la
línea de base y expresiones como <<am/pm>> resultan poco estéticas.
|"/| produce una barra que, de ser necesario, se baja ligeramente.
Computer Modern tiene una barra bien diseñada y no es posible ilustrar
aquí este punto, pero se escribiría |am"/pm|.

\begin{decl}
\txt  |"y|\act{shorthand}\deact{\textit{es-noshorthands, es-sloppy}}
\end{decl}

El signo \textit{et tironiano}, que en español se empleó muy a menudo,
se puede <<imitar>> con |"y|, siempre que se haya cargado el paquete
|graphics|; de no ser así, se usa la letra $\tau$, aunque la variante
normal de \TeX{} no es demasiado apropiada.

\section{Funciones de texto y matemáticas}

\subsection{Abreviaturas}

\begin{decl}
\txt  |\sptext|\marg{texto}\act{text}\deact{\textit{es-sloppy}}
\end{decl}

Pone un punto y le sigue el argumento en voladitas.  Para abreviaturas
como |adm\sptext{ón}| que da adm\sptext{ón}.  Hay seis abreviaciones
asociadas a ordinales: |"a|, |"A|, |"o|, |"O|, |"er| y |"ER| que
equivalen a |\sptext{a}|, etc. Muchos tipos añaden un pequeño
subrayado que debe evitarse, y por tanto no se deben escribir los
ordinales con \textsf{inputenc} (a menos que se esté seguro de que el
resultado es el que se busca).

Para ajustar el tamaño lo mejor posible, se usa el de índices en
curso. Esto funciona bien salvo para tamaños muy grandes o muy
pequeños, donde los resultados son meramente aceptables.

En Plain \TeX{} se ejecuta |\sptextfont| para la letra voladita, de
forma que |{\bf\let\sptextfont\bf 1"o}| da el resultado correcto
(|\mit| si es para cursiva). Para usar un tipo nuevo con |\sptext| hay
que definir también las variantes matemáticas con |\newfam|.

\subsection{Espaciado}

El espaciado español difiere relativamente poco del inglés, con alguna
excepción; una de ellas es que en \textsf{spanish} |\frenchspacing|
está activo.

\begin{decl}
\txt  |\...|\act{text}\deact{\textit{es-sloppy}}
\end{decl}

Puntos suspensivos menos espaciados que |\dots|. El espacio que sigue
se conserva:
\begin{quote}\small\begin{tabbing}
|\... y solo estaba\... ella.|\quad\=\... y solo estaba\... ella.
\end{tabbing}\end{quote}
También podrían escribirse los tres puntos sin más |...|, y en la
práctica no hay diferencia, a menos que se cambie el valor del espacio
tras punto; en ese caso, la forma con barra da los valores apropiados
\emph{dentro} de una sentencia, y los tres puntos \emph{al final} de
ella. Esta orden no interfiere con el valor original de |\.| (un punto
suprascrito).

\begin{decl}
\txt  |\%|\act{text}\deact{\textit{es-minimal, es-sloppy}}
\end{decl}

Se añade un espacio fino antes del signo (en concreto |\,|), con lo
cual se puede "<recuperar"> con su opuesto |\!| si |\%| no sigue a una
cifra; también se puede emplear |\percentsign|).

\begin{decl}
\con  |\spanishplainpercent|
\end{decl}

Orden para que |\%| no añada el espacio fino. Puede ser útil en
cuadros, si |\%| aparece siempre entre paréntesis.

\subsection{Fuentes}

\begin{decl}
\txt |\lsc|\marg{texto}\act{text}\deact{\textit{es-sloppy}}
\end{decl}

Pasa \textit{texto} a versalitas:
\begin{quote}\small\begin{tabbing}
|\lsc{RAE}| \quad \= \lsc{RAE}\\
|\lsc{ReNFe}| \quad \= \lsc{ReNFe}.\\
|siglo \lsc{XVII}| \quad \= siglo \lsc{XVII}\\
|capítulo \lsc{II}| \quad \= capítulo \lsc{II}.
\end{tabbing}\end{quote}

Para evitar que con un tipo que carece de versalitas acabe apareciendo
(por substitución) un texto de minúsculas se intenta usar en estos
casos las versales \emph{reales} de un tamaño menor (\LaTeX\ tiende a
sustituir versalitas por versalitas, pero hay excepciones, como con
las negritas).

\begin{decl}
\txt |\'{i}|\alw
\end{decl}

Lo mismo que |\'{\i}|.

\subsection{Entrecomillados}

\begin{decl}
\txt |\begin{quoting} ... \end{quoting}|\alw
\end{decl}

El entorno |quoting| entrecomilla un texto, añadiendo comillas de
seguir al comienzo de cada párrafo en su interior.\footnote{Se puede
encontrar una detallada exposición de las comillas en \DTL{44 ss.}  De
ahí se ha tomado algún ejemplo.}

\begin{decl}
\txt |<<    >>|\act{shorthands}\deact{es-noquoting,
  \textit{es-noshorthands, es-minimal, es-sloppy}}
\end{decl}
\vskip-1.5pc\vskip0pt
\begin{decl}
\txt |"`    "'|\act{shorthands}\deact{\textit{es-noshorthands, es-sloppy}}
\end{decl}

También se pueden emplear las abreviaciones |<<| y |>>| (o
alternativamente |"`| y |"'|) que se limitan a llamar a |quoting|, que
por ser entorno considera sus cambios internos como locales.  (Es
decir, |<< ... >>| implica |{<< ... >>}|.) Las abreviaciones |"<| y
|">| continúan dando sin más los caracteres de comillas de abrir y
cerrar, respectivamente.

Por ejemplo:
\begin{verbatim}
<<Se llaman <<comillas de seguir>> a las que son de cierre,
pero se colocan al comienzo de cada párrafo cuando se transcribe
un texto entrecomillado con más de un párrafo.

En su interior, como de costumbre, se usan inglesas.>>
\end{verbatim}
cuyo resultado es:
\begin{quotation}\small
<<Se llaman <<comillas de seguir>> a las que son de cierre,
pero se colocan al comienzo de cada párrafo cuando se transcribe
un texto entrecomillado con más de un párrafo.

En su interior, como de costumbre, se usan inglesas.>>
\end{quotation}

También se añaden comillas de seguir en listas, excepto con la opción
\texttt{es-nolists} o cualquier otra que las desactive.

Este entorno se puede redefinir, como por ejemplo:
\begin{verbatim}
\renewenvironment{quoting}{\itshape}{}
\end{verbatim}
pero en principio no implica un nuevo párrafo, ya que está pensado
para ser usado también en el texto.

\begin{decl}
\con |\lquoti| |\rquoti| |\lquotii| |\rquotii| |\lquotiii|
|\rquotiii|
\end{decl}

Controlan las comillas en |quoting|, según el nivel en que nos
encontremos. |\lquoti| son las comillas de abrir más exteriores,
|\lquotii| las de segundo nivel, etc., y lo mismo para las de cerrar
con |\rquoti|... Para las de seguir siempre se usan las de cerrar. Los
valores predefinidos están en el cuadro 3.
\begin{table}
\center\small
\caption{Entrecomillados}
\vspace{1.5ex}
\begin{tabular}{l@{\hspace{5em}}l}
\toprule2
|\lquoti|   &|"<|\\
|\rquoti|   &|">|\\
|\lquotii|  &|``|\\
|\rquotii|  &|''|\\
|\lquotiii| &|`|\\
|\rquotiii| &|'|
\botrule2
\end{tabular}
\end{table}

\begin{decl}
\con |\activatequoting    \deactivatequoting|
\end{decl}

Las incompatibilidades potenciales de estas abreviaciones son
enormes. Por ejemplo, en \textsf{ifthen} se cancelan las comparaciones
entre números;\,\footnote{Y en \texttt{\textbackslash ifnum},
\texttt{\textbackslash ifdim}, etc., usado por los desarrolladores en
los paquetes.} también resultan inoperantes |@>>>| y |@<<<| de
\textsf{amstex}.\footnote{Aunque en este caso cabe usar los sinónimos
|@)))| y |@(((|.}  Por ello, se da la posibilidad de cancelarlas y
reactivarlas con estas órdenes, aunque si se está usando
\textsf{xmltex} ya se desactivan por completo de forma automática. El
entorno |quoting| siempre permanece disponible.\footnote{Algunos tipos
disponen de esta ligadura de forma interna para generar los caracteres
de comillas, por lo que en ellos también podemos usarlos siempre,
aunque los ajustes proporcionados por \textsf{spanish} se pueden
perder; por otra parte, tampoco se usan demasiado a menudo.}

\subsection{Funciones matemáticas}

\begin{decl}
\txt |\lim \limsup \liminf \bmod \pmod \sen \tg|
etc.\act{math}\deact{\textit{es-minimal, es-sloppy}}
\end{decl}

Tradicionalmente, las abreviaciones de lo que en \TeX\ se conocen como
operadores se han formado a partir del nombre castellano, lo que
implica la presencia del acento en lím (en sus tres formas |\lim|,
|\limsup| y |\liminf|), máx, mín, ínf y mód (en sus dos formas |\bmod|
y |\pmod|).

Con \textsf{spanish} pueden seguirse varias convenciones con ayuda de
las siguientes órdenes:
\begin{decl} \con |\accentedoperators| |\unaccentedoperators|
\end{decl}
Activa o desactiva los acentos.  Por omisión se acentúan, como por
ejemplo: $\lim_{x\to 0}(1/x)$ (|$\lim_{x\to 0}(1/x)$|).

\begin{decl}
\con |\spacedoperators| |\unspacedoperators|
\end{decl}
Activa o desactiva el espacio entre "<arc"> y la función.  Lo habitual
ha sido con espacio; así pues, por omisión se espacia.

También se añaden |\sen|, |\arcsen|, |\tg| y |\arctg|, que dan las
funciones respectivas.
\begin{decl}
\con |\spanishoperators|
\end{decl}

Otras funciones trigonométricas se encuentran almacenadas en el
parámetro |\spanishoperators|, que inicialmente incluye cotg, cosec,
senh y tgh. Estas funciones se han separado porque su forma no está
normalizada en el ámbito hispanohablante. De esta forma se puede
cambiar por otras con, por ejemplo:
\begin{verbatim}
\renewcommand{\spanishoperators}{ctg arc\,ctg sh ch th}
\end{verbatim}
(separadas con espacio). Cuando se selecciona \textsf{spanish} se
crean órdenes con esos nombres y que dan esas funciones (siempre con
|\nolimits|). Además de las letras sin acentuar se aceptan las órdenes
|\,| y |\acute|, que se pasan por alto para formar el nombre. Por
ejemplo, |arc\,ctg| se escribe en el documento con |\arcctg|,
|M\acute{a}x| como |\Max| y |cr\acute{i}t| como |\crit| (hay que usar
|i| y no |\dotlessi|).  La orden |\,| responde a
|\|(|un|)|spacedoperators|, y |\acute| a |\|(|un|)|accentedoperators|.

Conviene que |\spanishoperators| esté en el preámbulo del documento en
sí, antes de |\selectspanish| o de |\begin{document}|.

\begin{decl}
\txt |\dotlessi|\act{math}\deact{\textit{es-sloppy}}
\end{decl}

La \textit{i} sin punto también es accesible directamente en modo
matemático con |\dotlessi|, de forma que se puede escribir
|\acute{\dotlessi}|. Por ejemplo,
|$V_{\mathbf{cr\acute{\dotlessi}t}}$| da
$V_{\mathbf{cr\acute{\dotlessi}t}}$.

De momento no funciona con luatex ni xetex, por lo que en estos
sistemas hay que desactivar la acentuación (donde se usa |\dotlessi|)
o reajustar las definiciones matemáticas.

\section{Opciones generales}

Están pensadas principalmente para documentos basados en una clase
o un estilo editorial muy preciso que no debe tocarse. Para conocer
los cambios exactos, véanse las diferentes entradas que describen
las funciones de \textsf{spanish}.

\begin{decl}
\con |es-minimal|\opp
\end{decl}

Anula la mayoría de los cambios pero deja unas cuantas utilidades que
pueden resultar utiles en el momento de escribir el texto.

\begin{decl}
\con |es-sloppy|\opp
\end{decl}

Anula, además, todas las ligaduras sin excepción, la eñe en listas y
los grupos \textsf{text} y \textsf{math}.

\section{Selección}

\begin{decl}
|\selectspanish|
\end{decl}

Por omisión, \babel{} deja <<dormidas>> las lenguas hasta que se llega
a |\begin{document}| con el fin de evitar conflictos por las
abreviaciones; a cambio, se priva de la posibilidad de usar las
lenguas en el preámbulo en órdenes como |\savebox|, |\title|,
|\newtheorem|, etc.

La orden |\selectspanish| permite activar \textsf{spanish} con sus
extensiones y abreviaciones antes de
|\begin{document}|.\footnote{Algunos detalles, que apenas afectan a
\textsf{spanish}, siguen sin activarse hasta el comienzo del
documento.}  De esta forma, podríamos decir
\begin{verbatim}
\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[cp1252]{inputenc}
\usepackage[spanish,activeacute,es-notilde]{babel}
.. % Mas paquetes

\selectspanish

\title{Título}
\author{Autor}
\newcommand{\pste}{para"-psicológicamente}
..   % Mas definiciones

\begin{document}
\end{verbatim}

\section{Adaptación}

\subsection{Opciones por países}
\label{paises}

\begin{decl} \con |mexico| \quad |mexico-com|\end{decl}

La primera cambia \textit{cuadro} a \textit{tabla} y desactiva tanto
|<||<>||>| como el punto decimal. También cambia |"`| y |"'| a
``\,`\,"<\,">\,'\,''. Es decir, aparte de redefinir las comillas, equivale a:
\begin{verbatim}
\usepackage[spanish,es-nodecimaldot,es-tabla,es-noquoting]{spanish}
\end{verbatim}
La segunda es similar pero sí activa el punto decimal. (Obsérvese que
no van precedidas de |es-|.)

Probablemente, esta opción también sea apropiada en algunos países de
América Central y del Sur.

\subsection{Configuración}

En sus últimas versiones, \babel{} ofrece la posibilidad de cargar
automáticamente un archivo con el mismo nombre que el principal, pero
con extensión |.cfg|. Aunque se desaconseja su uso, \textsf{spanish}
proporciona unas pocas órdenes para ser usadas en este archivo.

\begin{decl}
\con |\es@activeacute|
\end{decl}
Activa las abreviaciones con apóstrofos, sin que sea necesario incluir
|activeacute| como opción en |\usepackage|.

\begin{decl} \con |\es@enumerate{<leveli>}|%
    |{<levelii>}{<leveliii>}{<leveliv>}|\alw
\end{decl}
Cambia los valores preestablecidos por \textsf{spanish} para
|enumerate|. \textit{leveln} consiste en una letra, que indica qué
formato tendrá el número, seguida de cualquier texto. La letra tiene
que ser: |1| (arábigo), |a| (minúscula \emph{cursiva}\,\footnote{La
letra es cursiva pero no los signos que le puedan seguir. Más bien
debería decirse destacada, ya que se usa |\string\emph|.  Véase
\DTL{11}.}), |A| (versal), |i| (romano \emph{versalita}), |I| (romano
versal) o finalmente |o| (ordinal\,\footnote{Lo normal es no añadir
ningún signo tras ordinal.}).

Esta orden no está pensada para hacer cambios elaborados, sino
solo meros reajustes. Los valores preestablecidos
equivalen a
\begin{verbatim}
\es@enumerate{1.}{a)}{1)}{a$'$)}
\end{verbatim}

\begin{decl} \con |\es@itemize{<leveli>}|%
    |{<levelii>}{<leveliii>}{<leveliv>}|\alw
\end{decl}
Lo mismo para |itemize|, solo que los argumentos se usan de forma
literal. Los valores originales de \LaTeX{} son similares a
\begin{verbatim}
\es@itemize{\textbullet}{\normalfont\bfseries\textendash}
  {\textasteriskcentered}{\textperiodcentered}
\end{verbatim}

\begin{decl}\con |\es@operators|\act{math}
\end{decl}
Todo lo relativo a operadores se cancela con
\begin{verbatim}
\let\es@operators\relax
\end{verbatim}

Otros ajustes útiles en este contexto son |\spanishoperators|,
|\selectspanish| y |\deactivatequoting|.

Recordemos que todos los cambios operados desde este archivo restan
compatibilidad al documento, por lo que si se distribuye conviene
adjuntarlo con el entorno |filecontents|.

\subsection{Pasar opciones desde un paquete o clase}

\begin{decl} \con |\spanishoptions|
\end{decl}

Como |\PassOptionsToPackage| añade opciones al comienzo y las opciones
específicas de \textsf{spanish} han de ir al final, definiendo esta
macro se puede controlar el comportamiento de \textsf{spanish} antes
de su carga.

\subsection{Otros cambios}

Las adaptaciones se encuentran organizadas en varios grupos, a los
que corresponden sendas macros:
|\textspanish|, |\mathspanish|,
|\shorthandsspanish|, |\datespanish| y |\captionsspanish|. Pueden
cancelarse con:
\begin{verbatim}
\renewcommand\textspanish{}
\end{verbatim}

\section{Plain \TeX}

Con Plain hay que hacer:
\begin{verbatim}
\input spanish.sty
\end{verbatim}

Se incluyen: traducciones, casi todas las abreviaciones, coma decimal,
utilidades para división de palabras, ordinales en una versión
simplificada (y no muy elegante), funciones matemáticas, |\í| y
espaciado. La selección de la lengua es inmediata al cargar el
archivo.

En cambio no están disponibles: entrecomillados, |\lsc| ni las
adaptaciones de lengua principal.

\section{Compatibilidad con versiones anteriores}

En versiones de \textsf{babel} bastante antiguas, las abreviaciones
con |'| se activaban por omisión, mientras que ahora es necesario
|activeacute|.

En la versión 4, la abreviación |~n| se consideró para extinguir.
En la versión 5 sigue disponible, pero \textit{no} se activa por
omisión, sino que hay que emplear |es-tilden|.

En la versión 5 el grupo \textsf{layout} no se retrasa a
|\begin{document}|, como en la 4, sino que se ejecuta
inmediatamente. Esto permite cambios en el preámbulo con otros
paquetes. Con ello, además, |\selectspanish*| carece de utilidad.  La
opción de paquete |es-delayed| restaura el comportamiento anterior,
por si hubiera alguna incompatibilidad.

La compatibilidad con la versión 2.09 de \LaTeX{} se ha suprimido.

\section*{Referencias}
\addcontentsline{toc}{section}{Referencias}

\begingroup
\small
\leftskip1.5cm \parindent-1.5cm

\makebox[1.5cm][l]{\lsc{DRAE}}\textit{Diccionario de la Academia
  Española}, Madrid, Espasa-Calpe, 21"a ed., 1992.

\makebox[1.5cm][l]{\lsc{DOT}}José Martínez de Sousa,
 \textit{Diccionario de ortografía técnica},
 Madrid, Germán Sánchez Ruipérez/Pirámide, 1987.
 (Biblioteca del libro.)

\makebox[1.5cm][l]{\lsc{DTL}}José Martínez de Sousa,
 \textit{Diccionario de tipografía y del libro},
 Madrid, Paraninfo, 3"a ed., 1992.

\makebox[1.5cm][l]{\lsc{MEA}}José Martínez de Sousa,
 \textit{Manual de edición y autoedición},
 Madrid, Pirámide, 1994.

\leftskip0pt \parindent0pt \vspace{6pt}

{\itshape
Para otras cuestiones tipográficas, las referencias
usadas son, entre otras:}

\parindent-1.5pc \leftskip1.5pc \vspace{3pt}

Asociación de Academias de la Lengua Española,
\textit{Diccionario panhispánico de dudas}, Madrid, Santillana, 2005.

Javier Bezos,
\textit{Tipografía española con \TeX}, documento electrónico
disponible en
\textsf{http://perso.wanadoo.es/jbezos/tipografia.html}.

Javier Bezos,
\textit{Tipografía y notaciones científicas}, Gijón,
Trea, 2008.

Bureau International des Poids et mesures,
\textit{Le Sist\`{e}me international dúnités},
8"a ed., París, {\footnotesize BIPM}, 2006,
\textsf{http://www.bipm.org/""fr/""si/""si\_brochure/}, 2006-11-10.

Jorge de Buen,
\textit{Manual de diseño editorial,} México, Santillana, 2000.

\textit{The Chicago Manual of Style}, Chicago, University of
Chicago Press, 14"a~ed., 1993, esp.~págs.~333~-335.

José Fernández Castillo,
\textit{Normas para correctores y compositores tipógrafos},
Madrid, Espasa-Calpe, 1959.

IRANOR [AENOR], Normas \lsc{UNE} números 5010 (<<Signos
matemáticos>>), 5028 (<<Símbolos
geométricos>>) y 5029 (<<Impresión de los
símbolos de magnitudes y unidades y de los números>>).
[Obsoletas.]

Llerena, Mario,
\textit{Un manual de estilo,} Miami, Unilit, 1999.

Real Academia Española,
\textit{Esbozo de una nueva gramática de la
lengua española}, Madrid, Espasa-Calpe, 1973.

V.\ Martínez Sicluna,
\textit{Teoría y práctica de la tipografía},
Barcelona, Gustavo Gili, 1945.

José Martínez de Sousa,
\textit{Diccionario de ortografía de la lengua española},
Madrid, Paraninfo, 1996.

Juan Martínez Val, \textit{Tipografía práctica}, Madrid,
Laberinto, 2002.

Juan José Morato, \textit{Guía práctica del compositor
tipográfico}, Madrid, Hernando, 2"a ed., 1908 (1"a ed., 1900,
3"a ed., 1933).

Marion Neubauer,
<<Feinheiten bei wissenschaftlichen Publikationen>>,
\textit{Die \TeX nisches Kom\"odie},  parte I, vol. 8, n"o 4, 1996,
págs. 23-40; parte II, vol. 9, n"o 1, 1997, págs.~25~-44.

Notimex, \textit{Manual de operación y estilo editorial}, México,
Notimex, 1999.

José Polo,
\textit{Ortografía y ciencia del lenguaje}, Madrid, Paraninfo,
1974.

Siglo 21, \textit{Libro de estilo}, México, Alda,
$\mathrm{^s}\!$/$\mathrm{_f}$
(impr.  1995).

Pedro Valle,
\textit{Cómo corregir sin ofender}, Buenos Aires, Lumen, 1998.

Hugh C. Wolfe, <<Símbolos, unidades y nomenclatura>>,
\textit{Enciclopedia de Física}, dir. Rita G. Lerner y George L.
Trigg, Madrid, Alianza, 1987, t.~2, págs.~1423~-1451.

\endgroup

\part*{English Summary}

\section{The Spanish language}

The file \file{spanish.dtx}\footnote{The file described in this
section has version number 5.0q and was last revised on 2021-05-27.
The maintainer from v4.0 on is Javier Bezos
(http://www.tex-tipografia.com).  Previous versions were made by Julio
S\'anchez.  The English documentation has been improved by José Luis
Rivera; thanks to him it is now a lot clearer.} defines all the
language-specific macros for the Spanish language.

Spanish support is implemented following mainly the guidelines given
by Jos\'e Mart\'\i nez de Sousa.  There are examples and some
additional features documented in the Spanish version only.
Cross-references in this section point to that document.

\paragraph{Features} This style provides:

\begin{itemize}
\item Translations following the International \LaTeX{} conventions,
 as well as |\today|.
\item Shorthands listed in Table~\ref{tab:spanish-quote-def}.
 Examples in subsection~3.4 are illustrative.  Notice that |"~| has a
 special meaning in \textsf{spanish} different to other languages,
 and is used mainly in linguistic contexts.
\begin{table}[htb]
\centering
\begin{tabular}{lp{8cm}}
|'a|      & Acute accented a. Works for e, i, o, u, too (both
           lowercase and uppercase).\\
|'n|      & \~n (uppercase too).\\
|"i|      & \"i (uppercase too).\\
|"u|      & \"u (uppercase too).\\
|"a| |"o| & Ordinal numbers (uppercase |"A|, |"O| too).\\
|"er "ER| & Ordinal 1.\textsuperscript{er} 1.\textsuperscript{\textsc{er}}\\
|"c|      & \c{c} (uppercase too).\\
|"rr|     & rr, but -r when hyphenated.\\
|"y|      & An old ligature for ``et'' (like the English \&).\\
|"-|      & Like |\-|, but allowing hyphenation in the rest
           the word.\\
|"=|      & Like |-|, but allowing hyphenation in the rest
           the word.\\
|"~|      & The hyphen is repeated at the very beginning of
           the next line if the word is hyphenated at this
           point.\\
|""|      & Like |"-| but producing no hyphen sign.\\
|~-|      & Like |"-| but with no break after the hyphen. Works for
           en-dashes (|~--|) and em-dashes (|~---|). |"+|, |"+-|
           and |"+--| are synonymous.\\
|"/|      & A slash slightly lowered, if necessary.\\
\verb+"|+ & Disable ligatures at this point.\\
|"<|      & Left guillemets.\\
|">|      & Right guillemets.\\
|<<| |>>| & |\begin{quoting}| and |\end{quoting}|. (See below.)
           |"`| and |"'| are synonymous.\\
|"? "!|   & Opening question and exlamation marks (?`!`)
           aligned on the baseline, useful for all-caps headings, etc.
\end{tabular}
\caption{Extra definitions made by file \file{spanish.ldf}}
\label{tab:spanish-quote-def}
\end{table}
\item |\frenchspacing|.
\item \emph{In math mode}, a dot followed by a digit is replaced by a
 decimal comma.
\item Spanish ordinals and abbreviations with the |\sptext|\marg{text}
 command as, for instance, |1\sptext{er}|. The preceptive dot is
 included.
\item Accented (l\'\i m, m\'ax, m\'\i n, m\'od) and spaced (arc\,cos,
 etc.) functions.
\item |\dotlessi| is provided for use in math mode.
\item A |quoting| environment and a related pair of shorthands |<<|
 and |>>|. Useful for traditional spanish multi-paragraph quoting.
\item There is a small space before the percent |\%| sign.
\item |\lsc| provides lowercase small caps. (See subsection~3.10.)
\item Ellipsis is best typed as |...| or, within a sentence, as |\...|
\end{itemize}

If \textsf{spanish} is the main language, the command
|\layoutspanish| is added to the main group, modifying the standard
classes throughout the whole document in the following way:

\begin{itemize}
\item Paragraphs are set with |\indentfirst|.
\item Both |enumerate| and |itemize| are adapted to Spanish rules.
\item Both |\alph| and |\Alph| include \textit{\~n} after \textit{n}.
\item Symbol footmarks are one, two, three, etc., asterisks.
\item |OT1| guillemets are generated with two |lasy| symbols instead
 of small |\ll| and |\gg|.
\item |\roman| is redefined to write small caps Roman numerals, since
lowercase Roman numerals are discouraged (see below).
\item There is a dot after section numbers in titles, headings, and toc.
\end{itemize}

A subset of these features is implemented for Plain \TeX{}
(accesible with the command |\input spanish.sty|).  Most
significantly, |\lsc|, the |quoting| environment, and features
provided by |\layoutspanish| are missing.

\paragraph{Customization}

Beginning with version 5.0, customization is made following two paths:
via |options| or via |commands|; these options and commands override
the layout for Spanish documents at different levels: options are meant for
use at the preamble only, while commands may be used in the configuration
file or at document level.

Global options control the overall appearance of the document, and may
be set on the |{babel}| call, right after calling |spanish|, or
shortly before the call to |{babel}|, to ensure their proper loading
at runtime. Thus, the following calls are roughly equivalent:

\begin{verbatim}
\usepackage[...,spanish,es-nosectiondot,es-nodecimaldot,...]{babel}

\def\spanishoptions{es-nosectiondot,es-nodecimaldot}
\usepackage[...,spanish,...]{babel}
\end{verbatim}

\begin{table}
\centering
\begin{tabular}{cccc}\hline
Basic Options       & |es-minimal| & |es-sloppy| & |es-noshorthands| \\\hline
|es-noindentfirst|  & X  & X  &   \\
|es-nosectiondot|   & X  & X  &   \\
|es-nolists|        & X  & X  &   \\
|es-noquoting|      & X  & X  & X \\
|es-notilde|        & X  & X  & X \\
|es-nodecimaldot|   & X  & X  & X \\
|es-nolayout|       &    & X  &   \\
|es-ucroman|        & X  &    &   \\
|es-lcroman|        & X  & X  &   \\\hline
\end{tabular}
\caption{Spanish Customization Options}
\label{tab:SpanishCustomizationOptions}
\end{table}

Some global options are built upon lower level options, and may be
used as shorthand for more global customizations.
Table~\ref{tab:SpanishCustomizationOptions} gives an overview of the
global options constructed this way.  Most of these options are
self-explanatory: they disable the changes made to the basic \LaTeX\
layout by |spanish|.  |es-lcroman| however, and a few others, need a
bit of explanation, and they may be described as follows:

\begin{itemize}
\item Traditional Spanish typography discourages the use of lowercase
 Roman numerals; instead, a smallcaps variant is implemented.
 However, since |Makeindex| seems to choke on the code implementing
 lowercase Roman numerals (via the |\lsc| macro), two workarounds are
 implemented: the |es-ucroman| option converts all Roman numerals to
 uppercase, and the |es-lcroman| option turns all Roman numerals to
 lowercase; the former should be preferred over the latter.  Three
 macros control local changes to Roman numbers: |\spanishscroman|,
 |\spanishucroman|, and |\spanishlcroman|.
\item The |es-preindex| option calls the |romanidx.sty| package
 automatically to fix index entries in smallcaps roman form.  An
 additional macro,
 |\spanishindexchars|\marg{encap}\marg{openrange}\marg{closerange}
 determines the characters delimiting index entries.  Defaults are
 \verb=\spanishindexchars{|}{(}{)}=.
\item The |es-tilden| option restores the old tilde |~| shorthand for
 \~n.  This shorthand is however \emph{strongly} deprecated.
\item The |es-nolayout| option disables layout changes in the document
 when |spanish| is the main language.  These changes affect
 enumerated and itemized lists, enumerations (alphabetic order
 excludes \~n), and symbolic footnotes.
\item The |es-noshorthands| disables the shorthand mechanism
 completely: neither |"| nor |'| nor |<| nor |>| nor |~| nor |.| work
 at all.
\item The |es-noquoting| option disables the macros |<<| and |>>|
 calling the |quoting| environment; the alternative macros |"`| and
 |"'| are still available.
\item The |es-uppernames| option makes uppercase versions of captions
 for chapter, tablename, etc.
\item The |es-tabla| option changes ``cuadro'' for ``tabla'' in
 captions.
\end{itemize}

Finally, the Spanish 5 series begins the implementation of national
variations of Spanish typography, beginning with Mexico.  Thus the
global options |mexico| and |mexico-com| are adapted to practices
spread in Mexico, and perhaps Central America, the Caribbean, and
some countries in South America.\footnote{The main difference is
that |mexico| disables the |decimaldot| mechanism, while
|mexico-com| keeps it enabled; both change the |quoting|
environment, disabling the use of guillemets.}

Many of the global options are implemented via macros, which may be
included in the configuration file |spanish.cfg|, in the preamble,
after the call to |babel|, and in the body of the document.  These
macros are the following.

\begin{itemize}
\item The macros |\spanishdashitems| and |\spanishsignitems| change
 the values of itemized lists to a series of dashes or an alternative
 series of symbols, respectively.
\item The command |\deactivatequoting| deactivates the |<<| and |>>|
 shorthands if you want to use |<| and |>| in numerical comparisons
 and some AMS\TeX\ commands.
\item You may kill the space in spaced operators with
 |\unspacedoperators|.
\item You may kill the accents on accented operators with
 |\unaccentedoperators|.
\item The command |\decimalpoint| resets the decimal separator to its
 default (dot) value, while |\spanishdecimal|\marg{symbol} allows for
 an arbitrary definition.
\item |\spanishplainpercent| prevents the addition of a thinspace
 before the percent sign in texts. This might be useful for
 parenthesized percent signs in tables, etc.
\item The macros |\spanishdatedel| and |\spanishdatede| control the if
 the article is given in years (|del| or |de|).
\item The macro |\spanishreverseddate| sets the date of the format
 ``Month Day del Year''.
\item The macro |\Today| gives months in uppercase.
\item The macros |\spanish|\textit{caption} change the value of the
 \emph{caption} automatically (no need to add an |\addto|).
\item The command |\spanishdeactivate|\marg{characters} disables the
 shorthand characters listed in the argument.  Elegible characters
 are the set |.'"~<>|.  These shorthand characters may be globally
 deactivated for Spanish adding this command to |\shorthandsspanish|.
\item Extras are divided in groups controlled by the commands
 |\textspanish|, |\mathspanish|, |\shorthandsspanish| y
 |\layoutspanish|; their values may be cancelled typing
 |\renewcommand|\marg{command}|{}|, or changed at will (check the
 Spanish documentation or the code for details).
\item The command |\spanishoperators|\marg{operators} defines command
 names for operators in Spanish.  There is no standard name for some
 of them, so they may be created or changed at will.  For instance,
 the command |\renewcommand{\spanishoperators}{arc\,ctg m\acute{i}n}|
 creates commands for these functions.  The command |\,| adds
 thinspaces at the appropriate places for spaced operators (like
 |\arcctg| in this case), and the command |\acute|\marg{letter} adds
 an accent to the letter included in the definition (thus,
 |m\acute{i}n| defines the accented function |\min| (m\'\i{}n);
 please notice that |\dotlessi| is not necessary).
\item The commands |\lquoti|\marg{string} |\rquoti|\marg{string}
 |\lquotii|\marg{string} |\rquotii|\marg{string}
 |\lquotiii|\marg{string} |\rquotiii|\marg{string} set the quoting
 signs in the |quoting| environment, nested from outside in. They may
 be |\renew|ed at will.  Default values are shown in
 table~\ref{tab:spanish-quote-ref}.
\begin{table}
\center\small
\vspace{1.5ex}
\begin{tabular}{l@{\hspace{5em}}l}
|\lquoti|   &|"<|\\
|\rquoti|   &|">|\\
|\lquotii|  &|``|\\
|\rquotii|  &|''|\\
|\lquotiii| &|`|\\
|\rquotiii| &|'|
\end{tabular}
\caption{Default quoting signs set for the \texttt{quoting} environment.}
\label{tab:spanish-quote-ref}
\end{table}

\item The command |\selectspanish*| is obsolete: if |spanish| is the
main language, all its features are available right after loading
|babel|.  The |es-delayed| option is provided to restore the
previous behavior and macros for backwards compatibility.

\end{itemize}

\end{document}
%</filedriver>
%\fi
%
% \StopEventually{}
% \section{The Code}
%
% \changes{spanish~5.0a}{2007/02/21}{Reimplemented in full, which some
%   parts rewritten from scratch. Added the es- mechanism and the mexico
%   option. Many bug fixes.}
% \changes{spanish~5.0d}{2008/05/25}{Fixed two bugs: misplaced
%   subscripts with lim and the like; problem with \cs{roman} and hyperref.}
% \changes{spanish~5.0h}{2009/01/02}{Removed unnecessary \cs{string}s
%   with two acutes. Added es-noenumerate, es-noitemize.}
% \changes{spanish~5.0i}{2009/05/11}{romanidx not working. Some \cs{es@roman}
%   replaced with \cs{es@scroman}.}
% \changes{spanish~5.0j}{2010/01/06}{Overdot \cs{.} was not robust.}
% \changes{spanish~5.0j}{2010/04/04}{Colon in saved catcodes, because
%   babel doesn't restore it after french}
% \changes{spanish~5.0j}{2010/05/08}{Changed order of tests in
%   shorthands, to fix a bug with ifthen}
% \changes{spanish~5.0k}{2011/08/08}{When saving ., check if
%   \cs{mathcode} is 8000}
% \changes{spanish~5.0l}{2013/04/11}{Support for babel modifiers}
% \changes{spanish~5.0m}{2014/01/29}{\cs{S@}size surrounded by
%   \cs{globalsdef} to avoid global changes in the size}
% \changes{spanish~5.0m}{2014/01/29}{Execute the first \cs{bbl@allowhyphens}
%   in \cs{es@accent} only in horizontal mode}
% \changes{spanish~5.0n}{2014/01/30}{\cs{es@accent} -- Removed first
%   \cs{bbl@allowhyphens}, the second one is ignored if a space
%   follows, removed code for spacefactor, removed code for primes}
% \changes{spanish~5.0n}{2014/04/14}{Check font name in \cs{dotlessi}}
% \changes{spanish~5.0n}{2014/04/23}{Added \cs{spanishdate} and
%   \cs{spanishDate}}
% \changes{spanish~5.0o}{2016/01/14}{Added \cs{spanishdate} and
%   \cs{spanishDate}}
%
%    This file is (hopefully) for both \LaTeXe{} and Plain formats.
%
%    \begin{macrocode}
%<*code>
\ProvidesLanguage{spanish.ldf}
   [2021/05/27 v5.0q Spanish support from the babel system]
\LdfInit{spanish}\captionsspanish

\edef\es@savedcatcodes{%
 \catcode`\noexpand\~=\the\catcode`\~
 \catcode`\noexpand\"=\the\catcode`\"
 \catcode`\noexpand\:=\the\catcode`\:}
\catcode`\~=\active
\catcode`\"=12
\catcode`\:=12

\ifx\undefined\l@spanish
 \@nopatterns{Spanish}
 \adddialect\l@spanish0
\fi

\def\es@sdef#1{\babel@save#1\def#1}
\def\es@sDRC#1{\babel@save#1\DeclareRobustCommand*#1}

\@ifundefined{documentclass}
 {\let\ifes@latex\iffalse}
 {\let\ifes@latex\iftrue}
%    \end{macrocode}
%
%    Package options for spanish. To avoid error messages dummy
%    options are created on the fly when neccessary.
%
%    \begin{macrocode}
\ifes@latex

\@ifundefined{spanishoptions}{}
{\PassOptionsToPackage{\spanishoptions}{babel}}

\def\es@genoption#1#2#3{%
 \DeclareOption{#1}{}%
 \@ifpackagewith{babel}{#1}%
   {\def\es@a{#1}%
    \expandafter\let\expandafter\es@b\csname [email protected]\endcsname
    \addto\es@b{,#2}%
    \expandafter\let\csname [email protected]\endcsname\es@b
    \AtEndOfPackage{#3}}%
   {}}

\es@genoption{es-minimal}
 {es-ucroman,es-noindentfirst,es-nosectiondot,es-noenumerate,%
  es-noitemize,es-noquoting,es-notilde,es-nodecimaldot}
 {\spanishplainpercent
  \let\es@operators\relax}
\es@genoption{es-nolists}
 {es-noenumerate,es-noitemize}{}
\es@genoption{es-sloppy}
 {es-nolayout,es-noshorthands}{}
\es@genoption{es-noshorthands}
 {es-noquoting,es-nodecimaldot,es-notilde}{}
\es@genoption{mexico}
 {mexico-com,es-nodecimaldot}{}
\es@genoption{mexico-com}
 {es-tabla,es-noquoting}
 {\def\lquoti{``}\def\rquoti{''}%
  \def\lquotii{`}\def\rquotii{'}%
  \def\lquotiii{\guillemotleft{}}%
  \def\rquotiii{\guillemotright{}}}

\def\es@ifoption#1#2#3{%
 \@ifundefined{BabelModifiers}%
   {\DeclareOption{es-#1}{}%
    \@ifpackagewith{babel}{es-#1}{#2}{#3}}
   {\@expandtwoargs\in@{,#1,}{,\BabelModifiers,}%
    \ifin@#2\else#3\fi}}

\def\es@optlayout#1#2{\es@ifoption{#1}{}{\addto\layoutspanish{#2}}}

\else

\def\es@ifoption#1#2#3{\@namedef{spanish#1}{#2}}

\fi

\let\es@uclc\@secondoftwo
\es@ifoption{uppernames}{\let\es@uclc\@firstoftwo}{}

\def\es@tablename{Ccuadro}
\es@ifoption{tabla}{\def\es@tablename{Ttabla}}{}
\es@ifoption{cuadro}{\def\es@tablename{Ccuadro}}{}
%    \end{macrocode}
%
%    Captions follow a two step schema, so that, say, |\refname| is
%    defined as |\spanishrefname| which in turn contains the string
%    to be printed. The final definition of |\captionsspanish|
%    is built below.
%
%    \begin{macrocode}
\StartBabelCommands*{spanish}{captions}
   [unicode, charset=utf8, fontenc=EU1 EU2]

 \AddBabelHook{spanish}{stringprocess}{%
   \protected@edef\BabelString{\BabelString}}
 \SetString{\bibname}{Bibliografía}%
 \SetString{\chaptername}{Capítulo}%
 \SetString{\appendixname}{Apéndice}%
 \SetString{\listfigurename}{Índice de \es@uclc Ffiguras}%
 \SetString{\listtablename}{Índice de \expandafter\es@uclc\es@tablename s}%
 \SetString{\indexname}{Índice \es@uclc Aalfabético}%
 \SetString{\pagename}{página}%
 \SetString{\seename}{véase}%
 \SetString{\alsoname}{véase también}%
 \SetString{\proofname}{Demostración}%
 \@ifundefined{chapter}
   {\SetString{\contentsname}{Índice}}%
   {\SetString{\contentsname}{Índice \es@uclc Ggeneral}}

\StartBabelCommands*{spanish}{captions}

 \AddBabelHook{spanish}{stringprocess}{%
   \protected@edef\BabelString{\BabelString}}
 \SetString{\prefacename}{Prefacio}%
 \SetString{\refname}{Referencias}%
 \SetString{\abstractname}{Resumen}%
 \SetString{\bibname}{Bibliograf\'{\i}a}%
 \SetString{\chaptername}{Cap\'{\i}tulo}%
 \SetString{\appendixname}{Ap\'{e}ndice}%
 \SetString{\listfigurename}{\'{I}ndice de \es@uclc Ffiguras}%
 \SetString{\listtablename}{\'{I}ndice de \expandafter\es@uclc\es@tablename s}%
 \SetString{\indexname}{\'{I}ndice \es@uclc Aalfab\'{e}tico}%
 \SetString{\figurename}{Figura}%
 \SetString{\tablename}{\expandafter\@firstoftwo\es@tablename}%
 \SetString{\partname}{Parte}%
 \SetString{\enclname}{Adjunto}%
 \SetString{\ccname}{Copia a}%
 \SetString{\headtoname}{A}%
 \SetString{\pagename}{p\'{a}gina}%
 \SetString{\seename}{v\'{e}ase}%
 \SetString{\alsoname}{v\'{e}ase tambi\'{e}n}%
 \SetString{\proofname}{Demostraci\'{o}n}%
 \SetString{\glossaryname}{Glosario}%
 \@ifundefined{chapter}
   {\SetString{\contentsname}{\'{I}ndice}}%
   {\SetString{\contentsname}{\'{I}ndice \es@uclc Ggeneral}}
%    \end{macrocode}
%
%    Now two macros for dates (upper and lowercase).
%
%    \begin{macrocode}
\StartBabelCommands*{spanish}{date}

 \SetStringLoop{month#1name}{enero,febrero,marzo,abril,mayo,junio,%
   julio,agosto,septiembre,octubre,noviembre,diciembre}
 \SetStringLoop{ucmonth#1name}{Enero,Febrero,Marzo,Abril,Mayo,Junio,%
   Julio,Agosto,Septiembre,Octubre,Noviembre,Diciembre}
 \SetString\today{\spanishdate{\year}{\month}{\day}}
 \SetString\Today{\spanishDate{\year}{\month}{\day}}

\EndBabelCommands

\newcommand\spanishdate{\es@date{}}
\newcommand\spanishDate{\es@date{uc}}
\def\es@date#1#2#3#4{%
 \ifcase\es@datefmt
   \ifnum#4=1
     \es@datefirst
   \else
     \number#4\relax
   \fi
   ~de \csname#1month\romannumeral#3name\endcsname
 \else
   \csname#1month\romannumeral#3name\endcsname~%
   \ifnum#4=1
     \es@datefirst
   \else
     \number#4\relax
   \fi
 \fi
 \ de%
   \ifnum#2>1999\relax\es@yearl
   \else\ifnum#2<1100\es@yearl
   \fi\fi
 ~\number#2\relax}
\chardef\es@datefmt=\z@
\def\spanishreverseddate{\chardef\es@datefmt=\@ne}
\def\spanishdatedel{\def\es@yearl{l}}
\def\spanishdatede{\let\es@yearl\@empty}
\spanishdatede
\def\spanishdatefirst{\def\es@datefirst}
\spanishdatefirst{1}
%    \end{macrocode}
%
%    The basic macros to select the language in the preamble or the
%    config file. Use of |\selectlanguage| should be avoided at this
%    early stage because the active chars are not yet
%    active. |\selectspanish| makes them active.
%
%    \begin{macrocode}
\def\selectspanish{%
 \def\selectspanish{%
   \def\selectspanish{%
     \PackageWarning{spanish}{Extra \string\selectspanish\space ignored}}%
   \es@select}}
\@onlypreamble\selectspanish
\def\es@select{%
 \let\es@select\@undefined
 \selectlanguage{spanish}}

\let\es@shlist\@empty
%    \end{macrocode}
%
%    Instead of joining all the extras directly in |\extrasspanish|,
%    we subdivide them in three further groups: text, math and shorthands.
%
%    \begin{macrocode}
\def\extrasspanish{%
 \textspanish
 \mathspanish
 \ifx\shorthandsspanish\@empty
   \expandafter\spanishdeactivate\expandafter{\es@shlist}%
   \languageshorthands{none}%
 \else
   \shorthandsspanish
 \fi}
\def\noextrasspanish{%
 \ifx\textspanish\@empty\else
   \notextspanish
 \fi
 \ifx\mathspanish\@empty\else
   \nomathspanish
 \fi
 \ifx\shorthandsspanish\@empty\else
   \noshorthandsspanish
 \fi
 \csname es@restorelist\endcsname}

\addto\textspanish{\es@sDRC\sptext{\es@sptext}}

\def\es@orddot{.}
%    \end{macrocode}
%
%    The definition of |\sptext| is more elaborated than that of
%     |\textsuperscript|. With uppercase superscript text
%    the scriptscriptsize is used. The mandatory dot is already
%    included. There are two versions, depending on the
%    format.
%
%    \begin{macrocode}
\ifes@latex
 \def\es@sptext#1{%
   {\es@orddot
    \setbox\z@\hbox{8}\dimen@\ht\z@
    \globaldefs\m@ne
    \csname S@\f@size\endcsname
    \globaldefs\z@
    \edef\@tempa{\def\noexpand\@tempc{#1}%
      \lowercase{\def\noexpand\@tempb{#1}}}\@tempa
    \ifx\@tempb\@tempc
      \fontsize\sf@size\z@
      \selectfont
      \advance\[email protected]
    \else
      \fontsize\ssf@size\z@
      \selectfont
      \advance\[email protected]
    \fi
    \math@fontsfalse\raise\dimen@\hbox{#1}}}
\else
 \let\sptextfont\rm
 \def\es@sptext#1{%
   {\es@orddot
    \setbox\z@\hbox{8}\dimen@\ht\z@
    \edef\@tempa{\def\noexpand\@tempc{#1}%
      \lowercase{\def\noexpand\@tempb{#1}}}\@tempa
    \ifx\@tempb\@tempc
      \advance\[email protected]
      \raise\dimen@\hbox{$\scriptstyle\sptextfont#1$}%
    \else
      \advance\[email protected]
      \raise\dimen@\hbox{$\scriptscriptstyle\sptextfont#1$}%
    \fi}}
\fi
%    \end{macrocode}
%
%    Lowercase small caps.  We check if the current font has small
%    caps.  If not, we fake them.  \cs{selectfont} in \cs{es@lsc}
%    seems redundant, but it's not.  An intermediate macro allows
%    for an optimized variant for Roman numerals.
%
%    \begin{macrocode}
\ifes@latex
 \addto\textspanish{\es@sDRC\lsc{\es@lsc}}
 \def\es@lsc{\es@xlsc\MakeUppercase\MakeLowercase}
 \def\es@xlsc#1#2#3{%
   \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
       \PackageWarning{spanish}{Replacing `\curr@fontshape' by
         \MessageBreak faked small caps}%
       #1{#3}%
     \else
       #2{#3}%
     \fi}}
\fi
%    \end{macrocode}
%
%    The |quoting| environment (not available in Plain).  Overriding
%    the default |\everypar| is a bit tricky.
%
%    \begin{macrocode}
\newif\ifes@listquot

\ifes@latex
 \csname newtoks\endcsname\es@quottoks
 \csname newcount\endcsname\es@quotdepth
 \newenvironment{quoting}
   {\leavevmode
    \advance\es@quotdepth\@ne
    \csname lquot\romannumeral\es@quotdepth\endcsname
    \ifnum\es@quotdepth=\@ne
      \es@listquotfalse
      \let\es@quotpar\everypar
      \let\everypar\es@quottoks
      \everypar\expandafter{\the\es@quotpar}%
      \es@quotpar{\the\everypar
        \ifes@listquot\global\es@listquotfalse\else\es@quotcont\fi}%
    \fi
    \toks@\expandafter{\es@quotcont}%
    \edef\es@quotcont{%
      \the\toks@
      \expandafter\noexpand
      \csname rquot\romannumeral\es@quotdepth\endcsname}}
   {\csname rquot\romannumeral\es@quotdepth\endcsname}
 \def\lquoti{\guillemotleft{}}
 \def\rquoti{\guillemotright{}}
 \def\lquotii{``}
 \def\rquotii{''}
 \def\lquotiii{`}
 \def\rquotiii{'}
 \let\es@quotcont\@empty
%    \end{macrocode}
%
%    If there is a marginpar inside quoting, we don't add the
%    quotes. |\es@listqout| stores the quotes to be used before
%    item labels; otherwise they could appear after the labels.
%
%    \begin{macrocode}
 \addto\@marginparreset{\let\es@quotcont\@empty}
 \DeclareRobustCommand\es@listquot{%
   \csname rquot\romannumeral\es@quotdepth\endcsname
   \global\es@listquottrue}
\fi
%    \end{macrocode}
%
%    |\frenchspacing|, |\...| and |\%|.
%
%    \begin{macrocode}
\addto\textspanish{\bbl@frenchspacing}
\addto\notextspanish{\bbl@nonfrenchspacing}
\addto\textspanish{%
 \let\es@save@dot\.%
 \es@sDRC\.{\@ifnextchar.{\es@dots}{\es@save@dot}}}
\def\es@dots..{\leavevmode\hbox{...}\spacefactor\@M}
\AtBeginDocument{% TODO. Not quite correct.
 \ifx\pdfstringdefDisableCommands\@undefined\else
   \pdfstringdefDisableCommands{\let\.\es@save@dot}%
 \fi}
\def\es@sppercent{% See tex.stack 435216 @egreg
 \leavevmode
 \ifnum\gluestretchorder\lastskip=\z@\unskip\fi
 \textormath{$\m@th\,$}{\,}}
\def\spanishplainpercent{\let\es@sppercent\@empty}
\addto\textspanish{%
 \let\percentsign\%%
 \es@sDRC\%{\es@sppercent\percentsign{}}}
%    \end{macrocode}
%
%    Now, the math group.  It's not easy to add an accent to an
%    operator, because we must avoid using text (that is, |\mbox|)
%    where we have no control on font and size, and at the same time
%    we need |\i|, which is forbidden in math mode.  |\dotlessi| must
%    be converted to uppercase if necessary in \LaTeXe.  There are two
%    versions, depending on the format.
% \changes{spanish~5.0o}{2016/01/10}{Fixed EUx: deal with them
%    separately, to be improved}
% \changes{spanish~5.0p}{2016/03/02}{Added TU. Now with uni encs use the
%    actual composite char}
%
%    \begin{macrocode}
\addto\mathspanish{\es@sDRC\dotlessi{\es@dotlessi}}
\let\nomathspanish\relax

\ifes@latex
 \def\es@texti{\i}
 \addto\@uclclist{\dotlessi\es@texti}
\fi

\def\es@fetchenc{%
 \begingroup
   \count@\escapechar \escapechar=\m@ne
     \edef\es@a{\expandafter\string\the\textfont\mathgroup}%
     \expandafter\split@name\es@a////\@nil
   \escapechar=\count@
   \@expandtwoargs\in@{////}{\f@size}%
   \ifin@\else
     \PackageError{spanish}{%
       Non-NFSS font name. The current math font (\es@a)\MessageBreak
       doesn't follow the NFSS conventions. I'll use the\MessageBreak
       default \string\i\space for \string\dotlessi,
       but expect a wrong output.}%
     {Find where this font has been (re)defined, and fix it.}%
     \def\f@encoding{OT1}%
   \fi
 \bbl@exp{\endgroup\def\\\f@encoding{\f@encoding}}}

\ifes@latex
 \ifx\Umathchardef\@undefined\else
   \expandafter\Umathchardef\csname es@EU1@dotlessi\endcsname"7"1"0131\relax
   \expandafter\Umathchardef\csname es@EU2@dotlessi\endcsname"7"1"0131\relax
   \expandafter\Umathchardef\csname es@TU@dotlessi\endcsname"7"1"0131\relax
 \fi
 \def\es@dotlessi{%
   \ifmmode
     {\ifnum\mathgroup=\m@ne
        \imath
      \else
        \es@fetchenc
        \@ifundefined{es@\f@encoding @dotlessi}%
          {\@ifundefined{\f@encoding\string\i}%
            {\edef\f@encoding{\string?}}{}%
           \expandafter\count@\the\csname\f@encoding\string\i\endcsname
           \advance\count@"7000
           \mathchar\count@}%
          {\csname es@\f@encoding @dotlessi\endcsname}%
      \fi}%
   \else
     \i
   \fi}
\else
 \def\es@dotlessi{\textormath{\i}{\mathchar"7010}}
\fi

\def\es@op@ac@base#1{\acute{\if i#1\dotlessi\else#1\fi}}
\ifx\Umathchar\@undefined\else
 \def\es@ac@TU@a{"00E1}\def\es@ac@TU@A{"00C1}%
 \def\es@ac@TU@e{"00E9}\def\es@ac@TU@E{"00C9}%
 \def\es@ac@TU@i{"00ED}\def\es@ac@TU@I{"00CD}%
 \def\es@ac@TU@o{"00F3}\def\es@ac@TU@O{"00D3}%
 \def\es@ac@TU@u{"00FA}\def\es@ac@TU@U{"00DA}%
 \def\es@op@ac@TU#1{%
   \ifnum\mathgroup=\m@ne
     \es@op@ac@base{#1}%
   \else
     \es@fetchenc
     \@ifundefined{es@op@ac@\f@encoding}%
       {\es@op@ac@base{#1}}%
       {\@ifundefined{es@ac@TU@#1}%
          {\es@op@ac@base{#1}}%
          {\Umathchar"7"1\csname es@ac@TU@#1\endcsname}}%
   \fi}%
 \expandafter\let\csname es@op@ac@EU1\endcsname\es@op@ac@TU
 \expandafter\let\csname es@op@ac@EU2\endcsname\es@op@ac@TU
\fi
\def\accentedoperators{%
 \@ifundefined{es@op@ac@TU}%
   {\let\es@op@ac\es@op@ac@base}%
   {\let\es@op@ac\es@op@ac@TU}}
\def\unaccentedoperators{%
 \def\es@op@ac##1{##1}}
\accentedoperators
\def\spacedoperators{\let\es@op@sp\,}
\def\unspacedoperators{\let\es@op@sp\@empty}
\spacedoperators
\addto\mathspanish{\es@operators}

\ifes@latex\else
 \let\operator@font\rm
\fi
%    \end{macrocode}
%
%    Operators are stored in |\es@operators|, which is
%    included in the math group. Since |\operator@font| is
%    defined in \LaTeXe{} only, we define it in the plain variant.
% \changes{spanish~5.0n}{2014-03-28}{tabular didn't like the
%   ampersand used in tests. Replaced by double backslash.}
%
%    \begin{macrocode}
\def\es@operators{%
 \es@sdef\bmod{\nonscript\mskip-\medmuskip\mkern5mu
   \mathbin{\operator@font m\es@op@ac od}\penalty900\mkern5mu
   \nonscript\mskip-\medmuskip}%
 \@ifundefined{@amsmath@err}%
   {\es@sdef\pmod##11{\allowbreak\mkern18mu
       ({\operator@font m\es@op@ac od}\,\,##11)}}%
   {\es@sdef\mod##1{\allowbreak\if@display\mkern18mu
       \else\mkern12mu\fi{\operator@font m\es@op@ac od}\,\,##1}%
     \es@sdef\pmod##1{\pod{{\operator@font m\es@op@ac od}%
       \mkern6mu##1}}}%
 \def\es@a##1 {%
   \ifx\relax##1\relax % empty? continue
     \bbl@afterelse
     \es@a
   \else
     \bbl@afterfi
     {\ifx\\##1% \@emtpy? finish
      \else
        \bbl@afterfi
        \begingroup
          \let\,\@empty % ignore when def'ing name
          \let\acute\@firstofone % id
          \edef\es@b{\expandafter\noexpand\csname##1\endcsname}%
          \def\,{\noexpand\es@op@sp}%
          \def\acute{\noexpand\es@op@ac}%
        \edef\es@a{\endgroup
          \noexpand\es@sdef\expandafter\noexpand\es@b{%
              \mathop{\noexpand\operator@font##1}\es@c}}%
        \es@a % restores itself
        \es@a
      \fi}%
   \fi}%
 \let\es@b\spanishoperators
 \addto\es@b{ }%
 \let\es@c\@empty
 \expandafter\es@a\es@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 \\ %
 \def\es@c{\nolimits}%
 \expandafter\es@a\es@b sen tg arc\,sen arc\,cos arc\,tg \\ }
\def\spanishoperators{cotg cosec senh tgh }
%    \end{macrocode}
%
%    Now comes the text shorthands. They are grouped in
%    |\shorthandsspanish| and this style performs some
%    operations before the babel shortands are called.
%    The aims are to allow espression like |$a^{x'}$|
%    and to deactivate shorthands by making them of
%    category `other.' After providing a |\'i| shorthand,
%    the new macros are defined.
%
%    \begin{macrocode}
\DeclareTextCompositeCommand{\'}{OT1}{i}{\@tabacckludge'{\i}}

\def\es@set@shorthand#1{%
 \expandafter\edef\csname es@savecat\string#1\endcsname
   {\the\catcode`#1}%
 \initiate@active@char{#1}%
 \catcode`#1=\csname es@savecat\string#1\endcsname\relax
 \if.#1\else
   \addto\es@restorelist{\es@restore{#1}}%
   \addto\es@select{\shorthandon{#1}}%
   \addto\shorthandsspanish{\es@activate{#1}}%
   \addto\es@shlist{#1}%
 \fi}

\def\es@use@shorthand{%
 \if@safe@actives
   \bbl@afterelse
   \string
 \else
   \bbl@afterfi
   {\ifx\thepage\relax
      \bbl@afterelse
      \string
    \else
      \bbl@afterfi
      \es@use@sh
    \fi}%
 \fi}

\def\es@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\es@activate#1{%
 \begingroup
   \lccode`\~=`#1
   \lowercase{%
 \endgroup
 \def~{\es@use@shorthand~}}}

\def\spanishdeactivate#1{%
 \@tfor\@tempa:=#1\do{\expandafter\es@spdeactivate\@tempa}}

\def\es@spdeactivate#1{%
 \if.#1%
   \mathcode`\.=\es@period@math\relax
   \begingroup\lccode`\~=`\.\lowercase{\endgroup\let~\es@period@code}%
 \else
   \begingroup
     \lccode`\~=`#1
     \lowercase{%
   \endgroup
   \expandafter\let\expandafter~%
     \csname normal@char\string#1\endcsname}%
     \catcode`#1=\csname es@savecat\string#1\endcsname\relax
 \fi}
%    \end{macrocode}
%
%    |\es@restore| is used in the list |\es@restorelist|, which in
%    turn restores all shorthands as defined by \babel. The latter
%    macros also has |\es@quoting|.
%
%    \begin{macrocode}
\def\es@restore#1{%
 \shorthandon{#1}%
 \begingroup
   \lccode`\~=`#1
   \lowercase{%
 \endgroup
 \bbl@deactivate{~}}}
%    \end{macrocode}
%
%    To selectively define the shorthands we have a couple of
%    macros, which defines a certain combination if the first
%    character has been activated as a shorthand. The second
%    one is intended for a few shorthands with an alternative
%    form.
%
%    \begin{macrocode}
\def\es@declare#1{%
 \@ifundefined{es@savecat\expandafter\string\@firstoftwo#1}%
   {\@gobble}%
   {\declare@shorthand{spanish}{#1}}}
\def\es@declarealt#1#2#3{%
 \es@declare{#1}{#3}%
 \es@declare{#2}{#3}}

\ifes@latex\else
 \def\@tabacckludge#1{\csname\string#1\endcsname}
\fi

\@ifundefined{add@accent}{\def\add@accent#1#2{\accent#1 #2}}{}
%    \end{macrocode}
%
%    Instead of redefining |\'|, we redefine the internal
%    macro for the OT1 encoding.
%
%    \begin{macrocode}
\ifes@latex
 \def\es@accent#1#2#3{%
   \expandafter\@text@composite
     \csname OT1\string#1\endcsname#3\@empty\@text@composite
     {\add@accent{#2}{#3}\futurelet\@let@token\bbl@sptest}}
 \def\bbl@sptest{\ifx\@let@token\@sptoken\else\bbl@allowhyphens\fi}
\else
 \def\es@accent#1#2#3{%
   \add@accent{#2}{#3}\bbl@allowhyphens}
\fi

\addto\shorthandsspanish{\languageshorthands{spanish}}%
\es@ifoption{noshorthands}{}{\es@set@shorthand{"}}
%    \end{macrocode}
%
%    We override the default |"| of babel, intended for german. Note
%    this only applies to OT1.
%
%    \begin{macrocode}
\def\es@umlaut#1{\add@accent{127}#1\bbl@allowhyphens}

\addto\shorthandsspanish{%
 \babel@save\bbl@umlauta
 \let\bbl@umlauta\es@umlaut}
\let\noshorthandsspanish\relax

\ifes@latex
\addto\shorthandsspanish{%
 \expandafter\es@sdef\csname OT1\string\~\endcsname{\es@accent\~{126}}%
 \expandafter\es@sdef\csname OT1\string\'\endcsname{\es@accent\'{19}}}
\else
\addto\shorthandsspanish{%
 \es@sdef\~{\es@accent\~{126}}%
 \es@sdef\'#1{\if#1i\es@accent\'{19}\i\else\es@accent\'{19}{#1}\fi}}
\fi

\def\es@babeltexpdf#1#2{\babel@texpdf{#1}{#2}{#2}{}}

\def\es@sptext@r#1#2{\es@sptext{#1#2}}
\es@declare{"a}{\sptext{a}}
\es@declare{"A}{\sptext{A}}
\es@declare{"o}{\sptext{o}}
\es@declare{"O}{\sptext{O}}
\es@declare{"e}{\protect\es@sptext@r{e}}
\es@declare{"E}{\protect\es@sptext@r{E}}
\es@declare{"u}{\"u}
\es@declare{"U}{\"U}
\es@declare{"i}{\"{\i}}
\es@declare{"I}{\"I}
\es@declare{"c}{\c{c}}
\es@declare{"C}{\c{C}}
\es@declare{"<}{\guillemotleft{}}
\es@declare{">}{\guillemotright{}}
\def\es@chf{\char\hyphenchar\font}
\es@declare{"-}{\bbl@allowhyphens\-\bbl@allowhyphens}
\es@declare{"=}{\es@babeltexpdf{\bbl@allowhyphens\es@chf\hskip\z@skip}{-}}
\es@declare{"~}
 {\es@babeltexpdf{\bbl@allowhyphens
  \discretionary{\es@chf}{\es@chf}{\es@chf}%
  \bbl@allowhyphens}{-}}
\es@declare{"r}
 {\bbl@allowhyphens
  \discretionary{\es@chf}{}{r}%
  \bbl@allowhyphens}
\es@declare{"R}
 {\bbl@allowhyphens
  \discretionary{\es@chf}{}{R}%
  \bbl@allowhyphens}
\es@declare{"y}
 {\@ifundefined{scalebox}%
   {\ensuremath{\tau}}%
   {\raisebox{1ex}{\scalebox{-1}{\resizebox{.45em}{1ex}{2}}}}}
\es@declare{""}{\hskip\z@skip}
\es@declare{"/}
 {\setbox\z@\hbox{/}%
  \dimen@\ht\z@
  \advance\dimen@-1ex
  \advance\dimen@\dp\z@
  \[email protected]\dimen@
  \advance\dimen@-\dp\z@
  \ifdim\dimen@>0pt
    \kern.01em\lower\dimen@\box\z@\kern.03em
  \else
    \box\z@
  \fi}
\es@declare{"?}
 {\es@babeltexpdf{\setbox\z@\hbox{?`}%
  \leavevmode\raise\dp\z@\box\z@}{\textquestiondown}}
\es@declare{"!}
 {\es@babeltexpdf{\setbox\z@\hbox{!`}%
  \leavevmode\raise\dp\z@\box\z@}{\textexclamdown}}

\def\spanishdecimal#1{\def\es@decimal{{#1}}}
\def\decimalcomma{\spanishdecimal{,}}
\def\decimalpoint{\spanishdecimal{.}}
\decimalcomma
\bbl@ifshorthand{.}{}%
 {\PassOptionsToPackage{es-nodecimaldot}{babel}}
\es@ifoption{nodecimaldot}{}
 {\AtBeginDocument{\bgroup\@fileswfalse}%
  \begingroup\lccode`\~=`\.\lowercase{\endgroup
    \let\es@period@code~%
    \es@set@shorthand{.}%
    \let~\es@period@code}%
  \AtBeginDocument{\egroup}%
  \@namedef{normal@char\string.}{%
    \@ifnextchar\egroup
      {\es@period@code}%
      {\csname active@char\string.\endcsname}}%
  \declare@shorthand{system}{.}{\es@period@code}%
  \addto\shorthandsspanish{%
    \babel@savevariable{\mathcode`\.}%
    \edef\es@period@math{\the\mathcode`\.}%
    \babel@save\es@period@code
    \ifnum\es@period@math="8000 %
      \begingroup\lccode`\~=`\.\lowercase{\endgroup\let\es@period@code~}%
    \else
      \mathchardef\es@period@code\es@period@math\relax
      \mathcode`\.="8000 %
    \fi
    \begingroup\lccode`\~=`\.\lowercase{\endgroup\babel@save~}%
    \es@activate{.}}%
  \def\es@a#1{\es@declare{.#1}{\es@decimal#1}}%
  \es@a1\es@a2\es@a3\es@a4\es@a5\es@a6\es@a7\es@a8\es@a9\es@a0}

\bbl@ifshorthand{~}{}%
 {\PassOptionsToPackage{es-notilde}{babel}}
\es@ifoption{notilde}{}{\es@set@shorthand{~}}
\def\deactivatetilden{%
 \expandafter\let\csname spanish@sh@\string~@n@\endcsname\relax
 \expandafter\let\csname spanish@sh@\string~@N@\endcsname\relax}
\es@ifoption{tilden}
 {\es@declare{~n}{\~n}%
  \es@declare{~N}{\~N}}
 {\let\deactivatetilden\relax}
\es@declarealt{~-}{"+}{%
 \leavevmode
 \bgroup
   \let\@sptoken\es@dashes % Changes \@ifnextchar behaviour
   \@ifnextchar-%
     {\es@dashes}%
     {\hbox{\es@chf}\egroup}}
\def\es@dashes-{%
   \@ifnextchar-%
     {\bbl@allowhyphens\hbox{---}\bbl@allowhyphens\egroup\@gobble}%
     {\bbl@allowhyphens\hbox{--}\bbl@allowhyphens\egroup}}

\es@ifoption{noquoting}%
 {\let\es@quoting\relax
  \let\activatequoting\relax
  \let\deactivatequoting\relax}
 {\@ifundefined{XML@catcodes}%
   {\es@set@shorthand{<}%
    \es@set@shorthand{>}%
    \declare@shorthand{system}{<}{\csname normal@char\string<\endcsname}%
    \declare@shorthand{system}{>}{\csname normal@char\string>\endcsname}%
    \addto\es@restorelist{\es@quoting}%
    \addto\es@select{\es@quoting}%
    \ifes@latex
      \AtBeginDocument{%
        \es@quoting
        \if@filesw
          \immediate\write\@mainaux{\string\@nameuse{es@quoting}}%
        \fi}%
    \fi
    \def\activatequoting{%
      \shorthandon{<>}%
      \let\es@quoting\activatequoting}%
    \def\deactivatequoting{%
      \shorthandoff{<>}%
      \let\es@quoting\deactivatequoting}}{}}

\es@declarealt{<<}{"`}{\es@babeltexpdf{\begin{quoting}}{\guillemotleft}}
\es@declarealt{>>}{"'}{\es@babeltexpdf{\end{quoting}}{\guillemotright}}
%    \end{macrocode}
%
% Acute accent shorthands are stored in a macro.  If |activeacute| was
% set as an option it is executed.  If not it is not deleted for a
% possible later use in the |cfg| file.  In non \LaTeXe{} formats it's
% always executed.
%
% \changes{spanish~5.0e}{2008/07/06}{Two acutes in a row should be
%    turned into a double right quote}
% \changes{spanish~5.0g}{2008/07/20}{Fixed bad kerning before two
%    acutes}
% \changes{spanish~5.0g}{2008/07/20}{Fixed bad kerning before two
%    acutes}
% \changes{spanish~5.0o}{2015/12/14}{Fixed typo in \cs{numberline} (\cs{if}
%    to \cs{ifx})}
%
%    \begin{macrocode}
\begingroup
\catcode`\'=12
\gdef\es@activeacute{%
 \es@set@shorthand{'}%
 \def\es@a##1{\es@declare{'##1}{\@tabacckludge'##1}}%
 \es@a a\es@a e\es@a i\es@a o\es@a u%
 \es@a A\es@a E\es@a I\es@a O\es@a U%
 \es@declare{'n}{\~n}%
 \es@declare{'N}{\~N}%
 \es@declare{''}{''}%
 \let\es@activeacute\relax}
\endgroup

\ifes@latex
 \@ifpackagewith{babel}{activeacute}{\es@activeacute}{}
\else
 \es@activeacute
\fi
%    \end{macrocode}
%
%    And the customization. By default these macros only
%    store the values and do nothing.
%
%    \begin{macrocode}
\def\es@enumerate#1#2#3#4{\def\es@enum{{#1}{#2}{#3}{#4}}}
\def\es@itemize#1#2#3#4{\def\es@item{{#1}{#2}{#3}{#4}}}

\ifes@latex
\es@enumerate{1.}{a)}{1)}{a$'$}
\def\spanishdashitems{\es@itemize{---}{---}{---}{---}}
\def\spanishsymbitems{%
 \es@itemize
   {\leavevmode\hbox to 1.2ex
     {\hss\vrule height .9ex width .7ex depth -.2ex\hss}}%
   {\textbullet}%
   {$\m@th\circ$}%
   {$\m@th\diamond$}}
\def\spanishsignitems{%
 \es@itemize
   {\textbullet}%
   {$\m@th\circ$}%
   {$\m@th\diamond$}%
   {$\m@th\triangleright$}}
\spanishsymbitems
\def\es@enumdef#1#2#3\@@{%
 \if#21%
   \@namedef{theenum#1}{\arabic{enum#1}}%
 \else\if#2a%
   \@namedef{theenum#1}{\emph{\alph{enum#1}}}%
 \else\if#2A%
   \@namedef{theenum#1}{\Alph{enum#1}}%
 \else\if#2i%
   \@namedef{theenum#1}{\roman{enum#1}}%
 \else\if#2I%
   \@namedef{theenum#1}{\Roman{enum#1}}%
 \else\if#2o%
   \@namedef{theenum#1}{\arabic{enum#1}\sptext{o}}%
 \fi\fi\fi\fi\fi\fi
 \toks@\expandafter{\csname theenum#1\endcsname}%
 \expandafter\edef\csname labelenum#1\endcsname
   {\noexpand\es@listquot\the\toks@#3}}
\def\es@guillemot#1#2{%
 \ifmmode#1%
 \else
   \save@sf@q{\penalty\@M
   \leavevmode\hbox{\usefont{U}{lasy}{m}{n}%
     \char#2 \kern-0.19em\char#2 }}%
 \fi}
\def\layoutspanish{%
 \let\layoutspanish\@empty
 \DeclareTextCommand{\guillemotleft}{OT1}{\es@guillemot\ll{40}}%
 \DeclareTextCommand{\guillemotright}{OT1}{\es@guillemot\gg{41}}%
 \def\@fnsymbol##1%
   {\ifcase##1\or*\or**\or***\or****\or
    *****\or******\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}%
 \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}}

\es@optlayout{noenumerate}{%
 \def\es@enumerate#1#2#3#4{%
   \es@enumdef{i}#1\@empty\@empty\@@
   \es@enumdef{ii}#2\@empty\@empty\@@
   \es@enumdef{iii}#3\@empty\@empty\@@
   \es@enumdef{iv}#4\@empty\@empty\@@}%
   \def\p@enumii{\theenumi}%
   \def\p@enumiii{\p@enumii\theenumii}%
   \def\p@enumiv{\p@enumiii\theenumiii}%
   \expandafter\es@enumerate\es@enum}
\es@optlayout{noitemize}{%
 \def\es@itemize#1#2#3#4{%
   \def\labelitemi{\es@listquot#1}%
   \def\labelitemii{\es@listquot#2}%
   \def\labelitemiii{\es@listquot#3}%
   \def\labelitemiv{\es@listquot#4}}%
   \expandafter\es@itemize\es@item}
\let\esromanindex\@secondoftwo
\es@ifoption{ucroman}
 {\def\es@romandef{%
    \def\esromanindex##1##2{##1{\uppercase{##2}}}%
    \def\@roman{\@Roman}}}
 {\def\es@romandef{%
    \def\esromanindex##1##2{##1{\es@scroman{##2}}}%
    \def\@roman##1{\es@roman{\number##1}}%
    \def\es@roman##1{%
      \es@babeltexpdf{\es@scroman{\romannumeral##1}}{\@Roman{##1}}}%
    \DeclareRobustCommand\es@scroman{\es@xlsc\uppercase\@firstofone}}}
\es@optlayout{lcroman}{\es@romandef}
\newcommand\spanishlcroman{\def\@roman##1{\romannumeral##1}}
\newcommand\spanishucroman{\def\@roman{\@Roman}}
\newcommand\spanishscroman{\def\@roman##1{\es@roman{\romannumeral##1}}}
\es@optlayout{noindentfirst}{%
 \let\@afterindentfalse\@afterindenttrue
 \@afterindenttrue}
\es@optlayout{nosectiondot}{%
 \def\@seccntformat#1{\csname the#1\endcsname.\quad}%
 \def\numberline#1{\hb@xt@\@tempdima{#1\ifx&#1&\else.\fi\hfil}}}
\es@ifoption{nolayout}{\let\layoutspanish\relax}{}
\es@ifoption{sloppy}{\let\textspanish\relax\let\mathspanish\relax}{}
\es@ifoption{delayed}{}{\def\es@layoutspanish{\layoutspanish}}
\es@ifoption{preindex}{\AtEndOfPackage{\RequirePackage{romanidx}}}{}
%    \end{macrocode}
%
%    We need to execute the following code when babel has been
%    run, in order to see if |spanish| is the main language.
%
%    \begin{macrocode}
\AtEndOfPackage{%
 \let\es@activeacute\@undefined
 \def\bbl@tempa{spanish}%
 \ifx\bbl@main@language\bbl@tempa
   \@nameuse{es@layoutspanish}%
   \addto\es@select{%
     \@ifstar{\PackageError{spanish}%
       {Old syntax--use es-nolayout}%
       {If you don't want changes in layout\MessageBreak
        use the package option `es-nolayout'}}%
     {}}%
   \AtBeginDocument{\layoutspanish}%
 \fi
 \selectspanish}
\fi % of \ifes@latex
%    \end{macrocode}
%
%    After restoring the catcode of |~| and setting the minimal
%    values for hyphenation, the |.ldf| is finished.
% \changes{spanish~5.0o}{2015/12/14}{Misplaced line -- activatequoting
%    must precede \cs{ldf@finish}}
%
%    \begin{macrocode}
\es@savedcatcodes
\providehyphenmins{\CurrentOption}{\tw@\tw@}
\ifes@latex\else
 \es@select
\fi
\csname activatequoting\endcsname
\ldf@finish{spanish}
%</code>
%    \end{macrocode}
%    That's all in the main file.
%
%    The |spanish| option writes a macro in the page field of
%    \textit{MakeIndex} in entries with small caps number, but they
%    are rejected. This program is a preprocessor which moves this
%    macro to the entry field. It can be called from the main
%    document as a package or with the package option |es-preindex|.
%
%    \begin{macrocode}
%<*indexes>
\makeatletter

\@ifundefined{es@idxfile}
 {\def\spanishindexchars#1#2#3{%
    \edef\es@encap{`\expandafter\noexpand\csname\string#1\endcsname}%
    \edef\es@openrange{`\expandafter\noexpand\csname\string#2\endcsname}%
    \edef\es@closerange{`\expandafter\noexpand\csname\string#3\endcsname}}%
  \spanishindexchars{|}{(}{)}%
  \ifx\documentclass\@twoclasseserror
     \edef\es@idxfile{\jobname}%
     \AtEndDocument{%
       \addto\@defaultsubs{%
         \immediate\closeout\@indexfile
         \input{romanidx.sty}}}%
     \expandafter\endinput
  \fi}{}

\newcount\es@converted
\newcount\es@processed

\def\es@split@file#1.#2\@@{#1}
\def\es@split@ext#1.#2\@@{#2}

\@ifundefined{es@idxfile}
 {\typein[\answer]{^^JArchivo que convertir^^J%
  (extension por omision .idx):}}
 {\let\answer\es@idxfile}

\@expandtwoargs\in@{.}{\answer}
\ifin@
 \edef\es@input@file{\expandafter\es@split@file\answer\@@}
 \edef\es@input@ext{\expandafter\es@split@ext\answer\@@}
\else
 \edef\es@input@file{\answer}
 \def\es@input@ext{idx}
\fi

\@ifundefined{es@idxfile}
 {\typein[\answer]{^^JArchivo de destino^^J%
    (archivo por omision: \es@[email protected],^^J%
     extension por omision .eix):}}
 {\let\answer\es@idxfile}
\ifx\answer\@empty
 \edef\es@output{\es@[email protected]}
\else
 \@expandtwoargs\in@{.}{\answer}
 \ifin@
    \edef\es@output{\answer}
 \else
    \edef\es@output{\answer.eix}
 \fi
\fi

\@ifundefined{es@idxfile}
 {\typein[\answer]{%
  ^^J?Se ha usado algun esquema especial de controles^^J%
  de MakeIndex para encap, open_range o close_range?^^J%
  [s/n] (n por omision)}}
 {\def\answer{n}}

\if s\answer
 \typein[\answer]{^^JCaracter para 'encap'^^J%
   (\string| por omision)}
 \ifx\answer\@empty\else
   \edef\es@encap{%
     `\expandafter\noexpand\csname\expandafter\string\answer\endcsname}
 \fi
 \typein[\answer]{^^JCaracter para 'open_range'^^J%
   (\string( por omision)}
 \ifx\answer\@empty\else
   \edef\es@openrange{%
     `\expandafter\noexpand\csname\expandafter\string\answer\endcsname}
 \fi
 \typein[\answer]{^^JCaracter para 'close_range'^^J%
   (\string) por omision)}
 \ifx\answer\@empty\else
   \edef\es@closerange{%
     `\expandafter\noexpand\csname\expandafter\string\answer\endcsname}
 \fi
\fi

\newwrite\es@indexfile
\immediate\openout\es@indexfile=\es@output

\newif\ifes@encapsulated

\def\es@scroman#1{#1}
\edef\es@slash{\expandafter\@gobble\string\\}

\def\indexentry{%
 \begingroup
 \@sanitize
 \es@indexentry}

\begingroup

\catcode`\|=12 \lccode`\|=\es@encap\relax
\catcode`\(=12 \lccode`\(=\es@openrange\relax
\catcode`\)=12 \lccode`\)=\es@closerange\relax

\lowercase{
\gdef\es@indexentry#1{%
 \endgroup
 \advance\es@processed\@ne
 \es@encapsulatedfalse
 \es@bar@idx#1|\@@
 \es@idxentry}%
}

\lowercase{
\gdef\es@idxentry#1{%
 \in@{\es@scroman}{#1}%
 \ifin@
   \advance\es@converted\@ne
   \immediate\write\es@indexfile{%
     \string\indexentry{\es@b|\ifes@encapsulated\es@p\fi esromanindex%
       {\ifx\es@a\@empty\else\es@slash\es@a\fi}}{#1}}%
 \else
   \immediate\write\es@indexfile{%
     \string\indexentry{\es@b\ifes@encapsulated|\es@p\es@a\fi}{#1}}%
 \fi}
}

\lowercase{
\gdef\es@bar@idx#1|#2\@@{%
 \def\es@b{#1}\def\es@a{#2}%
 \ifx\es@a\@empty\else\es@encapsulatedtrue\es@bar@eat#2\fi}
}

\lowercase{
\gdef\es@bar@eat#1#2|{\def\es@p{#1}\def\es@a{#2}%
 \edef\es@t{(}\ifx\es@t\es@p
 \else\edef\es@t{)}\ifx\es@t\es@p
 \else
   \edef\es@a{\es@p\es@a}\let\es@p\@empty%
 \fi\fi}
}

\endgroup

\input \es@input@file.\es@input@ext

\immediate\closeout\es@indexfile

\typeout{*****************}
\typeout{Se ha procesado: \es@input@file.\es@input@ext }
\typeout{Lineas leidas: \the\es@processed}
\typeout{Lineas convertidas: \the\es@converted}
\typeout{Resultado en: \es@output}
\ifnum\es@converted>\z@
 \typeout{Genere el indice a partir de ese archivo}
\else
 \typeout{No se ha convertido nada. Se puede generar}
 \typeout{el .ind  directamente de \es@input@file.\es@input@ext}
\fi
\typeout{*****************}

\@ifundefined{es@sdef}{\@@end}{}

\endinput
%</indexes>
%    \end{macrocode}
%
% \Finale
%
%%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\endinput
%
% Local Variables:
% mode: doctex
% coding: utf-8
% End: