1

I am trying to import citations but the following error occurs. It displays author? instead of author-year.

document1.snw:

\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{float}
\usepackage{mathtools}
\usepackage{eso-pic}
\usepackage{array}
\usepackage{shortvrb}
\usepackage{tikz}
\usepackage{tabularx}
\usepackage{listings}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{natbib}



\begin{document}

the possible future events \citet{Test12}.

\bibliographystyle{plainnat}
\bibliography{References_trial}

\end{document}    

References_trial.bib:

@article{Test12,
    author = {{John Smith}},
    title = {Test Article},
    year = {2012},
    journal = {The Test Journal}
}

enter image description here

7
  • 2
    Unrelated: plese don't use the tag biblatex when this is not related to biblatex as you don't use it.
    – daleif
    Aug 31, 2020 at 17:03
  • 1
    That is not the output I get. Did you compile enough times? pdflatex, bibtex, pdflatex, pdflatex
    – daleif
    Aug 31, 2020 at 17:05
  • @daleif I am using knit for the document1.snw in RStudio and after that I compile document1.tex . The method that i have used to complite it, is the method that you described above.
    – Nicolas123
    Aug 31, 2020 at 17:07
  • Are you sure, you're compiling the right files? Compiling your example gives me the desired output. Yet, the References aren't numbered. So there is something else going on here. Aug 31, 2020 at 17:11
  • 3
    Why do you enclose John Smith in curly braces, i.e. as author = {{John Smith}} instead of author = {John Smith}? I think you try to use this to get the name as "John Smith" instead of "Smith, John" or "Smith, J.". However, if that is the case, use a reference style that gives you the name in the desired format. Because if you do it like that and ever want to use a reference style in author-year format with alphabetically ordered bibliography, this will wreak havoc. BibTeX will be unable to determine first and last names and will sort "John Smith" before "Zac Ahrens", for instance. Aug 31, 2020 at 17:52

1 Answer 1

1

Some comments and observations:

  • If you want to use \citet to generate "textual style" authoryear-type citation call-outs, be sure to load the natbib citation package with the options authoryear and round.

  • Whatever else you do, change author = {{John Smith}}, to either author = {John Smith}, or author = {Smith, John},.

  • Be sure to run a full compile cycle -- LaTeX, BibTeX, and LaTeX twice more -- to resolve the \cite-related cross-dependencies.

enter image description here

\documentclass[a4paper]{article} 
\begin{filecontents}[overwrite]{References_trial.bib}
@article{Test25,
    author = {John Smith},
    title  = {Test Article},
    journal= {The Test Journal},
    year   = {2525},
    volume = {1},
    number = {2},
    pages  = {3-4},
}
\end{filecontents}
\usepackage[authoryear,round]{natbib}
\bibliographystyle{plainnat}

\begin{document}
\noindent
\citet{Test25}
\bibliography{References_trial}
\end{document}    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .