0

Anyone know why I am getting an undefined control sequence error when trying to use \defcitealias in natbib, even though natbib otherwise seems to be working?

\documentclass{article} 
\usepackage{natbib}

\defcitealias{foo}{bar}

\begin{document}

\citetalias{foo}
\citet{handk}

\bibliographystyle{chicago}
\bibliography{all.bib}

\end{document}


This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded 
format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./Untitled-2.tex
LaTeX2e <2015/01/01>
Babel <3.9l> and hyphenation patterns for 79 languages loaded.
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/size10.clo))
(/Users/firstnamelastname/Library/texmf/tex/latex/natbib.sty)
./Untitled-2.tex:4: Undefined control sequence.
l.4 \defcitealias
                 {foo}{bar}
?

foobar

BCBC
  • 35
  • What about this fix https://tex.stackexchange.com/questions/319983/undefined-control-sequence-pgfsyspdfmark-converting-standalone-tikz-with-pdflat? – koleygr Feb 01 '18 at 20:44
  • Aside: It should be \bibliography{all}, not \bibliography{all.bib}. – Mico Feb 01 '18 at 21:37
  • Another aside: How old is the natbib.sty file? Any chance you could update your TeX distribution from TeXLive2015 to TeXLive2017? – Mico Feb 01 '18 at 21:38
  • 1
    You have a local natbib.sty in /Users/firstnamelastname/Library/texmf/tex/latex/natbib.sty rename it to something else and try again. – Ulrike Fischer Feb 01 '18 at 22:50
  • Thanks, reloading natbib and then using kolygr's answer did the trick! – BCBC Feb 02 '18 at 11:52

1 Answers1

0

I tried the solution of my comment and didn't work but gave me an error about unknown option english in babel... I fixed it adding these lines before calling \defcitealias:

\providecommand{\pgfsyspdfmark}[3]{}
\usepackage[english]{babel}

Full MWE:

\documentclass{article} 
\usepackage{natbib}
\providecommand{\pgfsyspdfmark}[3]{}
\usepackage[english]{babel}
\defcitealias{foo}{bar}

\begin{document}

\citetalias{foo}
\citet{handk}

\bibliographystyle{chicago}
\bibliography{all.bib}

\end{document}
koleygr
  • 20,105
  • Thanks. Doesn't work for me, either with or without babel. So the idea is that the problem has to do with pdflatex? – BCBC Feb 01 '18 at 20:56
  • Just out of idle curiosity: where does \pgfsyspdfmark come from, and how does it fit in? – Mico Feb 01 '18 at 22:06
  • @Mico see the first comment of the question... I have no idea and will not search now... May be some other time but this fix is described there – koleygr Feb 01 '18 at 22:09