ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* formula block with align and pagebreak
@ 2006-07-18 11:53 Tobias Burnus
  2006-07-18 16:06 ` Aditya Mahajan
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2006-07-18 11:53 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 693 bytes --]

Hello,

I have often longer equations of the type

\startformula\startalign
  A = b c
  B = c d
  E = g h
\intertext{Some intermediate text}
  F = h j
  G = k l
\stopformula\stopalign

I would like to keep the alignment (per page), however I also would like
to have automatic page breaks inbetween. I can split it manually into
two \startformula\startalign ... \stopformula\stopalign blocks, but this
I would have to adapt any time I change something, which changes the
text length, before that block.

Any idea?

Additional question: Does anyone know why in the example the "Gauss'
law" starts not at the top of the page but roughly two line further down?

Tobias

PS: I attached an example.

[-- Attachment #2: test.tex --]
[-- Type: application/x-tex, Size: 1159 bytes --]

[-- 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] 2+ messages in thread

* Re: formula block with align and pagebreak
  2006-07-18 11:53 formula block with align and pagebreak Tobias Burnus
@ 2006-07-18 16:06 ` Aditya Mahajan
  0 siblings, 0 replies; 2+ messages in thread
From: Aditya Mahajan @ 2006-07-18 16:06 UTC (permalink / raw)


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

On Tue, 18 Jul 2006, Tobias Burnus wrote:

> Hello,
>
> I have often longer equations of the type
>
> \startformula\startalign
>  A = b c
>  B = c d
>  E = g h
> \intertext{Some intermediate text}
>  F = h j
>  G = k l
> \stopformula\stopalign
>
> I would like to keep the alignment (per page), however I also would like
> to have automatic page breaks inbetween. I can split it manually into
> two \startformula\startalign ... \stopformula\stopalign blocks, but this
> I would have to adapt any time I change something, which changes the
> text length, before that block.
>
> Any idea?
>
> Additional question: Does anyone know why in the example the "Gauss'
> law" starts not at the top of the page but roughly two line further down?
>
> Tobias

Page break with math is a bit tricky at the moment. Before I come to 
that, some comments.

Hans, right now zapf.tex reads

\definetypeface [zapf] [cg] [calligraphy] [chancery]
\switchtotypeface [zapf] [12pt,cg]

Zapf Chancery

\input tufte.tex

Shouldn't that be surrounded by a start/stop (or bgroup/egroup) to 
prevent font changes in the entire document?

Tobias, startintertext/stopintertext are already in the core, so you 
do not need to redefine those in your document.

Now coming back to the main problem of equations not breaking across 
pages. Taco had provided a fix for making this work. There are a few 
issues with math equations breaking across pages, and this is the 
reason that the fix is not in the core. I am attaching Taco's fix, 
keep in mind that this is not final.

Aditya

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

\unprotect

\def\dostartmathcases[#1][#2]%
  {\begingroup
   \edef\currentmathcases{#1}%
   \doifassignmentelse{#2}{\setupmathcases[#1][#2]}\donothing
   \mathcasesparameter\c!left
   \vcenter\bgroup
   \pushmacro\docasesNC
   \let\endmath\relax
   \def\NC{\docasesNC}%
   \def\MC{\docasesNC\ifmmode\else$\def\endmath{$}\fi}%
   \global\let\docasesNC\dodocasesNC
   \def\NR{\unskip\endmath&\global\let\docasesNC\dodocasesNC\doxxdoubleempty\docasesNR}%
   \normalbaselines
   \mathsurround\zeropoint
   \everycr\emptytoks
   \tabskip\zeropoint
   \global\eqaligncolumn\plusone
   \halign\bgroup
        $\mathcasesparameter\c!style##$\hfil 
       &\hskip\mathcasesparameter\c!distance\relax
        \popmacro\docasesNC##\hfil
       &\hskip\mathcasesparameter\c!numberdistance\relax
        \let\formuladistance\!!zeropoint
        \span\textineqalign{##}%
     \crcr} % todo: number

\def\preparemathmatrix
  {\!!toksa{\strut 
            \firstineqalign\leftofeqalign \span 
            \textineqalign{\mathmatrixparameter\c!style ##}\rightofeqalign}%
   \!!toksb{&\hskip\mathmatrixparameter\c!distance
            \nextineqalign\leftofeqalign \span 
            \textineqalign{\mathmatrixparameter\c!style ##}\rightofeqalign}%
   \!!toksc{&&\hskip\mathmatrixparameter\c!distance
            \leftofeqalign \span 
            \textineqalign{\mathmatrixparameter\c!style ##}\rightofeqalign}%
   \buildmathmatrix
   \halign \@EA \bgroup\the\scratchtoks \crcr}

\def\dostartmathmatrix[#1][#2]%
  {\begingroup
   \edef\currentmathmatrix{#1}%
   \doifassignmentelse{#2}{\setupmathmatrix[#1][#2]}\donothing
   \null
   \mathmatrixparameter\c!left
   \processaction
      [\mathmatrixparameter\c!location]
      [\s!default=>\let\vchbox\vcenter,
       \s!unknown=>\let\vchbox\vcenter,
       \v!top=>\let\vchbox\vtop,
       \v!bottom=>\let\vchbox\vbox]%
   \vchbox\bgroup
   \pushmacro\domatrixNC
   \let\endmath\relax
   \def\NC{\domatrixNC}%
   \def\MC{\domatrixNC\ifmmode\else$\def\endmath{$}\fi}%
   \global\let\domatrixNC\dodomatrixNC
   \def\NR{\endmath\global\let\domatrixNC\dodomatrixNC\crcr}%
   \normalbaselines
   \mathsurround\zeropoint
   \everycr\emptytoks
   \tabskip\zeropoint
   \eqaligncolumn\zerocount % could be \scratchcounter
   \processcommacommand[\mathmatrixparameter\c!align]{\advance\eqaligncolumn\plusone\dosetmatrixcolumn}%
   \scratchcounter=\ifnum\eqaligncolumn>\scratchcounter \eqaligncolumn \else \plusone \fi
   \global\eqaligncolumn\plusone
   \preparemathmatrix } % uses scratchcounter

\def\dobothaligneqalignno#1%
  {\ifmmode
    \displ@y
    \global\chardef\mathnumberstatus\plusone
    \ifcase\mathraggedstatus 
       \def\finishalignno{\crcr\egroup}%
    \else
       % we're in a mathbox
       \vcenter\bgroup
       \def\finishalignno{\crcr\egroup\egroup}%
    \fi
   \fi
   #1%
   \halign \ifcase\eqalignmode \or to \displaywidth \fi \@EA \bgroup\the\scratchtoks\crcr}

\protect

[-- 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] 2+ messages in thread

end of thread, other threads:[~2006-07-18 16:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-18 11:53 formula block with align and pagebreak Tobias Burnus
2006-07-18 16:06 ` 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).