From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
Jon Wong <jhannwong@gmail.com>
Subject: Re: doifsomething vs iffirstargument in TABLE?
Date: Thu, 12 Sep 2019 17:23:34 +0200 [thread overview]
Message-ID: <a2a2d14a-7388-25e9-12d7-5858e6bf8f63@gmail.com> (raw)
In-Reply-To: <CD017B5A-D98F-4BDB-ABAA-C201BF363FFB@gmail.com>
Jon Wong schrieb am 12.09.2019 um 15:44:
> Hi all,
>
> If I use iffirstargument, the optional (first argument) is always seen as false.
>
> If I use doifsomething, it works, but the “else” part is never executed when it should.
>
> MWE:
>
> \starttext
>
> % \def\MyRow{\dosingleempty\doMyRow}
> % \def\doMyRow[#1]#2#3#4#5{%
> % \bTR \bTD #2 \eTD %
The \bTD command for the cell content has an optional argument
which changes the value of the firstargument conditional and your
check below uses the result from \bTD.
> % \iffirstargument
> % \bTD Replaced! \eTD %
> % \else
> % \bTD #3 \eTD %
> % \fi
> % \bTD #4 \eTD \bTD #5 \eTD \eTR
> % }
>
> \def\MyRow{\dosingleempty\doMyRow}
> \def\doMyRow[#1]#2#3#4#5{%
> \bTR \bTD #2 \eTD %
> \doifsomething{#1}
\doifsomethingelse{#1}
> {\bTD Replaced! \eTD }%
> {\bTD #3 \eTD }%
> \bTD #4 \eTD \bTD #5 \eTD \eTR
> }
>
> \bTABLE
> \bTABLEbody
> \MyRow{A}{B}{C}{D}
> \MyRow[optional]{A}{B}{C}{D}
> \eTABLEbody
> \eTABLE
>
> \stoptext
Wolfgang
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
prev parent reply other threads:[~2019-09-12 15:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-12 13:44 Jon Wong
2019-09-12 15:23 ` Wolfgang Schuster [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a2a2d14a-7388-25e9-12d7-5858e6bf8f63@gmail.com \
--to=wolfgang.schuster.lists@gmail.com \
--cc=jhannwong@gmail.com \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).