ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \setlayer on \startalign row
@ 2013-02-06 17:14 Troy Henderson
  2013-02-06 17:21 ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Troy Henderson @ 2013-02-06 17:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 378 bytes --]

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

Troy Henderson

[-- Attachment #1.2: Type: text/html, Size: 441 bytes --]

[-- Attachment #2: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: \setlayer on \startalign row
  2013-02-06 17:14 \setlayer on \startalign row Troy Henderson
@ 2013-02-06 17:21 ` Aditya Mahajan
  2013-02-06 17:41   ` Troy Henderson
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2013-02-06 17:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: \setlayer on \startalign row
  2013-02-06 17:21 ` Aditya Mahajan
@ 2013-02-06 17:41   ` Troy Henderson
  2013-02-06 20:41     ` Troy Henderson
  2013-02-06 21:51     ` Aditya Mahajan
  0 siblings, 2 replies; 9+ messages in thread
From: Troy Henderson @ 2013-02-06 17:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1143 bytes --]

Aditya,

Thanks for your steps.tex.  The following example does not work as
expected.  In particular, the first equation moves from page 1 to page 2,
and the "12 x" moves from page 2 to page 3.

Troy

    \StartStepping{10}
        \startformula
            \startalign[n=4,align={right,right,middle,left}]
                \STEP{1}{\NC \NC \frac{2}{3}x-\frac{3}{4} \NC = \NC
\frac{1}{6}x+\frac{21}{4} \NR}
                \STEP{2}{\NC 12\times\NC \NC \NC \NR}
                \STEP{3}{\NC \NC \left(12\cdot\frac{2}{3}x\right) -
\left(12\cdot\frac{3}{4}\right) \NC = \NC \left(12\cdot\frac{1}{6}x\right)
+ \left(12\cdot\frac{21}{4}\right) \NR}
                \STEP{4}{\NC \NC 8x - 9 \NC = \NC 2x + 63 \NR}
                \STEP{5}{\NC \NC 8x - 9 - 2x \NC = \NC 2x - 2x + 63 \NR}
                \STEP{6}{\NC \NC 6x - 9 \NC = \NC 63 \NR}
                \STEP{7}{\NC \NC 6x - 9 + 9 \NC = \NC 63 + 9 \NR}
                \STEP{8}{\NC \NC 6x \NC = \NC 72 \NR}
                \STEP{9}{\NC \NC \frac{6x}{6} \NC = \NC \frac{72}{6} \NR}
                \STEP{10}{\NC \NC x \NC = \NC 12}
            \stopalign
        \stopformula
    \StopStepping

[-- Attachment #1.2: Type: text/html, Size: 1235 bytes --]

[-- Attachment #2: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: \setlayer on \startalign row
  2013-02-06 17:41   ` Troy Henderson
@ 2013-02-06 20:41     ` Troy Henderson
  2013-02-06 21:51     ` Aditya Mahajan
  1 sibling, 0 replies; 9+ messages in thread
From: Troy Henderson @ 2013-02-06 20:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 48 bytes --]

Aditya,

Can you confirm this phenomenon?

Troy

[-- Attachment #1.2: Type: text/html, Size: 64 bytes --]

[-- Attachment #2: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: \setlayer on \startalign row
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2013-02-06 21:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, 6 Feb 2013, Troy Henderson wrote:

> Aditya,
>
> Thanks for your steps.tex.  The following example does not work as
> expected.  In particular, the first equation moves from page 1 to page 2,
> and the "12 x" moves from page 2 to page 3.
>
> Troy
>
>    \StartStepping{10}
>        \startformula
>            \startalign[n=4,align={right,right,middle,left}]
>                \STEP{1}{\NC \NC \frac{2}{3}x-\frac{3}{4} \NC = \NC
> \frac{1}{6}x+\frac{21}{4} \NR}
>                \STEP{2}{\NC 12\times\NC \NC \NC \NR}
>                \STEP{3}{\NC \NC \left(12\cdot\frac{2}{3}x\right) -
> \left(12\cdot\frac{3}{4}\right) \NC = \NC \left(12\cdot\frac{1}{6}x\right)
> + \left(12\cdot\frac{21}{4}\right) \NR}
>                \STEP{4}{\NC \NC 8x - 9 \NC = \NC 2x + 63 \NR}
>                \STEP{5}{\NC \NC 8x - 9 - 2x \NC = \NC 2x - 2x + 63 \NR}
>                \STEP{6}{\NC \NC 6x - 9 \NC = \NC 63 \NR}
>                \STEP{7}{\NC \NC 6x - 9 + 9 \NC = \NC 63 + 9 \NR}
>                \STEP{8}{\NC \NC 6x \NC = \NC 72 \NR}
>                \STEP{9}{\NC \NC \frac{6x}{6} \NC = \NC \frac{72}{6} \NR}
>                \STEP{10}{\NC \NC x \NC = \NC 12}
>            \stopalign
>        \stopformula
>    \StopStepping

You need to ensure that the width of the columns does not change from each 
step. There is no easy way to do this with \startmathalign, but you can 
try \startTABLE, with explicit values of widths. (Some day, I will check 
how beamer does this with aligned equations).

Aditya
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: \setlayer on \startalign row
  2013-02-06 21:51     ` Aditya Mahajan
@ 2013-02-06 23:14       ` Aditya Mahajan
  2013-02-06 23:33         ` Troy Henderson
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2013-02-06 23:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, 6 Feb 2013, Aditya Mahajan wrote:

> On Wed, 6 Feb 2013, Troy Henderson wrote:
>
>> Aditya,
>> 
>> Thanks for your steps.tex.  The following example does not work as
>> expected.  In particular, the first equation moves from page 1 to page 2,
>> and the "12 x" moves from page 2 to page 3.
>> 
>> Troy
>>
>>    \StartStepping{10}
>>        \startformula
>>            \startalign[n=4,align={right,right,middle,left}]
>>                \STEP{1}{\NC \NC \frac{2}{3}x-\frac{3}{4} \NC = \NC
>> \frac{1}{6}x+\frac{21}{4} \NR}
>>                \STEP{2}{\NC 12\times\NC \NC \NC \NR}
>>                \STEP{3}{\NC \NC \left(12\cdot\frac{2}{3}x\right) -
>> \left(12\cdot\frac{3}{4}\right) \NC = \NC \left(12\cdot\frac{1}{6}x\right)
>> + \left(12\cdot\frac{21}{4}\right) \NR}
>>                \STEP{4}{\NC \NC 8x - 9 \NC = \NC 2x + 63 \NR}
>>                \STEP{5}{\NC \NC 8x - 9 - 2x \NC = \NC 2x - 2x + 63 \NR}
>>                \STEP{6}{\NC \NC 6x - 9 \NC = \NC 63 \NR}
>>                \STEP{7}{\NC \NC 6x - 9 + 9 \NC = \NC 63 + 9 \NR}
>>                \STEP{8}{\NC \NC 6x \NC = \NC 72 \NR}
>>                \STEP{9}{\NC \NC \frac{6x}{6} \NC = \NC \frac{72}{6} \NR}
>>                \STEP{10}{\NC \NC x \NC = \NC 12}
>>            \stopalign
>>        \stopformula
>>    \StopStepping
>
> You need to ensure that the width of the columns does not change from each 
> step. There is no easy way to do this with \startmathalign, but you can try 
> \startTABLE, with explicit values of widths. (Some day, I will check how 
> beamer does this with aligned equations).

For display equations, the following will also work (but it is very tedius 
to type)

\environment steps

\long\def\gobblebox#1{\phantom{#1}}
\long\def\displaybox#1{{#1}}

\starttext
\StartStepping{3}
   \startformula
     \startalign[n=4,align={right,right,middle,left}]
       \NC \NC \frac{2}{3}x-\frac{3}{4} \NC = \NC \frac{1}{6}x+\frac{21}{4} 
\NR
       \NC \HIDE 2{12\times } \NC  \NC \NC \NR
       \NC \NC \HIDE 3 {\left(12\cdot\frac{2}{3}x\right) -
           \left(12\cdot\frac{3}{4}\right) } \NC \HIDE 3 {=} \NC
           \HIDE 3 {\left(12\cdot\frac{1}{6}x\right)
           + \left(12\cdot\frac{21}{4}\right)} \NR
     \stopalign
   \stopformula
\StopStepping
\stoptext

Aditya
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: \setlayer on \startalign row
  2013-02-06 23:14       ` Aditya Mahajan
@ 2013-02-06 23:33         ` Troy Henderson
  2013-02-06 23:34           ` Troy Henderson
  0 siblings, 1 reply; 9+ messages in thread
From: Troy Henderson @ 2013-02-06 23:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 116 bytes --]

>
> For display equations, the following will also work (but it is very tedius
> to type)
>

Good workaround.

Troy

[-- Attachment #1.2: Type: text/html, Size: 284 bytes --]

[-- Attachment #2: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: \setlayer on \startalign row
  2013-02-06 23:33         ` Troy Henderson
@ 2013-02-06 23:34           ` Troy Henderson
  2013-02-06 23:52             ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Troy Henderson @ 2013-02-06 23:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 74 bytes --]

Any idea how to put a \framed{ ... } around

\NC \NC x \NC = \NC 12

Troy

[-- Attachment #1.2: Type: text/html, Size: 90 bytes --]

[-- Attachment #2: 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: \setlayer on \startalign row
  2013-02-06 23:34           ` Troy Henderson
@ 2013-02-06 23:52             ` Aditya Mahajan
  0 siblings, 0 replies; 9+ messages in thread
From: Aditya Mahajan @ 2013-02-06 23:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, 6 Feb 2013, Troy Henderson wrote:

> Any idea how to put a \framed{ ... } around
>
> \NC \NC x \NC = \NC 12

AFAIK, you can't. It's on my TODO list but requires a complete rewrite of 
math align macros. If you really need it:

\startsetups table:math
   \setupTABLE[frame=off, toffset=0.2ex, boffset=0.2ex]
   \setupTABLE[column][odd][align=flushright]
   \setupTABLE[column][even][align=flushleft]
   \setupTABLE[first][2][leftframe=on]
   \setupTABLE[last][2][rightframe=on]
   \setupTABLE[first,last][2][topframe=on, bottomframe=on]
\stopsetups

\starttext
   \startTABLE[setups=table:math]
     \NC $\displaystyle \frac{2}{3}x-\frac{3}{4}$ \NC $\displaymath {}= 
\frac{1}{6}x+\frac{21}{4}$ \NC \NR
     \NC $\displaystyle \left(12\cdot\frac{2}{3}x\right) - 
\left(12\cdot\frac{3}{4}\right) $
     \NC $\displaystyle{}= \left(12\cdot\frac{1}{6}x\right) + 
\left(12\cdot\frac{21}{4}\right)$ \NC \NR
   \stopTABLE
\stoptext

Aditya
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-02-06 23:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-06 17:14 \setlayer on \startalign row Troy Henderson
2013-02-06 17:21 ` Aditya Mahajan
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

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).