ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* framed parameter
@ 2006-06-30  8:04 Hans van der Meer
  2006-06-30 16:45 ` Taco Hoekwater
  2006-06-30 17:05 ` Hans Hagen
  0 siblings, 2 replies; 5+ messages in thread
From: Hans van der Meer @ 2006-06-30  8:04 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 720 bytes --]

Just curious, because the last of the three examples solves the problem.

Why is it that this is allowed in the parameter list of \framed:

\framed[frame=on,\iftrue width=3cm\fi]{abc}

But this gives an error:
\framed[frame=on,\iftrue background=color,backgroundcolor=green\fi]{abc}

! Incomplete \if; all text was ignored after line 42.
<inserted text>
                 \fi
<*> test.tex
              emergencyend
?

Allthough this works and solves the problem I had:
\framed[frame=on,background=\iftrue color\else none 
\fi,backgroundcolor=green]{abc}

Is this somewhat inconsistent behaviour intrinsic to some parameters?
I thought all parameters are picked up by a macro and then stashed away.

Hans van der Meer




[-- Attachment #1.2: Type: text/html, Size: 3395 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: framed parameter
  2006-06-30  8:04 framed parameter Hans van der Meer
@ 2006-06-30 16:45 ` Taco Hoekwater
  2006-06-30 17:05 ` Hans Hagen
  1 sibling, 0 replies; 5+ messages in thread
From: Taco Hoekwater @ 2006-06-30 16:45 UTC (permalink / raw)


Hans van der Meer wrote:
> Is this somewhat inconsistent behaviour intrinsic to some parameters? 

It _is_ consistent, but not in the way you expect. :-)

The rule is: you cannot have multiple parameters inside the \if 
statement, because that confuses the keyval parser that then picks up
  "\iftrue background=color"
as a  complete item.

If you really need this, use \expanded around \framed and its option
list, like so:

   \expanded{\framed[frame=on,\iftrue
                   background=color,backgroundcolor=green\fi]}{abc}

Greetings, Taco

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: framed parameter
  2006-06-30  8:04 framed parameter Hans van der Meer
  2006-06-30 16:45 ` Taco Hoekwater
@ 2006-06-30 17:05 ` Hans Hagen
  2006-06-30 19:35   ` Hans van der Meer
  1 sibling, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2006-06-30 17:05 UTC (permalink / raw)


Hans van der Meer wrote:
> Just curious, because the last of the three examples solves the problem.
>
> Why is it that this is allowed in the parameter list of \framed:
>
> \framed[frame=on,\iftrue width=3cm\fi]{abc}
i would not use that kind of tricks, since it's pure luck if it works
>
> But this gives an error:
> \framed[frame=on,\iftrue background=color,backgroundcolor=green\fi]{abc}
because a , is seen and it separates the if from the fi
>
> ! Incomplete \if; all text was ignored after line 42.
> <inserted text>
> � � � � � � � � \fi
> <*> test.tex
> � � � � � �� emergencyend
> ?
>
> Allthough�this works and solves the problem I had:
> \framed[frame=on,background=\iftrue color\else 
> none\fi,backgroundcolor=green]{abc}
>
> Is this somewhat inconsistent behaviour intrinsic to some parameters?�
> I thought all parameters are picked up by a macro and then stashed away.
indeed

btw background=none will trigger an overlay called 'none', when defined

why do you need such tricks?

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: framed parameter
  2006-06-30 17:05 ` Hans Hagen
@ 2006-06-30 19:35   ` Hans van der Meer
  2006-06-30 20:15     ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Hans van der Meer @ 2006-06-30 19:35 UTC (permalink / raw)



On Jun 30, 2006, at 19:05, Hans Hagen wrote:

> Hans van der Meer wrote:
>> Just curious, because the last of the three examples solves the  
>> problem.
>>
>> Why is it that this is allowed in the parameter list of \framed:
>>
>> \framed[frame=on,\iftrue width=3cm\fi]{abc}
> i would not use that kind of tricks, since it's pure luck if it works
>>
>> But this gives an error:
>> \framed[frame=on,\iftrue background=color,backgroundcolor=green\fi] 
>> {abc}
> because a , is seen and it separates the if from the fi
>>
>> ! Incomplete \if; all text was ignored after line 42.
>> <inserted text>
>> � � � � � � � � \fi
>> <*> test.tex
>> � � � � � �� emergencyend
>> ?
>>
>> Allthough�this works and solves the problem I had:
>> \framed[frame=on,background=\iftrue color\else
>> none\fi,backgroundcolor=green]{abc}
>>
>> Is this somewhat inconsistent behaviour intrinsic to some  
>> parameters?�
>> I thought all parameters are picked up by a macro and then stashed  
>> away.
> indeed
>
> btw background=none will trigger an overlay called 'none', when  
> defined
>
> why do you need such tricks?
>

I want to switch runtime between colors. The switching occurs inside  
the execution of a \halign template.
By the way, your remark about triggering an overlay seems to the point.
What then if I want nothing as background color that then will  
obviously be more efficient?

Hans van der Meer



_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: framed parameter
  2006-06-30 19:35   ` Hans van der Meer
@ 2006-06-30 20:15     ` Hans Hagen
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2006-06-30 20:15 UTC (permalink / raw)


Hans van der Meer wrote:
> On Jun 30, 2006, at 19:05, Hans Hagen wrote:
>
>   
>> Hans van der Meer wrote:
>>     
>>> Just curious, because the last of the three examples solves the  
>>> problem.
>>>
>>> Why is it that this is allowed in the parameter list of \framed:
>>>
>>> \framed[frame=on,\iftrue width=3cm\fi]{abc}
>>>       
>> i would not use that kind of tricks, since it's pure luck if it works
>>     
>>> But this gives an error:
>>> \framed[frame=on,\iftrue background=color,backgroundcolor=green\fi] 
>>> {abc}
>>>       
>> because a , is seen and it separates the if from the fi
>>     
>>> ! Incomplete \if; all text was ignored after line 42.
>>> <inserted text>
>>> � � � � � � � � \fi
>>> <*> test.tex
>>> � � � � � �� emergencyend
>>> ?
>>>
>>> Allthough�this works and solves the problem I had:
>>> \framed[frame=on,background=\iftrue color\else
>>> none\fi,backgroundcolor=green]{abc}
>>>
>>> Is this somewhat inconsistent behaviour intrinsic to some  
>>> parameters?�
>>> I thought all parameters are picked up by a macro and then stashed  
>>> away.
>>>       
>> indeed
>>
>> btw background=none will trigger an overlay called 'none', when  
>> defined
>>
>> why do you need such tricks?
>>
>>     
>
> I want to switch runtime between colors. The switching occurs inside  
> the execution of a \halign template.
>   
then just redefine the color

\definecolor[colorone][r=1]
\definecolor[colortwo][g=1]

\definecolor[mycolor][colorone]

....

\definecolor[mycolor][colortwo] 

or, when you want to switch many colors, use color palets and switch palets 

Hans 


 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-06-30 20:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-30  8:04 framed parameter Hans van der Meer
2006-06-30 16:45 ` Taco Hoekwater
2006-06-30 17:05 ` Hans Hagen
2006-06-30 19:35   ` Hans van der Meer
2006-06-30 20:15     ` Hans Hagen

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).