ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: \setlayer on \startalign row
Date: Wed, 6 Feb 2013 12:21:30 -0500 (EST)	[thread overview]
Message-ID: <alpine.LNX.2.02.1302061219380.25867@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <CAFP+xFJKE-evxEkjvxEAhOc-9Tbz5wLWd_vnU5qaMzPWG47MWA@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 805 bytes --]

On Wed, 6 Feb 2013, Troy Henderson wrote:

> I would like to make a "row" of a \startalign ... \stopalign "hidden".  The
> following fails.
>
> \starttext
>    \definelayer[hiddenlayer][state=stop]
>    \startformula
>        \startalign[n=3,align={right,middle,left}]
>            \NC a \NC = \NC b \NR
>            \setlayer[hiddenlayer]{\NC a + c \NC = \NC b + c \NR}
>        \stopalign
>    \stopformula
> \stoptext

Layers would not work for something like this.

I usually use the attached macros for stepping:

\environment steps
\starttext
     \StartStepping 2
     \startformula
         \startalign[n=3,align={right,middle,left}]
             \NC a \NC = \NC b \NR
             \STEP 2{\NC a + c \NC = \NC b + c \NR}
         \stopalign
       \stopformula
     \StopStepping
\stoptext

Aditya

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/x-tex; name=steps.tex, Size: 2865 bytes --]

\startmodule steps
\unprotect

% This module defines two macros:
% \ONLY{count}{...} which displays text on a particular page
% \STEP{count}{...} which displays text from a particular page

\def\complexslides_only#1{\csname complexslides_steps_only_#1\endcsname}
\def\complexslides_step#1{\csname complexslides_steps_step_#1\endcsname}
\def\complexslides_hide#1{\csname complexslides_steps_hide_#1\endcsname}

\def\StartStep#1#2\StopStep{\complexslides_step{#1}{#2}}
\def\StartOnly#1#2\StopOnly{\complexslides_only{#1}{#2}}
\def\StartHide#1#2\StopHide{\complexslides_hide{#1}{#2}}

\long\def\gobble#1{}
\long\def\oneofone#1{#1}
\long\def\gobblebox#1%
    {\phantom{\framed[align=normal, frame=off]{#1}}}

\long\def\displaybox#1%
    {\framed[align=normal, frame=off]{#1}}

% Allow nesting of \StartStepping ... \StopStepping

\def\StartStepping#1#2\StopStepping%
  {\dorecurse{30}{\long\setvalue{complexslides_steps_step_\recurselevel}{\gobble}}%
   \dorecurse{30}{\long\setvalue{complexslides_steps_only_\recurselevel}{\gobble}}%
   \dorecurse{30}{\long\setvalue{complexslides_steps_hide_\recurselevel}{\gobblebox}}%
   \pushmacro\ONLY
   \pushmacro\STEP
   \pushmacro\HIDE
   \def\ONLY{\complexslides_only}%
   \def\STEP{\complexslides_step}%
   \def\HIDE{\complexslides_hide}%
   \dorecurse{#1}{%
   \edef\currentStepLevel{\recurselevel}%
   \long\setvalue{complexslides_steps_step_\currentStepLevel}{\oneofone}%
   \long\setvalue{complexslides_steps_only_\currentStepLevel}{\oneofone}%
   \long\setvalue{complexslides_steps_hide_\currentStepLevel}{\displaybox}%
   #2%
   \setvalue{complexslides_steps_only_\currentStepLevel}{\gobble}%
   \page\decrementnumber[userpage]}%
   \incrementnumber[userpage]%
   \popmacro\ONLY
   \popmacro\STEP
  }

\def\doifStepelse%
    {\doifelse\currentStepLevel}

% To be used in a group
\unexpanded\def\disablesteps
    {\def\complexslides_only##1{\gobble}% ##2
     \def\complexslides_step##1{\oneofone}%##2
    }

\unexpanded\def\SetStep#1#2% i of n
    {\dorecurse{#2}{\long\setvalue{complexslides_steps_step_\recurselevel}{\gobble}}%
     \dorecurse{#2}{\long\setvalue{complexslides_steps_only_\recurselevel}{\gobble}}%
     \dorecurse{#2}{\long\setvalue{complexslides_steps_hide_\recurselevel}{\gobblebox}}%
     \edef\currentStepLevel{#1}%
     \long\setvalue{complexslides_steps_step_\currentStepLevel}{\oneofone}%
     \long\setvalue{complexslides_steps_only_\currentStepLevel}{\oneofone}%
     \long\setvalue{complexslides_steps_hide_\currentStepLevel}{\displaybox}%
    }

\def\hidecomponent#1
    {\let\StartS\StartStepping
     \let\StopS\StopStepping
     \def\StartStepping{\grabbufferdata[Stepping][StartStepping][StopStepping]}
     \component[#1]
     \let\StartStepping\StartS
     \let\StopStepping\StopS}


\protect
\stopmodule

[-- Attachment #3: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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	other threads:[~2013-02-06 17:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06 17:14 Troy Henderson
2013-02-06 17:21 ` Aditya Mahajan [this message]
2013-02-06 17:41   ` Troy Henderson
2013-02-06 20:41     ` Troy Henderson
2013-02-06 21:51     ` Aditya Mahajan
2013-02-06 23:14       ` Aditya Mahajan
2013-02-06 23:33         ` Troy Henderson
2013-02-06 23:34           ` Troy Henderson
2013-02-06 23:52             ` Aditya Mahajan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.02.1302061219380.25867@ybpnyubfg.ybpnyqbznva \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).