2

I'm trying to have a different behavior for itemize inside a given environment, but I can't make it work. I tried to use the before option, as in the following MWE

\defineframedtext[special]
             [before={\setupitemize[each][3,packed]},
               width=max]
%% document
\starttext
\startspecial
  Hello
  \startitemize  %% default behavior : not ok
    \item foo bar
    \item \input knuth
  \stopitemize
\stopspecial
\startspecial
  Hello
  \startitemize[3]  %% what I would like to be automatic
    \item foo bar
    \item \input knuth    
  \stopitemize
\stopspecial
\stoptext

Can you explain me what option may work please ?

EDIT

I tried the answer given by Metafox, which worked on the MWE, but not on my real document. With more work, I found that my global setting was taken even in the new framed block.

\setupitemize[1][2,packed]  %% this line is the problem

\startsetups[framedtext:special]
    \setupitemize[each][3,packed]
\stopsetups
\defineframedtext[special]
             [inner={\directsetup{framedtext:special}},
               width=max]

%% document
\starttext
\startspecial
  Hello
  \startitemize  %% not ok
    \item foo bar
    \item \input knuth
  \stopitemize
\stopspecial
\stoptext

Is there a way to make this setting prevalent in the new framedtext environment ?

1
  • \setupitemize[1] takes precedence over \setupitemize[each]. You should also include \setupitemize[1][2,packed] in your setups.
    – Aditya
    Commented Jul 12, 2016 at 22:47

1 Answer 1

6

The arguments of the before and after keys are applied after the content of the environment is typeset. To add setups which are local to the environment you can use the inner key.

\defineframedtext
  [special]
  [inner={\setupitemize[each][3,packed]},
   width=max]

\starttext

\startspecial
  Hello
  \startitemize
    \item foo bar
    \item \input knuth
  \stopitemize
\stopspecial

\stoptext

Local settings for itemize in a framed text environment

When your setups are longer you can put them into a setups environment and load it with the inner key.

\startsetups[framedtext:special]
    \setupitemize[each][3,packed]
\stopsetups

\defineframedtext
  [special]
  [inner=\directsetup{framedtext:special},
   width=max]

To ensure global settings are overwritten you should use 1,2,... instead of the each keyword for the first argument of the \setupitemize command because unlike in MkII the each keyword in MkIV doesn’t overwrite level specific settings anymore.

\startsetups[framedtext:special]
    \setupitemize[1,2,3,4][3,packed]
\stopsetups

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .