* Formulas and pagebreaks
@ 2017-08-30 10:44 Henri Menke
2017-08-30 17:18 ` Hans Hagen
0 siblings, 1 reply; 2+ messages in thread
From: Henri Menke @ 2017-08-30 10:44 UTC (permalink / raw)
To: ntg-context
Dear list,
Motivated by this question on TeX.SX (https://tex.stackexchange.com/questions/388963) I found that formulas do not honour the samepage option in spacebefore. I could track the issue down to the \strc_math_obey_depth macro where a vertical kern is inserted which apparently introduces a good breakpoint. MWE is below, the line is marked with an ASCII arrow. Please fix.
Cheers, Henri
---
\setupformulas[spacebefore={big,samepage},spaceafter=big]
\unprotect
\def\strc_math_obey_depth
{\ifvmode\ifdim\prevdepth<\zeropoint\else\ifdim\prevdepth<\strutdp
% maybe add a tracing option here
\ifgridsnapping
\directvspacing\v!depth
\else
\kern\dimexpr\strutdp-\prevdepth\relax % <-----------
\prevdepth\strutdp
\fi
\fi\fi\fi}
\protect
\starttext
\dorecurse{4}{\input knuth\par}
\startformula
\exp(x)=\sum_{k=0}^{+\infty}\frac{x^k}{k!}.
\stopformula
\stoptext
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Formulas and pagebreaks
2017-08-30 10:44 Formulas and pagebreaks Henri Menke
@ 2017-08-30 17:18 ` Hans Hagen
0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2017-08-30 17:18 UTC (permalink / raw)
To: ntg-context
On 8/30/2017 12:44 PM, Henri Menke wrote:
> Dear list,
>
> Motivated by this question on TeX.SX (https://tex.stackexchange.com/questions/388963) I found that formulas do not honour the samepage option in spacebefore. I could track the issue down to the \strc_math_obey_depth macro where a vertical kern is inserted which apparently introduces a good breakpoint. MWE is below, the line is marked with an ASCII arrow. Please fix.
>
> Cheers, Henri
>
> ---
>
> \setupformulas[spacebefore={big,samepage},spaceafter=big]
>
> \unprotect
>
> \def\strc_math_obey_depth
> {\ifvmode\ifdim\prevdepth<\zeropoint\else\ifdim\prevdepth<\strutdp
> % maybe add a tracing option here
> \ifgridsnapping
> \directvspacing\v!depth
> \else
> \kern\dimexpr\strutdp-\prevdepth\relax % <-----------
> \prevdepth\strutdp
> \fi
> \fi\fi\fi}
>
> \protect
>
> \starttext
>
> \dorecurse{4}{\input knuth\par}
> \startformula
> \exp(x)=\sum_{k=0}^{+\infty}\frac{x^k}{k!}.
> \stopformula
>
> \stoptext
please test extensively with:
\setvalue{\??mathdisplayspacemodel\v!before:3}%
{\let\m_spacebefore\empty
\ifvmode
\ifdim\lastskip>\zeropoint\else
\ifdim\prevdepth<\zeropoint\else
\ifdim\prevdepth<\strutdp
% maybe add a tracing option here
\ifgridsnapping
\let\m_spacebefore\v!depth
\else
\edef\m_spacebefore{\the\dimexpr\strutdp-\prevdepth\relax}%
\fi
\fi
\fi
\fi
\nointerlineskip
\fi
\ifx\m_spacebefore\empty
\ifx\p_spacebefore\v!none
% nothing
\else\ifx\p_spacebefore\empty
\directvspacing\currentvspacing
\else
\directvspacing{\p_spacebefore,\the\scratchdimen}%
\fi\fi
\else
\ifx\p_spacebefore\v!none
\directvspacing{\m_spacebefore}%
\else\ifx\p_spacebefore\empty
\directvspacing{\m_spacebefore,\currentvspacing}%
\else
\directvspacing{\m_spacebefore,\p_spacebefore}%
\fi\fi
\fi}
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-30 17:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-30 10:44 Formulas and pagebreaks Henri Menke
2017-08-30 17:18 ` Hans Hagen
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).