2

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.

1
  • 1
    Two things: don't specify .bib and you should but \bibliography where you want the bibliography it is what is providing the data for cite – daleif Feb 27 at 19:32
2

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}

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.