%$PDFLaTeX (encoding:utf-8)

\documentclass{article}

\author{Javier Bezos}
\title{\textsf{babeltools}\\%
\Large Fixing (some) \textsf{babel} annoyances}

\begin{document}

\maketitle

(Beta.)

The \textsf{babel} package introduces some changes in the \LaTeX{}
kernel which are not strictly necessary (perhaps just convenient), but
have some unwanted side-effects.  Oddly enough, most of these changes
cannot be disabled, with a few exceptions (eg, \texttt{activeacute}
and \texttt{activegrave}, but note there are not \texttt{activecaret}
or \texttt{activetilde}). 

With \textsf{babeltools} you can modify the \textsf{babel} behaviour
by means of a set of package options, with a few macros serving as
tools for specific purposes.  This package must be loaded
\textbf{before} \textsf{babel}.

\section{Package options}

\begin{description}
\item[shorthands=off] The shorthands mechanism is turned off.
As some languages use this mechanism for tools not availible
otherwise, a macro \verb|\babelshorthand| is defined, which allows 
using them; see below. 

\item[shortands=...]  The shorthands mechanism is on, but the only
shorthands activated are those given, like, eg:
\begin{verbatim}
\usepackage[shorthands=:;!?]{babeltools}
\end{verbatim} 

If \verb|'| is included, \texttt{activeacute} is passed to
\textsf{babel}; if \verb|`| is included, \texttt{activegrave} is
passed.  Active characters (like \verb|~|) should be preceded by
\verb|\string| (otherwise they will be expanded by \LaTeX{} before
they are passed to the package and therefore they will not be
recognized).

\item[adaptive] By default, all \textsf{babel} shorthands are active
and live from start to end of documents.  You can deactivate them by
hand with \verb|\shorthandoff|, but this is cumbersome and you cannot
use it ``just in case'' (if the character is not a shorthands an error
is raised, instead of ignoring silently the redundant setting).  That
means you have to accept a character like : is active in an English
document even if you need it for just a few quotations in French.  The
default engine may be replaced by a new one which adapts the
shorthands behaviour to the context in the following way:
\begin{enumerate}
\item In math mode, while still shorthands, they behave always like the
corresponding normal char.  Things like \verb|$a \mathrel{x'} b$|
work as expected.

\item When the language is switched, shorthands chars are made normal or
active, as appropiate.  Thus, \texttt{:} or \texttt{?}  are active only in
\texttt{french}.
\end{enumerate}

% This option is useful when there are, say, short quotations in French
% inside a German text or when there are whole chapter in either French
% or German.

\item[nocrossrefs] newlabel, ref and pageref are not redefined. You 
cannot use shorthands in labels.

\item[nocitations] nocite, bibcite and bibitem are not redefined. You 
cannot use shorthands in labels.

\item[langcaptions] Captions are redefined if possible so that an
intermediate macro \verb|\lang...name| is used, eg,
\verb|\germanchaptername|.  Somewhat experimental.

\item[noconfig] Config files are not loaded, so you can make sure your
document is not spoilt by an unexpected \texttt{.cfg} file.
\end{description}

Babel tweaks several packages for shorthands to be accepted.  At the
time of this writing they are \textsf{cite}, \textsf{natbib},
\textsf{varioref} and \textsf{hhline} (the latter for the colon).  If
you don't use shorthands, these redefinitions are unnecesary and
inconvenient.  If you give a list of shorthands and it doesn't include
\verb|:|, then \verb|hhline| is left untouched.  The other packages
are handled by \texttt{nocrossrefs} and \texttt{nocitations}, as
appropiate.

\section{Macros}

\begin{description}
\item[\ttfamily\string\babelshorthand] Use a shorthand, even with
\texttt{shorthands=off} or not listed in it, eg,
\verb|\babelshorthand{"u}| or \verb|\babelshorthand{:}|.  You can
conveniently define your own macros.
\end{description}

\section{Known limitations}

If a class loads \textsf{babel} with a language, you cannot use
\textsf{babeltools}.  However, if a class loads babel without loading
any language, you can use it.  Languages given in
\verb|\documentclass| work as expected (provided the class doesn't
load it, of course).

\end{document}