Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm wondering if anyone can suggest a better way to tweak natbib to generate numeric references that follow IEEE's citation reference guide and style manual. Specifically, IEEE wants each of a group of citations in separate brackets (like this: [1], [2]), but natbib seems to insist on grouping them (like so: [1, 2]).

The cite package handles this correctly, and I know the natbib IEEE templates are "not recommended" for IEEE submission, but I like being able to pull the name of the author(s) into the text sometimes, which natbib lets me do with \citet. Using natbib also lets me switch to author-year citations, if I end up having to change publications, without going through and changing every citation, which is also nice.

I can get close in natbib by setting the separator punctuation to ], [ (using \bibpunct), but natbib appears to add a hard-coded space after the separator (looks like this: [1], [ 2] (note the space in front of the 2; it looks more prominent in my typeset copy)). My solution at this point is to override one of the macros in natbib.sty in my own document, to remove the space (which can be put onto the end of the separator string if it's needed):

\makeatletter
\def\NAT@def@citea{\def\@citea{\NAT@separator}}% removed \NAT@space
\makeatother

Is there a more elegant and robust solution, with either cite or natbib? Or should I start looking into biblatex (which I've just found out about) for future work?

share|improve this question
1  
Why not just use \cite{author1}, \cite{author2} (a seperate \cite for each reference) instead of \cite{author1, author2}? –  Werner Mar 8 '12 at 21:47
    
I think your solution can't be improved very much. However I also recommend biblatex. –  Marco Daniel Mar 8 '12 at 21:48
    
@Werner, if you mean using two separate \citep entries, that's an okay workaround to get the formatting I need, but it would break the formatting if I switched to another citation format. The regular cite package already does the formatting correctly (so I wouldn't need two separate \cites--your second example works correctly), but it doesn't support inlining author names. natbib does, but gets the formatting slightly wrong. Thanks for the suggestion, though! –  big_m Mar 9 '12 at 16:07
    
Thanks, @Marco. I'll check out biblatex when I have the time, and use my workaround for now. –  big_m Mar 9 '12 at 16:09
    
Side-issue: I often publish in IEEE related journals and conferences and they simply don't mind since seperate brackets look (I think) awful. So I wouldn't mind that much. –  percusse Mar 9 '12 at 21:02

1 Answer 1

up vote 3 down vote accepted

Your solution can't be improved very well. I recommend switching to biblatex.

However @Werner suggested a separate \cite command for each reference.

To avoid this you can use something like this:

\usepackage{letltxmacro}
\LetLtxMacro{\Origcite}{\cite}
\makeatletter
\renewcommand*\cite[1]{%
 \@for \i:={#1}\do{%
      \Origcite{#1}%
      }%
}

Note that with this way you lose the optional argument of \cite.

share|improve this answer
    
Ah! Nice idea, @Marco! Is it necessary to lose the optional argument, though? I do use it sometimes, but it would only be in the case where there is a single citation, I think. (Unlikely you'd reference the same page in both sources. Which kind of points to a flaw in the design of the \cite command -- that single and multiple citations behave differently. Maybe another reason to think about switching.) –  big_m Mar 10 '12 at 2:55
    
@big_m: Of course you can modify and expand the code. But for a small workaround it's to much ;-) –  Marco Daniel Mar 10 '12 at 9:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.