[Tex/LaTex] Biblatex, author-year, square brackets

biblatexbracketsciting

I need to customize the author-year citation in biblatex for a template at work. Right now biblatex cites like this:

Ruschmeyer u. a. 1995, S. 123

They way I was told it needs to cite is:

[Ruschmeyer u. a. 1995, S. 123]

This seems pretty simple and I thought it would be done in a second, but after reading through the biblatex documentation for the second time, I still don't really have a clue.

Best Answer

An alternative to lockstep's solution is to redefine the high-level parentheses commands. With the default option setting parentracker=true, these are context-sensitive; nested parentheses may be set as brackets, depending on the nesting level.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}

%\ExecuteBibliographyOptions{parentracker=false}

\makeatletter

\newrobustcmd*{\parentexttrack}[1]{%
  \begingroup
  \blx@blxinit
  \blx@setsfcodes
  \blx@bibopenparen#1\blx@bibcloseparen
  \endgroup}

\AtEveryCite{%
  \let\parentext=\parentexttrack%
  \let\bibopenparen=\bibopenbracket%
  \let\bibcloseparen=\bibclosebracket}

\makeatother

\addbibresource{biblatex-examples.bib}
\begin{document}
\null\vfill\noindent
Filler text \parencite[see][59--63]{markey}. \\
Filler text \parencite[see][\pno~59 \parentext{last paragraph}]{markey}. \\
Filler text \parencite[see][\pno~59 \brackettext{last paragraph}]{markey}. \\
\parentext{Filler text \parencite[see][\pno~59 \parentext{last paragraph}]{markey}.} \\
\brackettext{Filler text \parencite[see][\pno~59 \parentext{last paragraph}]{markey}.} \\
\citeauthor{markey} show that this is filler text \parencite*{markey}. \\
\textcite[see][\pno~59 \parentext{last paragraph}]{markey} show that this is filler text. \\
Filler text \autocite{markey}. \\
\citeauthor{markey} show that this is filler text \autocite*{markey}. \\
Filler text.\smartcite[\pno~59 \brackettext{last paragraph}]{markey}
Filler text.\footnote{More filler text \smartcite[see][\pno~59 \brackettext{last paragraph}]{markey}.} \\
\parencites{markey,knuth:ct:b} \\
\textcites{markey,knuth:ct:b} \\
\printbibliography
\end{document}

enter image description here

Related Question