From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/85172 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: How to test the emptyness of a variable? Date: Sat, 9 Nov 2013 14:55:31 -0500 (EST) Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1459398699-1384026933=:6684" X-Trace: ger.gmane.org 1384026939 21319 80.91.229.3 (9 Nov 2013 19:55:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Nov 2013 19:55:39 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Nov 09 20:55:46 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 1VfEdF-0000xl-2Q for gctc-ntg-context-518@m.gmane.org; Sat, 09 Nov 2013 20:55:45 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 6533110268; Sat, 9 Nov 2013 20:55:44 +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 gEcYb6zWzvqQ; Sat, 9 Nov 2013 20:55:41 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 72129101FD; Sat, 9 Nov 2013 20:55:41 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 1CD2A101FD for ; Sat, 9 Nov 2013 20:55:40 +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 bNGMcZSnyevD for ; Sat, 9 Nov 2013 20:55:39 +0100 (CET) Original-Received: from filter5-til.mf.surf.net (filter5-til.mf.surf.net [194.171.167.221]) by balder.ntg.nl (Postfix) with ESMTP id EE2CC101FC for ; Sat, 9 Nov 2013 20:55:38 +0100 (CET) Original-Received: from tombraider.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.12.86]) by filter5-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id rA9JtZrk004642 for ; Sat, 9 Nov 2013 20:55:37 +0100 Original-Received: FROM Decentralized.ECE.McGill.CA (Decentralized.ECE.McGill.CA [132.206.69.142]) By tombraider.mr.itd.umich.edu ID 527E9335.A3DB9.19989 ; Authuser adityam; 9 Nov 2013 14:55:33 EST In-Reply-To: User-Agent: Alpine 2.03 (LNX 1266 2009-07-14) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=141.211.12.86; country=US; region=MI; city=Ann Arbor; postalcode=48105; latitude=42.3241; longitude=-83.7113; metrocode=505; areacode=734; http://maps.google.com/maps?q=42.3241,-83.7113&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0WKLvTAzf - 65f4006bb1c9 - 20131109 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.221 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:85172 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1459398699-1384026933=:6684 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 7 Nov 2013, G=C3=A9ry 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 Cool > 2 Cat > 3 Mouse > > So I need to check if the chapter label has been set empty or not by the > user, because it is not empty (let's say the user chose the string > "CHAPTER~" for the chapter label) I want to display this: > > CHAPTER ONE Cool > CHAPTER 2 Cat > CHAPTER 3 Mouse > The way to do that is to check if the variable \currentstructurelabel is > empty, so the code must be: Why not just check the labeltext? \define[1]\MyConversion {\doifelse{#1}{1}{ONE}{#1}} \define\CheckedConversion % #1 number {\doiftextelse{\labeltexts{chapter}}\MyConversion\numbers} \defineconversion[CheckedConversion][\CheckedConversion] \setuphead[chapter][conversion=3DCheckedConversion] \doifmode{label}{\setuplabeltext[chapter=3DCHAPTER~]} \starttext \chapter{Cool} \chapter{Cat} \chapter{Mouse} \stoptext compile with and without --mode=3Dlabel. Aditya --8323328-1459398699-1384026933=:6684 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 ___________________________________________________________________________________ --8323328-1459398699-1384026933=:6684--