# biblatex: Closing Square Bracket Causes Trouble in Bibliography / References Heading Name (title) (Chapter Name or Section Name)

• I want to use a custom name for the heading of the Bibliography/References.
• Apparently a closing square bracket ] causes problems.
• I use the syntax \printbibliography[title = ...].
• Enclosing the title string with {} does not seem to solve the problem.
• Only title = Test [Test{]} seems to work.
• Question: Why is that and what is the best practice (intended appraoch) to solve this?

\documentclass[]{article}

\usepackage{biblatex}

\begin{document}
\cite{westfahl:space}.

\printbibliography[title = Test [Test]] % "{Test [Test]}" does not work. "Test [Test{]}" does work.
\end{document}


• \printbibliography[title = {{Test [Test]}}] works – moewe Jan 4 at 14:47
• @moewe Thanks! I try it. – Dr. Manuel Kuehner Jan 4 at 14:49
• @Skillmon Ahhh :). I see. Both of you can add an answer. Ideally with an explanation. I will upvote both and accept the first answer. – Dr. Manuel Kuehner Jan 4 at 14:50
• @moewe See one comment above. – Dr. Manuel Kuehner Jan 4 at 14:51
• I have absolutely no idea why one needs two levels of braces here. I know that the key-value parser does some things with braces and spaces and it might end up removing some braces. Since the options are passed on several times to several helper commands that could explain it. But I would have to dig deeper to confirm that this is the issue here. Unfortunately, I don't have the time to do that at the moment. So if anyone knows why the braces go missing, feel free to answer. Otherwise I'll have a look later, but I can't promise I'll find the out why we need that many braces. – moewe Jan 4 at 15:04

Since @moewe says he has not much time currently, and I was curious, I did some digging. Please note that I did not read much source code for this digging, so I'm not sure whether that's the only problem, but here is what happens in short (with much skipped):

1. The key-val parser strips the first pair of braces (that's intentional behaviour and usually does no harm).

2. The value of the title key (if used) is forwarded as the optional argument to the \blx@head@bibliography macro. And here lies the issue, what is done is (with <title> being the argument to the title key):

\ifblank{<title>}


And the \blx@head@bibliography macro grabs its optional argument without checking for balanced brackets (as is done for almost all macros) by using \@protected@testopt, so the closing bracket in your <title> stops the argument grabbing of \blx@head@bibliography too early.

Note that this is a bug in the way \blx@head@bibliography is used here internally. Instead of doing

\ifblank{<title>}

biblatex should have been doing
\ifblank{<title>}