4

Currently in the preamble I have:

\usepackage[
        backend=biber,
        style=authoryear,
        isbn=false,
        doi=false
]{biblatex}

My figures´ code looks like:

\begin{figure}
    \centering
    \includegraphics[width=0.7\textwidth]{Ecore_kernel.pdf}
    \caption{Kern-Elemente von Ecore}
    \label{Ecore_kernel}
    \small{(Eigene Darstellung in Anlehnung an \textcite[S. 124]{Steinberg2009})}
\end{figure}

Which produces a fine output with no errors but the citation looks like:

(Eigene Darstellung in Anlehnung an Steinberg u.a. (2009, S. 124))

Instead of parentheses I need square brackets inside the outer parentheses, like:

(Eigene Darstellung in Anlehnung an Steinberg u.a. [2009, S. 124])

I searched for similar problems and only found this solution which I find a bit too much for this imho simple task. I also read the biblatex documentation which doesn´t offer info on this task regarding \textcite{}.

I thought of a solution like \textcite[brackets][][S. 124]{Steinberg2009} if that is possible.

I hope you have a nice solution :)

Karl
  • 623
  • One very easy solution is to write \small{\mkbibparens{Eigene Darstellung in Anlehnung an \textcite[S. 124]{Steinberg2009}}}. That is replace the literal parentheses (...) by \mkbibparens{...}. – moewe Jul 11 '15 at 17:15
  • Wow, moewe, this is really nice! I was about to write my own \DeclareCiteCommand{\textcitebrackets} but this nesting feature is the better solution I think :) – Karl Jul 11 '15 at 17:43
  • You don't give an MWE so I haven't tested but what about {\small \parentext{Eigene Darstellung in Anlehnung an \textcite[S. 124]{Steinberg2009}}}? By the way, \small is a font switch: it does not take an argument. – cfr Jul 11 '15 at 22:02
  • @moewe You mean {\small ...} I'm assuming? – cfr Jul 11 '15 at 22:03
  • @cfr Of course I should have meant that, absolutely. I didn't really think about the command in front when I copied it, ... turns out I should have. – moewe Jul 12 '15 at 06:38
  • Note that there is no need to manually insert the abbreviation "S.", biblatex can do that for you automatically, just go with \textcite[124]{foo}. – moewe Jul 12 '15 at 06:48
  • Your level of knowledge is incredible. But as for the S. I discovered inconsistencies between \parencite and \textcite so I put S. in \textcite where I don´t have to and in \parencite where I have to, to get consistency in my .tex-files. – Karl Jul 12 '15 at 14:29
  • That inconsistency in the handling of the postnote between \parencite and \textcite is odd. The normal authoryear style adds the correct page prefix for both (all commands ultimately call \printfield{postnote}). Did you change something more with biblatex (especially something related to postnote)? – moewe Jul 12 '15 at 14:51
  • @moewe: To be honest, I don´t know. My preamble is longer than the holy bible ... – Karl Jul 12 '15 at 18:40

1 Answers1

5

You can make use of biblatex's nesting features for parentheses. biblatex can keep track of the nesting level and automatically chooses the right form of brackets (either (...) or [...]) depending on the level. (There also is a maximum level of nesting for parentheses, which can be changed with maxparens the default is three.)

The easiest way then is to use one of biblatex's commands with parentheses tracking, replace the literal parentheses (...) by \parentext{...} (\or mkbibparens{...}). For example

{\small \parentext{Eigene Darstellung in Anlehnung an \textcite[124]{Steinberg2009}}}

Since \parentext is defined via \newrobustcmd*{\parentext}{\mkbibparens} in biblatex.sty, you can also use \mkbibparens instead of \parentext , the latter simply being an alias for the former.

It might be an interesting debate which command to prefer. \parentext is listed in §3.7.5 Text Commands these text commands are "[...] are intended for use in the flow of text" (p. 89 of the biblatex documentation). While \mkbibparens is a "generic command which wraps its argument in parentheses" (p. 225) and is listed in §4.10.4 Auxiliary Commands and Hooks.


You can also define commands to track parentheses manually

\makeatletter
\newcommand{\openpar}{%
  \global\advance\blx@parenlevel\@ne
  \global\advance\c@parenlevel\@ne}
\newcommand{\closepar}{%
  \global\advance\blx@parenlevel\m@ne
  \global\advance\c@parenlevel\m@ne}
\makeatother

Using \openpar before or after a manually inserted ( tells biblatex you opened a bracket, and then after a ) you can close it for the tracker via \closepar. As in

(\openpar\textcite{geer})\closepar

Since this seems to require quite a lot of remembering and the use of two commands, the other method seems preferable.

moewe
  • 175,683
  • Useful precision: in order to disable automatic turning of nested parentheses into brackets, use package option parentracker=false. – Vincent Krebs Feb 14 '23 at 05:20