%
% This is babelauthor.sty
% (c) 2008 Ulrich M. Schwarz, ulmi <at> absatzen.de
%
% You are allowed to use, distribute and modify this file
% under the terms of the LaTeX Project Public License 1.3a.
%
% This file is maintained. Current maintainer: Ulrich M. Schwarz
%
% USAGE:
% \usepackage[foo, bar, baz]{babelauthor}
% redefines \foo, \bar and \baz so that babel shortcuts are
% available in its first and only argument.
% (So likely you'll only use \usepackage[author,title]{babelauthor}
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{babelauthor}[2008/03/09 v0.1 early babel ahortcuts(ums)]

\RequirePackage{babel}%
% ugly hack: the last element of \dospecials without babel
% is \~, everything after that, we assume to be a shortcut.
\def\bba@getshortcuts#1\~#2\@nil{#2}%
\def\bba@do#1{\catcode`#1\active}%

\def\bba@redefine#1{%
  \PackageInfo{babelauthor}{Redefining #1}%
  \expandafter\let\csname bba@#1\expandafter\endcsname 
    \csname #1\endcsname
  \expandafter\renewcommand\csname #1\endcsname{%
    \begingroup
    \let\do\bba@do
    \expandafter\bba@getshortcuts\dospecials\@nil
    \expandafter\selectlanguage\expandafter{\bbl@main@language}%
    \expandafter\expandafter\expandafter\endgroup\csname bba@#1\endcsname
  }%
}

\DeclareOption*{%
  \expandafter\bba@redefine\expandafter{\CurrentOption}%
}
\ProcessOptions\relax
\endinput
% Finis.
% Example document follows:
\documentclass{article}

\usepackage[french, ngerman]{babel}

\usepackage[author,title]{babelauthor}
\show\author

\author{dr"olf}
\title{Dr"usenfieber}

% not patched:
\def\test{br"oken}

\begin{document}
  \maketitle
  
  \test
\end{document}

