LaTeX/Manually Managing References

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Back to main bibliography page

A reference list is nothing more than a, well, list. A list with anchors, or keys, to properly refer to the different list items. The list environment is called thebibliography, it takes one mandatory argument. Every item in the list starts with \bibitem{bibkey}.

Citing an entry from your references works similar to the label and ref mechanism. The label is the key given to the bibitem, referencing is done by \cite.

\documentclass{article}
\usepackage{url}
\begin{document}
I doubt that there is any useful information here~\cite{wikibook}.

All we know is limited, apart from knowing the answer we all know. Or do we? Wombat and Koala have discovered some interesting things~\cite{wombat2016}.

Some people are too nosy. What can happen to them is described by Laura Lion~\cite[p.~9]{lion2010}.

\begin{thebibliography}{1}
	\bibitem{wombat2016}
		Walther Wombat and Klaus Koala,
		``The true meaning of 42'' in: Journal of modern skepticism;
		2016
	\bibitem{lion2010}
		Laura Lion, Gabrielle Giraffe and Carl Capybara,
		``The dangers of asking the wrong question'', publishing house;
		2010
	\bibitem{wikibook}
		manually managing references, 
		\url{https://en.wikibooks.org/wiki/LaTeX/Manually_Managing_References}
		2016
\end{thebibliography}
\end{document}

cite returns the number of our list entry in the list in brackets. An optional argument can be given to add some text within the brackets.

As one can see, there is no sorting. Sorting is left to the document author.

Style and punctuation has to be consistent in your bibliography. If you have trouble remembering to put the title into quotes, define a helper command and use it. There is another inconsistency in the image above. Can you spot it?

\documentclass{article}
\usepackage{url}
\newcommand{\bibTitle}[1]{``#1''}
\begin{document}
I doubt that there is any useful information here~\cite{wikibook}.

All we know is limited, apart from knowing the answer we all know. Or do we? Wombat and Koala have discovered some interesting things~\cite{wombat2016}.

Some people are too nosy. What can happen to them is described by Laura Lion~\cite[p.~9]{lion2010}.

\begin{thebibliography}{1}
	\bibitem{wikibook}
		\bibTitle{Manually Managing References}, 
		\url{https://en.wikibooks.org/wiki/LaTeX/Manually_Managing_References};
		2016
	\bibitem{wombat2016}
		Walther Wombat and Klaus Koala,
		\bibTitle{The true meaning of 42} in: Journal of modern skepticism;
		2016
	\bibitem{lion2010}
		Laura Lion, Gabrielle Giraffe and Carl Capybara,
		\bibTitle{The dangers of asking the wrong question}, publishing house;
		2010
\end{thebibliography}
\end{document}

You may ask yourself what the mandatory argument of the environment is doing. You can define your own label for any entry in your list. Use your widest entry inside the argument. Using that optional argument, you can create an author-year style.

\documentclass{article}
\usepackage{url}
\newcommand{\bibTitle}[1]{``#1''}
\begin{document}
I doubt that there is any useful information here~\cite{wikibook}.

All we know is limited, apart from knowing the answer we all know. Or do we? Wombat and Koala have discovered some interesting things~\cite{wombat2016}.

Some people are too nosy. What can happen to them is described by Laura Lion~\cite[p.~9]{lion2010}.

\begin{thebibliography}{Wombat, 2016}
	\bibitem[Wikibook]{wikibook}
		\bibTitle{Manually Managing References}, 
		\url{https://en.wikibooks.org/wiki/LaTeX/Manually_Managing_References};
		2016
	\bibitem[Wombat, 2016]{wombat2016}
		Walther Wombat and Klaus Koala,
		\bibTitle{The true meaning of 42} in: Journal of modern skepticism;
		2016
	\bibitem{lion2010}
		Laura Lion, Gabrielle Giraffe and Carl Capybara,
		\bibTitle{The dangers of asking the wrong question}, publishing house;
		2010
\end{thebibliography}
\end{document}


Making use of package natbib to style citations[edit | edit source]

You can load package natbib to assist you with in text citations. The thebibliography environment needs to have a stricter formatting.

\documentclass{article}
\usepackage[numbers,round]{natbib}
\usepackage{url}
\newcommand{\bibTitle}[1]{``#1''}
\begin{document}
I doubt that there is any useful information here~\citep{wikibook}.

All we know is limited, apart from knowing the answer we all
know. Or do we? Some very interesting things have been found by~\citet{wombat2016}.

Some people are too nosy. What can happen to them is described by
\citeauthor{lion2010}~\cite[compare][p.~9]{lion2010}.

\begin{thebibliography}{1}
	\bibitem[Wikibooks(2017)]{wikibook}
		\bibTitle{Manually Managing References}, 
		\url{https://en.wikibooks.org/wiki/LaTeX/Manually_Managing_References};
		2016
	\bibitem[Wombat and Koala(2017)]{wombat2016}
		Walther Wombat and Klaus Koala,
		\bibTitle{The true meaning of 42} in: Journal of modern skepticism;
		2016
	\bibitem[Lion et al.(2010)Laura Lion, Gabrielle Giraffe and Carl Capybara]{lion2010}
		Laura Lion, Gabrielle Giraffe and Carl Capybara,
		\bibTitle{The dangers of asking the wrong question}, publishing house;
		2010
\end{thebibliography}
\end{document}

The optional argument for bibitem contains the short author list at the beginning, the year in parenthesis and the long author list at the end. Please note that there are no spaces around the parentheses, they separate the year of the publication from the short (beginning) and long list at the end.

natbib introduces new commands for citing and styling those citations, the package manual will give you more details.

Keeping track of all the details and checking for consistency will cost a lot of time.



Bibliographies per Chapter or Section[edit | edit source]

Package chapterbib can be used to make separated bibliographies within a document. It is important to have the content separated as well, meaning every section that gets its own bibliography needs to be in a separated file. In the main document, \include is used to put everything together. The following example creates those extra files on the run. This method is great for examples, but filecontents should not be used for real projects.

\begin{filecontents}{aster.tex}
\chapter{Aster}
I doubt that there is any useful information here~\citep{wikibook}.

All we know is limited, apart from knowing the answer we all
know. Or do we? Some very interesting things have been found by~\citet{wombat2016}.

\begin{thebibliography}{1}
	\bibitem[Wikibooks(2017)]{wikibook}
		\bibTitle{Manually Managing References}, 
		\url{https://en.wikibooks.org/wiki/LaTeX/Manually_Managing_References};
		2016
	\bibitem[Wombat and Koala(2017)]{wombat2016}
		Walther Wombat and Klaus Koala,
		\bibTitle{The true meaning of 42} in: Journal of modern skepticism;
		2016
\end{thebibliography}
\end{filecontents}
\begin{filecontents}{begonia.tex}
\chapter{Begonia}
All we know is limited, apart from knowing the answer we all
know. Or do we? Some very interesting things have been found by~\citet{wombat2016}.

Some people are too nosy. What can happen to them is described by Laura Lion~\cite[9]{lion2010}.

\begin{thebibliography}{1}
	\bibitem[Wombat and Koala(2017)]{wombat2016}
		Walther Wombat and Klaus Koala,
		\bibTitle{The true meaning of 42} in: Journal of modern skepticism;
		2016
	\bibitem[Lion et al.(2010)Laura Lion, Gabrielle Giraffe and Carl Capybara]{lion2010}
		Laura Lion, Gabrielle Giraffe and Carl Capybara,
		\bibTitle{The dangers of asking the wrong question}, publishing house;
		2010
\end{thebibliography}
\end{filecontents}
\documentclass{report}
\usepackage{url}
\usepackage[numbers]{natbib}
\usepackage[sectionbib]{chapterbib}
\usepackage{mwepage}
\newcommand{\bibTitle}[1]{``#1''}
\begin{document}
\include{aster}
\include{begonia}
\end{document}|