ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] defining macros
@ 2025-01-10 11:55 Henning Hraban Ramm
  2025-01-10 18:45 ` [NTG-context] " Hans Hagen via ntg-context
  0 siblings, 1 reply; 8+ messages in thread
From: Henning Hraban Ramm @ 2025-01-10 11:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi, I just recognized that I’m not sure how to define a macro with 
optional and mandatory arguments the best way.

E.g. (oldfashioned)

\def\doMyMacro[#1]#2%
{Do something ... \iffirstargument #1\fi #2}

\def\MyMacro%
{\dosingleargument\doMyMacro}


Is this still the way to do it?
Does it also work with \define?

I have more questions like that:

 From Wolfgang’s presentation (article in progress…) I know all the cool 
stuff for modules (namespaces, setup helpers…), I also know the Lua way 
of interface.implement, but how to combine those?

When should I use brackets or other characters in a definition, when not?

Which docs should I read?


Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2025-01-14 18:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-10 11:55 [NTG-context] defining macros Henning Hraban Ramm
2025-01-10 18:45 ` [NTG-context] " Hans Hagen via ntg-context
2025-01-10 22:04   ` Henning Hraban Ramm
2025-01-10 23:19     ` Hans Hagen
2025-01-11  9:21       ` Henning Hraban Ramm
2025-01-11 11:30         ` Hans Hagen via ntg-context
2025-01-14 17:50           ` Henning Hraban Ramm
2025-01-14 18:27             ` 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).