On 2014-08-14 00:26, Wolfgang Schuster wrote:

Am 13.08.2014 um 20:56 schrieb Rik Kabel <cont...@rik.users.panix.com <mailto:cont...@rik.users.panix.com>>:

Dear list,

In a number of notes (recent and in the list archive) I have seen \resetsetups, used (always) as in a block of code like this from Gerben Wierde:

    \startsetups chapter:before
       \page[left]
       \noheaderandfooterlines
       \startalignment[left,nothyphenated]
        \startnarrower[4*left]
            \em \getbuffer[chapter:quote]
        \stopnarrower
       \stopalignment
       \resetsetups[quote:text]
       \page[right]
       \noheaderandfooterlines
       \blank[force,2*big]
    \stopsetups


What is the purpose of \resetsetups in this code? I see no different result without it, and all I can determine from list and document searches is that this is a vestigal command from x-fo processing.

With the \resetsetups command you can remove a previously created setups environment. As you can see from the following example “mysetups” doesn’t exist anymore after the \resetsetups command.

\startsetups[mysetups]
  Dummy text.
\stopsetups

\starttext

\doifsetupselse{mysetups}{YES}{NO}

\resetsetups[mysetups]

\doifsetupselse{mysetups}{YES}{NO}

\stoptext

Wolfgang

Thank you again, Wolfgang.

I notice that, while the _contents_ of the setup are removed, and using the reset setup introduces nothing into the text, there is no error or warning generated. (This is also the case, I learned, with an undefined buffer.) I can see that this can be very useful in a number of situations.

Can \resetsetups reset more than one setup in a single execution? When I try \resetsetups[setupA,setupB] it appears to reset neither. I only ask because of the plural name. It does not appear to be a burden to use multiple \resetsetups commands.

Are there equivalent commands to \resetsetups and \doifsetupelse for buffers? I could find nothing obvious.

The following example shows what I mean by the above statements. My examples are often clearer than my descriptions.

   \starttext

   \subject{test 1}

   \startsetups[mysetups]
      YES
   \stopsetups

   1. \doifsetupselse{mysetups}{\setup[mysetups]}{NO}

   \resetsetups[mysetups]

   2. \doifsetupselse{mysetups}{\setup[mysetups]}{NO}

   \startsetups[mysetups]
      yes
   \stopsetups

   3. \doifsetupselse{mysetups}{\setup[mysetups]}{NO}

   \subject{test 2}

   \startsetups[mysetups]
      YES
      \resetsetups[mysetups]
   \stopsetups

   1. \doifsetupselse{mysetups}{\setup[mysetups]}{NO}

   2. \doifsetupselse{mysetups}{\setup[mysetups]}{NO}

   \startsetups[mysetups]
      yes
      \resetsetups[mysetups]
   \stopsetups

   3. \doifsetupselse{mysetups}{\setup[mysetups]}{NO}

   \subject{test 3}

   \startsetups[mysetups]
      YES
   \stopsetups

   1. ¦\setup[mysetups]¦

      \resetsetups[mysetups]

   2. ¦\setup[mysetups]¦

   \startsetups[mysetups]
      yes
   \stopsetups

   3. ¦\setup[mysetups]¦

   \subject{test 4}

   \startsetups[mysetups]
      YES
      \resetsetups[mysetups]
   \stopsetups

   1. ¦\setup[mysetups]¦

   2. ¦\setup[mysetups]¦

   \startsetups[mysetups]
      yes
      \resetsetups[mysetups]
   \stopsetups

   3. ¦\setup[mysetups]¦

   \subject{test 5}

   1. ¦\setup[neverdefined]¦

   2.  ¦\getbuffer[neverdefined]¦

   \subject{test 6}

   \startsetups[mysetupstwo]
      , SIR!
   \stopsetups

   \startsetups[mysetups]
      YES
   \stopsetups

   1. ¦\setup[mysetups]\setup[mysetupstwo]¦

      \resetsetups[mysetups,mysetupstwo]

   2. ¦\setup[mysetups]\setup[mysetupstwo]¦

   \stoptext

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to