3

I'd like to be able to choose either square brackets or round parentheses around the year of my citation call-outs, because my teacher wants to have square brackets only if the citation call-out is inside parentheses, and otherwise parentheses.

Example : "We would like to cite Hock (1986), Antilla (1989) and Fox (1995) in this chapter (and Rankin [2003] and Ringe [2013]), [...]"

Is there a way in doing this ?

  • I think it's a bad idea to have two different parenthesis styles. If one or more citation call-outs are placed inside a pair of parentheses, the "inner" parentheses are generally simply omitted, i.e., one writes either (Rankin, 2003 and Ringe, 2013) or (Rankin 2003 and Ringe 2013). Anyway, I don't think that natbib offers an option to use both round parentheses and square brackets. I don't know about biblatex, though. (Almost anything can be (re)configured with biblatex...) – Mico Aug 9 '17 at 10:35
  • @Mico if there is a way to change the parenthesis style in natbib there most likely is a way to switch this in the document, too, so one could build some custom macros with it. But I don't know natbib that well. Automated isn't reliably possible, I guess. – Skillmon Aug 9 '17 at 10:48
7

Certainly a strange request by your teachers. I can only think of defining your own \cite command to use when you're inside a parenthesis.

I assume you would require the square versions less, so I pass a default round option to natbib, then define respective commands: \sqcitet and \sqcitep which are just wrappers to change (locally) the cite style.

\begin{filecontents}{\jobname.bib}
@ARTICLE{feyn54,
    title = {Testing},
    author = {R. P. Feynman},
    journal = {Phys. Rev.},
    year = {1954},
    volume = {94},
    pages = {262}
}
\end{filecontents}

\documentclass{article}
\usepackage[round]{natbib}

\makeatletter
\newcommand{\bianca}{\renewcommand\NAT@open{[}\renewcommand\NAT@close{]}}
\makeatother

\newcommand*\sqcitet[1]{{\bianca\citet{#1}}}
\newcommand*\sqcitep[1]{{\bianca\citep{#1}}}

\begin{document}    
    We would like to cite some in-line \citet{feyn54} and \citep{feyn54}, and of course in brackets as well:
    (with \sqcitet{feyn54} and \sqcitep{feyn54}) 

    We would like to cite some in-line \citet{feyn54} and \citep{feyn54}

    \bibliographystyle{plainnat}
    \bibliography{\jobname}
\end{document}

enter image description here

Extra Note

The documentation offers two ways to change the citation style, viz. (i) \setcitestyle{square} and (ii) creating a new \bibstyle@xxx and calling it with \citestyle{xxx}.

Method (i) is simple enough to implement, while implementation of Method (ii) can be seen in my previous edit of this answer. But..

The first method adds spurious spacings, while the second method sets the style globally. (and so both are unsatisfactory).

And so instead, I've gone for the option of explicitly setting the open and close parenthesis with \renewcommand\NAT@open{[} and \renewcommand\NAT@close{]} for the time being.

  • @BiancaMertens np! – Troy Aug 9 '17 at 11:35
  • Actually I discovered that it doesn't work quite as well as I thought... After using \sqcitet{feyn54} for the first time, all following citations have squares and I can't go back to brackets... – Bianca Mertens Aug 9 '17 at 14:06
  • @BiancaMertens Sorry, I didn't check that \citestyleisn't affecting locally. Can you use \newcommand*\sqcitep[1]{{\setcitestyle{square}$\!\!$\citep{#1}}} instead for the time being? I'll try to dig up a little more. – Troy Aug 9 '17 at 14:15
  • @BiancaMertens Please see edit. Let me know if this causes any other problems. It might affect your bib style? I'm not too sure.. – Troy Aug 9 '17 at 14:45
  • Looks like it works perfectly this time. Thank you very much for your help! – Bianca Mertens Aug 9 '17 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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