## Hyperlink Latex Bibliography Environment

One of the immense strengths of LaTeX is its capability to cross-reference through information it places in auxiliary files. Done properly, this feature permits one to extract, insert, move and modify large and small chunks of the document around without having to manually renumber cross-references, it is all done automatically.

One of the easiest things to do is to insert a table of contents into a document simply by placing the LaTeX command \tableofcontents at the desired location in the document; see .

The first time this is LaTeX'ed the table will not appear because the information is being stored in the associated file. Subsequent LaTeX'ing will typeset the table of contents.

The package may be used to insert a Table of Contents of just the current chapter or Part in a book or report. Very useful to help map out the parts of the dissertation for a reader. See the scheme laid out in the skeleton file .

## Footnotes

Unlike most publishers, LaTeX easily handles footnotes with contemptuous ease. Just use the \footnote{some-text} command with one argument being the text of the footnote. As seen in , this will typeset a numerical flag at the location of the footnote command and will place the footnote text at the bottom of the page.

## Labels and references

Somewhat more sophisticated are references to equations and sections. First one has to label them as in \section{...} \label{sec-name} or in $$... \label{eq-name}$$ which associates a string such as '' with the number of the section, and a string such as '' with the number of the equation. See .

Having created the labels, you refer to the objects using the command as seen in . You may use the command to typeset a symbol for 'section' and 'subsection'. You must put parentheses around the equation number in its reference.

One also labels and refers to chapters, subsections, subsubsections, tables, figures, and enumerated lists.

Avoid unhelpful and easy to misinterpret phrases such as "we will do", "from the above equation" and "in the figure below": instead use precise cross-references such as "section \ref{} does", "using equation (\ref{})", and "Figure \ref{} plots", respectively.

### Drafts and electronic reading

When drafting a document, you often lose track of labels. Further, you want to read the document comfortably on screen rather than printing it. These desires are solved by two packages.

First, in the preamble will cause names of labels to also appear in a (draft) printed document for your ready reference.

Second, in the preamble will cause the document to be typeset with A5 paper size which is great for electronic reading. See and the next section where we also incorporate hypertext links.

### Cross-reference into enumerated lists

Also ensure you cross-reference to enumerated lists, instead of coding the numbers by hand. Such cross-references are best done with . For example, this package empowers you to do the following in typesetting an algorithm. \begin{enumerate}[ref=Step~\theenumi] \item\label{s1} Proceed to \ref{s2}. \item\label{s2} Go to \ref{s1}. \end{enumerate} To get typeset
1. Proceed to Step 2.
2. Go to Step 1.
In mathematics we often want to cross-reference to parts of assumptions, theorems, and so on. Do this, given that assumptions use the theorem counter, with LaTeX such as \begin{assumption} \label{ass} Assume the following. \begin{enumerate} [ref=Assumption~\thetheorem.\theenumi] \item\label{a1} This is \ref{a1}, \item\label{a2} and this is \ref{a2} \end{enumerate} \end{assumption} To get typeset something like
Assumption 3. Assume the following.
1. This is Assumption 3.1,
2. and this is Assumption 3.2

A feature of LaTeX is the ability to automatically insert hypertext links within a document:
• the command puts in a clickable link to the referred object;
• the command automatically inserts a target;
The hyperref package is wonderful, try it. To get this feature just insert the command at the end of the preamble (e.g., ).

Warning:  the files generated with and without hyperref may be incompatible, so delete the current file before using hyperref.

## Clever cross-referencing

The package enhances LaTeX's cross-referencing by determining the format of cross-references automatically according to the 'type' of cross-reference (whether to equation, section, theorem, and so on). After invoking the and packages, I recommend you include in the preamble (e.g., )

\usepackage[capitalise,nameinlink ,noabbrev]{cleveref} \crefname{equation}{}{} \crefname{enumi}{}{} All definitions must be after the above.

Then use for all your cross-references, except at the start of a sentence where you should use . The result is that each such cross-reference expands as in the following, with each cross-reference being a hyperlink.

