ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Help : Unknown references
@ 2006-03-21 19:42 WN
  2006-03-21 23:43 ` Aditya Mahajan
  0 siblings, 1 reply; 14+ messages in thread
From: WN @ 2006-03-21 19:42 UTC (permalink / raw)


Hi,

I am getting unknown references when I use
\startformula
\startalign[n=3]
.... Some math ......
\stopalign
\stopformula
in conjunction with
\placeformula[eqn1]
\startformula
.... math ..
\stopformula
See \in[eqn1] .... <----------- unknown reference

It has something to do with the formulanumber not set, I know, but how 
do I fix
this in the above ??

Thanks for your help and time
WN

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

* Re: Help : Unknown references
  2006-03-21 19:42 Help : Unknown references WN
@ 2006-03-21 23:43 ` Aditya Mahajan
  2006-03-22 16:33   ` WN
  0 siblings, 1 reply; 14+ messages in thread
From: Aditya Mahajan @ 2006-03-21 23:43 UTC (permalink / raw)


On Tue, 21 Mar 2006, WN wrote:

> Hi,
>
> I am getting unknown references when I use
> \startformula
> \startalign[n=3]
> .... Some math ......
> \stopalign
> \stopformula
> in conjunction with
> \placeformula[eqn1]
> \startformula
> .... math ..
> \stopformula
> See \in[eqn1] .... <----------- unknown reference
>
> It has something to do with the formulanumber not set, I know, but how 
> do I fix this in the above ??

Which context version are you using? The following compiles correctly on 
live.contextgarden.net

\starttext
\startformula \startalign[n=3]
  \NC a \NC b \NC d \NR
  \NC a \NC b \NC d \NR
\stopalign \stopformula

in conjunction with
\placeformula[eqn1]
  \startformula
    a = b
   \stopformula
See \in[eqn1] \unknown

\stoptext

See if this works for you.

Aditya

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

* Re: Help : Unknown references
  2006-03-21 23:43 ` Aditya Mahajan
@ 2006-03-22 16:33   ` WN
  2006-03-22 16:55     ` Taco Hoekwater
  0 siblings, 1 reply; 14+ messages in thread
From: WN @ 2006-03-22 16:33 UTC (permalink / raw)



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

Hi,

I think I am using the latest context version

 > texexec --version
TeXExec 5.4.3 - ConTeXt / PRAGMA ADE 1997-2005

               texexec : TeXExec 5.4.3 - ConTeXt / PRAGMA ADE 1997-2005
               texutil : TeXUtil 9.0.1 - ConTeXt / PRAGMA ADE 1992-2006
                   tex : pdfeTeX, 3.141592-1.30.6-2.2 (Web2C 7.5.5)
             *  context : ver: 2006.03.20 10:19
               cont-en : ver: 2006.03.20 10:19  fmt: 2006.3.21  mes: 
english*

When I compile your  code, it works. However my code , which I think, is 
similar, doesn't work.
I  cannot see any difference in the setup. I must be doing something 
basically wrong ???

Here is an excerpt  from my code

