[NTG-context] questions regarding `\date`

Wolfgang Schuster schuster.wolfgang at googlemail.com
Sat Aug 28 22:51:34 CEST 2010


Am 28.08.2010 um 21:02 schrieb Peter Münster:

> On Sat, Aug 28 2010, Wolfgang Schuster wrote:
> 
>> It's a problem with the optional argument, if the second argument is
>> missing the space after the first is gobbled but it can be fixed.
> 
> It's a general problem with ConTeXt macros. The same applies for example for
> \externalfigure. Should this be fixed for all commands, that can be used in
> running text, or should this behaviour just be well documented?

\unprotect

\unexpanded\def\externalfigure
  {\doifnextoptionalelse\doexternalfigure\donothing}

\def\doexternalfigure[#1]%
  {\strictdoifnextoptionalelse{\dodoexternalfigure[#1]}{\nodoexternalfigure[#1]}}

\def\nodoexternalfigure[#1]%
  {\dododoexternalfigure[#1][][]}

\def\dodoexternalfigure[#1][#2]%
  {\strictdoifnextoptionalelse{\dododoexternalfigure[#1][#2]}{\dododoexternalfigure[#1][#2][]}

\def\dododoexternalfigure[#1][#2][#3]% [label][file][settings] | [file][settings] | [file][parent][settings]
   {\bgroup
    \doifelsenothing{#1}
      {\framed[\c!width=\defaultfigurewidth,\c!height=\defaultfigureheight]{external\\figure\\no name}}
      {\doifundefinedelse{\??ef\??ef#1}
         {\useexternalfigure[\s!dummy][#1][#2][#3]%
          \getvalue{\??ef\??ef\s!dummy}[]} % [] is dummy arg 5
         {\doifassignmentelse{#2}
            {\getvalue{\??ef\??ef#1}[#2]}%
            {\getvalue{\??ef\??ef#1}[#3]}}}%
   \globallet\currentresourcecomment\empty
    \egroup}

\protect

\starttext
this is how a \externalfigure[cow][height=\lineheight] looks i the netherlands
\stoptext

Wolfgang


More information about the ntg-context mailing list