3

I'm having some troubles using the command \nocite{*} to avoid citations in the body of my text. I've compiled many times and it keeps showing me question marks at the \nocite{*}'s location. No matter what bibliography style I use, it still shows the question marks. Besides, I've tried to use the listbibpackage and didn't have a good result as well.

Please, don't mark this question as already asked because the only one related to this talks about Other issue

This is (hopefully), the MWE:

\documentclass[12pt ,a4paper]{article}

\usepackage[brazil]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ae}
\usepackage{harvard}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{parskip}
\usepackage{indentfirst}
\usepackage{hyperref}
\usepackage{amssymb,fancyhdr,fancybox,epsfig,psfrag,amsmath,tabularx}
\usepackage[paperwidth=8.5in,paperheight=11in,hmargin={25mm,20mm},vmargin={20mm,20mm}]{geometry} %tamanho letter
\usepackage{fancyhdr}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book{key,
author = {Author, A.},
year = {2001},
title = {Title},
publisher = {Publisher},
}
\end{filecontents}

\begin{document}
Hello world
\nocite{key} 
\thispagestyle{empty}
\newpage
\bibliographystyle{abbrv}
\bibliography{\jobname} % or \addbibressource{/jobname.bib}
\end{document}

1 Answers1

8

The MWE can be reduced to the following code:

\documentclass{article}

\usepackage{harvard} \usepackage{filecontents} \bibliographystyle{abbrv}

\begin{filecontents}{\jobname.bib} @book{key, author = {Author, A.}, year = {2001}, title = {Title}, publisher = {Publisher}, } \end{filecontents}

\begin{document} Hello world \nocite{key} \bibliography{\jobname} \end{document}

which still exhibits the issue. I did not look into the harvard package code for the details, but it seems it does not handle the \nocite macro consistently with the LaTeX built-in support or other packages.

As a workaround, the document can be migrated to natbib while still using all the citation commands provided by harvard by replacing

\usepackage{harvard}

with

\usepackage{natbib}
\usepackage{har2nat}

as described in the har2nat package documentation.

Here's the complete revised MWE:

\documentclass{article}

\usepackage{natbib} \usepackage{har2nat} \usepackage{filecontents} \bibliographystyle{abbrv}

\begin{filecontents}{\jobname.bib} @book{key, author = {Author, A.}, year = {2001}, title = {Title}, publisher = {Publisher}, } \end{filecontents}

\begin{document} Hello world \nocite{key} \bibliography{\jobname} \end{document}

And the resulting output (no question mark! :-) :

enter image description here

Paul Gessler
  • 29,607