ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* (re)defining command with options
@ 2017-05-16 20:10 Florian Grammel
  2017-05-16 21:26 ` Henri Menke
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Grammel @ 2017-05-16 20:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

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

* Re: (re)defining command with options
  2017-05-16 20:10 (re)defining command with options Florian Grammel
@ 2017-05-16 21:26 ` Henri Menke
  2017-05-18 11:25   ` Florian Grammel
  0 siblings, 1 reply; 3+ messages in thread
From: Henri Menke @ 2017-05-16 21:26 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________

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

* Re: (re)defining command with options
  2017-05-16 21:26 ` Henri Menke
@ 2017-05-18 11:25   ` Florian Grammel
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Grammel @ 2017-05-18 11:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

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

How could I possibly have overlooked this?!

Thanks a lot!

____________________________________________

Florian Grammel

Copenhagen, Denmark


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

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

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

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

end of thread, other threads:[~2017-05-18 11:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16 20:10 (re)defining command with options Florian Grammel
2017-05-16 21:26 ` Henri Menke
2017-05-18 11:25   ` Florian Grammel

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