Comments on bibulus.sty

Morten Høgholm <[email protected]> Thu, 25 Nov 2004 01:21:37 +0100
Newsgroups gmane.comp.tex.bibulus.devel
Message-ID <[email protected]>
Hi all,

A few comments on bibulus.sty:

1) \cite should be a robust command, so use \DeclareRobustCommand for it.

2) There's a typo (a missing t) in the error message:
%% Error messages to check whether obsolete commands are being used.
\def\bibliography#1{%
   \PackageError{bibulus}{The command 'bibliography' is not to be used
     with bibulus}{You have entered the command
     \string\bibliography\space in your document.\MessageBreak
     Use \string\prinbibliography\space instead.}}

3) \footnotecite: Needs to be done from scratch as it doesn't support  
babel and babel is required by bibulus!

\documentclass{article}
\usepackage[danish,frenchb]{babel}
\usepackage[T1]{fontenc}
\makeatletter

\DeclareRobustCommand*\footnotecite [1]{%
   \unskip
   \def\bibulus@arg{#1}%
   \futurelet\@let@token\bibulus@footnotecite
}

\def\bibulus@footnotecite{%
   \@safe@activestrue
   \let\bibulus@gobble\@gobble
   \bibulus@@footnotecite
   \footnote{\cite{\bibulus@arg}}%
   \bibulus@gobble
}

\newcommand*\AddFootciteToken[1]{%
   \begingroup
     \def\x##1\@nil{\endgroup
       \def\bibulus@@footnotecite{%
         \expandafter\if\expandafter\string
           #1\@let@token
           \@safe@activesfalse\@let@token
         \else
           ##1%
         \fi
       }%
     }%
   \expandafter\x\bibulus@@footnotecite\@nil
}

\def\bibulus@@footnotecite{%
   \@safe@activesfalse
   \let\bibulus@gobble\relax
}

\@tfor\reserved@a:=%
   .,;:?!%
   \do{\expandafter\AddFootciteToken\reserved@a}%

\makeatother
\begin{document}

Some text \footnotecite{Braams:TB12-2-291}. More text

Some text \footnotecite{Braams:TB12-2-291}: More text

Some text \footnotecite{Braams:TB12-2-291}! More text

Some text \footnotecite{Braams:TB12-2-291}  More text

\selectlanguage{danish}

Some text \footnotecite{Eijkhout:TTT92}. More text

Some text \footnotecite{Eijkhout:TTT92}: More text

Some text \footnotecite{Eijkhout:TTT92}! More text

Some text \footnotecite{Eijkhout:TTT92} More text

\begin{thebibliography}{1}

\bibitem{Braams:TB12-2-291}
Johannes Braams.
\newblock {Babel, a multilingual style-option system for use with  
{\LaTeX}'s
   standard document styles}.
\newblock {\em TUGboat}, 12(2):291--301, June 1991.

\bibitem{Eijkhout:TTT92}
Victor Eijkhout.
\newblock {\em {\TeX} by Topic, {A} {\TeX}nician's Reference}.
\newblock Reading, MA, USA, 1992.

\end{thebibliography}

\end{document}


-- 
Morten