0

I'm very new to LaTeX so i know very little about it, please keep this in mind. So I've just written a document and I did the bibliography using the following method.

\begin{thebibliography}{}
    \bibitem{label}
\end{thebibliography}

However, I was told I needed to use Harvard style referencing and was subsequently recommended that I make use of bib files. So I created a bib file with my bibliography information. However, I can't seem to get it to work at all I've tried various resources to no avail.

How do I use a bib files within LaTeX for my bibliography (in Harvard style)?

Output currently when I implement the bib file.

Process started: bibtex.exe "Project"

This is BibTeX, Version 0.99d (TeX Live 2019/W32TeX)
The top-level auxiliary file: Project.aux
I found no \citation commands---while reading file Project.aux
I found no \bibdata command---while reading file Project.aux
I found no \bibstyle command---while reading file Project.aux
(There were 3 error messages)

Process exited with error(s)



Process started: pdflatex.exe -synctex=1 -interaction=nonstopmode "Project".tex

Process exited normally

Here is a sample from my bib file:

@book{codebreakers3,
    author = {Kahn,D.},
    title = {The Codebreakers: the story of secret writing },
    year = {1996},
    publisher = {Scribner},
    isbn = {0684831309},
    page ={235},

}

@book{Cryptonetwork,
    title={Cryptography and Network Security: Principles and Practice, Global Edition},
    author={Stallings, W.},
    isbn={9781292158587},
    year={2016},
    pages = {314,451},
    publisher={Pearson Education},
}

@article{diffie,
    author = {  W. Diffie. and  M. Hellman.},
    title = {New directions in cryptography},
    journaltitle = {IEEE Transactions on Information Theory},
    year = {1976},
    volume = {22},
    issue = {6},
    month = {November},
    pages = {644-654},
    publisher = {IEEE Press Piscataway, NJ, USA },
    issn = {0018-9448},
}
5
  • If you want to use the code from the answer below, you need not run biber, not bibtex. You'll also have to ensure that there are \cite{...} commands in your document and that you run pdflatex before (and after) you run biber Aug 28, 2019 at 14:23
  • Hi sorry what is biber?
    – Dead_Ling0
    Aug 28, 2019 at 14:58
  • It's a tool similar to bibtex for a comprehensive view have a look at bibtex vs. biber and biblatex vs. natbib. If you are using any kind of "advanced" Editor you might want to include it as people might be able to comment on how to use biber with that. As an example see TeXstudio: how to automate LaTeX biber sequence of compilation
    – Seth
    Aug 29, 2019 at 5:37
  • @user36296 could you suggest an edit for the answer to make it work with bibtex or provide an alternative MWE that does? I've been using biber for so long ... I just don't remember the differences anymore.
    – Seth
    Aug 29, 2019 at 5:40
  • 1
    @Seth I just suggested a bibtex based example with a similar style. If you want to use your biblatex example with bibtex, add the backend=bibtex option, but this will only support a limited set of biblatex features Aug 29, 2019 at 8:02

1 Answer 1

1

Depending on how you write your LaTeX documents it might be more or less complex for you to make proper use of bib files as you will need to use bibtex or biber as part of the compilation progress.

An MWE could look like the following:

example.bib

@book{example,
    author = {Example Author},
    title = {Example Book},
    year = {2018}
}

example.tex (to be compiled with biber)

\documentclass{article}
\usepackage[style=authoryear-comp]{biblatex}
\addbibresource{example.bib}

\begin{document}
    Here is some text with a reference. \parencite[Pages 1-4]{example}

    \printbibliography
\end{document}

example.tex (to be compiled with bibtex)

\documentclass{article}

\usepackage{natbib}
\setcitestyle{authoryear,open={(},close={)}}

\begin{document}
    Here is some text with a reference. 

    \cite{example} or \citep{example}

    \bibliographystyle{abbrvnat}
    \bibliography{example}
\end{document}

You probably want to check with your source/professor what kind of Harvard style he expects. While the general idea might be clear there can be some surprises like requiring a strict format for your bibliography.

2
  • Hi I'm actually getting an error when I try to implement my bib file into my document I've updated my question with the specific problem.
    – Dead_Ling0
    Aug 28, 2019 at 14:01
  • I'll add a sample of the bib file to make sure that is correct also.
    – Dead_Ling0
    Aug 28, 2019 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.