0

I am trying to include my references using PDFLATEX into my document like this :

\begin{document}

... \bibliographystyle{plain}

\bibliography{References}

\end{document}

But the cite command returns empty and the references are not displayed. What package should i include knowing that i only included natbib. Also i put my References.bib in the same folder than my .tex and it starts like this :

@article{ref1,
  title={...

AND neither can i use filecontents :

\begin{filecontents}{jobname.bib}
@book{author_book,
title = {Book's title},
author = {Author, Some},
location = {The City},
publisher = {Publisher},
year = {2005},
}
\end{filecontents}

\begin{document} \nocite{*}

\bibliographystyle{abbrv} \bibliography{jobname}

\end{document}

PS : i use TexWorks under Windows 10.

Thanks.

moewe
  • 175,683
  • Please make sure to complete your examples such that they contain a suitable document class. Did you remember to run pdflatex, bibtex, pdflatex, pdflatex? And you'd probably want to use \jobname not jobname, though that also works. – daleif Jun 17 '21 at 15:07
  • Bibtex is returning the error : found no \citation commands---while reading file .aux – John Campbell Jun 17 '21 at 15:09
  • @JohnCampbell Your code is incomplete. Post the entire code. – Mafsi Jun 17 '21 at 15:12
  • 1
    You need to run BibTeX as explained in https://tex.stackexchange.com/q/63852/35864. If you get "found no \citation commands" you might not be running the full compile sequence of LaTeX, BibTeX, LaTeX, LaTeX or you might not be running BibTeX on the correct file (it has to be run on the .aux file or extension-less name of your main .tex file) or your .tex file does not contain any cite commands (unlike the example shown in the question). – moewe Jun 17 '21 at 15:12
  • @moewe i don't understand i am using TexWorks' pdflatex compiler for my .tex file, but for the error found no \citation commands---while reading file .aux was after running using Bibtex compiler – John Campbell Jun 17 '21 at 15:14
  • the link https://tex.stackexchange.com/q/63852/35864 is not helping me. – John Campbell Jun 17 '21 at 15:16
  • pdfLaTeX and BibTeX are two different programs: Basically pdfLaTeX typesets your document, but cannot resolve citations. BibTeX resolves citations and makes them available to LaTeX. So you always need to run pdfLaTeX, BibTeX, pdfLaTeX, pdfLaTeX together (in that order). See the link I posted above. – moewe Jun 17 '21 at 15:16
  • i am trying to run Bibtex on my main .tex file using TexWorks but getting the .aux error i mentioned – John Campbell Jun 17 '21 at 15:18
  • Hmm. If the code in your main .tex file looks anything like the pieces of code shown in the question this shouldn't be happening. (Assuming you did run LaTeX before you ran BibTeX.) But it is hard to diagnose the problem without knowing what your document actually looks like. Please run the following example https://gist.github.com/moewew/57eb80c249f25dbc07878cc734575d30 without change (the file xampl.bib that is called should be available on all machines with BibTeX) in a new and empty folder with pdfLaTeX, BibTeX, pdfLaTeX, pdfLaTeX. Report exactly what happens. – moewe Jun 17 '21 at 15:26
  • it is working fine in your example – John Campbell Jun 17 '21 at 15:30
  • Good. Then try to boil your non-working example down to a small example document (in the style of what I posted) where the citations do not work. This will take some time (even though you can probably remove almost all body text immediately and lost of code from the preamble as well), but it is really the only way to enable us to help you properly. – moewe Jun 17 '21 at 15:36
  • wheres the content of your xampl file .bib ? – John Campbell Jun 17 '21 at 15:39
  • Forget about the contents of that file for a moment. Just use \cite{article-full} (or \citep or whatever cite command you use) and \bibliography{xampl} in your example document. If the error messages are indeed as described above, the contents of your .bib file are unlikely to be the problem. – moewe Jun 17 '21 at 15:47

1 Answers1

0

Run in TeXWorks: pdflatex + biber + pdflatex + pdflatex

\documentclass[
    a4paper,
    ]{article}

\usepackage[backend=biber]{biblatex} \begin{filecontents}[force]{\jobname.bib} @book{author_book, title = {Book's title}, author = {Author, Some}, location = {The City}, publisher = {Publisher}, year = {2005}, } \end{filecontents} \addbibresource{\jobname.bib}

\begin{document}

\printbibliography \nocite{*}

\end{document}

Mafsi
  • 664