Latex: Can I cite a reference after the bibliography - latex

I'm having trouble with citations after the bibliography (in my appendices) using Bibtex/pdflatex. I'm using the 'puthesis' class - Purdue's class for our theses - which is built on top of the 'report' class. I'm using package 'natbib' with the option 'numbers'. An MWE isn't really feasible, but an example is shown below
\documentclass[english, ne, thesis]{puthesis}
\usepackage[numbers]{natbib}
...
\begin{document}
\chapter{Body Chapter}
Citations work fine here \cite{abc123}
\bibliographystyle{unsrt}
\bibliography{dissertation.bib}
\appendices
\chapter{Appendix Chapter}
Citations don't work here, I get an error that the
"Package natbib Warning: Citation `Crane1991' on page 145 undefined
on input line 4940." \cite{abc1234}
\end{document}
Some obvious things:
The citation does exist in the .bib file.
I'm running pdflatex; bibtex; pdflatex; pdflatex
I get the same error with and without the \appendices line.
Is there a way to cite references in latex after the bibliography?

This problem was caused by a non-UTF8/Latin9 encoded character in my .bib file. After ensuring the correct encoding with
recode utf8..l9 dissertation.bib
the file compiled as expected.

Related

Citations in Latex not working using biber backend and biblatex

I am working on a presentation and for some reason, none of my citations are working. I have created presentations with Latex before and never encountered this problem.
The following is a minimal example which is not working:
\documentclass{beamer}
\usepackage[backend=biber, style=authoryear, citestyle=authoryear]{biblatex}
\setbeamertemplate{footline}[frame number]
\bibliography{literatur.bib}
%\addbibresource{common/literatur.bib}
\begin{document}
\begin{frame}
\cite{test_citation}
\end{frame}
\nocite{*}
\begin{frame}[allowframebreaks=.85]{Bibliography}
\printbibliography
\end{frame}
\end{document}
During compilation, I get the following messages:
This is BibTeX, Version 0.99d (MiKTeX 21.10)
The top-level auxiliary file: document.aux
I found no \citation commands---while reading file document.aux
I found no \bibdata command---while reading file document.aux
I found no \bibstyle command---while reading file document.aux
(There were 3 error messages)
literatur.bib lies on the same level as document.tex and contains the following text:
#article{test_citation,
author="Author, Dummy",
title="Dummy citation",
year="2022"
}
I suspect that something is wrong with my biblatex installation, because even making the problem as simple as possible, the bibliography contains not a single entry in spite of the \nocite{*} command.

Bibtex saying empty bibliography when it is not empty

