BibTeX, biblatex and biberBibliography

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
Nadia_ZA
Posts: 11
Joined: Fri Dec 05, 2014 4:28 am

Bibliography

Post by Nadia_ZA »

Hi! I'm writing a bibliography.

Code: Select all

\documentclass{report}
\usepackage{setspace}
\doublespacing 

\begin{document}

\chapter{Introduction}
A book on hamiltonian circuits is \cite{ref:tutte}.

\cleardoublepage

\chapter{Graphs} 
Owens \cite{ref:owens} constructed a non-hamiltonian graph.

\renewcommand{\bibname}{References}
\def\bibindent{0.5in}
\begin{thebibliography}{99\kern\bibindent}
\makeatletter
\def\@biblabel#1{}
\let\old@bibitem\bibitem
\def\bibitem#1{\old@bibitem{#1}\leavevmode\kern-\bibindent}
\makeatother

\bibitem{ref:owens} Owens, P. J. (1981). Non-hamiltonian simple 3-polytopes whose faces are all 5-gons or 7-gons. {\em Discrete Mathematics, 36}, 227-230.

\bibitem{ref:tutte} Tutte, W. T. (1946). On hamiltonian circuits. {\em Journal of the London Mathematical Society, 21}, 98-101.	

\end{thebibliography}

\end{document}
How can I have this style of citation (1981) or (Owens, 1981)? I also want each reference to be written in single spacing and a double space between references. What should I insert/type to achieve that? 

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Bibliography

Post by Johannes_B »

Doing the bibliography this way (by hand) isn't the way to go, you can automate this and later change your mind and set the style of either the references in text or the bibliography.
There are commands in your example that are obsolete for 20 years.
I recommend to put your bibliographical data into a database (Read more about BibTeX-data bases).
Package biblatex will collect the information needed to run the helper program biber.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Nadia_ZA
Posts: 11
Joined: Fri Dec 05, 2014 4:28 am

Bibliography

Post by Nadia_ZA »

Hi! I've put my bibliographical data into a bib file. As I have mentioned earlier, I want each entry to be single spaced and double spaced between entries. By the way, the body of the text is to be typed with double spacing. I've read several posts on this forum that are related to mine. But, I still can't figure out how to do. I've put \singlespacing command (as shown below in the code) but it makes the whole references to be single spaced. Please help.

Code: Select all

\begin{filecontents}{biblio.bib}
@article{gz1974,
	title={The existence of certain planar maps},
	author={Gr{\"u}nbaum, Branko and Zaks, Joseph},
	journal={Discrete Mathematics},
	volume={10},
	number={1},
	pages={93--115},
	year={1974},
	publisher={North-Holland}
}

@article{owens1984regular,
	title={Regular planar graphs with faces of only two types and shortness parameters},
	author={Owens, PJ},
	journal={Journal of graph theory},
	volume={8},
	number={2},
	pages={253--275},
	year={1984},
	publisher={Wiley Online Library}
}
\end{filecontents}

\documentclass{report}

\usepackage[UKenglish]{babel}
\usepackage[latin1]{inputenc}

\usepackage{setspace}
\doublespacing 

\usepackage[round]{natbib}

\begin{document}

\chapter{Introduction}
\citet{gz1974} have written a paper on planar maps.

\cleardoublepage

\chapter{Graphs} 
3-, 4-, 5-regular non-hamiltonian graphs can be found in \citep{owens1984regular}.

\renewcommand{\bibname}{References}
\setlength{\bibhang}{0.5in}
\singlespacing
\bibliographystyle{plainnat}
\bibliography{biblio}

\end{document} 
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Bibliography

Post by Johannes_B »

Putting \singlespace to the bibliography will set each bibitem single spaced. The distance between to item can be changed by the length bibsep. You can change it just like you did with bibhang

Code: Select all

\setlength{\bibsep}{0.5in}
Choose a value you like :-)

Now, for completeness the example with biblatex. Some things are similar, some are slightly different. It has some features that i don't want to miss. And you can alter the appearance relatively easy.

Code: Select all

\begin{filecontents}{\jobname.bib}
	@article{gz1974,
		title={The existence of certain planar maps},
		author={Gr{\"u}nbaum, Branko and Zaks, Joseph},
		journal={Discrete Mathematics},
		volume={10},
		number={1},
		pages={93--115},
		year={1974},
		publisher={North-Holland}
	}

	@article{owens1984regular,
		title={Regular planar graphs with faces of only two types and shortness parameters},
		author={Owens, PJ},
		journal={Journal of graph theory},
		volume={8},
		number={2},
		pages={253--275},
		year={1984},
		publisher={Wiley Online Library}
	}
\end{filecontents}

\documentclass{report}

\usepackage[UKenglish]{babel}

\usepackage{blindtext}
\usepackage{setspace}
\doublespacing

\usepackage[style=authoryear,natbib]{biblatex}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\setlength{\bibitemsep}{\baselineskip}
\setlength{\bibhang}{1in}
\begin{document}

\chapter{Introduction}
\citet{gz1974} have written a paper on planar maps. On the other
hand, \citeauthor{companion} have written \citetitle{companion}
in \citeyear{companion}.

\blindtext

\chapter{Graphs}
3-, 4-, 5-regular non-hamiltonian graphs can be found in \citep{owens1984regular}.

\singlespacing
\printbibliography[title=References]
\end{document}
Hint, click on »open in writelatex« to check the output and play around. :-)
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Nadia_ZA
Posts: 11
Joined: Fri Dec 05, 2014 4:28 am

Bibliography

Post by Nadia_ZA »

Hi Johannes! The output pdf has gz1974, owens1984regular, companion printed in bold and no bibliography. I'm using MiKTeX 2.9 with TeXworks. I've compiled pdflatex, bibtex, pdflatex, pdflatex and repeated the combination many times. Here are some of the output written on the console output.

Package biblatex Warning: No "backend" specified, using Biber backend.
(biblatex) To use BibTeX, load biblatex with
(biblatex) the "backend=bibtex" option.
Package biblatex Warning: 'babel/polyglossia' detected but 'csquotes' missing.
(biblatex) Loading 'csquotes' recommended.
LaTeX Warning: Citation 'gz1974' on page 1 undefined on input line 41.
LaTeX Warning: Citation 'companion' on page 1 undefined on input line 42.
LaTeX Warning: Citation 'companion' on page 1 undefined on input line 42.
LaTeX Warning: Citation 'companion' on page 1 undefined on input line 43.
LaTeX Warning: Citation 'owens1984regular' on page 2 undefined on input line 48.
LaTeX Warning: Empty bibliography on input line 51.
LaTeX Warning: There were undefined references.
Package biblatex Warning: Please (re)run Biber on the file:
(biblatex) test3(3)
(biblatex) and rerun LaTeX afterwards.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10330
Joined: Mon Mar 10, 2008 9:44 pm

Re: Bibliography

Post by Stefan Kottwitz »

Hi Nadia,

you need to run biber instead of bibtex with those settings,

Stefan
LaTeX.org admin
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Bibliography

Post by Johannes_B »

I should have mentioned that.

You can find some pictures how to include biber in Texworks at TeXwelt.

Or have a look at TeX.SX for some english explanations. :-)
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply