Prev Up Next
Go backward to 8.3 Links into your document
Go up to 8 Moving information around
Go forward to 8.5 Splitting your input

8.4 Bibliography and citation

Hyperlatex understands the thebibliography environment. Like LaTeX, it creates a chapter or section (depending on the document class) titled "References". The \bibitem command sets a label with the given cite key at the position of the reference. This means that you can use the \link command to define a hyperlink to a bibliography entry.

The command \Cite is defined analogously to \Ref and \Pageref by \link. If you define a bibliography like this

   \begin{thebibliography}{99}
      \bibitem{latex-book}
      Leslie Lamport, \cit{\LaTeX: A Document Preparation System,}
      Addison-Wesley, 1986.
   \end{thebibliography}
then you can add a reference to the LaTeX-book as follows:
   ... we take a stroll through the
   \link{\LaTeX-book}[~\Cite]{latex-book}, explaining ...

Furthermore, the command \htmlcite generates the printed citation itself (in our case, \htmlcite{latex-book} would generate "[1]"). The command \cite is approximately implemented as \link{\htmlcite{#1}}{#1}, so you can use it as usual in LaTeX, and it will automatically become an active hyperlink, as in "[1]". (The actual definition allows you to use multiple cite keys in a single \cite command.)

Hyperlatex also understands the \bibliographystyle command (which is ignored) and the \bibliography command. It reads the .bbl file, inserts its contents at the given position and proceeds as usual. Using this feature, you can include bibliographies created with BibTeX in your HTML-document! It would be possible to design a WWW-server that takes queries into a BibTeX database, runs BibTeX and Hyperlatex to format the output, and sends back an HTML-document.

The formatting of the bibliography can be customized by redefining the bibliography environment thebibliography and the Hyperlatex macro \htmlbibitem. The default definitions are

   \newenvironment{thebibliography}[1]%
      {\chapter{References}\begin{description}}{\end{description}}
   \newcommand{\htmlbibitem}[2]{\label{#2}\item[{[#1]}]}

If you use BibTeX to generate your bibliographies, then you will probably want to incorporate hyperlinks into your .bib files. No problem, you can simply use \xlink. But what if you also want to use the same .bib file with other (vanilla) LaTeX files, which do not define the \xlink command? What if you want to share your .bib files with colleagues around the world who do not know about Hyperlatex?

Here is a trick that solves this problem without defining a new BibTeX style or something similar: You can put a URL into the note field of a BibTeX entry as follows:

   note = "\def\HTML{\XURL}{ftp://nowhere.com/paper.ps}"
This is perfectly understandable for plain LaTeX, which will simply ignore the funny prefix \def\HTML{\XURL} and typeset the URL.

In your Hyperlatex source, however, you can put these definitions in the preamble:

   \W\newcommand{\def}{}
   \W\newcommand{\HTML}[1]{#1}
   \W\newcommand{\XURL}[1]{\xlink{#1}{#1}}
This will turn the note field into an active hyperlink to the document in question.

(An alternative approach would be to redefine some LaTeX command in Hyperlatex, such as \relax.)


Otfried Schwarzkopf, September 2, 1997

Prev Up Next