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.

Is it possible to use both "and" and "&" using natbib? I've been trying to work it out for a long time now and I just can't seem to figure this one out. All I can manage is to either have "and" or "&" on both.

What I want to achieve:

\citet: "Given_a and Given_b (2013)"

\citep: "(Given_a & Given_b, 2013)"

share|improve this question
2  
Welcome to TeX.sx! My opinion is that "&" is good only for commercial names. –  egreg Feb 11 '13 at 13:06
    
Thanks! I agree, but my university insists of using a variation of the Harvard system. –  Storm Feb 11 '13 at 15:57
add comment

1 Answer 1

up vote 4 down vote accepted

Afaik, natbib does not support this. But of course, a hack is always possible ... Try putting this in your preamble (assuming that originally both commands produce an and):

\usepackage{natbib}
\usepackage{xstring}
\makeatletter
\let\origNAT@nmfmt\NAT@nmfmt
\def\NAT@nmfmt#1{%
  \ifNAT@swa
    \exploregroups\expandarg
    \StrSubstitute{#1}{ and }{ \& }[\mynatfmttemp]%
  \else
    \def\mynatfmttemp{#1}%
  \fi
  \origNAT@nmfmt{\mynatfmttemp}%
}
\makeatother
share|improve this answer
    
As of right now I'm using "&" as my current default, if I change it to "and" in the .bst file it changes the formatting of my reference list as well. It is however very close to what I'm looking for, the \citep and \citet worked perfectly when I changed to "and" :) –  Storm Feb 11 '13 at 16:06
    
just exchange { and } and { \& } after \StrSubstitute. –  Sašo Živanović Feb 11 '13 at 16:13
    
If I exchange those I get the exact opposite of what I want. (authorA and authorB, 2013) and in text authorA & authorB (2013) –  Storm Feb 11 '13 at 16:28
    
If you do the exchange I suggested in the comment and keep your default (where .bst produces &s), you should get the right thing. If I understand your situation correctly ... Ahh, unless you mean that \citep and \citet behave just oppositely of what you want? In that case, stick an \unless in front of \ifNAT@swa. (Btw, my declaration of \citep above is superfluous ... remains of experimentation ... I'll delete it.) –  Sašo Živanović Feb 11 '13 at 16:35
    
Awesome! using \unless worked perfectly (using the previous example code). Thanks! –  Storm Feb 11 '13 at 16:42
add comment

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.