ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Defined command troubles
@ 2013-09-05 15:42 Xan
  2013-09-05 15:52 ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: Xan @ 2013-09-05 15:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

I just want to define a shortcut for framedtexts...

That's it:

\def\important{\dodoubleempty\doimportant}
\def\doimportant[#1][#2]{\bgroup
    \ifsecondargument
       \startframedtext[background=#2,frame=off,width=broad]%
       #1
    \else
       \startframedtext[background=screen,frame=off,width=broad]%
       #1
    \fi
    \stopframedtext
    \egroup}

It works perfectly with \important[Anything] but not with \important[Anything][red].

By the other hand, I want to define 'important' for use with start and end (startimportant ... \stopimportant) and not with single command. How can I get it?

Thanks,
Xan.
___________________________________________________________________________________
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] 2+ messages in thread

* Re: Defined command troubles
  2013-09-05 15:42 Defined command troubles Xan
@ 2013-09-05 15:52 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2013-09-05 15:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 05.09.2013 um 17:42 schrieb Xan <dxpublica@telefonica.net>:

> Hi,
> 
> I just want to define a shortcut for framedtexts...
> 
> That's it:
> 
> \def\important{\dodoubleempty\doimportant}
> \def\doimportant[#1][#2]{\bgroup
>    \ifsecondargument
>       \startframedtext[background=#2,frame=off,width=broad]%
>       #1
>    \else
>       \startframedtext[background=screen,frame=off,width=broad]%
>       #1
>    \fi
>    \stopframedtext
>    \egroup}
> 
> It works perfectly with \important[Anything] but not with \important[Anything][red].

To set colors for the background you need “background color,backgroundcolor=<name>”.

> By the other hand, I want to define 'important' for use with start and end (startimportant ... \stopimportant) and not with single command. How can I get it?

\defineframedtext
  [important]
  [background=screen,
   frame=off,
   width=broad]

\starttext

\startimportant
\input ward
\stopimportant

\startimportant[background=color,backgroundcolor=red]
\input ward
\stopimportant

\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2013-09-05 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-05 15:42 Defined command troubles Xan
2013-09-05 15:52 ` Wolfgang Schuster

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