So I am trying to print my bibliography on my LaTex file and am having trouble. The package I am using is
\usepackage[backend=biber, style=alphabetic, sorting=ynt]{biblatex}
\addbibresource{refs.bib}
At the end of my document (still inside the document section though), I use \printbibliography and am being told "Empty bibliography on line 53" (that is the line that the \printbibliography is on). Inside of my bibliography I have this:
#article{junger1995traveling,
title={The traveling salesman problem},
author={J{\"u}nger, Michael and Reinelt, Gerhard and Rinaldi, Giovanni},
journal={Handbooks in operations research and management science},
volume={7},
pages={225--330},
year={1995},
publisher={Elsevier}
}
Any ideas why my bibliography is not showing? I am using Overleaf btw.

citations in Pandoc footnotes rendered as numerals

I am getting a weird result when I convert markdown to PDF using Pandoc. This is for academic writing with footnotes generated via citeproc; a bibtex library generated by Zotero; and a Chicago csl file. Most of the footnotes are fine, but sometimes where I should see a book or article I just get a numeral.
When I write the following in Markdown
^[#melvilleMobyDick, 155]
I want a footnote that says
Herman Melville, Moby-Dick, p. 155
but I get
1, p. 155
The problem seems to be in the transition from markdown to LaTeX; the latter output is:
\footnote{1, 155}
My shell command is:
$ pandoc article.md -o article.latex --filter=pandoc-citeproc
And I am using this YAML header:
title: Essay
bibliography: My_Library.bib
csl: chicago_fullnote_ibid.csl
Many thanks for your help.
You're using chicago_fullnote_ibid.csl, which styles citations as footnotes. So just do [#melvilleMobyDick, 155] instead of ^[#melvilleMobyDick, 155] and it will turn into a footnote.

Latex: In Springer class svjour3, want references sorted in alphabetical order, in author-year format

I am writing a paper in LAtex and using Springer macro package (svjour3 class).
Requirement is: citations should be in the form of authoryear and sorted in alphabetical order.
My tex file looks like:
{
\documentclass[smallextended]{svjour3}
\usepackage{natbib}
\begin{document}
\title{abc}
\bibliographystyle{spbasic} % basic style, author-year citations
%\bibliographystyle{spmpsci} % mathematics and physical sciences
%\bibliographystyle{apa}
%bibliographystyle{spphys} % APS-like style for physics
%\bibliographystyle{plainnat}
\bibliography{review} % name your BibTeX data base
\end{document}
}
I have used all the possible options of bibliographystyle.
Also I have used various types of options in \usepackage[options]{natbib}
Tried deleting all the temporary files aux, logs and all others.
All entries in bib file have author and year and are separated by commas.
Still I am getting following errors:
{
Package natbib Error: Bibliography not compatible with author-year citations. ...mmand\NAT#force#numbers{}\NAT#force#numbers
}
You have to add:
\usepackage[numbers,sort&compress]{natbib}
and then add bibliography as:
\bibliographystyle{spbasic}
\bibliography{sample.bib}
You have to add:
\usepackage[numbers,sort&compress]{natbib}
and then add bibliography as:
\bibliographystyle{spbasic}
\bibliography{sample.bib}
That almost did it for me. I changed it to
\usepackage[sort&compress]{natbib}
in the preamble. Cited with
\citep{ReferenceXY}
and added my bib
\bibliographystyle{spbasic}
\bibliography{literature.bib}

How to order citations by appearance using BibTeX?

By default (using the plain style) BibTeX orders citations alphabetically.
How to order the citations by order of appearance in the document?
There are three good answers to this question.
Use the unsrt bibliography style, if you're happy with its formatting otherwise
Use the makebst (link) tool to design your own bibliography style
And my personal recommendation:
Use the biblatex package (link). It's the most complete and flexible bibliography tool in the LaTeX world.
Using biblatex, you'd write something like
\documentclass[12pt]{article}
\usepackage[sorting=none]{biblatex}
\bibliography{journals,phd-references} % Where journals.bib and phd-references.bib are BibTeX databases
\begin{document}
\cite{robertson2007}
\cite{earnshaw1842}
\printbibliography
\end{document}
Change
\bibliographystyle{plain}
to
\bibliographystyle{ieeetr}
Then rebuild it a few times to replace the .aux and .bbl files that were made when you used the plain style.
Or simply delete the .aux and .bbl files and rebuild.
If you use MiKTeX you shouldn't need to download anything extra.
The best I came up with is using the unsrt style, which seems to be a tweaked plain style. i.e.
\bibliographystyle{unsrt}
\bibliography{bibliography}
However what if my style is not the default?
Just a brief note - I'm using a modified version of plain.bst sitting in the directory with my Latex files; it turns out having sorting by order of appearance is a relatively easy change; just find the piece of code:
...
ITERATE {presort}
SORT
...
... and comment it - I turned it to:
...
%% % avoid sort:
%% ITERATE {presort}
%%
%% SORT
...
... and then, after running bibtex, pdflatex, pdflatex - the citations will be sorted by order of appearance (that is, they will be unsorted :) ).
Cheers!
EDIT: just realized that what I wrote is actually in the comment by #ChrisN: "can you edit it to remove the SORT command" ;)
You answered your own question---unsrt is to be used when you want references to ne listed in the order of appeareance.
But you might also want to have a look at natbib, an extremely flexible citation package. I can not imagine living without it.
I'm a bit new to Bibtex (and to Latex in general) and I'd like to revive this old post since I found it came up in many of my Google search inquiries about the ordering of a bibliography in Latex.
I'm providing a more verbose answer to this question in the hope that it might help some novices out there facing the same difficulties as me.
Here is an example of the main .tex file in which the bibliography is called:
\documentclass{article}
\begin{document}
So basically this is where the body of your document goes.
``FreeBSD is easy to install,'' said no one ever \cite{drugtrafficker88}.
``Yeah well at least I've got chicken,'' said Leeroy Jenkins \cite{goodenough04}.
\newpage
\bibliographystyle{ieeetr} % Use ieeetr to list refs in the order they're cited
\bibliography{references} % Or whatever your .bib file is called
\end{document}
...and an example of the .bib file itself:
#ARTICLE{ goodenough04,
AUTHOR = "G. D. Goodenough and others",
TITLE = "What it's like to have a sick-nasty last name",
JOURNAL = "IEEE Trans. Geosci. Rem. Sens.",
YEAR = "xxxx",
volume = "xx",
number = "xx",
pages = "xx--xx"
}
#BOOK{ drugtrafficker88,
AUTHOR = "G. Drugtrafficker",
TITLE = "What it's Like to Have a Misleading Last Name",
YEAR = "xxxx",
PUBLISHER = "Harcourt Brace Jovanovich, Inc."
ADDRESS = "The Florida Alps, FL, USA"
}
Note the references in the .bib file are listed in reverse order but the references are listed in the order they are cited in the paper.
More information on the formatting of your .bib file can be found here: http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management
I often use the bibliography style natbib because it supplies quite complete set of formats as well as tags for us.
Add this if you want the number of citations to appear in order in the document
they will only be unsorted in the reference page:
\bibliographystyle{unsrt}
I used the following in overleaf and become in ascending order:
\usepackage{cite}
\bibliographystyle{unsrt}
with unsrt the problem is the format. use \bibliographystyle{ieeetr} to get refences in order of citation in document.
If you happen to be using amsrefs they will override all the above - so comment out:
\usepackage{amsrefs}
The datatool package offers a nice way to sort bibliography by an arbitrary criterion, by converting it first into some database format.
Short example, taken from here and posted for the record:
\documentclass{article}
\usepackage{databib}
\begin{document}
% First argument is the name of new datatool database
% Second argument is list of .bib files
\DTLloadbbl{mybibdata}{acmtr}
% Sort database in order of year starting from most recent
\DTLsort{Year=descending}{mybibdata}
% Add citations
\nocite{*}
% Display bibliography
\DTLbibliography{mybibdata}
\end{document}
I use natbib in combination with bibliographystyle{apa}. Eg:
\begin{document}
The body of the document goes here...
\newpage
\bibliography{bibliography} % Or whatever you decided to call your .bib file
\usepackage[round, comma, sort&compress ]{natbib}
bibliographystyle{apa}
\end{document}

Resources