LaTeX codeTypeset example
Figure 1
Theorem 2
Definition 3
(4)
Figures 1 and 2
Theorem 2 and Definition 3
(4) to (6)

You might ask why I do not recommend the automatic name 'equation' when cross-referencing an equation? The reason is that for best comprehension by readers, mostly we need to refer to an 'equation' by a more informative synonym such as "system (1)", "PDE (2)", "bound (3)", "approximation (4)", "inequality (5)", "transform (6)", and so on. It is not practical to code such informative synonyms automatically, we have to write them explicitly.

Similarly for an enumerated list: the default 'Item' name generated by is also functionally useless. Instead use via .

Warning: does not work with ; use instead.

## Bibliography

A bibliography is handled as a sort of enumerated list with labels.

The following list like environment

\begin{thebibliography}{99} \bibitem{bib-name1} article-description1 \bibitem{bib-name2} article-description2 ... \end{thebibliography} typesets the bibliography with the heading References and associates the labels, the strings such as '', with the description of the article or reference. See the end of .

Hint: if you want the entry "References" to appear in the table-of-contents then put the line at the start of thebibliography environment (use instead for reports or books).

Achieve citations in the text to the bibliography items by the command

\cite{bib-name} This typesets the number of the bibitem in square brackets as seen in .

Generally put a non-breaking space before the cite command as in

Mandelbrot~\cite{Mandel}...

### The actual citation has no meaning

Avoid the odius perversion, that somehow has spread throughout modern writing, of using citations in your sentences in the form "in [2]" or "by [3]". The bracketed number of a citation is just a pointer to more information. The bracketed number must not be part of the meaning of the sentence.
• Good ""
• Good ""
The meaning of your sentences must be independent of whether the bracketed citation appears or not.

## BibTeX et al.

The basic bibliography environment is fine for your first project report. However, in time you develop enough so that you want to keep one central database of all your references which you then access via the command in any document you prepare.
• First you prepare your database, say , consisting of records such as @article{Roberts94a, author = {A. J. Roberts}, journal = {Australasian Science}, month = apr, title = {The importance of beings fractal}, year = 1994, pages = 23, } or @article{Roberts95b, author = {A. J. Roberts and A. Cronin}, journal = {Physica A}, pages = {867--878}, title = {Unbiased estimation of multi-fractal dimensions of finite data sets}, volume = 233, year = 1996, } The program appears good for preparing and maintaining such a database; although I use BibDesk on a Macintosh.
• Then whenever you prepare a document, include the commands \bibliographystyle{plain} \bibliography{ajr} instead of thebibliography environment. Use as normal within the document.
• Lastly, after running LaTeX, execute the program bibtex (it will look in the file to determine what references are needed) which creates a file that later runs of LaTeX will read to form the bibliography. This sounds complicated, but it is all worth it.
There are also publicly available databases of files covering specialist areas of research compiled by interested people. For example there is one for dynamical systems.

### Some people use a Harvard style

Many people need to know how to use a Harvard style of citations. The one big advantage of Harvard style is that the citations are mostly invariant: "Smith (1987)" means the same (mostly) in each article that a reader reads; whereas "Smith [13]" means different things in different articles; and lastly, "[13]" is completely meaningless to a reader.

In LaTeX, obtain a Harvard style of citations as follows, with the same format for the data files, and very similar commands in the document.

• In the preamble put (get it from a CTAN site if your system does not have the package).
• In the place you want the bibliography put then as before but now using the AGSM bibtex style instead of the default plain style.
• Then to get the following citations use the given command
• "Roberts & Cronin (1996)" use ;
• "(Roberts & Cronin, 1996)" use ;
• this form also typesets an afterword, for example, for "(Roberts & Cronin, 1996, p.15)" use ;
• for three or more authors will typeset "Roberts et al. (1996)" which is good, but the convention is that the first time a three author work is cited the three authors ought to be explicitly given so then use to get "Roberts, Cronin & Another (1996)" the first time you site the work.
• Finally, the default style for URLs in natbib is very ugly. So in the preamble after and , include the statement
The hyperref package works with natbib and agsm.