*/\def\mathrm/*#1{ {*/\rm/* #1}}
*/\def\done/*#1#2{ */\frac/*{ */\mathrm/*{d}  #1}{*/\mathrm/*{d} */\mathrm/*{#2}} }
*/\def\dtwo/*#1#2{ */\frac/*{*/\mathrm/*{d}^{2}  #1}{*/\mathrm/*{d} */\mathrm/*{#2}^{2}} }
*/\starttext/*
Als op het tijdstip *$t_{0}$* plaats *$**\vec**{r}_{0}$* en snelheid *$v_{0}$* zijn gegeven, 
dan kan de plaats *$**\vec**{r}$* van een deeltje op ieder tijdstip worden berekend met de
vergelijkingen
*/\placeformula/*[eqn1]
*/\startformula/*
*/\startalign/*[n=3]
*/\vec/*{v} & = & */\done/*{*/\vec/*{r}}{t}    */\quad/* */\quad/* */\vec/*{r} - */\vec/*{r}_{0} = */\int/*_{t_{0}}^{t} */\vec/*{v} */\:/* dt */\\/*
*/\stopalign/*
*/\stopformula/*
*/\placeformula/*[eqn2]
*/\startformula/*
*/\startalign/*[n=3]
*/\vec/*{a} & = & */\done/*{*/\vec/*{v}}{t}    */\quad/* */\quad/* */\vec/*{v} - */\vec/*{v}_{0} = */\int/*_{t_{0}}^{t} */\vec/*{a} */\:/* dt  */\\/*
*/\stopalign/*
*/\stopformula/*
Voor *$**\vec**{a}$* constant volgt uit */\in/*[eqn2] 
*/\startformula/*
*/\vec/*{v} = */\vec/*{v}_{0} + */\vec/*{a} */\:/* (t - t_0)
*/\stopformula/*
en hieruit met behulp van */\in/*[eqn1] 
*/\stoptext
/*

Wim


adityam@umich.edu wrote:
> On Tue, 21 Mar 2006, WN wrote:
>
>   
>> Hi,
>>
>> I am getting unknown references when I use
>> \startformula
>> \startalign[n=3]
>> .... Some math ......
>> \stopalign
>> \stopformula
>> in conjunction with
>> \placeformula[eqn1]
>> \startformula
>> .... math ..
>> \stopformula
>> See \in[eqn1] .... <----------- unknown reference
>>
>> It has something to do with the formulanumber not set, I know, but how 
>> do I fix this in the above ??
>>     
>
> Which context version are you using? The following compiles correctly on 
> live.contextgarden.net
>
> \starttext
> \startformula \startalign[n=3]
>   \NC a \NC b \NC d \NR
>   \NC a \NC b \NC d \NR
> \stopalign \stopformula
>
> in conjunction with
> \placeformula[eqn1]
>   \startformula
>     a = b
>    \stopformula
> See \in[eqn1] \unknown
>
> \stoptext
>
> See if this works for you.
>
> Aditya
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
>   


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

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Help : Unknown references
  2006-03-22 16:33   ` WN
@ 2006-03-22 16:55     ` Taco Hoekwater
  2006-03-22 21:57       ` Aditya Mahajan
  0 siblings, 1 reply; 14+ messages in thread
From: Taco Hoekwater @ 2006-03-22 16:55 UTC (permalink / raw)




WN wrote:
> Hi,
> 
> I think I am using the latest context version

> I  cannot see any difference in the setup. I must be doing something 
> basically wrong ???

There is a bug, and it is caused by the embedded \startalign
environment. Minimal file:

   \starttext
   \placeformula[eqn1]
   \startformula \startalign[n=1] a\\ \stopalign \stopformula
   See \in[eqn1]
   \stoptext

Sorry, I have no time for further debugging tonight.

Cheers, Taco

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

* Re: Help : Unknown references
  2006-03-22 16:55     ` Taco Hoekwater
@ 2006-03-22 21:57       ` Aditya Mahajan
  2006-03-23  5:43         ` Guide on align (was Help : Unknown references) Aditya Mahajan
  0 siblings, 1 reply; 14+ messages in thread
From: Aditya Mahajan @ 2006-03-22 21:57 UTC (permalink / raw)
  Cc: mailing list for ConTeXt users

On Wed, 22 Mar 2006, Taco Hoekwater wrote:
> WN wrote:
>> Hi,
>> 
>> I think I am using the latest context version
>
>> I  cannot see any difference in the setup. I must be doing something 
>> basically wrong ???
>
> There is a bug, and it is caused by the embedded \startalign
> environment. Minimal file:
>
>  \starttext
>  \placeformula[eqn1]
>  \startformula \startalign[n=1] a\\ \stopalign \stopformula
>  See \in[eqn1]
>  \stoptext

To WN, quick workaround, use \NR construct rather than \\.

\starttext
\placeformula
  \startformula \startalign[n=1]
   a \NR[eqn1]
  \stopalign \stopformula
\stoptext


>From what I understand, Hans said that this loose label was an ugly method 
to refer to equations. Consider
\placeformula[eq1]
  \startformula \startalign[n=1]
    eqn 1 \NR
    eqn 2 \NR
  \stopalign \stopformula

What should eq1 refer to? The first equation or the second? The "correct" 
way is to specify which one you want to be refered, so
\placeformula
  \startformula \startalign[n=1]
    eqn 1 \NR[eq1]
    eqn 2 \NR
  \stopalign \stopformula

And this does work correctly.


Actually, there is another problem. Consider this

\placeformula \startformula \startalign
  \NC ... \NC ... \NR
  \NC ... \NC ....\NR
  \NC ... \NC ... \NR
\stopalign \stopformula

vs

\placeformula \startformula \startalign
  \NC ..\NC ... \NR
  \NC ..\NC ... \NR[+]
\stopalign \stopformula


The second construct should only number the second equation, and it does 
exactly that. The first does not number any equation, which is also the 
correct and expected behaviour.

Now suppose that I want to number all equations. I am pretty sure that 
this used to work (can't check at the moment, as I have upgraded context)

\placeformula[+] \startformula \startalign
  \NC ... \NC ... \NR
  \NC ... \NR ... \NR
\stopalign \stopformula

However, this is no longer working? How do I number all the equations in a 
multiline formula, without doing a \NR[+] at each line?

Aditya

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

* Guide on align (was Help : Unknown references)
  2006-03-22 21:57       ` Aditya Mahajan
@ 2006-03-23  5:43         ` Aditya Mahajan
  2006-03-24 16:54           ` WN
  2006-03-27 14:24           ` Hans Hagen
  0 siblings, 2 replies; 14+ messages in thread
From: Aditya Mahajan @ 2006-03-23  5:43 UTC (permalink / raw)


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

Here are a few details of _how I understand_ the align mechanism of 
context. Hope that others will find it useful. Any suggestions for 
improvement are welcome.

Aditya

[-- Attachment #2: Type: APPLICATION/octet-stream, Size: 6595 bytes --]

\setupcolors[state=start]
\definecolor [BufferColor] [r=1,g=1,b=0.5]

\setuptyping[option=color]
\gdef\ShowExample{
  \blank
  \framed[align=normal,width=broad,frame=off,background=screen]
  {\tfx \typebuffer}
  \framed[align=normal,width=broad,frame=off,
  background=color,backgroundcolor=BufferColor] {\getbuffer}}

\starttext
\section{Basic Alignment}
The purpose of this document is to show how to do multi-line display equations 
in \CONTEXT. Hans has provided a configurable align environment that can be 
used for general purpose multiline display equations. Lets look at few 
examples to understand how it works. In many cases, we need to align a 
sequence of equations at the $=$ sign. This is how it can be done
\startbuffer
\startformula \startalign
  \NC a_1 x + b_1 y \NC = c_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NR
\stopalign \stopformula
\stopbuffer
\ShowExample

Lets look at how this is working. The \tex{startformula} starts the \CONTEXT 
display mode, \tex{startalign} moves to the multiline display mode. \tex{NC} 
specifies to start a {\em New Column} is starting and \tex{NR} specifies to 
start a {\em New Row}. By default, the first column is right aligned and the 
second is left aligned. You can increase the number of alignments by 
specifying \type{n=?} as options to \tex{startalign}. By default all the new 
columns are left aligned.
\startbuffer
\startformula \startalign[n=3]
  \NC a_1 x + b_1 y \NC = c_1 \NC =  d_1 u + e_1 v \NR
  \NC a_2 x + b_2 y \NC = c_2 + c_3 \NC =  d_2 u + e_2 v + f_1 w\NR
\stopalign \stopformula
\stopbuffer
\ShowExample

The default column alignment can be changed by using 
\type<<align={...,...,...}>> construct. This is a comma separated list, each 
value is either \type{right}, \type{left} or \type{middle}.  For example, to 
get the second column to be middle aligned, we can specify \type<<[n=3, 
align={right,middle,left}]>>
\startbuffer
\startformula \startalign[n=3, align={right,middle,left}]
  \NC a_1 x + b_1 y \NC = c_1 \NC =  d_1 u + e_1 v \NR
  \NC a_2 x + b_2 y \NC = c_2 + c_3 \NC =  d_2 u + e_2 v + f_1 w\NR
\stopalign \stopformula
\stopbuffer
\ShowExample

Oops, this doesn't look too good. We need to specify each \type{=} sign as a 
separate column.
\startbuffer
\startformula \startalign[n=4, align={right,middle,middle,left}]
  \NC a_1 x + b_1 y \NC = \NC c_1 \NC =  d_1 u + e_1 v \NR
  \NC a_2 x + b_2 y \NC = \NC c_2 + c_3 \NC =  d_2 u + e_2 v + f_1 w\NR
\stopalign \stopformula
\stopbuffer
\ShowExample

Sometimes one wants to have two columns of equations, next to one another.  
This can be done by specifying the number of blocks in \type<<m=?>>.
\startbuffer
\startformula \startalign[m=2]
  \NC a_1 x + b_1 y \NC = c_1 \NC d_1 u + e_1 v \NC = f_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NC d_2 u + e_2 v \NC = f_2 \NR
\stopalign \stopformula
\stopbuffer
\ShowExample

The distance between the blocks can be increased by specifying (well you 
guessed it) \type<<distance>> in the parameters of align.
\startbuffer
\startformula \startalign[m=2,distance=5em]
  \NC a_1 x + b_1 y \NC = c_1 \NC d_1 u + e_1 v \NC = f_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NC d_2 u + e_2 v \NC = f_2 \NR
\stopalign \stopformula
\stopbuffer
\ShowExample

However, this block mode can be cumbersome to work with. You need to work with 
two formulas at the same time and this can be confusing. There is another 
alternative in \tex{startformulas}
\startbuffer
\startformulas
  \startformula \startalign
    \NC a_1 x + b_1 y \NC = c_1 \NR
    \NC a_2 x + b_2 y \NC = c_2 \NR
  \stopalign \stopformula
  \startformula \startalign
    \NC d_1 u + e_1 v \NC = f_1 \NR
    \NC d_2 u + e_2 v \NC = f_2 \NR
  \stopalign \stopformula
\stopformulas
\stopbuffer
\ShowExample

More than two groups can also be placed.
\startbuffer
\startformulas
    \dorecurse{5}{\startformula
        \startalign[n=3,align={middle,middle,middle}]
            \NC a  \NC = \NC b  \NR
            \NC 2a \NC = \NC 2b \NR
        \stopalign
    \stopformula}
\stopformulas
\stopbuffer
\ShowExample

\section{Equation Numbering and referring}
To number multiline displays, two things need to be done. Write 
\tex{placeformula} before \tex{startformula} to {\em start up} equation 
numbering. To actually number the equations, you need to type \type{[+]} with 
each \tex{NR}. Going back to our basic example

\startbuffer
\placeformula
\startformula \startalign
  \NC a_1 x + b_1 y \NC = c_1 \NR[+]
  \NC a_2 x + b_2 y \NC = c_2 \NR[+]
\stopalign \stopformula
\stopbuffer
\ShowExample

If you only want to number a some specific equations, just add \type<<[+]>> to 
that equation only. Suppose in the above example, we want to only number the 
second equation.
\startbuffer
\placeformula
\startformula \startalign
  \NC a_1 x + b_1 y \NC = c_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NR[+]
\stopalign \stopformula
\stopbuffer
\ShowExample

Some more examples \unknown
\startbuffer
\placeformula
\startformula \startalign[n=3, align={right,middle,left}]
  \NC a_1 x + b_1 y \NC = c_1 \NC =  d_1 u + e_1 v \NR[+]
  \NC a_2 x + b_2 y \NC = c_2 + c_3 \NC =  d_2 u + e_2 v + f_1 w\NR
\stopalign \stopformula
\stopbuffer
\ShowExample


\startbuffer
\placeformula
\startformula \startalign[m=2]
  \NC a_1 x + b_1 y \NC = c_1 \NC d_1 u + e_1 v \NC = f_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NC d_2 u + e_2 v \NC = f_2 \NR[+]
\stopalign \stopformula
\stopbuffer
\ShowExample
\startbuffer
\placeformula
\startformulas
  \startformula \startalign
    \NC a_1 x + b_1 y \NC = c_1 \NR[+]
    \NC a_2 x + b_2 y \NC = c_2 \NR
  \stopalign \stopformula
  \startformula \startalign
    \NC d_1 u + e_1 v \NC = f_1 \NR
    \NC d_2 u + e_2 v \NC = f_2 \NR[+]
  \stopalign \stopformula
\stopformulas
\stopbuffer
\ShowExample

There is no fun numbering equations if can not refer to it. Well, referencing 
an equation is easy. Instead of the \type<<[+]>>, you can specify 
\type<<[eq:tag]>> and then refer to the equation using \type{\in[eq:tag]}. For 
example,

\startbuffer
\placeformula
\startformula \startalign
  \NC a_1 x + b_1 y \NC = c_1 \NR[eq:1]
  \NC a_2 x + b_2 y \NC = c_2 \NR[eq:2]
\stopalign \stopformula
As seen from (\in[eq:1]) and (\in[eq:2]), referring equations is straight 
forward.
\stopbuffer
\ShowExample

{\bf Note that you need to put the tag with the \tex{NR} and not with 
\tex{placeformula} (as is done with single line equations).}


\section{Some Advanced Tips}
Well, need to understand more myself before writing this. Write about 
\tex{setupalign}, \tex{definealign}. Give examples of defining \type<<gather>> 
and \type<<split>> environments.




\stoptext

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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Guide on align (was Help : Unknown references)
  2006-03-23  5:43         ` Guide on align (was Help : Unknown references) Aditya Mahajan
@ 2006-03-24 16:54           ` WN
  2006-03-24 18:06             ` Aditya Mahajan
  2006-03-27 14:24           ` Hans Hagen
  1 sibling, 1 reply; 14+ messages in thread
From: WN @ 2006-03-24 16:54 UTC (permalink / raw)



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

First thanks for your help, I did what you suggested and it worked.
But now I am trying your example file align.tex and running texexec,
using the latest Context (2006.03.23), I get the following error. I 
believe the problems
lies in verb-tex.tex but I am not sure.

section         : 1 Basic Alignment
<align-align.tmp> (/usr/local/tex/texmf-local/tex/context/base/verb-tex.tex
loading         : Context Support Macros / Pretty TEX Verbatim
)
! Missing number, treated as zero.
<to be read again>
                   f
\currenttyping ->f
                  ile
\checkverbatimfileline ...enumber <\currenttyping
                                                  \c!start \else \ifnum 
\ver...

\presetnormalverbatimline ...\doflushverbatimline
                                                  \global \chardef 
\verbatim...

\readline ...line \else \presetnormalverbatimline
                                                  \fi \fi \fi \fi 
\handlever...

\processfileverbatim ...expandafter \readline \fi
                                                  \closein 
\verbatiminput \e...
...
*l.25 \ShowExample*

Greetings
Wim Neimeijer

adityam@umich.edu wrote:
> Here are a few details of _how I understand_ the align mechanism of 
> context. Hope that others will find it useful. Any suggestions for 
> improvement are welcome.
>
> Aditya
> ------------------------------------------------------------------------
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
>   


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

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Guide on align (was Help : Unknown references)
  2006-03-24 16:54           ` WN
@ 2006-03-24 18:06             ` Aditya Mahajan
  2006-03-24 20:45               ` Taco Hoekwater
  2006-03-24 21:41               ` Hans Hagen
  0 siblings, 2 replies; 14+ messages in thread
From: Aditya Mahajan @ 2006-03-24 18:06 UTC (permalink / raw)
  Cc: mailing list for ConTeXt users

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

On Fri, 24 Mar 2006, WN wrote:

> First thanks for your help, I did what you suggested and it worked.
> But now I am trying your example file align.tex and running texexec,
> using the latest Context (2006.03.23), I get the following error. I believe 
> the problems
> lies in verb-tex.tex but I am not sure.
>
> section         : 1 Basic Alignment
> <align-align.tmp> (/usr/local/tex/texmf-local/tex/context/base/verb-tex.tex
> loading         : Context Support Macros / Pretty TEX Verbatim
> )
> ! Missing number, treated as zero.
> <to be read again>
>                  f
> \currenttyping ->f
>                 ile
> \checkverbatimfileline ...enumber <\currenttyping
>                                                 \c!start \else \ifnum 
> \ver...
>
> \presetnormalverbatimline ...\doflushverbatimline
>                                                 \global \chardef 
> \verbatim...
>
> \readline ...line \else \presetnormalverbatimline
>                                                 \fi \fi \fi \fi 
> \handlever...
>
> \processfileverbatim ...expandafter \readline \fi
>                                                 \closein \verbatiminput 
> \e...
> ...
> *l.25 \ShowExample*

Strange. Try

\def\ShowExample{\typebuffer\showbuffer}

and if that does not work, I guess you do not have permissions to write to 
a buffer. (This is all that I can make out from the error message). Try 
modifying texmf.cnf for the correct permissions. (Again, I am not sure 
which setting you need to modify).

Otherwise try the attached file. I have replaced all 
\typebuffer\showbuffer by
\starttyping ... \stoptyping buffer contents (vim regex rules). This also 
compiles on live.contextgarden.

If you do not manage to get it working, I will send you a pdf later today. 
I do not have access to a recent context distribution right now [1].

HTH,
Aditya

[1] On my college computer
  texexec --version gives
I can send you a pdf sometime 
later today.

TeXExec 3.1 - ConTeXt / PRAGMA ADE 1997-2002

Taco, do you need this one for the museum :)


[-- Attachment #2: Type: TEXT/PLAIN, Size: 9614 bytes --]

\setupcolors[state=start]
\definecolor [BufferColor] [r=1,g=1,b=0.5]

\setuptyping[option=color]
\gdef\ShowExample{
  \blank
  \framed[align=normal,width=broad,frame=off,background=screen]
  {\tfx \typebuffer}
  \framed[align=normal,width=broad,frame=off,
  background=color,backgroundcolor=BufferColor] {\getbuffer}}

\starttext
\section{Basic Alignment}
The purpose of this document is to show how to do multi-line display equations 
in \CONTEXT. Hans has provided a configurable align environment that can be 
used for general purpose multiline display equations. Lets look at few 
examples to understand how it works. In many cases, we need to align a 
sequence of equations at the $=$ sign. This is how it can be done
\starttyping
\startformula \startalign
  \NC a_1 x + b_1 y \NC = c_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NR
\stopalign \stopformula

\stoptyping

\startformula \startalign
  \NC a_1 x + b_1 y \NC = c_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NR
\stopalign \stopformula




Lets look at how this is working. The \tex{startformula} starts the \CONTEXT 
display mode, \tex{startalign} moves to the multiline display mode. \tex{NC} 
specifies to start a {\em New Column} is starting and \tex{NR} specifies to 
start a {\em New Row}. By default, the first column is right aligned and the 
second is left aligned. You can increase the number of alignments by 
specifying \type{n=?} as options to \tex{startalign}. By default all the new 
columns are left aligned.
\starttyping
\startformula \startalign[n=3]
  \NC a_1 x + b_1 y \NC = c_1 \NC =  d_1 u + e_1 v \NR
  \NC a_2 x + b_2 y \NC = c_2 + c_3 \NC =  d_2 u + e_2 v + f_1 w\NR
\stopalign \stopformula

\stoptyping

\startformula \startalign[n=3]
  \NC a_1 x + b_1 y \NC = c_1 \NC =  d_1 u + e_1 v \NR
  \NC a_2 x + b_2 y \NC = c_2 + c_3 \NC =  d_2 u + e_2 v + f_1 w\NR
\stopalign \stopformula



The default column alignment can be changed by using 
\type<<align={...,...,...}>> construct. This is a comma separated list, each 
value is either \type{right}, \type{left} or \type{middle}.  For example, to 
get the second column to be middle aligned, we can specify \type<<[n=3, 
align={right,middle,left}]>>
\starttyping
\startformula \startalign[n=3, align={right,middle,left}]
  \NC a_1 x + b_1 y \NC = c_1 \NC =  d_1 u + e_1 v \NR
  \NC a_2 x + b_2 y \NC = c_2 + c_3 \NC =  d_2 u + e_2 v + f_1 w\NR
\stopalign \stopformula

\stoptyping

\startformula \startalign[n=3, align={right,middle,left}]
  \NC a_1 x + b_1 y \NC = c_1 \NC =  d_1 u + e_1 v \NR
  \NC a_2 x + b_2 y \NC = c_2 + c_3 \NC =  d_2 u + e_2 v + f_1 w\NR
\stopalign \stopformula



Oops, this doesn't look too good. We need to specify each \type{=} sign as a 
separate column.
\starttyping
\startformula \startalign[n=4, align={right,middle,middle,left}]
  \NC a_1 x + b_1 y \NC = \NC c_1 \NC =  d_1 u + e_1 v \NR
  \NC a_2 x + b_2 y \NC = \NC c_2 + c_3 \NC =  d_2 u + e_2 v + f_1 w\NR
\stopalign \stopformula

\stoptyping

\startformula \startalign[n=4, align={right,middle,middle,left}]
  \NC a_1 x + b_1 y \NC = \NC c_1 \NC =  d_1 u + e_1 v \NR
  \NC a_2 x + b_2 y \NC = \NC c_2 + c_3 \NC =  d_2 u + e_2 v + f_1 w\NR
\stopalign \stopformula



Sometimes one wants to have two columns of equations, next to one another.  
This can be done by specifying the number of blocks in \type<<m=?>>.
\starttyping
\startformula \startalign[m=2]
  \NC a_1 x + b_1 y \NC = c_1 \NC d_1 u + e_1 v \NC = f_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NC d_2 u + e_2 v \NC = f_2 \NR
\stopalign \stopformula

\stoptyping

\startformula \startalign[m=2]
  \NC a_1 x + b_1 y \NC = c_1 \NC d_1 u + e_1 v \NC = f_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NC d_2 u + e_2 v \NC = f_2 \NR
\stopalign \stopformula



The distance between the blocks can be increased by specifying (well you 
guessed it) \type<<distance>> in the parameters of align.
\starttyping
\startformula \startalign[m=2,distance=5em]
  \NC a_1 x + b_1 y \NC = c_1 \NC d_1 u + e_1 v \NC = f_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NC d_2 u + e_2 v \NC = f_2 \NR
\stopalign \stopformula

\stoptyping

\startformula \startalign[m=2,distance=5em]
  \NC a_1 x + b_1 y \NC = c_1 \NC d_1 u + e_1 v \NC = f_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NC d_2 u + e_2 v \NC = f_2 \NR
\stopalign \stopformula



However, this block mode can be cumbersome to work with. You need to work with 
two formulas at the same time and this can be confusing. There is another 
alternative in \tex{startformulas}
\starttyping
\startformulas
  \startformula \startalign
    \NC a_1 x + b_1 y \NC = c_1 \NR
    \NC a_2 x + b_2 y \NC = c_2 \NR
  \stopalign \stopformula
  \startformula \startalign
    \NC d_1 u + e_1 v \NC = f_1 \NR
    \NC d_2 u + e_2 v \NC = f_2 \NR
  \stopalign \stopformula
\stopformulas

\stoptyping

\startformulas
  \startformula \startalign
    \NC a_1 x + b_1 y \NC = c_1 \NR
    \NC a_2 x + b_2 y \NC = c_2 \NR
  \stopalign \stopformula
  \startformula \startalign
    \NC d_1 u + e_1 v \NC = f_1 \NR
    \NC d_2 u + e_2 v \NC = f_2 \NR
  \stopalign \stopformula
\stopformulas



More than two groups can also be placed.
\starttyping
\startformulas
    \dorecurse{5}{\startformula
        \startalign[n=3,align={middle,middle,middle}]
            \NC a  \NC = \NC b  \NR
            \NC 2a \NC = \NC 2b \NR
        \stopalign
    \stopformula}
\stopformulas

\stoptyping

\startformulas
    \dorecurse{5}{\startformula
        \startalign[n=3,align={middle,middle,middle}]
            \NC a  \NC = \NC b  \NR
            \NC 2a \NC = \NC 2b \NR
        \stopalign
    \stopformula}
\stopformulas



\section{Equation Numbering and referring}
To number multiline displays, two things need to be done. Write 
\tex{placeformula} before \tex{startformula} to {\em start up} equation 
numbering. To actually number the equations, you need to type \type{[+]} with 
each \tex{NR}. Going back to our basic example

\starttyping
\placeformula
\startformula \startalign
  \NC a_1 x + b_1 y \NC = c_1 \NR[+]
  \NC a_2 x + b_2 y \NC = c_2 \NR[+]
\stopalign \stopformula

\stoptyping

\placeformula
\startformula \startalign
  \NC a_1 x + b_1 y \NC = c_1 \NR[+]
  \NC a_2 x + b_2 y \NC = c_2 \NR[+]
\stopalign \stopformula



If you only want to number a some specific equations, just add \type<<[+]>> to 
that equation only. Suppose in the above example, we want to only number the 
second equation.
\starttyping
\placeformula
\startformula \startalign
  \NC a_1 x + b_1 y \NC = c_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NR[+]
\stopalign \stopformula

\stoptyping

\placeformula
\startformula \startalign
  \NC a_1 x + b_1 y \NC = c_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NR[+]
\stopalign \stopformula



Some more examples \unknown
\starttyping
\placeformula
\startformula \startalign[n=3, align={right,middle,left}]
  \NC a_1 x + b_1 y \NC = c_1 \NC =  d_1 u + e_1 v \NR[+]
  \NC a_2 x + b_2 y \NC = c_2 + c_3 \NC =  d_2 u + e_2 v + f_1 w\NR
\stopalign \stopformula

\stoptyping

\placeformula
\startformula \startalign[n=3, align={right,middle,left}]
  \NC a_1 x + b_1 y \NC = c_1 \NC =  d_1 u + e_1 v \NR[+]
  \NC a_2 x + b_2 y \NC = c_2 + c_3 \NC =  d_2 u + e_2 v + f_1 w\NR
\stopalign \stopformula




\starttyping
\placeformula
\startformula \startalign[m=2]
  \NC a_1 x + b_1 y \NC = c_1 \NC d_1 u + e_1 v \NC = f_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NC d_2 u + e_2 v \NC = f_2 \NR[+]
\stopalign \stopformula

\stoptyping

\placeformula
\startformula \startalign[m=2]
  \NC a_1 x + b_1 y \NC = c_1 \NC d_1 u + e_1 v \NC = f_1 \NR
  \NC a_2 x + b_2 y \NC = c_2 \NC d_2 u + e_2 v \NC = f_2 \NR[+]
\stopalign \stopformula


\starttyping
\placeformula
\startformulas
  \startformula \startalign
    \NC a_1 x + b_1 y \NC = c_1 \NR[+]
    \NC a_2 x + b_2 y \NC = c_2 \NR
  \stopalign \stopformula
  \startformula \startalign
    \NC d_1 u + e_1 v \NC = f_1 \NR
    \NC d_2 u + e_2 v \NC = f_2 \NR[+]
  \stopalign \stopformula
\stopformulas

\stoptyping

\placeformula
\startformulas
  \startformula \startalign
    \NC a_1 x + b_1 y \NC = c_1 \NR[+]
    \NC a_2 x + b_2 y \NC = c_2 \NR
  \stopalign \stopformula
  \startformula \startalign
    \NC d_1 u + e_1 v \NC = f_1 \NR
    \NC d_2 u + e_2 v \NC = f_2 \NR[+]
  \stopalign \stopformula
\stopformulas



There is no fun numbering equations if can not refer to it. Well, referencing 
an equation is easy. Instead of the \type<<[+]>>, you can specify 
\type<<[eq:tag]>> and then refer to the equation using \type{\in[eq:tag]}. For 
example,

\starttyping
\placeformula
\startformula \startalign
  \NC a_1 x + b_1 y \NC = c_1 \NR[eq:1]
  \NC a_2 x + b_2 y \NC = c_2 \NR[eq:2]
\stopalign \stopformula
As seen from (\in[eq:1]) and (\in[eq:2]), referring equations is straight 
forward.

\stoptyping

\placeformula
\startformula \startalign
  \NC a_1 x + b_1 y \NC = c_1 \NR[eq:1]
  \NC a_2 x + b_2 y \NC = c_2 \NR[eq:2]
\stopalign \stopformula
As seen from (\in[eq:1]) and (\in[eq:2]), referring equations is straight 
forward.



{\bf Note that you need to put the tag with the \tex{NR} and not with 
\tex{placeformula} (as is done with single line equations).}


\section{Some Advanced Tips}
Well, need to understand more myself before writing this. Write about 
\tex{setupalign}, \tex{definealign}. Give examples of defining \type<<gather>> 
and \type<<split>> environments.




\stoptext

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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Guide on align (was Help : Unknown references)
  2006-03-24 18:06             ` Aditya Mahajan
@ 2006-03-24 20:45               ` Taco Hoekwater
  2006-03-24 21:40                 ` Aditya Mahajan
  2006-03-24 21:41               ` Hans Hagen
  1 sibling, 1 reply; 14+ messages in thread
From: Taco Hoekwater @ 2006-03-24 20:45 UTC (permalink / raw)


Aditya Mahajan wrote:
> On Fri, 24 Mar 2006, WN wrote:
> 
>> First thanks for your help, I did what you suggested and it worked.
>> But now I am trying your example file align.tex and running texexec,
>> using the latest Context (2006.03.23), I get the following error. I 
>> believe the problems
>> lies in verb-tex.tex but I am not sure.

Probabyl that typo in core-ver.tex that was diagnosed by Peter Rolf.
That was introduced in 2006.03.22, so that seems about right. I must
be getting blind to have missed no less that two verbatim bugs in
the diff logs. :-(

> [1] On my college computer
>  texexec --version gives
> I can send you a pdf sometime later today.
> 
> TeXExec 3.1 - ConTeXt / PRAGMA ADE 1997-2002

 > Taco, do you need this one for the museum :)

Can you find a version number somewhere? or the filesize of texexec.pl?

Cheers, Taco

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

* Re: Guide on align (was Help : Unknown references)
  2006-03-24 20:45               ` Taco Hoekwater
@ 2006-03-24 21:40                 ` Aditya Mahajan
  2006-03-27  8:37                   ` Taco Hoekwater
  0 siblings, 1 reply; 14+ messages in thread
From: Aditya Mahajan @ 2006-03-24 21:40 UTC (permalink / raw)


>> [1] On my college computer
>>  texexec --version gives
>> I can send you a pdf sometime later today.
>>
>> TeXExec 3.1 - ConTeXt / PRAGMA ADE 1997-2002
>
> > Taco, do you need this one for the museum :)
>
> Can you find a version number somewhere? or the filesize of texexec.pl?

filesize of texexec.pl: 93024

here is the head of texexec.pl

eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl 
-S $0 $argv:q'
         if 0;

# todo: second run of checksum of mp file with --nomprun changes
# todo: warning if no args
# todo: <<<< in messages
# todo: cleanup

#D \module
#D   [       file=texexec.pl,
#D        version=2002.05.04,
#D          title=running \ConTeXt,
#D       subtitle=\TEXEXEC,
#D         author=Hans Hagen,
#D           date=\currentdate,
#D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
#C
#C This module is part of the \CONTEXT\ macro||package and is
#C therefore copyrighted by \PRAGMA. See licen-en.pdf for
#C details.

#  Thanks to Tobias Burnus    for the german translations.
#  Thanks to Thomas Esser     for hooking it into web2c
#  Thanks to Taco   Hoekwater for suggesting improvements
#  Thanks to Wybo Dekker      for the advanced help interface

# (I still have to completely understand the help code -)

#D We started with a hack provided by Thomas Esser. This
#D expression replaces the unix specific line \type
#D {#!/usr/bin/perl}.


Aditya

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

* Re: Guide on align (was Help : Unknown references)
  2006-03-24 18:06             ` Aditya Mahajan
  2006-03-24 20:45               ` Taco Hoekwater
@ 2006-03-24 21:41               ` Hans Hagen
  1 sibling, 0 replies; 14+ messages in thread
From: Hans Hagen @ 2006-03-24 21:41 UTC (permalink / raw)


Aditya Mahajan wrote:
> On Fri, 24 Mar 2006, WN wrote:
>
>> First thanks for your help, I did what you suggested and it worked.
>> But now I am trying your example file align.tex and running texexec,
>> using the latest Context (2006.03.23), I get the following error. I 
>> believe the problems
>> lies in verb-tex.tex but I am not sure.
>>
>> section         : 1 Basic Alignment
>> <align-align.tmp> 
>> (/usr/local/tex/texmf-local/tex/context/base/verb-tex.tex
>> loading         : Context Support Macros / Pretty TEX Verbatim
>> )
>> ! Missing number, treated as zero.
>> <to be read again>
>>                  f
>> \currenttyping ->f
>>                 ile
>> \checkverbatimfileline ...enumber <\currenttyping
i just ran into that one as well; this was introduced when i optimized the code a bit (brace in wrong place + wrong macro calls); i'll upload a fixed version 

Hans 


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: Guide on align (was Help : Unknown references)
  2006-03-24 21:40                 ` Aditya Mahajan
@ 2006-03-27  8:37                   ` Taco Hoekwater
  0 siblings, 0 replies; 14+ messages in thread
From: Taco Hoekwater @ 2006-03-27  8:37 UTC (permalink / raw)




Aditya Mahajan wrote:
>>>[1] On my college computer
>>> texexec --version gives
>>>I can send you a pdf sometime later today.
>>>
>>>TeXExec 3.1 - ConTeXt / PRAGMA ADE 1997-2002
>>
>>>Taco, do you need this one for the museum :)
>>
>>Can you find a version number somewhere? or the filesize of texexec.pl?
> 
> 
> filesize of texexec.pl: 93024

got that one already, but thanks anyway. It is probably this release
of context:

https://foundry.supelec.fr/plugins/scmsvn/viewcvs.php?root=contextrev&view=rev&rev=30

Cheers, Taco

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

* Re: Guide on align (was Help : Unknown references)
  2006-03-23  5:43         ` Guide on align (was Help : Unknown references) Aditya Mahajan
  2006-03-24 16:54           ` WN
@ 2006-03-27 14:24           ` Hans Hagen
  2006-03-27 14:40             ` Aditya Mahajan
  1 sibling, 1 reply; 14+ messages in thread
From: Hans Hagen @ 2006-03-27 14:24 UTC (permalink / raw)


Aditya Mahajan wrote:
> Here are a few details of _how I understand_ the align mechanism of 
> context. Hope that others will find it useful. Any suggestions for 
> improvement are welcome.
>
why not add this to the wiki? some day taco and i will make a manual for math and then we can use such examples 

Hans 


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: Guide on align (was Help : Unknown references)
  2006-03-27 14:24           ` Hans Hagen
@ 2006-03-27 14:40             ` Aditya Mahajan
  0 siblings, 0 replies; 14+ messages in thread
From: Aditya Mahajan @ 2006-03-27 14:40 UTC (permalink / raw)


<--- On Mar 27, Hans Hagen wrote --->

> Aditya Mahajan wrote:
>> Here are a few details of _how I understand_ the align mechanism of
>> context. Hope that others will find it useful. Any suggestions for
>> improvement are welcome.
>>
> why not add this to the wiki? some day taco and i will make a manual for math and then we can use such examples

Actually I am almost through with a myway. Will upload that to the 
wiki in 3-4 days.

Aditya

-- 
Aditya Mahajan, EECS Systems, University of Michigan
http://www.eecs.umich.edu/~adityam || Ph: 7342624008

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

end of thread, other threads:[~2006-03-27 14:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-21 19:42 Help : Unknown references WN
2006-03-21 23:43 ` Aditya Mahajan
2006-03-22 16:33   ` WN
2006-03-22 16:55     ` Taco Hoekwater
2006-03-22 21:57       ` Aditya Mahajan
2006-03-23  5:43         ` Guide on align (was Help : Unknown references) Aditya Mahajan
2006-03-24 16:54           ` WN
2006-03-24 18:06             ` Aditya Mahajan
2006-03-24 20:45               ` Taco Hoekwater
2006-03-24 21:40                 ` Aditya Mahajan
2006-03-27  8:37                   ` Taco Hoekwater
2006-03-24 21:41               ` Hans Hagen
2006-03-27 14:24           ` Hans Hagen
2006-03-27 14:40             ` 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).