For a specific biblatex style, I have declared a bibliography option which takes a name, as in


Now LaTeX yields an error if the value of this option consists of braces, such as myname=M{\"u}ller:

! You can't use `macro parameter character #' in horizontal mode.
\@removeelement #1#2#3->\def \reserved@a ##1,#1,##
                                                  2\reserved@a {##1,##2\rese...

l.59 \ProcessOptions\relax

Is there a way to work around this? If not, is there a way to expand a macro in such a way that braces disappear? My aim is to test for string equivalence via \ifdefstring, and the test returns false if M{\"u}ller is compared to M\"uller, as in


which will return FALSE.

  • Passing M{\"u}ller through \edef is impossible and it wouldn't solve the problem anyway, because \edef doesn't touch braces that don't delimit arguments to commands. – egreg Oct 29 '12 at 15:08
  • I'm not sure I understand. If I pass M{\"u}ller to \edef, it expands to M{ü}ller, which is one step closer to what I want. Why is it "impossible"? – JSpitzm Oct 29 '12 at 15:13
  • No, \"u expands to the set of instructions for printing "ü", which is very different from a simple token ü. And \edef\x{\"u} will always raise errors: the command \" cannot go inside \edef. – egreg Oct 29 '12 at 15:28
  • Hm, seemed to work good enough for my purpose (I compare two \edefed macros via etoolbox's \ifdefstrequal). Now the question is: is there a way to fully expand a string for testing, including macros and nested braces? – JSpitzm Oct 29 '12 at 15:32
  • Are the braces you need to strip off just like in M{\"u}ller or is there something more complicated? – egreg Oct 29 '12 at 15:36

You can't use \edef in this context: \edef\x{...\"u...} will always fail.

If you are using UTF-8 for your files and your author can appear in the three forms


then these macros can be what you want:









\stripbraces{\O re}{\z}









All the tests yield "TRUE".

However this would fail for Fran{\c{c}}ais and Fran{\c c}ais. So the final answer depends on your needs.

  • Thanks, @egreg, this seems to work for my cases. For some reason, however, it does not work for values passed through \DeclareBibliographyOption, which seems to do some expansion. I.e. with \DeclareBibliographyOption{myname}{\def\myname{#1}} and myname=M\"uller the \"u is expanded. – JSpitzm Oct 29 '12 at 16:54
  • @JSpitzm Try \stripbraces{#1}{\myname} instead of \def\myname{#1} – egreg Oct 29 '12 at 17:25
  • this fails as well. It seems the \"u is already expanded when passed as #1 within \DeclareBibliographyOption. – JSpitzm Oct 29 '12 at 17:33
  • @JSpitzm Sorry, but without a real example it's impossible to say more. – egreg Oct 29 '12 at 17:37
  • Nevermind, it'll do for now without the bibliography option approach (I'll provide an alternative way to set the respective name). The real example is my biblatex-publist package on CTAN. – JSpitzm Oct 29 '12 at 17:46

Trying out unicode bib options with

\ifstrequal{#1}{𐎑𓀀ຢഓæçøûüŧũǻΦ}{\renewcommand\testuni{𐎑𓀀ຢഓæçøûüŧũǻΦ has matched}}{\renewcommand\testuni{𐎑𓀀ຢഓæçøûüŧũǻΦ has not matched}}

and setting the biblatex option to


and compiling in xelatex with the file in utf-8 format, and suitable font (\usepackage{fontspec} and \newfontface\funicode{Code2003})

Result of \textbackslash testuni: {\funicode \testuni}.


unicode biblatex bib options

Changing the bib option to



unmatched string is correct

So looks OK now.

The old-style escapes are no longer really needed.

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.