I would like to add brackets to all quotations as in (Shneider et al 2016). The closest style is \usepackage[backend=bibtex, citestyle=authoryear]{biblatex}, it just lacks the brackets. I tried


but that causes a stack overflow

! TeX capacity exceeded, sorry [input stack size=5000].

What is the correct way to add the braces?

  • 1
    Use \parencite instead of \cite. – Phelype Oleinik May 10 '19 at 19:32
  • @PhelypeOleinik thank you, this answers the question. If you could also post a paragraph on why does this separation exist (as opposed to it being a separate bibliography style) it will be a perfect answer. – Vorac May 11 '19 at 15:39

Well first: why did your attempt break TeX?

When you do \renewcommand{\cite}[1]{(\cite{#1})}, and use \cite{hello}, TeX expands the \cite macro to (\cite{hello}). Pretty obvious, right? After all that's what you were trying to do. Now TeX writes a ( an then sees \cite{hello}). It expands \cite again and replaces by the definition you did: (\cite{hello})). Note that there are two )); one from the previous expansion and one from the latest one. The process repeats an you get \cite{hello}))), then \cite{hello})))), then \cite{hello}))))... And you got TeX stuck in an infinite loop.

Usually it would keep expanding \cite ad infinitum (if you do \renewcommand{\cite}[1]{\cite{#1}}, for instance, you'll need to interrupt TeX manually, or it will run forever), however at each expansion you are adding a new ), and soon that list of ) gets too big and TeX can't handle it, so it tells you that

! TeX capacity exceeded, sorry [input stack size=5000].

which is what you did, a 5000 items long list of ) characters :D

Just for the fun of it, with only 10 bytes: \def~{~)}~

If you wanted to re-define a command but still use the old definition you would need to do something like this:

\let\cite_OLD\cite % make a copy of \cite in \cite_OLD
\renewcommand{\cite}[1]{(\cite_OLD{#1})} % redefine \cite to use \cite_OLD

Now for the problem at hand...

You are using BibLaTeX, which comes with all sorts of citation goodies, so you'll hardly ever need to manually add the parentheses. Also, there are tons of excellent usage examples for BibLaTeX in this site, just search and you'll find :)

For your specific query you can look at the biblatex manual, section 3.8 Citation Commands. There are two basic types of citation commands (quote form the manual, summarised):

  • \cite/\Cite [⟨prenote⟩][⟨postnote⟩]{⟨key⟩}: These are the bare citation commands. They print the citation without any additions such as parentheses. \Cite is similar to \cite but capitalizes the name prefix of the first name in the citation if the useprefix option is enabled.
  • \parencite/\Parencite [⟨prenote⟩][⟨postnote⟩]{⟨key⟩}: These commands use a format similar to \cite but enclose the entire citation in parentheses.

And since you are using authoryear, this one is pretty common too (emphasis mine):

  • \textcite/\Textcite [⟨prenote⟩][⟨postnote⟩]{⟨key⟩}: These citation commands are intended for use in the flow of text, replacing the subject of a sentence. They print the authors or editors followed by a citation label which is enclosed in parentheses. Depending on the citation style, the label may be a number, the year of publication, an abridged version of the title, or something else.

This separation exists, as you ask, because according to Thor (2019), in author-year citation styles it's rather common to either use the citation as the subject in a sentence like above, with \textcite, or, after the sentence, add a parenthesized citation (with \parencite) which would not make sense outside the parentheses (Thor, 2019). Thus it's just natural that reference management packages provide such alternatives.

Thor, A. U. (2019). The difference between citation commands. in: The annals of references I just made up.

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.