Skip to content

Conflict with natbib #37

@mjthoraval

Description

@mjthoraval

When I use jabbrv with natbib, it breaks the commands \citet and \citeauthor.

Here is a minimal example:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

%Import the natbib package and sets a bibliography  and citation styles
%\usepackage[numbers, sort&compress]{natbib}
\usepackage{natbib}
\usepackage{jabbrv} % Use a custom jabbrv-compatible style (.bst file) in \bibliographystyle
% Use a custom jabbrv-compatible style (.bst file) in \bibliographystyle when using the package jabbrv
\bibliographystyle{unsrtnat}
%\bibliographystyle{jabbrv_unsrtnat} % Does not seem to be compatible with jabbrv

% Write the bibtex file
% https://latexref.xyz/fr/filecontents.html
\begin{filecontents*}[overwrite]{References.bib}
@article{einstein,
  author =       "Albert Einstein",
  title =        "Test title",
  journal =      "Annalen der Physik",
  volume =       "322",
  number =       "10",
  pages =        "891--921",
  year =         "1905",
  DOI =          "10.1002/andp.19053221004"
}
\end{filecontents*}

\title{Test Natbib and Jabbrv}
\author{}
\date{}

\begin{document}
\maketitle

Test of the different Natbib commands:
\begin{enumerate}
    \item \verb|cite|: \cite{einstein}
    \item \verb|citet|: \citet{einstein}
    \item \verb|citep|: \citep{einstein}
    \item \citeauthor{einstein}
\end{enumerate}


\bibliography{References}

\end{document}

If I remove the jabbrv package, here is the expected result:
image

After adding the jabbrv package, here is the result:
image

I get the following error:
! Package natbib Error: Bibliography not compatible with author-year citations.
And warnings:
Package natbib Warning: Author undefined for citation`einstein'

Any idea of what is going wrong and how it could be fixed?
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions