# How to let an argument be empty without breaking if?

I was refactoring a biblatex-style to work with changes recently introduced to biber. So I had this code:

``````\DeclareNameFormat{labelname}{%
\nameparts{#1}%
\ifcase\value{uniquename}%
{\usebibmacro{name:first-last}{\namepartfamily}{\namepartprefixi}{}{\namepartsuffix}}%
\or
\ifuseprefix
{\usebibmacro{name:first-last}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffixi}}
{\usebibmacro{name:first-last-init}{\namepartfamily}{\namepartgiveni}{\namepartprefixi}{\namepartsuffixi}}%
\or
\usebibmacro{name:first-last-init}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}%
\fi%
\usebibmacro{name:andothers}%
}%
``````

But this code always gives me the errors "extra \or" (for both \or s) and "extra \fi". When debugging, I figured out, that filling in just anything into the `{}` in the first branch makes the code work. But I need to have an empty argument there. Why does it make a difference if the argument is empty or not for the if structure? And, even more important: how do I submit an empty argument in there?

• I really don't understand the details, but I've found that often, `\relax` can satisfy your need. It is not "nothing", but it performs "nothing" when executed. – Steven B. Segletes Sep 24 '16 at 23:46
• It does nothing successfully :-). – cfr Sep 25 '16 at 1:48
• It's hard to help you if you don't give us code to reproduce your problem. Like Steven, I would have thought that adding `\relax` after `\value{uniquename}` would probably fix the problem but I can't test this from what you have posted. Can you please expand your code snippet to a full minimal working example. A MWE should compile and be as small as possible to demonstrate your problem. – user30471 Sep 25 '16 at 5:05
• You can use the macros \empty and \@empty. It has been my experience that {} gets translated as \@empty, so break out the \makeatletter ... \makeatother. – John Kormylo Sep 25 '16 at 16:22
• great, using \relax works. Seems that the – not too well documented – changes in biblatex recently made the macros not accepting {} as empty arguments anymore…. If you're posting this as an answer again, I'll accept it as the correct solution :) – Florian Sep 26 '16 at 0:43

You have not provided enough context to run the code but you have

``````\ifcase\value{uniquename}%
``````

here `\ifcase` requires a `<number>`, and assuming the standard latex definition of `\value` then `\value{uniquename}` will be a number just if `uniquename` is a latex counter, that is, if `\c@uniquename` is defined to be a count register.

If `\c@uniqename` isn't defined then `\value` will define it `\let` to `\relax`. You don't say what non-error behaviour you want, but for example you could make it act as -1, in which case none of the `\ifcase` branches will be executed.

``````\ifcase\expandafter\ifx\csname c@uniquename\endcsname\relax-1 \else\value{uniquename}\fi
``````
• actually looking at your question again perhaps that isn't the `\if..` you are asking about, but it's the only one in the posted code, hard to be sure. If the question is updates I'll revisit this. – David Carlisle Sep 25 '16 at 7:32
• I'd bet on the conditionals in `name:first-last-init`. With the `biblatex` changes in 3.3 the type of the arguments changed, I guess that could confuse the `\if...` commands there. – moewe Sep 26 '16 at 15:41