# [OS X TeX] OT: low-tech bibliographic hyperlinking

Maarten Sneep maarten.sneep at xs4all.nl
Thu May 3 17:55:56 EDT 2007

Hi,

On May 2, 2007, at 19:30, Bruno Voisin wrote:

> Le 2 mai 07 à 18:50, Simon Spiegel a écrit :
>
>> Why don't you just use bibtex and biblatex? Much easier and more
>> versatile.
>
> Just a reluctance (and material difficulty) to invest several days
> learning to use new tools and customizing them to suit specific
> needs, when for any particular project I can get what I need in
> half a day of handwork say.

You can do it in two steps (although I think it is easier to use
bibtex, and it is most certainly worth it in the long run). But you
can use natbib without bibtex, and you'll be a lot happier, because
it will do most of what you ask straight away. To get you started, I
created a little sample file, included at the end.

> For example, imagine I need to cite three papers:
>
> Kistovich & Chashechkin 1992
> Kistovich & Chashehckin 1993
> Kistovich & Chashehckin 1998
>
> in the precise form (Kistovich & Chashechkin 1992, 1993, 1998),
> with "Kistovich & Chashehckin 1992" a hyperlink to Kistovich &
> Chashechkin (1992) in the list of references, "1993" a hyperlink to
> Kistovich & Chashehckin (1993) in that list, and "1998" a hyperlink
> to Kistovich & Chashehckin (1998) in that list. I'm sure getting
> exactly that with BibTeX would be problematic.

\bibliographystyle{} and \bibliography{} commands, and that is it.

> Or imagine you want to follow rules such that each paper with three
> authors is cited with the names of all three authors on first
> occurrence, and with the first author followed by "et al." on all
> subsequent occurrences. Or even worse: all papers with four authors
> or more are cited in the form first author et al.; this implies
> that two papers with four authors or more, published the same year
> and with same first author must have additional letters "a" and "b"
> added automatically to their year of publication, so that they are
> cited as "First author et al. (2000a, b)".

package. (seep pages 16 in texdoc natbib).
Second problem: is the default, although at least three authors are
needed to trigger 'et al.'

For more complicated bibliography requirements, there is makebst,
which will allow you to perform even better tricks. Although Gerben
once managed to find a journal that had requirements beyond the wild
imaginations of the author of makebst.

> All this I get can get tediously but easily when doing things
> manually. Using BibTeX and specific LaTeX packages, I imagine this
> is also possible, but I fear it would take hours of doc studying
> then customization. Being always in a rush, I'm reluctant to do that.

Since these requirements are common, they are easily obtained. I hope
that my samples are what you need to get started.

> And I've also that reluctance to rely on external packages (i.e.
> those not in latex/base) when avoidable: these packages may at any
> time be discontinued by their authors, or incompatible changes may
> be introduced in any new version, or superior packages may be
> introduced at any time leading you to invest time again learning a
> new syntax, converting your old files, and so forth. I prefer
> stability and working with the same limited set of tools, and
> invest time learning to use these tools to their maximum and push
> them to their limits.

natbib is well maintained, and has been around for at least a decade.
Its author has written a few books on LaTeX, and several (big)
journals rely on it (Phys Rev, the AGU journals, etc.) natbib is one
of the least risky packages to rely on.

> But you're certainly right that I should at least give a closer
> look to BibTeX and all the bibliography-related packages. When time
> allows...

Just to give you a headstart:

Instructions: save files under the indicated names.
Run pdflatex twice on trial.tex, view result.
- manual step: create your 'thebibliography' environment as usual,
but with the extra parameters for \item[]{} to help natbib.
- automated step: open the trial.bib file in bibdesk, and be amazed.
The hardest bit is putting names in the database to that bibtex can
cope with them.

A normal run would require:
pdflatex trial.tex
bibtex trial
pdflatex trial.tex
pdflatex trial.tex

(the first will produce an aux file to be parsed by bibtex, the
bibtex run will create the bbl file with the latex code for teh
bibliography, the last two runs will include the bibliography in the
master document, and resolve all links and references).

