* How do I test for empty labeltext?
@ 2011-10-24 17:41 Mojca Miklavec
2011-10-24 18:41 ` Hans Hagen
0 siblings, 1 reply; 5+ messages in thread
From: Mojca Miklavec @ 2011-10-24 17:41 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hello,
The following code
\setuplabeltext[test=]
test is \doifemptyelse{\labeltext{test}}{empty}{not empty}
doesn't work as intended for the reasons that I approximately
understand (not exactly, but I understand that there might be a lot of
weird stuff returned when I ask for labeltext). However I have no idea
how to check if text is empty or not.
As an exception :) :) :), MKIV hints should be highly appreciated and
enough for this particular application.
Mojca
PS: the extended example looks approximately as follows:
\def\document#1#2{
\setuplabeltext[name={{#1}},company={{#2}}]
\startstandardmakeup
\setups{content}
\setups{decoration}
\stopstandardmakeup
}
\startsetups content
This is for \labeltext{name}%
\doifemptyelse{\labeltext{company}}{.}{, working for \labeltext{company}.}
\stopsetups
I have no problem changing the complete code and I can already find a
workaround by defining some new "if" inside definition of \document,
but I'm still slightly curious to know how to test for existence of a
label. The sources contain
definelabels("setuplabeltext", data.texts, true)
and it is not too clear to me how to decrypt the rest with too much pain.
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How do I test for empty labeltext?
2011-10-24 17:41 How do I test for empty labeltext? Mojca Miklavec
@ 2011-10-24 18:41 ` Hans Hagen
2011-10-25 9:26 ` Mojca Miklavec
0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2011-10-24 18:41 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Mojca Miklavec
On 24-10-2011 19:41, Mojca Miklavec wrote:
> Hello,
>
> The following code
>
> \setuplabeltext[test=]
> test is \doifemptyelse{\labeltext{test}}{empty}{not empty}
>
> doesn't work as intended for the reasons that I approximately
> understand (not exactly, but I understand that there might be a lot of
> weird stuff returned when I ask for labeltext). However I have no idea
> how to check if text is empty or not.
>
> As an exception :) :) :), MKIV hints should be highly appreciated and
> enough for this particular application.
an empty test is always somewhat special as there can be an unexpandable
macro inside that eventually expands to nothing
you can try \doiftextelse instead
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How do I test for empty labeltext?
2011-10-24 18:41 ` Hans Hagen
@ 2011-10-25 9:26 ` Mojca Miklavec
2011-10-25 10:14 ` Hans Hagen
2011-10-25 16:36 ` Aditya Mahajan
0 siblings, 2 replies; 5+ messages in thread
From: Mojca Miklavec @ 2011-10-25 9:26 UTC (permalink / raw)
To: Hans Hagen; +Cc: mailing list for ConTeXt users
On Mon, Oct 24, 2011 at 20:41, Hans Hagen <pragma@wxs.nl> wrote:
> On 24-10-2011 19:41, Mojca Miklavec wrote:
>>
>> Hello,
>>
>> The following code
>>
>> \setuplabeltext[test=]
>> test is \doifemptyelse{\labeltext{test}}{empty}{not empty}
>>
>> doesn't work as intended for the reasons that I approximately
>> understand (not exactly, but I understand that there might be a lot of
>> weird stuff returned when I ask for labeltext). However I have no idea
>> how to check if text is empty or not.
>>
>> As an exception :) :) :), MKIV hints should be highly appreciated and
>> enough for this particular application.
>
> an empty test is always somewhat special as there can be an unexpandable
> macro inside that eventually expands to nothing
>
> you can try \doiftextelse instead
Thank you very much. This works fine.
This should probably be added to
http://wiki.contextgarden.net/System_Macros/Branches_and_Decisions
at least (possibly to reference next to labels as well), but I'm not
sure how to describe it.
Mojca
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How do I test for empty labeltext?
2011-10-25 9:26 ` Mojca Miklavec
@ 2011-10-25 10:14 ` Hans Hagen
2011-10-25 16:36 ` Aditya Mahajan
1 sibling, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2011-10-25 10:14 UTC (permalink / raw)
To: Mojca Miklavec; +Cc: mailing list for ConTeXt users
On 25-10-2011 11:26, Mojca Miklavec wrote:
> On Mon, Oct 24, 2011 at 20:41, Hans Hagen<pragma@wxs.nl> wrote:
>> On 24-10-2011 19:41, Mojca Miklavec wrote:
>>>
>>> Hello,
>>>
>>> The following code
>>>
>>> \setuplabeltext[test=]
>>> test is \doifemptyelse{\labeltext{test}}{empty}{not empty}
>>>
>>> doesn't work as intended for the reasons that I approximately
>>> understand (not exactly, but I understand that there might be a lot of
>>> weird stuff returned when I ask for labeltext). However I have no idea
>>> how to check if text is empty or not.
>>>
>>> As an exception :) :) :), MKIV hints should be highly appreciated and
>>> enough for this particular application.
>>
>> an empty test is always somewhat special as there can be an unexpandable
>> macro inside that eventually expands to nothing
>>
>> you can try \doiftextelse instead
>
> Thank you very much. This works fine.
>
> This should probably be added to
> http://wiki.contextgarden.net/System_Macros/Branches_and_Decisions
> at least (possibly to reference next to labels as well), but I'm not
> sure how to describe it.
"If you want to know if some macro provides some typeset content you can
use the following helper macro:" ...
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How do I test for empty labeltext?
2011-10-25 9:26 ` Mojca Miklavec
2011-10-25 10:14 ` Hans Hagen
@ 2011-10-25 16:36 ` Aditya Mahajan
1 sibling, 0 replies; 5+ messages in thread
From: Aditya Mahajan @ 2011-10-25 16:36 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Tue, 25 Oct 2011, Mojca Miklavec wrote:
>> you can try \doiftextelse instead
>
> Thank you very much. This works fine.
>
> This should probably be added to
> http://wiki.contextgarden.net/System_Macros/Branches_and_Decisions
> at least (possibly to reference next to labels as well), but I'm not
> sure how to describe it.
IIRC, there is some explanation in the source file (supp-box or pack-box,
not sure which one).
Aditya
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-25 16:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-24 17:41 How do I test for empty labeltext? Mojca Miklavec
2011-10-24 18:41 ` Hans Hagen
2011-10-25 9:26 ` Mojca Miklavec
2011-10-25 10:14 ` Hans Hagen
2011-10-25 16:36 ` Aditya Mahajan
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).