ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* mathalignment and grid
@ 2016-08-28 13:27 Henri Menke
  2016-08-28 15:26 ` Henri Menke
  0 siblings, 1 reply; 4+ messages in thread
From: Henri Menke @ 2016-08-28 13:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

when I typeset multi line equations using mathalignment and grid the descenders of the last line of equation run into the first line of text after that equation.  The problem is particularly bad with the Lucida fonts (I think the large operators are relatively larger than for Latin Modern).

I could just increase the spacing after equation (commented out in the MWE below), but that would introduce an imbalance between space before and space after for all equations without descenders.  Furthermore the problem does not arise for single line equations with descenders.  Without grid there is also no problem.

How do I fix mathalignment to prevent this?

Cheers, Henri

---

\setuplayout[grid=yes]
\setupbodyfont[lucidaot,9pt]
%\setupformulas[spaceafter={back,nowhite,2*line}]

\showgrid
\starttext

\input ward
\startformula
  \startmathalignment
  \NC \sum_{i,\alpha,\beta} c_{i,\alpha}^\dagger c_{i,\beta} \NR
  \NC \sum_{i,\alpha,\beta} c_{i,\alpha}^\dagger c_{i,\beta} \NR
  \stopmathalignment
\stopformula
%\blank[2*line]
\input ward
\startformula
  \sum_{i,\alpha,\beta} c_{i,\alpha}^\dagger c_{i,\beta}
\stopformula
\input ward
\startformula
  \text{no descenders}
\stopformula
\input ward

\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: mathalignment and grid
  2016-08-28 13:27 mathalignment and grid Henri Menke
@ 2016-08-28 15:26 ` Henri Menke
  0 siblings, 0 replies; 4+ messages in thread
From: Henri Menke @ 2016-08-28 15:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

I did some research in math-ali.mkiv and found that when grid is enabled, the whole alignment is simply put in a vbox and snapped to the grid using

\def\math_alignment_snap_start
  {\ifgridsnapping
     \snaptogrid[\v!both]\vbox\bgroup
   \fi}

Unfortunately, the `both` option rounds down both depth and height which is inconvenient when the content has large descenders (as in the example).  It  should be therefore changed to some other grid setting which rounds up.  I chose `top` for now but I'm not done experimenting yet.

Cheers, Henri


On 08/28/2016 03:27 PM, Henri Menke wrote:
> Dear list,
> 
> when I typeset multi line equations using mathalignment and grid the descenders of the last line of equation run into the first line of text after that equation.  The problem is particularly bad with the Lucida fonts (I think the large operators are relatively larger than for Latin Modern).
> 
> I could just increase the spacing after equation (commented out in the MWE below), but that would introduce an imbalance between space before and space after for all equations without descenders.  Furthermore the problem does not arise for single line equations with descenders.  Without grid there is also no problem.
> 
> How do I fix mathalignment to prevent this?
> 
> Cheers, Henri
> 
> ---
> 
> \setuplayout[grid=yes]
> \setupbodyfont[lucidaot,9pt]
> %\setupformulas[spaceafter={back,nowhite,2*line}]
> 
> \showgrid
> \starttext
> 
> \input ward
> \startformula
>   \startmathalignment
>   \NC \sum_{i,\alpha,\beta} c_{i,\alpha}^\dagger c_{i,\beta} \NR
>   \NC \sum_{i,\alpha,\beta} c_{i,\alpha}^\dagger c_{i,\beta} \NR
>   \stopmathalignment
> \stopformula
> %\blank[2*line]
> \input ward
> \startformula
>   \sum_{i,\alpha,\beta} c_{i,\alpha}^\dagger c_{i,\beta}
> \stopformula
> \input ward
> \startformula
>   \text{no descenders}
> \stopformula
> \input ward
> 
> \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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: mathalignment and grid
  2017-07-03  6:37 Henri Menke
@ 2017-07-03  7:24 ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2017-07-03  7:24 UTC (permalink / raw)
  To: ntg-context

On 7/3/2017 8:37 AM, Henri Menke wrote:
> Dear Hans,
> 
> In a previous email I complained that with mathalignment large formulas crash into the paragraph
> below when using grid typesetting.  This has been fixed in the latest beta but now the space above
> and below is asymmetric.  For this particular case I could fix it by setting the gird snapping mode
> to "top" rather than "math", but this does not apply universally.  Any chance there is an easy fix?

you can experiment with other grid options to see what is the best 
average .. the problem is that in a symmetrical vcentered formula ht/dp 
is kind of unknown (we could add a grid key to formulas so that users 
can choose)

> Cheers, Henri
> 
> ---
> 
> \setuplayout[grid=both]
> \showgrid
> 
> \startmode[fix]
> \unprotect
> \def\math_alignment_snap_start
>    {\ifgridsnapping
>       \snaptogrid[top]\vbox\bgroup
>     \fi}
> \protect
> \stopmode
> 
> \starttext
> \input knuth
> \startformula
>    \startmathalignment
>      \NC i\hbar\frac{\diff}{\diff t}\psi \NC= \left( - \frac{\hbar^2}{2 m} \nabla^2 + V(r) \right)
> \psi \NR
>      \NC F(x) \NC= \int f(x) \diff x \NR
>    \stopmathalignment
> \stopformula
> \input ward
> \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
> ___________________________________________________________________________________
> 


-- 

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

* mathalignment and grid
@ 2017-07-03  6:37 Henri Menke
  2017-07-03  7:24 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Henri Menke @ 2017-07-03  6:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear Hans,

In a previous email I complained that with mathalignment large formulas crash into the paragraph
below when using grid typesetting.  This has been fixed in the latest beta but now the space above
and below is asymmetric.  For this particular case I could fix it by setting the gird snapping mode
to "top" rather than "math", but this does not apply universally.  Any chance there is an easy fix?

Cheers, Henri

---

\setuplayout[grid=both]
\showgrid

\startmode[fix]
\unprotect
\def\math_alignment_snap_start
  {\ifgridsnapping
     \snaptogrid[top]\vbox\bgroup
   \fi}
\protect
\stopmode

\starttext
\input knuth
\startformula
  \startmathalignment
    \NC i\hbar\frac{\diff}{\diff t}\psi \NC= \left( - \frac{\hbar^2}{2 m} \nabla^2 + V(r) \right)
\psi \NR
    \NC F(x) \NC= \int f(x) \diff x \NR
  \stopmathalignment
\stopformula
\input ward
\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] 4+ messages in thread

end of thread, other threads:[~2017-07-03  7:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-28 13:27 mathalignment and grid Henri Menke
2016-08-28 15:26 ` Henri Menke
2017-07-03  6:37 Henri Menke
2017-07-03  7:24 ` 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).