From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/91319 Path: news.gmane.org!not-for-mail From: Keith McKay Newsgroups: gmane.comp.tex.context Subject: Help with \numexpr Date: Mon, 04 May 2015 16:21:33 +0100 Organization: The PotHole Press Message-ID: <55478E7D.20301@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0432658070==" X-Trace: ger.gmane.org 1430752958 4091 80.91.229.3 (4 May 2015 15:22:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 May 2015 15:22:38 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon May 04 17:22:23 2015 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 1YpICL-0007Rm-Qt for gctc-ntg-context-518@m.gmane.org; Mon, 04 May 2015 17:22:21 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3C52A10203 for ; Mon, 4 May 2015 17:22:21 +0200 (CEST) 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 tbQwDdg2jgw2 for ; Mon, 4 May 2015 17:22:20 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 3E9A01023E for ; Mon, 4 May 2015 17:21:47 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 57CF210200 for ; Mon, 4 May 2015 17:21:43 +0200 (CEST) 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 e8CSFnoNikT0 for ; Mon, 4 May 2015 17:21:42 +0200 (CEST) Original-Received: from filter3-til.mf.surf.net (filter3-til.mf.surf.net [194.171.167.219]) by balder.ntg.nl (Postfix) with ESMTP id A1185101FB for ; Mon, 4 May 2015 17:21:42 +0200 (CEST) Original-Received: from mail-wg0-x22c.google.com (mail-wg0-x22c.google.com [IPv6:2a00:1450:400c:c00::22c]) by filter3-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id t44FLahd027974 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Mon, 4 May 2015 17:21:41 +0200 Original-Received: by wgen6 with SMTP id n6so153786072wge.3 for ; Mon, 04 May 2015 08:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:organization:user-agent:mime-version:to :subject:content-type; bh=SH6s0aGmxixueyTOniWcrjz8bqVLJiidL2bWHPnfCRA=; b=MIb55ZzH40udTNUzEVzJlAVa5sIJuXqAiyngCiuZLHb5XNRCDZSsVEPc6E9LBU2Btj aP/wl5Il19jQBtHww777jBE+r3x55EsawT7Ffv6QtWOsOr1u20SRfyi9GZ2sT7a8zD38 VXgCks/7DPWbyq8KpbE/OwoyFdi7rZYDeYwrLTPvK6p6YrcQQfRz+6HwBNnEQPioUJRH VWNUSNNeKsSC4GtkFGufTsDFOvzB79JXgST8QBNVHBgh6nSbR/+LzdJbjtRFticnH74+ 4zloqo+7qaxYjM1E9u78yVm8ORGDZfMuA+oOM3MjXrieAVrdVJW76kx1nnmPmxfhjQ6H sf2A== X-Received: by 10.180.91.137 with SMTP id ce9mr20044777wib.76.1430752896152; Mon, 04 May 2015 08:21:36 -0700 (PDT) Original-Received: from Keiths-Mac-mini.local (cpc12-uddi22-2-0-cust219.20-3.cable.virginm.net. [82.15.155.220]) by mx.google.com with ESMTPSA id 14sm21112730wjv.0.2015.05.04.08.21.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2015 08:21:35 -0700 (PDT) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=2a00:1450:400c:c00::22c; country=IE; latitude=53.3478; longitude=-6.2597; http://maps.google.com/maps?q=53.3478,-6.2597&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 06OnPlAGs - a6ae10c1489f - 20150504 (trained as not-spam) Received-SPF: pass (filter3-til.mf.surf.net: domain of mckaymeister@gmail.com designates 2a00:1450:400c:c00::22c as permitted sender) receiver=filter3-til.mf.surf.net; client-ip=2a00:1450:400c:c00::22c; envelope-from=; helo=mail-wg0-x22c.google.com; identity=mailfrom X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 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" Xref: news.gmane.org gmane.comp.tex.context:91319 Archived-At: This is a multi-part message in MIME format. --===============0432658070== Content-Type: multipart/alternative; boundary="------------030808060607090107030701" This is a multi-part message in MIME format. --------------030808060607090107030701 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Colleagues I've written some code which should extract photos from a directory and a add couple of lines of description to each photo. I'm using a variable (\numberText) as a counter which I was hoping to use with \getfromcommalist[string1, string2,...][\numberText] to add one line of text. However when I try to increment the variable using \numexpr (\numberText=\numberText+1) \relax I get the error "You can't use `\numexpr' in vertical mode". I'm not familiar with \numexpr and there does not seem to be much on the wiki on how to use it. Any suggestions would be helpfull. Here is the code \setupexternalfigures [directory={/Path/to/the/Photos}] \defineexternalfigure[photo][maxheight=0.4\textheight] \define \numberText{1} \starttext \dostepwiserecurse{141}{146}{1}/% //\recurselevel is part of photo filename. See below./ { \externalfigure[sam_0\recurselevel.jpg][photo] \par /% //\recurselevel is part of photo filename/ File Name /Path/to/the/Photos/sam_0\recurselevel.jpg\par \getfromcommalist[some text,another text,even more text,much better text,even better text,the ultimate text][\numberText] \commalistelement\par \numexpr (\numberText=\numberText+1) \relax \par \numberText \par } \stoptext Thanks Keith --------------030808060607090107030701 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Colleagues

I've written some code which should extract photos from a directory and a add couple of lines of description to each photo.=C2=A0 I'm usi= ng a variable (\numberText) as a counter which I was hoping to use with \getfromcommalist[string1, string2,...][\numberText] to add one line of text.=C2=A0 However when I try to increment the variable using \numexpr (\numberText=3D\numberText+1) \relax I get the error "You can't use `\numexpr' in vertical mode".

I'm not familiar with \numexpr and there does not seem to be much on the wiki on how to use it.=C2=A0 Any suggestions would be helpfull.
Here is the code

\setupexter= nalfigures [directory=3D{/Path/to/the/Photos}]

\defineexte= rnalfigure[photo][maxheight=3D0.4\textheight]

\define \numberText{1}

\starttext<= /p>

\dostepwise= recurse{141}{146}{1}% \recurselevel is part of photo filename. See below.

{

\externalfi= gure[sam_0\recurselevel.jpg][photo] \par % \recurselevel is part of photo filename

File Name /Path/to/the/Photos/sam_0\recurselevel.jpg\par

\getfromcom= malist[some text,another text,even more text,much better text,even better text,the ultimate text][\numberText]

\commaliste= lement\par

\numexpr (\numberText=3D\numberText+1) \relax \par

\numberText \par

}

\stoptext

Thanks
Keith


--------------030808060607090107030701-- --===============0432658070== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============0432658070==--