HTMH,

Maarten

%---8<----------- trial.tex
\documentclass{article}
longnamesfirst to solve one of the other issues.
% see page 16 of texdoc natbib for details.
\usepackage{hyperref}
\usepackage{hypernat}

\begin{document}
\bibliographystyle{abbrvnat}

See~\citep{kistovich1999a,kistovich1998a,kistovich1999b}

and see~\citep{kistovich1998a,kistovich1998b,kistovich1999c}
\clearpage

\bibliography{trial}
\end{document}
%---8<----------- trial.bbl
\begin{thebibliography}{5}
\providecommand{\natexlab}[1]{#1}
\providecommand{\url}[1]{\texttt{#1}}
\expandafter\ifx\csname urlstyle\endcsname\relax
\providecommand{\doi}[1]{doi: #1}\else
\providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi

\bibitem[Kistovich(1998)]{kistovich1998b}
A.~Kistovich.
\newblock Going solo?
\newblock \emph{journal of gnats and gnus}, 1998.

\bibitem[Kistovich et~al.(1998)Kistovich, Chashechkin, and
Michaelevich]{kistovich1998a}
A.~Kistovich, B.~Chashechkin, and C.~Michaelevich.
\newblock A title.
\newblock \emph{journal of gnats and gnus}, 1998.

\bibitem[Kistovich et~al.(1999{\natexlab{a}})Kistovich, Chashechkin, and
Michaelevich]{kistovich1999a}
A.~Kistovich, B.~Chashechkin, and C.~Michaelevich.
\newblock Another title.
\newblock \emph{journal of gnats and gnus}, 1999{\natexlab{a}}.

\bibitem[Kistovich et~al.(1999{\natexlab{b}})Kistovich, Chashechkin, and
Michaelevich]{kistovich1999b}
A.~Kistovich, B.~Chashechkin, and C.~Michaelevich.
\newblock Yet more titles.
\newblock \emph{journal of gnats and gnus}, 1999{\natexlab{b}}.

\bibitem[Kistovich et~al.(1999{\natexlab{c}})Kistovich, Michaelevich,
Chashechkin, and Nonsense]{kistovich1999c}
A.~Kistovich, C.~Michaelevich, B.~Chashechkin, and W.~Nonsense.
\newblock Grouping.
\newblock \emph{journal of gnats and gnus}, 1999{\natexlab{c}}.

\end{thebibliography}
%---8<----------- trial.bib
%% This BibTeX bibliography file was created using BibDesk.
%% http://bibdesk.sourceforge.net/
%% Created for Maarten Sneep at 2007-05-03 23:36:32 +0200
%% Saved with string encoding Western (ISO Latin 1)

@article{kistovich1999c,
Author = {Kistovich, A. and Michaelevich, C. and Chashechkin, B. and
Nonsense, W.},
Date-Modified = {2007-05-03 23:36:28 +0200},
Journal = {journal of gnats and gnus},
Title = {Grouping},
Year = {1999}}

@article{kistovich1998b,
Author = {Kistovich, A.},
Date-Modified = {2007-05-03 23:34:13 +0200},
Journal = {journal of gnats and gnus},
Title = {Going Solo?},
Year = {1998}}

@article{kistovich1999b,
Author = {Kistovich, A. and Chashechkin, B. and Michaelevich, C.},
Date-Modified = {2007-05-03 23:31:50 +0200},
Journal = {journal of gnats and gnus},
Title = {Yet more titles},
Year = {1999}}

@article{kistovich1999a,
Author = {Kistovich, A. and Chashechkin, B. and Michaelevich, C.},
Date-Modified = {2007-05-03 23:31:37 +0200},
Journal = {journal of gnats and gnus},
Title = {Another title},
Year = {1999}}

@article{kistovich1998a,
Author = {Kistovich, A. and Chashechkin, B. and Michaelevich, C.},
Date-Modified = {2007-05-03 23:31:46 +0200},
Journal = {journal of gnats and gnus},
Title = {A title},
Year = {1998}}