LaTeX forum ⇒ Articles, Essays, and Journal Templateshow to add reference in my paper?

IEEE, Elsevier, ACM, ACE, Science, AGU, PNAS, PLOS, RSoC, Springer, Stylish articles and Essays
yaozhao
Posts: 55
Joined: Sat Oct 27, 2018 10:38 pm

how to add reference in my paper?

Postby yaozhao » Mon Feb 24, 2020 4:02 am

Hi,

I don't know how to add reference section in my paper. I tried to google, but the tutorial I saw is very hard to understand.

I write my paper in overleaf. I have one main.tex and one bibliography.bib

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. %in the preamble
  2. %--------------------------------
  3. \usepackage[
  4. backend=biber,
  5. style=apa,
  6. ]{biblatex}
  7.  
  8. \addbibresource{bibliography}
  9. %--------------------------------
  10.  
  11. %Where the bibliography will be printed
  12. \printbibliography


In my bibliography.bib, it contains one reference:
Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. @article{glaze2008parents,
  2. title={Parents in prison and their minor children},
  3. author={Glaze, Lauren E},
  4. year={2008},
  5. publisher={Bureau of Justice Statistics}
  6. }


It doesn't work, The reference doesn't show up in my paper.

Can anyone help me?

Bartman
Posts: 96
Joined: Fri Jan 03, 2020 2:39 pm

Postby Bartman » Mon Feb 24, 2020 6:14 am

Please read the section on bibliography commands in the package documentation. The resource you are adding is missing the filename extension.

Furthermore, the incomplete example does not show us whether you cited the reference.

yaozhao
Posts: 55
Joined: Sat Oct 27, 2018 10:38 pm

Postby yaozhao » Mon Feb 24, 2020 7:35 am

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[12pt, a4paper]{article}
  2. \setlength{\oddsidemargin}{0.5cm}
  3. \setlength{\evensidemargin}{0.5cm}
  4. \setlength{\topmargin}{-1.6cm}
  5. \setlength{\leftmargin}{0.5cm}
  6. \setlength{\rightmargin}{0.5cm}
  7. \setlength{\textheight}{24.00cm}
  8. \setlength{\textwidth}{15.00cm}
  9. \parindent 0pt
  10. \parskip 5pt
  11. \pagestyle{plain}
  12.  
  13. %in the preamble
  14. %--------------------------------
  15. \usepackage[
  16. backend=biber,
  17. style=apa,
  18. ]{biblatex}
  19.  
  20. \addbibresource{bibliography.bib}
  21. %--------------------------------
  22.  
  23. \title{Research Proposal}
  24. \author{}
  25. \date{}
  26.  
  27. \newcommand{\namelistlabel}[1]{\mbox{#1}\hfil}
  28. \newenvironment{namelist}[1]{%1
  29. \begin{list}{}
  30. {
  31. \let\makelabel\namelistlabel
  32. \settowidth{\labelwidth}{#1}
  33. \setlength{\leftmargin}{1.1\labelwidth}
  34. }
  35. }{%1
  36. \end{list}}
  37.  
  38. \begin{document}
  39. \maketitle
  40.  
  41. \begin{namelist}{xxxxxxxxxxxx}
  42. \item[{\bf Title:}]
  43. Jailed parents
  44. \item[{\bf Keywords:}]
  45. Financial Stress
  46. \end{namelist}
  47.  
  48. \section*{Abstract}
  49. %Where the bibliography will be printed
  50. \printbibliography
  51.  
  52.  
  53.  
  54. \end{document}

User avatar
Ijon Tichy
Posts: 296
Joined: Mon Dec 24, 2018 10:12 am

Postby Ijon Tichy » Mon Feb 24, 2020 9:54 am

By default, only cited references are shown in the bibliography. So you have to add something like \autocite{glaze2008parents} or \nocite{*}.

Off-topic note: \bf is deprecated. You should use either {\bfseries Title} or \textbf{Title}. And instead of manipulation if layout lengths like \oddsidemargin it is recommended to use a package like geometry.

Code: [Select all] [Expand/Collapse] [Download] (example-withautocite.tex)
  1. \begin{filecontents}{\jobname.bib}
  2. @article{glaze2008parents,
  3. title={Parents in prison and their minor children},
  4. author={Glaze, Lauren E},
  5. year={2008},
  6. publisher={Bureau of Justice Statistics}
  7. }
  8. \end{filecontents}
  9.  
  10. \documentclass[12pt, a4paper]{article}
  11. \usepackage{geometry}% recommended to change layout
  12. \geometry{left=3.04cm,top=0.94cm,includehead,textheight=24cm,textwidth=15cm}
  13. \usepackage{parskip}% Recommended, if you want parskip instead of indent with standard classes
  14. \setlength{\parskip}{5pt}% strange value
  15.  
  16. %in the preamble
  17. %--------------------------------
  18. \usepackage[
  19. backend=biber,
  20. style=apa,
  21. ]{biblatex}
  22.  
  23. \addbibresource{\jobname.bib}
  24. %--------------------------------
  25.  
  26. \title{Research Proposal}
  27. \author{}
  28. \date{}
  29.  
  30. \newcommand{\namelistlabel}[1]{\textbf{#1:}\hfil}% label format moved to the definition
  31. \newenvironment{namelist}[1]{%1
  32. \begin{list}{}
  33. {
  34. \let\makelabel\namelistlabel
  35. \settowidth{\labelwidth}{#1}
  36. \setlength{\leftmargin}{1.1\labelwidth}
  37. }
  38. }{%1
  39. \end{list}}
  40.  
  41. \begin{document}
  42. \maketitle
  43.  
  44. \begin{namelist}{xxxxxxxxxxxx}
  45. \item[Title]% label format moved to the definition
  46. Jailed parents
  47. \item[Keyword]% label format moved to the definition
  48. Financial Stress
  49. \end{namelist}
  50.  
  51. \section*{Abstract}
  52.  
  53. Example cite: \autocite{glaze2008parents}% to have it in the references, cite it
  54.  
  55. \printbibliography
  56.  
  57. \end{document}

After running pdflatex, biber, pdflatex, pdflatex this results in:
Image

yaozhao
Posts: 55
Joined: Sat Oct 27, 2018 10:38 pm

Postby yaozhao » Mon Feb 24, 2020 7:44 pm

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \begin{filecontents}{\jobname.bib}
  2. @article{glaze2008parents,
  3. title={Parents in prison and their minor children},
  4. author={Glaze, Lauren E},
  5. year={2008},
  6. publisher={Bureau of Justice Statistics}
  7. }
  8. \end{filecontents}


These codes are just on the top of main.tex file? I don't need to create a new .bib file?
Also, what if I want to cite a lot of papers?

User avatar
Ijon Tichy
Posts: 296
Joined: Mon Dec 24, 2018 10:12 am

Postby Ijon Tichy » Mon Feb 24, 2020 7:57 pm

Using filecontents is usual for creating Infominimal working examples. For real documents you would just create the bib file either using an editor and a separate file or an application like JabRef.

yaozhao
Posts: 55
Joined: Sat Oct 27, 2018 10:38 pm

Postby yaozhao » Tue Feb 25, 2020 12:17 am

Sorry, I don't figure it out. I'm totally stuck.


Return to “Articles, Essays, and Journal Templates”

Who is online

Users browsing this forum: No registered users and 1 guest