How to test the emptyness of a variable?
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 display, but not the second one since I don’t know how to test the emptyness of the chapter label. When I remove the chapter label, it displays: ONE Cool 2 Cat 3 Mouse instead of: 1 Cool 2 Cat 3 Mouse My code: \setuplabeltext[chapter=CHAPTER~] \define[1] \MyCommand{\doifelse{\currentsectioncountervalue}{1}{ONE}{#1}} \setuphead[chapter][deepnumbercommand=\MyCommand] \starttext \chapter{Cool} \chapter{Cat} \chapter{Mouse} \stoptext
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" TeX way, but I'm not experienced enough for that.
Cheers,
Lukas
On Tue, 05 Nov 2013 22:56:54 +0100, Géry Ogam
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 display, but not the second one since I don’t know how to test the emptyness of the chapter label. When I remove the chapter label, it displays:
ONE Cool 2 Cat 3 Mouse
instead of:
1 Cool 2 Cat 3 Mouse
My code:
\setuplabeltext[chapter=CHAPTER~] \define[1] \MyCommand{\doifelse{\currentsectioncountervalue}{1}{ONE}{#1}} \setuphead[chapter][deepnumbercommand=\MyCommand]
\starttext
\chapter{Cool} \chapter{Cat} \chapter{Mouse}
\stoptext
-- Ing. Lukáš Procházka [mailto:LPr@pontex.cz] Pontex s. r. o. [mailto:pontex@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 241 096 751 Fax: +420 244 461 038
participants (2)
-
Géry Ogam
-
Procházka Lukáš Ing. - Pontex s. r. o.