From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/85116 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?G=C3=A9ry_Ogam?= Newsgroups: gmane.comp.tex.context Subject: How to test the emptyness of a variable? Date: Tue, 5 Nov 2013 22:56:54 +0100 Message-ID: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0022162025==" X-Trace: ger.gmane.org 1383688618 15416 80.91.229.3 (5 Nov 2013 21:56:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Nov 2013 21:56:58 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Tue Nov 05 22:57:04 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VdocP-0008Cr-P6 for gctc-ntg-context-518@m.gmane.org; Tue, 05 Nov 2013 22:57:01 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id CB4A21023E; Tue, 5 Nov 2013 22:57:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2oRRVwU7AT-N; Tue, 5 Nov 2013 22:56:59 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id F3DF2101F1; Tue, 5 Nov 2013 22:56:58 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id DEF26101F1 for ; Tue, 5 Nov 2013 22:56:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id v7ZlJ6HMcQtA for ; Tue, 5 Nov 2013 22:56:56 +0100 (CET) Original-Received: from filter4-til.mf.surf.net (filter4-til.mf.surf.net [194.171.167.220]) by balder.ntg.nl (Postfix) with ESMTP id 01B91101EF for ; Tue, 5 Nov 2013 22:56:55 +0100 (CET) Original-Received: from mail-wi0-x22e.google.com (mail-wi0-x22e.google.com [IPv6:2a00:1450:400c:c05::22e]) by filter4-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id rA5Luso2000584 for ; Tue, 5 Nov 2013 22:56:55 +0100 Original-Received: by mail-wi0-f174.google.com with SMTP id cb5so2844534wib.1 for ; Tue, 05 Nov 2013 13:56:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=QVdI0kanrF7MoTqetI1ZNWbP2G4RM3v0+LBAclpP5yY=; b=C65ho+hI/EBrHrsGMkhU7EgK0AQqcA3jP+PHVdy11pzZC1OZC40G4fOrcuQgCpEX7H KuTWwoA25PnNyj9AM1JB1pmTsZi1Bht9YYuc92fzAdwWHYvIWVY8dYwTVAmWmZxemy1U MoVjq2XfVSV4EtiXOptkPadk5+zM7P48ynZSg5/EtXCzs/VONVhq8lcE4Uq5eBNKN112 K8xd0NH+aOm7QkzqWsEAovMn7mB8avVksJmhuTqSx/zisthBNqNVsJusjEEooJq/ABYz 4wYgo3Ak7Qa2z+UDDJSffZtzwHCijAxcDn3k33WTymtVXmDNxesgwvsq6bwqEYJd/58w 4Dag== X-Received: by 10.180.198.79 with SMTP id ja15mr18264070wic.36.1383688614758; Tue, 05 Nov 2013 13:56:54 -0800 (PST) Original-Received: by 10.216.244.4 with HTTP; Tue, 5 Nov 2013 13:56:54 -0800 (PST) X-Bayes-Prob: 0.0003 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=2a00:1450:400c:c05::22e; country=IE X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0VKJVUTg7 - cfd8866502b7 - 20131105 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:85116 Archived-At: --===============0022162025== Content-Type: multipart/alternative; boundary=047d7b6242525cd13e04ea751cd4 --047d7b6242525cd13e04ea751cd4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Any idea for achieving this behaviour? - When there is a chapter label (\setuplabeltext[chapter=3DCHAPTER~]), disp= lay : CHAPTER ONE Cool CHAPTER 2 Cat CHAPTER 3 Mouse etc. - When there is no chapter label (\setuplabeltext[chapter=3D]), display: 1 Cool 2 Cat 3 Mouse etc. My try achieves the first display, but not the second one since I don=E2=80= =99t 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=3DCHAPTER~] \define[1] \MyCommand{\doifelse{\currentsectioncountervalue}{1}{ONE}{#1}} \setuphead[chapter][deepnumbercommand=3D\MyCommand] \starttext \chapter{Cool} \chapter{Cat} \chapter{Mouse} \stoptext --047d7b6242525cd13e04ea751cd4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Any idea for achieving th= is behaviour?

- When there is a chapter lab= el (\setuplabeltext[chapter=3DCHAPTER~]), display:

CHAPTER ONE Cool
CHAPTER 2 Cat
CHAPTER 3 Mouse=
etc.

- When there is no chapter label= (\setuplabeltext[chapter=3D]), display:

1 Cool
2 Cat
3 Mouse<= br style=3D"font-family:arial,sans-serif;font-size:13px">etc.


My try achieves the first display, but not the se= cond one since I don=E2=80=99t know how to test the emptyness of the chapte= r label. When I remove the chapter label, it displays:

= ONE Cool
2 Cat
3 Mouse<= /div>

=C2=A0instead of:

1 Cool
<= span style=3D"font-size:13px;font-family:arial,sans-serif">2 Cat
3 Mouse<= font face=3D"arial, sans-serif">


My code:

\setuplabeltext[chapter=3DCHAPTER~]
\define[1] \MyC= ommand{\doifelse{\currentsectioncountervalue}{1}{ONE}{#1}}
\setuphead[chap= ter][dee= pnumbercommand=3D\MyCommand]

\starttext

\chapter{Cool}<= /span>
\chapter{Cat}
\chapter{Mouse}=

\stoptext
--047d7b6242525cd13e04ea751cd4-- --===============0022162025== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============0022162025==--