TransWikia.com

Citation problem with natbib

TeX - LaTeX Asked on April 27, 2021

I have some problems with citations with natbib. Here’s my code:

documentclass[a4paper,11pt]{article}
pdfoutput=1 % if your are submitting a pdflatex (i.e. if you have
             % images in pdf, png or jpg format)

usepackage{jcappub} % for details on the use of the package, please
                     % see the JCAP-author-manual

usepackage[T1]{fontenc} % if needed

usepackage{amsmath}
usepackage{amssymb}
usepackage{caption}  

bibliographystyle{achemso}
usepackage[authoryear]{natbib}

bibliography{mybib.bib}
usepackage{tikz}
begin{document}
section{Introduction}
citep{Mondal2020}
end{document}

And here’s my .bib file:

@ARTICLE{Mondal2020,
       author = {{Mondal}, Sushovan and {Ali}, Saif and {S}, Shanima and {Banerjee}, Narayan and {Mortuza Hossain}, Golam},
        title = "{Propagation of gravitational waves in various cosmological backgrounds}",
      journal = {arXiv e-prints},
     keywords = {General Relativity and Quantum Cosmology},
         year = 2020,
        month = apr,
          eid = {arXiv:2004.13554},
        pages = {arXiv:2004.13554},
archivePrefix = {arXiv},
       eprint = {2004.13554},
 primaryClass = {gr-qc},
       adsurl = {https://ui.adsabs.harvard.edu/abs/2020arXiv200413554M},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

Why when I’m trying to create pdf, I’m instead of citation receiving [?]? Any help will be appreciated. Thanks.

One Answer

There are several issues with your test document:

  • Most importantly, place the bibliography directive not in the preamble, but inside the document environment, where you want the formatted bibliography to be typeset. Usually, this is toward the end of the document.

  • The jcappub package loads natbib automatically. If you want authoryear-style citation call-outs, you need to place the authoryear option among the document class options.

  • The @article entry type is not right for the entry at hand. It really ought to be @misc.

enter image description here

documentclass[a4paper,11pt,authoryear]{article}
begin{filecontents}[overwrite]{mybib.bib}
@misc{Mondal2020,
      title={Propagation of gravitational waves in various cosmological backgrounds}, 
      author={Sushovan Mondal and Saif Ali and Shanima S and Narayan Banerjee 
              and Golam Mortuza Hossain},
      year={2020},
      eprint={2004.13554},
      archivePrefix={arXiv},
      url={https://arxiv.org/abs/2004.13554},
      primaryClass={gr-qc}
}
end{filecontents}

usepackage[T1]{fontenc}
usepackage{xurl}
usepackage{jcappub} % this package loads 'natbib' automatically
bibliographystyle{achemso}

begin{document}
section{Introduction}
citep{Mondal2020}
bibliography{mybib}
end{document}

Correct answer by Mico on April 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP