Thank you very much Aditya, now it works.
As you said, the trick was to use \doiftextelse{}{}{} function as test of
emptyness function, and \labeltext{chapter} instead of
\currentstructurelabel as variable for the test because the latter was
never found empty, even when it was.
Thus the right
On Thu, 7 Nov 2013, Géry Ogam wrote:
I'm sure there is also a cleaner TeX way, but I'm not experienced
enough for that.
I think you misunderstood my issue: your Lua way does the same thing than
my TeX way: it displays:
ONE Cool
2 Cat
3 Mouse
but that is NOT what I want. What I want is:
1
Hello,
Lua way:
\setuplabeltext[chapter=]
\define[1]\MyCommand{\ctxcommand{doifelse(1==\currentsectioncountervalue)}{ONE}{#1}}
\setuphead[chapter][deepnumbercommand=\MyCommand]
\starttext
\chapter{Cool}
\chapter{Cat}
\chapter{Mouse}
\stoptext
I'm sure there is also a cleaner
I'm sure there is also a cleaner TeX way, but I'm not experienced
enough for that.
I think you misunderstood my issue: your Lua way does the same thing than
my TeX way: it displays:
ONE Cool
2 Cat
3 Mouse
but that is NOT what I want. What I want is:
1 Cool
2 Cat
3 Mouse
So I need to check if
On 11/5/2013 12:42 AM, Géry Ogam wrote:
Hello,
How to test if the current structure label is empty? The following
example does not work because I don’t know how to expand the variable
\currentstructurelabel..
E.g.:
\define \MyCommand{\doifempty{\currentstructurelabel}{Do something}}
you
you can try
\doifnothing\currentstructurelabel{Do something}
It does not work in my case (even if the currenstructurelabel is empty it
acts as if it not empty). In fact I asked that to get the following
behaviour:
— When there is a chapter label (\setuplabeltext[chapter=CHAPTER~]) I want
Any idea for achieving this behaviour?
- When there is a chapter label (\setuplabeltext[chapter=CHAPTER~]), display
:
CHAPTER ONE Cool
CHAPTER 2 Cat
CHAPTER 3 Mouse
etc.
- When there is no chapter label (\setuplabeltext[chapter=]), display:
1 Cool
2 Cat
3 Mouse
etc.
My try achieves the first
Hello,
How to test if the current structure label is empty? The following example
does not work because I don’t know how to expand the variable
\currentstructurelabel.
E.g.:
\define \MyCommand{\doifempty{\currentstructurelabel}{Do something}}
Best regards.