As for the bracketed citation style, the parenthetical form is just a pointer to more information and must not contribute to the meaning of the sentence. Also avoid physically impossible statements such as ; instead use .

### Collaboration with BibTeX

In your first use of LaTeX you will probably be working on your own, in which case ignore this subsection. But as soon as you start to collaborate on writing, then come back and read this: collaboration with BibTeX is only reasonable with the following which merges from all the collaborators the relevant bib entries from their database into the common database .

• Ensure your system has the script or ---it comes with most LaTeX systems.
• Say three people are collaborating: you are Alice with collaborators Bob and Eve, and you each have separate bib files say , and , respectively. Then, in your LaTeX source, say , include a line for each collaborator of the following form, \bibliography{bibexport,alice} %\bibliography{bibexport,bob} %\bibliography{bibexport,eve}
• Execute LaTeX on the source (which records in the bibfiles to use).
• Execute (usually via a terminal application) which merges into the local file the necessary bib information from itself (first) and (second). Ignore warnings about duplicated bib entries.
• Execute to get the new file generated, and away you go as usual.
• When your collaborators want to merge in information from their personal bibfiles, and respectively, then they uncomment the bibliography line for themselves, comment out the other bibliography lines, and then proceed as above.
• One can even choose the bibliography command automatically by lines in the source such as \IfFileExists{alice.sty} {\bibliography{bibexport,alice}}{} \IfFileExists{bob.sty} {\bibliography{bibexport,bob}}{} \IfFileExists{eve.sty} {\bibliography{bibexport,eve}}{} provided each individual has a personal style file implementing their personal preferences for style!

### Gather bibliographic data via Zoterro

To find articles, one often searches the internet: use "Google Scholar" rather than just Google or other web search engine (as they are too indiscriminant).

Once found on the internet, mostly it is good to use Zoterro (a plugin to browsers) to download the article and the bibliographic information (despite occasional failure). Then a richt-click to "Export Item(s)..." saves bibliographic info in a *.bib file: edit and merge with your own database.

### BibLaTeX?

This is a new more powerful and flexible method for citations from data: to be incorporated soon.

## Divide and conquer large documents

Large documents, especially dissertations and books, can be a pain to deal with just because of their size. LaTeX gives a facility to split the source, the file, into manageable sized chunks to make editing easier and to speed typesetting by only doing that chunk of interest at any one time.
• Establish the main file, as in , of the form \documentclass{article} \begin{document} \include{frac25a} \include{frac25b} \include{frac25c} \end{document} with as many divisions as there are logical chunks in your document.
• Then put all your normal LaTeX text and commands in the corresponding files. Here I have broken the input file into:
• Typeset the main file and all appears as normal (except pagebreaks are enforced between the included files).
• To typeset only one of the chunks, say the first section, just insert the command \includeonly{frac25b} in the preamble as you see commented out in .

### Appendices

Often large documents have one or more appendices. If so just insert the command immediately before the first appendix, then use chapter and/or sectioning commands as before. The first chapter or section after will become Appendix A, the second will be Appendix B, etc.

## Summary

Cross-referencing is important in professional documents. Cross-referencing is absolutely vital in research as you must `plug' your work into the world's knowledge base, and must connect information across pages and sections within your own work. LaTeX provides incredibly easy tools to do this.

## Bibliography and citation

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

The command is defined analogously to and by . 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 generates the printed citation itself (in our case, would generate "[1]"). The command is approximately implemented as , 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 command.)

Hyperlatex also understands the command (which is ignored) and the 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 and the Hyperlatex macro . 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 . But what if you also want to use the same .bib file with other (vanilla) LaTeX files, which do not define the command? What if you want to share your .bib files with colleagues around the world who do not know about Hyperlatex?

One way to solve this problem is by using the BibTeX command. For instance, you put this in your BibTeX file:

@preamble(" \providecommand{\url}[1]{#1} ")

Then you can put a into the note field of a BibTeX entry as follows:

note = "\url{ftp://nowhere.com/paper.ps}"

Now your BibTeX file will work fine with any LaTeX documents, typesetting the as it is.

In your Hyperlatex source, however, you could define any way you like, such as: