0

I want to use the following citation style

(AuthorName, Year)

I tried to do this by using the following commands

\usepackage{natbib}
...
\fancyhead[LO]{Bibliography}
\setcitestyle{round}
\bibliographystyle{plainnat}
\bibliography{references}

but the results is:

[AuthorName, Year]

Because I am not that comfortable with latex, I am also adding the other packages I am using, just to make sure I am not using something that comes in conflict with the natbib package

\usepackage{placeins}
\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{soul}
\usepackage{float}
\usepackage{amssymb} % Fancy letter package
\usepackage{mathrsfs} % Fancy letter package
\usepackage{caption}
\usepackage[toc,page]{appendix}

Update 1:

I forgot to mention that I am using overleaf.com for my document.

  • The packages you show should all be harmless and should not influence the brackets around citations, so there must be something else going on. Can you please prepare a full example document that reproduces the issue? (An MWE: tex.meta.stackexchange.com/q/228/35864) – moewe Nov 29 '19 at 15:25
  • 1
    Do you have \setcitestyle{round} in the document body? I can't quite tell, but the code snippet suggests you do. Try moving it into the preamble (i.e. before \begin{document}). – moewe Nov 29 '19 at 15:27
  • @moewe you are right. That fixed it. I wrote your suggestion as an answer, for future readers. But if you write the answer your self, I will accept it as the correct and delete my answer. :) – Dimitris Pantelis Nov 29 '19 at 16:22
  • Nah, it's fine. Just remember to accept your answer (when you can, I think there is a waiting time)? – moewe Nov 29 '19 at 16:25
  • 1
    ... Deleting large parts of text/code is easy with the binary search technique (delete half of the code, see if the error persists, if so, repeat; if not add the deleted half back in and delete the other half, repeat). With binary search you only need $O(\log_2 n)$ steps to reduce $n$ lines of code (so about 10 steps for 1000 lines of code). – moewe Nov 29 '19 at 16:34
1

I got the solution from @moewe's comment.

I had \setcitestyle{round} inside of \begin{document} ... \end{document}. After moving it before \begin{document}, it worked properly.

Thank you all for the effort and help.

| improve this answer | |

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.