2

I have encountered a problem when I wanted to start referencing my work. I get the error

Package natbib Error: Bibliography not compatible with author-year citations. ...mand\NAT@force@numbers{}\NAT@force@numbers

and it is not even possible to compile the PDF when I undo the cite. The command that I am using is:

\ifuseCustomBib
    \RequirePackage[square, sort, numbers, authoryear]{natbib} 
\fi

I am using a bibtex file produced by Mendeley but the weird thing comes when I am not even using the package. Do you have any idea how to solve it?

Thank you in advance for your time and attention.

chrisma
  • 1,239
cjl
  • 21
  • 2
    Welcome to TeX.SE. Please tell us which bibliography style you employ. Incidentally, why are you setting the mutually exclusive and incompatible options numbers and authoryear? The first option it for numeric-style citation callouts, and the second is for authoryear-style citation call-outs. Choose one or the other option, but not both. – Mico Aug 09 '18 at 13:15
  • Hi Mico! Thank you for your welcome and your fast reply. So sorry if I am not clear enough but this is my first time using Latex. I used IEEE normative:
    \bibliographystyle{ieeetr}
    
    

    However, I have tried what you mention to remove one of them and neither worked out.

    – cjl Aug 09 '18 at 13:19
  • 1
    You need to (a) remove the authoryear option (since the ieeetr bibliography style is not capable of creating authoryear-style citation callouts), (b) delete all auxiliary files (esp. the aux file), (c) run LaTeX again (ignoring any warning messages from LaTeX/natbib), (d) rerun BibTeX, and (e) rerun LaTeX twice more. – Mico Aug 09 '18 at 14:23
  • By removing all the auxiliary files it is possible to compile and view the PDF, which I did not know. However, when I try to use \cite \citep or \citet the problem arises again. The console shows:
    This is BibTeX, Version 0.99d (MiKTeX 2.9.6745 64-bit)
    The top-level auxiliary file: thesis.aux
    ... The style file: ieeetr.bst
    ... I found no \citation commands---while reading file thesis.aux
    Database file #1: References/references.bib
    (There was 1 error message)
    Process exited with error(s)
    Am I missing anything?
    – cjl Aug 09 '18 at 14:55
  • Could this similar question and its answers help? – chrisma Aug 09 '18 at 15:20
  • @cjl - If BibTeX complains about an absence of \cite-type commands, it's mostly likely because you didn't run LaTeX first after deleting all the aux files. The sequence is LaTeX-BibTeX-LaTeX-LaTeX. – Mico Aug 09 '18 at 18:32
  • @cjl - Since the ieeetr bibliography style is only capable of generating numeric-style citation call-outs, it's make much to provide \citet instructions. I suggest you change \citet instructions to \cite. With the option numbers, \citep behaves like \cite, i.e., there's no real need to change the \citep instructions. – Mico Aug 09 '18 at 18:53
  • Hi @Mico!, I made an attempt with just one single reference and it worked. When I included all the bibiliography, which contains different types and following exactly the same procedureI got the same error. All my cites are \citet and the package I am using is `\ifuseCustomBib

    \RequirePackage[square, sort, numbers]{natbib}

    \fi`
    Do you have any other idea? By the way, thank you for your awesome support.

    – cjl Aug 10 '18 at 02:54
  • No error while running BibTeX, if helpful. – cjl Aug 10 '18 at 02:58
  • @cjl - I don’t understand why you use the \ifuseCustomBib conditional. What happens if you get rid of the conditional wrapper? – Mico Aug 10 '18 at 12:54
  • If I use \usepackage[square,numbers]{natbib} instead of \ifuseCustomBib \RequirePackage[square, sort, numbers]{natbib} \fi \renewcommand{\bibname}{References} is `"Option clash for package natbib." I received this template to start with so I am not that proficient and I do not know how to proceed. – cjl Aug 10 '18 at 21:24
  • Problem solved by modifying \bibliographystyle{ieeetr} – cjl Aug 10 '18 at 22:41
  • 4
    I'm voting to close this question as the OP's issues appear to have been solved via comments. – Mico Aug 12 '18 at 21:42

0 Answers0