[dev-context] \startframed and parameters

Wolfgang Schuster schuster.wolfgang at googlemail.com
Thu May 17 12:11:34 CEST 2012


Hi Hans,

\startframed doesn’t accept local settings because \pack_framed_process expects two arguments.


Here is only one optional argument

\unexpanded\def\startframed
  {\dosingleempty\pack_framed_start_framed}

\def\pack_framed_start_framed[#1]%
  {\bgroup
   \advance\framednesting\plusone
   \expandafter\let\csname\??ol:\the\framednesting\s!parent\endcsname\??ol
   \pack_framed_process[\??ol:\the\framednesting][#1]%
   \bgroup}

while \framed accepts two

\unexpanded\def\framed
  {\bgroup
   \advance\framednesting\plusone
   \expandafter\let\csname\??ol:\the\framednesting\s!parent\endcsname\??ol
   \dodoubleempty\pack_framed_process[\??ol:\the\framednesting]}

and \pack_framed_process checks for the second argument:

\unexpanded\def\pack_framed_process[#1][#2]% assumes a \dodoubleempty (slows down), also should have leading \bgroup
  {\bgroup
   \pack_framed_initialize{#1}%
   \ifsecondargument % faster
     \getparameters[\currentframed][#2]% here !
   \fi
   \pack_framed_process_indeed}


Test file:

\starttext

\secondargumentfalse % was true from a previous command but should be false

\startframed[frame=off]text\stopframed

\framed[frame=off]{text}

\stoptext

Wolfgang


More information about the dev-context mailing list