[texhax] TeX command works for "1 Foo" but not for "11 Foo"

Wed Oct 31 09:52:20 CET 2007

also sprach Martin Heller <mr_heller at yahoo.dk> [2007.10.30.2335 +0100]:
> Your test for empty arguments is broken.

work. Thank you very much.

Now I would like to understand what's going on. And I have two
questions:

1. Why do you postpone the command creation until \makeatletter? It
works just fine if I define it in the preamble with \newcommand.

2. I still don't understand the problem I had. It seems that my test
somehow ate arguments.

Let's look at the three kinds of invocation:

http://debian.org/
which is correct.

http://debian.org/ [10 Oct 2007]
with the date in brackets at a smaller font size. Also correct.

http://debian.org/ Oct 2007
with the date at the same size as the link. This is wrong.

My function did

\if\@empty#2\relax\else{ }\begin{smaller}{[#2]}\end{smaller}\fi%

but nothing about the test for empty arguments I use explains that
behaviour, and especially not that it works as soon as I use two
extra braces:

\if\@empty#2\relax\else{ }\begin{smaller}{[{#2}]}\end{smaller}\fi%

It seems as if the function gets "11 Oct 2007" as #2 and then ends
up comparing the first two members (1 & 1). If they are equal, then
it would push back the rest of #2 and exit, such that the remainder,
"Oct 2007" would be printed outside the function (and outside
\begin{smaller}). This just blows my mind. Do you have an idea what
exactly is happening?

--

"it is the mark of an educated mind
to be able to entertain a thought
without accepting it."
-- aristoteles