TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

I would like to know, what's the first character of the value of the editor field. If the character is a curly bracket "{" the value should be printed for example bold, if the first character is something else the fields value should be printed \textnormal.

I've tried to do that with the package xstring and the following code in a biblatex declaration:


But this will not modify anything. How to do that right?

share|improve this question
biblatex can do many different tests. Maybe any of those can be used to answer this question? – N.N. Jun 13 '11 at 10:25
I've had taken a look to these tests, but didn't found the right one. Do you have an idea? – MaKa TaBo Jun 13 '11 at 11:17
up vote 4 down vote accepted

Looks like you should read up on data types in biblatex; editor is of the type name list, not field. Some details on how you can access data in a name list are described in the documentation on \DeclareNameFormat. You're on the right track in using xstring, but more care is required in passing arguments.

The code below will print out any corporate editor (i.e. any editor name enclosed in braces - see section 2.3.3 of the biblatex manual, version 1.4b) in boldface. I've applied edits to the generic biblatex format and macro definitions, but depending on the style you are using this solution will probably need to be adapted.


\DeclareNameFormat{byeditor}{%  Based on first-last format from biblatex.def

\newbibmacro*{ename:first-last}[4]{%  Basd on name:first-last macro from biblatex.def

    author = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
    title = {The LaTeX Companion},
    edition = {1},
    editor = {{Corporate Editor} and {A}ristotle and \texttt{HAL}},
    publisher = {Addison-Wesley},
    location = {Reading, Mass.},
    date = {1994}}
    author = {Gillies, Alexander and {Corporate Author}},
    title = {Herder and the Preparation. Goethe's Idea of World Literature},
    journaltitle = {Publications of the English Goethe Society},
    volume = {9},
    date = {1933},
    editor = {Lastname, Firstname and {Corporate Editor} and {Corporation}},
    pages = {46--67}}



enter image description here

Some notes on the code:

  • The corporate name gets passed to the last name argument (#1 throughout). All other name arguments (e.g. first names, name prefixes, etc.) are empty/blank.
  • Enclosure in braces prevents xstring from doing any straightforward string comparisons. I've instead detected corporate names using some other commands from xstring.
  • \ifdefstring tests if a control sequence is equal to a string. This test is from the etoolbox package, which is loaded by biblatex.
share|improve this answer
Wow! Thats much more complicated than I thought before! Thanks for your effort :-) – MaKa TaBo Jun 15 '11 at 6:26
@Matthias If you compare my code with the definitions in biblatex.def, you'll see that I've only added a few lines. But yes, pattern matching isn't easy. – Audrey Jun 15 '11 at 13:05

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.