TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
up vote 4 down vote accepted

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.

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.