6

According to the natbib manual you can either set options via package option of by giving them to \setcitestyle, how ever they do not give the same result

Try the MWE below with either

\usepackage{natbib}
\setcitestyle{
  super,
  numbers,
  square,
}

or

\usepackage[super,numbers,square]{natbib}

the later gives me what I want (equiv to \textsuperscript{[1]}) but in the situation we are trying to solve, we cannot give options directly to natbib (I know I can just load natbib manually earlier, but that is not the point here, both solutions ought to give the same results).

Any idea why?

\listfiles
\documentclass[a4paper]{article}
\usepackage{filecontents}
\begin{filecontents*}{xxx.bib}
\@article{xxx,
  title={My Title},
  author={An Author},
  year={2017},
  pages={92--93},
  publisher={My Publisher}
}
\end{filecontents*}
% shouldn't the below be equivalent to 
%\usepackage[super,numbers,square]{natbib}
\usepackage{natbib}
\setcitestyle{
  super,
  numbers,
  square,
}
\bibliographystyle{plainnat}
\begin{document}

test\cite{xxx}

 \bibliography{xxx}


\end{document}
daleif
  • 54,450
  • 2
    Ahh, hint: \setcitestyle does not like spaces, sigh – daleif Jun 13 '17 at 11:29
  • That plus you don't want numbers, just square: will you post that as an answer? – Joseph Wright Jun 13 '17 at 11:31
  • @JosephWright we are actually trying to use your achemso package and the student wanted a very specific style. As I explain in my answer there seems to be a discrepancy in the implementation in natbib – daleif Jun 13 '17 at 11:38

1 Answers1

6

To answer my own question

  • The package options and the options in \setcitestyle are not implemented in the same manner, numbers package option sets numbers to true, but numbers option to \setcitestyle sets numbers to true and super explicitly to false!
  • \setcitestyle{...} uses its own low level comma parser, and it does not remove white space at the start or end of the keyword.

Therefore

[super,numbers,square]

is equivalent to

\setcitestyle{numbers,square,super}

super has to go last.

As Joseph mentions numbers are probably not needed here, but does not hurt.

daleif
  • 54,450