Re: [NTG-context] (re)defining command with options

2017-05-18 Thread Florian Grammel
> See also http://wiki.contextgarden.net/Commands_with_optional_arguments 
> 

How could I possibly have overlooked this?!

Thanks a lot!



Florian Grammel

Copenhagen, Denmark

___
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
___

Re: [NTG-context] (re)defining command with options

2017-05-16 Thread Henri Menke
On Tue, 2017-05-16 at 22:10 +0200, Florian Grammel wrote:
> While visualising index-entires in the margin using
> \version[temporary] isn't implemented for MkIV yet, I'd like to
> define a basic stand-in in the meantime:
> 
> \setupmargindata[inmargin][location=outer, style=itxx]
> \define[1]\myindex{\index{#1}%
>   \inmargin{#1}%
>   }
> 
> But occurrences of e.g.
> 
> \myindex[CONTEXT]{\ConTeXt}
> 
> break these simple definitions.
> 
> Is there an easy way to define commands with options and/or patching
> (extending) existing commands?
> 
> 

See also http://wiki.contextgarden.net/Commands_with_optional_arguments

\setupmargindata[inmargin][location=outer,style=itxx]

\define\myindex{\dosingleempty\domyindex}
\def\domyindex[#1]#2{%
  \inmargin{#2}%
  \index[#1]{#2}%
}

\starttext

\input knuth
\myindex[CONTEXT]{\ConTeXt}
\input knuth

\stoptext

> 
> 
> Thanks in advance!
> Florian.
> 
> 
> 
> 
> Florian Grammel
> 
> Copenhagen, Denmark
> 
> _
> __
> 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/nt
> g-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> _
> __
___
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
___

[NTG-context] (re)defining command with options

2017-05-16 Thread Florian Grammel
While visualising index-entires in the margin using \version[temporary] isn't 
implemented for MkIV yet, I'd like to define a basic stand-in in the meantime:

\setupmargindata[inmargin][location=outer, style=itxx]
\define[1]\myindex{\index{#1}%
\inmargin{#1}%
}

But occurrences of e.g.

\myindex[CONTEXT]{\ConTeXt}

break these simple definitions.

Is there an easy way to define commands with options and/or patching 
(extending) existing commands?




Thanks in advance!
Florian.




Florian Grammel

Copenhagen, Denmark

___
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
___