Am 06.03.2025 um 19:37 schrieb Pablo Rodriguez via ntg-context:
On 3/6/25 17:55, Wolfgang Schuster wrote:
1. Add a optional argument to \sidebarA.
\ifparameter#1\or\pagereference[#1]\fi
Many thanks for your reply, Wolfgang.
I didn’t know \ifparameter existed.
I have a question, would this possible?
\ifparameter#1\pagereference[#1]\else\fi
If it were, which would be the difference?
With \ifparameter you can check if the given parameter has content or
not and everything goes after the \or, not before it.
The check itself is similar to \doifelsesomething or \ifempty because
you only care whether the argument is empty or not.
%%%% begin example
\tolerant\def\Test[#1][#2]%
{\ifparameter#1\or
Optional argument!
\else
Empty or no argument!
\fi}
\starttext
\Test
\Test[xxx]
\Test[]
\stoptext
%%%% end example
More information can be found in lowlevel-macros.pdf.
Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________