[Tex/LaTex] Placing a comma before a citation-related superscript number

bibtexnatbibpunctuationsuperscripts

According to the Chicago Manual of Style (section 14.21) "a note number should generally be placed at the end of a sentence or at the end of a clause. The number normally follows a quotation (whether it is run into the text or set as an extract). Relative to other punctuation, the number follows any punctuation mark except for the dash, which it precedes."

I'm using the natbib package, with superscript values to refer to specific entries in the bibliography. But I cannot find a way to place a comma before the superscript number (the same problem would occur if there is a period after the citation). The following minimal example shows the problem:

\documentclass{article}                                                         
\usepackage[super,comma,numbers]{natbib}                                        
\begin{document}                                                                
\citet{latex,latex:guide}                                                       
\bibliography{harvard}                                                          
\bibliographystyle{apalike2}                                                    
\end{document}

Screenshot of the generated document:

screenshot

Is there any way to place the comma before the superscript value (2 in the example)?

Best Answer

I contacted the maintainer of the natbib package. For completeness, I'm posting the response that I was given.

This is an issue that cannot be easily solved.

The whole \citet with superscripted numerals was a complicated programming problem, since it is radically different from regular numerical citations. The problem was to add the authors to the numbers, something that the original LaTeX did not provide. This was an extra bonus for natbib. Then to extend it to superscripts was a greater effort.

The problem is that for multiple citations each citation is made up on its own and then put together. This means that the authors plus number are a unit, and the units are separated by whatever punctuation is applicable. Even for a single citation, the final punctuation comes outside that unit, so the final period is also outside.

A solution would involve extensive reprogramming. The code would have to know what punctuation is to come next, and then insert that into the citation unit between authors and superscript. For the final citation, this is even trickier because the code must look ahead to see what comes next and then insert it inside the citation unit, and then suppress that external punctuation. Mind boggling!

Multiple citations with \citet is something that I find strange anyway. I did provide it for completeness but wondered how it was to be applied. The \citet text is meant to be part of the sentence which would normally refer to a single reference. If you want to refer to more, it makes sense to expand the sentence as: see the details in \citet{ref1} and \citet{ref2} for clarification. This makes for better reading anyway. For \citep, parenthetical citations, multiple citations are really needed, because it is the only way to all the citations inside one set of brackets, a problem that does not exist for textual citations.

This applies to superscripted citations too. It would be better to give \citet{latex} and \citet{latex:guide}. The sentence reads better then. (Your example does not contain a full sentence and so this is not obvious. Try a real example.)

This still does not solve your problem if the \citet comes at the end of a sentence. Here I can only suggest the following: For more details, see \citeauthor{latex:guide}.\citep{latex:guide}

If you need this a lot, then you can define \newcommand{\citetdot}[1]{\citeauthor{#1}.\citep{#1}} and use that instead, but remember to leave off the period after using this command, since it is included within it.

There is no way to apply this trick to multiple citations, but then they should be avoided anyway and it is easy to get around it.