ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* line correction
@ 2017-09-28 14:21 MF
  2017-09-28 19:48 ` Henri
  0 siblings, 1 reply; 14+ messages in thread
From: MF @ 2017-09-28 14:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello list, 
I would like ConTeXt to snap normal text to grid after a quotation.
This example does not work:

--------------
\setupquotation[before={\switchtobodyfont[9pt]}]

\starttext
\showgrid

\input knuth

\startlinecorrection[halfline]
\startquotation
  \input sapolsky
\stopquotation
\stoplinecorrection

\input knuth

\stoptext
--------------

If I prepend a \setuplayout[grid=yes], it works, but grid snapping
introduces also other side effects I don't want (i.e. tall formulas
inside text taking too much vertical space).

I would like the halfline spaces before and after the quotation to
shrink or stretch a bit to the nearest multiple of the main text line
height.

Is there an automatic way to get the normal text "return" on the grid
after a quotation without turning on a global grid snapping?

Thanks,
Massi
___________________________________________________________________________________
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] 14+ messages in thread

* Re: line correction
  2017-09-28 14:21 line correction MF
@ 2017-09-28 19:48 ` Henri
  2017-09-28 21:30   ` mf
  0 siblings, 1 reply; 14+ messages in thread
From: Henri @ 2017-09-28 19:48 UTC (permalink / raw)
  To: ntg-context

On Thu, 2017-09-28 at 16:21 +0200, MF wrote:
> Hello list, 
> I would like ConTeXt to snap normal text to grid after a quotation.
> This example does not work:
> 
> --------------
> \setupquotation[before={\switchtobodyfont[9pt]}]
> 
> \starttext
> \showgrid
> 
> \input knuth
> 
> \startlinecorrection[halfline]
> \startquotation
>   \input sapolsky
> \stopquotation
> \stoplinecorrection
> 
> \input knuth
> 
> \stoptext
> --------------
> 
> If I prepend a \setuplayout[grid=yes], it works, but grid snapping
> introduces also other side effects I don't want (i.e. tall formulas
> inside text taking too much vertical space).
> 
> I would like the halfline spaces before and after the quotation to
> shrink or stretch a bit to the nearest multiple of the main text line
> height.
> 
> Is there an automatic way to get the normal text "return" on the grid
> after a quotation without turning on a global grid snapping?

\setuplayout[grid=both] to round down both height and width when snapping.

> 
> Thanks,
> Massi
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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] 14+ messages in thread

* Re: line correction
  2017-09-28 19:48 ` Henri
@ 2017-09-28 21:30   ` mf
  2017-09-28 21:47     ` luigi scarso
                       ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: mf @ 2017-09-28 21:30 UTC (permalink / raw)
  To: ntg-context

Thank you Henri.

Now consider this:
-------------------------------
\setuplayout[grid=both]
\setupquotation[before={\switchtobodyfont[9pt]}]

\starttext
\showgrid

\input knuth

\startlinecorrection[halfline]
\startquotation
  \input sapolsky
\stopquotation
\stoplinecorrection

\input knuth
$\displaystyle{\frac{1}{a + b}}$
\input knuth

\stoptext
-------------------------------

Now the text snaps to the grid after the quotation, but the tall
formula inside the text overlaps with the text lines.

The solution would be a grid configuration that gives the line
containing the formula two lines of height, putting that only line in
the middle and then snapping the following lines again to the grid
(still solving the alignment of quotations as in the grid=both case).
Is it possible?

Best regards,
Massi

Il giorno ven, 29/09/2017 alle 08.48 +1300, Henri ha scritto:
> On Thu, 2017-09-28 at 16:21 +0200, MF wrote:
> > Hello list, 
> > I would like ConTeXt to snap normal text to grid after a quotation.
> > This example does not work:
> > 
> > --------------
> > \setupquotation[before={\switchtobodyfont[9pt]}]
> > 
> > \starttext
> > \showgrid
> > 
> > \input knuth
> > 
> > \startlinecorrection[halfline]
> > \startquotation
> >   \input sapolsky
> > \stopquotation
> > \stoplinecorrection
> > 
> > \input knuth
> > 
> > \stoptext
> > --------------
> > 
> > If I prepend a \setuplayout[grid=yes], it works, but grid snapping
> > introduces also other side effects I don't want (i.e. tall formulas
> > inside text taking too much vertical space).
> > 
> > I would like the halfline spaces before and after the quotation to
> > shrink or stretch a bit to the nearest multiple of the main text
> > line
> > height.
> > 
> > Is there an automatic way to get the normal text "return" on the
> > grid
> > after a quotation without turning on a global grid snapping?
> 
> \setuplayout[grid=both] to round down both height and width when
> snapping.
> 
> > 
> > Thanks,
> > Massi
> > 
___________________________________________________________________________________
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] 14+ messages in thread

* Re: line correction
  2017-09-28 21:30   ` mf
@ 2017-09-28 21:47     ` luigi scarso
  2017-09-29  8:33       ` Hans Hagen
  2017-09-28 21:51     ` Henri
  2017-09-28 21:55     ` Henri
  2 siblings, 1 reply; 14+ messages in thread
From: luigi scarso @ 2017-09-28 21:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Sep 28, 2017 at 11:30 PM, mf <massifr@fastwebnet.it> wrote:
> Thank you Henri.
>
> Now consider this:
> -------------------------------
> \setuplayout[grid=both]
> \setupquotation[before={\switchtobodyfont[9pt]}]
>
> \starttext
> \showgrid
>
> \input knuth
>
> \startlinecorrection[halfline]
> \startquotation
>   \input sapolsky
> \stopquotation
> \stoplinecorrection
>
> \input knuth
> $\displaystyle{\frac{1}{a + b}}$
> \input knuth
>
> \stoptext
> -------------------------------
>
> Now the text snaps to the grid after the quotation, but the tall
> formula inside the text overlaps with the text lines.
>
> The solution would be a grid configuration that gives the line
> containing the formula two lines of height, putting that only line in
> the middle and then snapping the following lines again to the grid
> (still solving the alignment of quotations as in the grid=both case).
> Is it possible?


I suppose that this is not what you want,
but perhaps it can give you some some idea



\setuplayout[grid=both]
\setupquotation[before={\switchtobodyfont[9pt]}]

\starttext
\showgrid

\input knuth

\startlinecorrection[halfline]
\startquotation
  \input sapolsky
\stopquotation
\stoplinecorrection

\input knuth
\setbox0=\hbox{$\displaystyle{\frac{1}{a + b}}$}%
\ruledvbox to 1\lineheight{\hsize=\wd0\vrule width0pt height0pt
depth1\lineheight \vss\box0\vss}
\input knuth

\stoptext


-- 
luigi
___________________________________________________________________________________
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] 14+ messages in thread

* Re: line correction
  2017-09-28 21:30   ` mf
  2017-09-28 21:47     ` luigi scarso
@ 2017-09-28 21:51     ` Henri
  2017-09-28 21:55     ` Henri
  2 siblings, 0 replies; 14+ messages in thread
From: Henri @ 2017-09-28 21:51 UTC (permalink / raw)
  To: ntg-context

On Thu, 2017-09-28 at 23:30 +0200, mf wrote:
> Thank you Henri.
> 
> Now consider this:
> -------------------------------
> \setuplayout[grid=both]
> \setupquotation[before={\switchtobodyfont[9pt]}]
> 
> \starttext
> \showgrid
> 
> \input knuth
> 
> \startlinecorrection[halfline]
> \startquotation
>   \input sapolsky
> \stopquotation
> \stoplinecorrection
> 
> \input knuth
> $\displaystyle{\frac{1}{a + b}}$

\startformula
  \frac{1}{a + b}
\stopformula

Using \displaystyle in inline math will always produce rubbish.

> \input knuth
> 
> \stoptext
> -------------------------------
> 
> Now the text snaps to the grid after the quotation, but the tall
> formula inside the text overlaps with the text lines.
> 
> The solution would be a grid configuration that gives the line
> containing the formula two lines of height, putting that only line in
> the middle and then snapping the following lines again to the grid
> (still solving the alignment of quotations as in the grid=both case).
> Is it possible?
> 
> Best regards,
> Massi
> 
> Il giorno ven, 29/09/2017 alle 08.48 +1300, Henri ha scritto:
> > 
> > On Thu, 2017-09-28 at 16:21 +0200, MF wrote:
> > > 
> > > Hello list, 
> > > I would like ConTeXt to snap normal text to grid after a quotation.
> > > This example does not work:
> > > 
> > > --------------
> > > \setupquotation[before={\switchtobodyfont[9pt]}]
> > > 
> > > \starttext
> > > \showgrid
> > > 
> > > \input knuth
> > > 
> > > \startlinecorrection[halfline]
> > > \startquotation
> > >   \input sapolsky
> > > \stopquotation
> > > \stoplinecorrection
> > > 
> > > \input knuth
> > > 
> > > \stoptext
> > > --------------
> > > 
> > > If I prepend a \setuplayout[grid=yes], it works, but grid snapping
> > > introduces also other side effects I don't want (i.e. tall formulas
> > > inside text taking too much vertical space).
> > > 
> > > I would like the halfline spaces before and after the quotation to
> > > shrink or stretch a bit to the nearest multiple of the main text
> > > line
> > > height.
> > > 
> > > Is there an automatic way to get the normal text "return" on the
> > > grid
> > > after a quotation without turning on a global grid snapping?
> > \setuplayout[grid=both] to round down both height and width when
> > snapping.
> > 
> > > 
> > > 
> > > Thanks,
> > > Massi
> > > 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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] 14+ messages in thread

* Re: line correction
  2017-09-28 21:30   ` mf
  2017-09-28 21:47     ` luigi scarso
  2017-09-28 21:51     ` Henri
@ 2017-09-28 21:55     ` Henri
  2017-09-28 22:35       ` mf
  2 siblings, 1 reply; 14+ messages in thread
From: Henri @ 2017-09-28 21:55 UTC (permalink / raw)
  To: ntg-context

On Thu, 2017-09-28 at 23:30 +0200, mf wrote:
> Thank you Henri.
> 
> Now consider this:
> -------------------------------
> \setuplayout[grid=both]
> \setupquotation[before={\switchtobodyfont[9pt]}]
> 
> \starttext
> \showgrid
> 
> \input knuth
> 
> \startlinecorrection[halfline]
> \startquotation
>   \input sapolsky
> \stopquotation
> \stoplinecorrection
> 
> \input knuth
> $\displaystyle{\frac{1}{a + b}}$

If you are really keen on screwing up your linespacing you can use

\vadjust pre{\blank[line]}%
$\displaystyle{\frac{1}{a + b}}$
\vadjust{\blank[line]}%

as a one-off solution.  But better make it a displayed formula or tweak it such that it does not
disrupt spacing and blends in with the text.  In this example I'd change $\displaystyle\frac{1}{a +
b}$ to $(a+b)^{-1}$.  Trust someone who does math typesetting every day.

> \input knuth
> 
> \stoptext
> -------------------------------
> 
> Now the text snaps to the grid after the quotation, but the tall
> formula inside the text overlaps with the text lines.
> 
> The solution would be a grid configuration that gives the line
> containing the formula two lines of height, putting that only line in
> the middle and then snapping the following lines again to the grid
> (still solving the alignment of quotations as in the grid=both case).
> Is it possible?
> 
> Best regards,
> Massi
> 
> Il giorno ven, 29/09/2017 alle 08.48 +1300, Henri ha scritto:
> > 
> > On Thu, 2017-09-28 at 16:21 +0200, MF wrote:
> > > 
> > > Hello list, 
> > > I would like ConTeXt to snap normal text to grid after a quotation.
> > > This example does not work:
> > > 
> > > --------------
> > > \setupquotation[before={\switchtobodyfont[9pt]}]
> > > 
> > > \starttext
> > > \showgrid
> > > 
> > > \input knuth
> > > 
> > > \startlinecorrection[halfline]
> > > \startquotation
> > >   \input sapolsky
> > > \stopquotation
> > > \stoplinecorrection
> > > 
> > > \input knuth
> > > 
> > > \stoptext
> > > --------------
> > > 
> > > If I prepend a \setuplayout[grid=yes], it works, but grid snapping
> > > introduces also other side effects I don't want (i.e. tall formulas
> > > inside text taking too much vertical space).
> > > 
> > > I would like the halfline spaces before and after the quotation to
> > > shrink or stretch a bit to the nearest multiple of the main text
> > > line
> > > height.
> > > 
> > > Is there an automatic way to get the normal text "return" on the
> > > grid
> > > after a quotation without turning on a global grid snapping?
> > \setuplayout[grid=both] to round down both height and width when
> > snapping.
> > 
> > > 
> > > 
> > > Thanks,
> > > Massi
> > > 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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] 14+ messages in thread

* Re: line correction
  2017-09-28 21:55     ` Henri
@ 2017-09-28 22:35       ` mf
  2017-09-29  3:19         ` Rik Kabel
  2017-09-29  8:37         ` Hans Hagen
  0 siblings, 2 replies; 14+ messages in thread
From: mf @ 2017-09-28 22:35 UTC (permalink / raw)
  To: ntg-context

Thank you Henri,
a slightly modified version of your solution works!

This is what I wanted to achieve:

\setuplayout[grid=both]
\setupquotation[before={\switchtobodyfont[9pt]}]

\starttext
\showgrid

\input knuth

\startlinecorrection[halfline]
\startquotation
  \input sapolsky
\stopquotation
\stoplinecorrection

\input knuth
%\vadjust pre{\blank[line]}% not line, but halfline!
\vadjust pre{\blank[halfline]}%
$\displaystyle{\frac{1}{a + b}}$
%\vadjust{\blank[line]}% not line, but halfline!
\vadjust{\blank[halfline]}%
\input knuth

\stoptext

In general, I'm ok without grid snapping, because the default
typesetting of taller formulas inside text is good enough for my goals.

But I have many quotations (and floats), whose spaces before and after
should be manually tuned not to push the main text out of the grid.
And here grid snapping does a very good (and automated) job.

But sometimes grid snapping is too strict, as in the tall formula
example. I'm still afraid it's too strict and it will hurt in other
places of the text, but now I have a solution, at least for that
problem.
So thank you again,
best regards,
Massi

Il giorno ven, 29/09/2017 alle 10.55 +1300, Henri ha scritto:
> On Thu, 2017-09-28 at 23:30 +0200, mf wrote:
> > Thank you Henri.
> > 
> > Now consider this:
> > -------------------------------
> > \setuplayout[grid=both]
> > \setupquotation[before={\switchtobodyfont[9pt]}]
> > 
> > \starttext
> > \showgrid
> > 
> > \input knuth
> > 
> > \startlinecorrection[halfline]
> > \startquotation
> >   \input sapolsky
> > \stopquotation
> > \stoplinecorrection
> > 
> > \input knuth
> > $\displaystyle{\frac{1}{a + b}}$
> 
> If you are really keen on screwing up your linespacing you can use
> 
> \vadjust pre{\blank[line]}%
> $\displaystyle{\frac{1}{a + b}}$
> \vadjust{\blank[line]}%
> 
> as a one-off solution.  But better make it a displayed formula or
> tweak it such that it does not
> disrupt spacing and blends in with the text.  In this example I'd
> change $\displaystyle\frac{1}{a +
> b}$ to $(a+b)^{-1}$.  Trust someone who does math typesetting every
> day.
> 
> > \input knuth
> > 
> > \stoptext
> > -------------------------------
> > 
> > Now the text snaps to the grid after the quotation, but the tall
> > formula inside the text overlaps with the text lines.
> > 
> > The solution would be a grid configuration that gives the line
> > containing the formula two lines of height, putting that only line
> > in
> > the middle and then snapping the following lines again to the grid
> > (still solving the alignment of quotations as in the grid=both
> > case).
> > Is it possible?
> > 
> > Best regards,
> > Massi
> > 
> > Il giorno ven, 29/09/2017 alle 08.48 +1300, Henri ha scritto:
> > > 
> > > On Thu, 2017-09-28 at 16:21 +0200, MF wrote:
> > > > 
> > > > Hello list, 
> > > > I would like ConTeXt to snap normal text to grid after a
> > > > quotation.
> > > > This example does not work:
> > > > 
> > > > --------------
> > > > \setupquotation[before={\switchtobodyfont[9pt]}]
> > > > 
> > > > \starttext
> > > > \showgrid
> > > > 
> > > > \input knuth
> > > > 
> > > > \startlinecorrection[halfline]
> > > > \startquotation
> > > >   \input sapolsky
> > > > \stopquotation
> > > > \stoplinecorrection
> > > > 
> > > > \input knuth
> > > > 
> > > > \stoptext
> > > > --------------
> > > > 
> > > > If I prepend a \setuplayout[grid=yes], it works, but grid
> > > > snapping
> > > > introduces also other side effects I don't want (i.e. tall
> > > > formulas
> > > > inside text taking too much vertical space).
> > > > 
> > > > I would like the halfline spaces before and after the quotation
> > > > to
> > > > shrink or stretch a bit to the nearest multiple of the main
> > > > text
> > > > line
> > > > height.
> > > > 
> > > > Is there an automatic way to get the normal text "return" on
> > > > the
> > > > grid
> > > > after a quotation without turning on a global grid snapping?
> > > 
> > > \setuplayout[grid=both] to round down both height and width when
> > > snapping.
> > > 
> > > > 
> > > > 
> > > > Thanks,
> > > > Massi
> > > > 
> > 
> > ___________________________________________________________________
> > ________________
> > 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
> > ___________________________________________________________________
> > ________________
> 
> _____________________________________________________________________
> ______________
> 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/nt
> g-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> _____________________________________________________________________
> ______________
___________________________________________________________________________________
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] 14+ messages in thread

* Re: line correction
  2017-09-28 22:35       ` mf
@ 2017-09-29  3:19         ` Rik Kabel
  2017-09-29  9:30           ` Risposta: " MF
  2017-09-29  8:37         ` Hans Hagen
  1 sibling, 1 reply; 14+ messages in thread
From: Rik Kabel @ 2017-09-29  3:19 UTC (permalink / raw)
  To: ntg-context

Massi and list,

There is one issue with \startlinecorrection  of which you should be 
aware. The text is set in a vbox. If the block quotation it encloses (or 
whatever text it encloses) does not fit on the current page, a page 
break will be generated. This makes it useless with quotes near the 
bottom of a page.  Enclosed texts longer than a page run over the bottom 
margin of the new page.

It would be nice to have an alternative that does not have that limitation.

-- 
Rik

On 2017-09-28 18:35, mf wrote:
> Thank you Henri,
> a slightly modified version of your solution works!
>
> This is what I wanted to achieve:
>
> \setuplayout[grid=both]
> \setupquotation[before={\switchtobodyfont[9pt]}]
>
> \starttext
> \showgrid
>
> \input knuth
>
> \startlinecorrection[halfline]
> \startquotation
>    \input sapolsky
> \stopquotation
> \stoplinecorrection
>
> \input knuth
> %\vadjust pre{\blank[line]}% not line, but halfline!
> \vadjust pre{\blank[halfline]}%
> $\displaystyle{\frac{1}{a + b}}$
> %\vadjust{\blank[line]}% not line, but halfline!
> \vadjust{\blank[halfline]}%
> \input knuth
>
> \stoptext
>
> In general, I'm ok without grid snapping, because the default
> typesetting of taller formulas inside text is good enough for my goals.
>
> But I have many quotations (and floats), whose spaces before and after
> should be manually tuned not to push the main text out of the grid.
> And here grid snapping does a very good (and automated) job.
>
> But sometimes grid snapping is too strict, as in the tall formula
> example. I'm still afraid it's too strict and it will hurt in other
> places of the text, but now I have a solution, at least for that
> problem.
> So thank you again,
> best regards,
> Massi
>
>

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

* Re: line correction
  2017-09-28 21:47     ` luigi scarso
@ 2017-09-29  8:33       ` Hans Hagen
  0 siblings, 0 replies; 14+ messages in thread
From: Hans Hagen @ 2017-09-29  8:33 UTC (permalink / raw)
  To: ntg-context

On 9/28/2017 11:47 PM, luigi scarso wrote:
> On Thu, Sep 28, 2017 at 11:30 PM, mf <massifr@fastwebnet.it> wrote:
>> Thank you Henri.
>>
>> Now consider this:
>> -------------------------------
>> \setuplayout[grid=both]
>> \setupquotation[before={\switchtobodyfont[9pt]}]
>>
>> \starttext
>> \showgrid
>>
>> \input knuth
>>
>> \startlinecorrection[halfline]
>> \startquotation
>>    \input sapolsky
>> \stopquotation
>> \stoplinecorrection
>>
>> \input knuth
>> $\displaystyle{\frac{1}{a + b}}$
>> \input knuth
>>
>> \stoptext
>> -------------------------------
>>
>> Now the text snaps to the grid after the quotation, but the tall
>> formula inside the text overlaps with the text lines.
>>
>> The solution would be a grid configuration that gives the line
>> containing the formula two lines of height, putting that only line in
>> the middle and then snapping the following lines again to the grid
>> (still solving the alignment of quotations as in the grid=both case).
>> Is it possible?
> 
> 
> I suppose that this is not what you want,
> but perhaps it can give you some some idea
> 
> 
> 
> \setuplayout[grid=both]
> \setupquotation[before={\switchtobodyfont[9pt]}]
> 
> \starttext
> \showgrid
> 
> \input knuth
> 
> \startlinecorrection[halfline]
> \startquotation
>    \input sapolsky
> \stopquotation
> \stoplinecorrection

linecorrection is to be used only with boxed material (normally 
something framed)

> \input knuth
> \setbox0=\hbox{$\displaystyle{\frac{1}{a + b}}$}%
> \ruledvbox to 1\lineheight{\hsize=\wd0\vrule width0pt height0pt
> depth1\lineheight \vss\box0\vss}
> \input knuth
> 
> \stoptext
> 
> 


-- 

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

* Re: line correction
  2017-09-28 22:35       ` mf
  2017-09-29  3:19         ` Rik Kabel
@ 2017-09-29  8:37         ` Hans Hagen
  2017-09-29  9:53           ` Risposta: " MF
  1 sibling, 1 reply; 14+ messages in thread
From: Hans Hagen @ 2017-09-29  8:37 UTC (permalink / raw)
  To: ntg-context

On 9/29/2017 12:35 AM, mf wrote:
> Thank you Henri,
> a slightly modified version of your solution works!
> 
> This is what I wanted to achieve:
> 
> \setuplayout[grid=both]
> \setupquotation[before={\switchtobodyfont[9pt]}]
> 
> \starttext
> \showgrid
> 
> \input knuth
> 
> \startlinecorrection[halfline]
> \startquotation
>    \input sapolsky
> \stopquotation
> \stoplinecorrection
> 
> \input knuth
> %\vadjust pre{\blank[line]}% not line, but halfline!
> \vadjust pre{\blank[halfline]}%
> $\displaystyle{\frac{1}{a + b}}$
> %\vadjust{\blank[line]}% not line, but halfline!
> \vadjust{\blank[halfline]}%
> \input knuth
> 
> \stoptext
> 
> In general, I'm ok without grid snapping, because the default
> typesetting of taller formulas inside text is good enough for my goals.

for a bit more complex doc with many different unpredictable elements 
snapping seldom works ... we never use it (in production it often leads 
to more whitespace than one wants) ... the tex glue model is good enough

(the requirement often comes from cases where snapping is the only way 
to get spacing right ... similar to the use of ragged right and no 
hyphenation because the used system can't handle it well ... in the 
worst case the limitations of a system then become undisputable 'good 
practice' and 'it's the default' and 'it's better for reader' etc)

> But I have many quotations (and floats), whose spaces before and after
> should be manually tuned not to push the main text out of the grid.
> And here grid snapping does a very good (and automated) job.
> 
> But sometimes grid snapping is too strict, as in the tall formula
> example. I'm still afraid it's too strict and it will hurt in other
> places of the text, but now I have a solution, at least for that
> problem.
> So thank you again,
> best regards,
> Massi
> 
> Il giorno ven, 29/09/2017 alle 10.55 +1300, Henri ha scritto:
>> On Thu, 2017-09-28 at 23:30 +0200, mf wrote:
>>> Thank you Henri.
>>>
>>> Now consider this:
>>> -------------------------------
>>> \setuplayout[grid=both]
>>> \setupquotation[before={\switchtobodyfont[9pt]}]
>>>
>>> \starttext
>>> \showgrid
>>>
>>> \input knuth
>>>
>>> \startlinecorrection[halfline]
>>> \startquotation
>>>    \input sapolsky
>>> \stopquotation
>>> \stoplinecorrection
>>>
>>> \input knuth
>>> $\displaystyle{\frac{1}{a + b}}$
>>
>> If you are really keen on screwing up your linespacing you can use
>>
>> \vadjust pre{\blank[line]}%
>> $\displaystyle{\frac{1}{a + b}}$
>> \vadjust{\blank[line]}%
>>
>> as a one-off solution.  But better make it a displayed formula or
>> tweak it such that it does not
>> disrupt spacing and blends in with the text.  In this example I'd
>> change $\displaystyle\frac{1}{a +
>> b}$ to $(a+b)^{-1}$.  Trust someone who does math typesetting every
>> day.
>>
>>> \input knuth
>>>
>>> \stoptext
>>> -------------------------------
>>>
>>> Now the text snaps to the grid after the quotation, but the tall
>>> formula inside the text overlaps with the text lines.
>>>
>>> The solution would be a grid configuration that gives the line
>>> containing the formula two lines of height, putting that only line
>>> in
>>> the middle and then snapping the following lines again to the grid
>>> (still solving the alignment of quotations as in the grid=both
>>> case).
>>> Is it possible?
>>>
>>> Best regards,
>>> Massi
>>>
>>> Il giorno ven, 29/09/2017 alle 08.48 +1300, Henri ha scritto:
>>>>
>>>> On Thu, 2017-09-28 at 16:21 +0200, MF wrote:
>>>>>
>>>>> Hello list,
>>>>> I would like ConTeXt to snap normal text to grid after a
>>>>> quotation.
>>>>> This example does not work:
>>>>>
>>>>> --------------
>>>>> \setupquotation[before={\switchtobodyfont[9pt]}]
>>>>>
>>>>> \starttext
>>>>> \showgrid
>>>>>
>>>>> \input knuth
>>>>>
>>>>> \startlinecorrection[halfline]
>>>>> \startquotation
>>>>>    \input sapolsky
>>>>> \stopquotation
>>>>> \stoplinecorrection
>>>>>
>>>>> \input knuth
>>>>>
>>>>> \stoptext
>>>>> --------------
>>>>>
>>>>> If I prepend a \setuplayout[grid=yes], it works, but grid
>>>>> snapping
>>>>> introduces also other side effects I don't want (i.e. tall
>>>>> formulas
>>>>> inside text taking too much vertical space).
>>>>>
>>>>> I would like the halfline spaces before and after the quotation
>>>>> to
>>>>> shrink or stretch a bit to the nearest multiple of the main
>>>>> text
>>>>> line
>>>>> height.
>>>>>
>>>>> Is there an automatic way to get the normal text "return" on
>>>>> the
>>>>> grid
>>>>> after a quotation without turning on a global grid snapping?
>>>>
>>>> \setuplayout[grid=both] to round down both height and width when
>>>> snapping.
>>>>
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Massi
>>>>>
>>>
>>> ___________________________________________________________________
>>> ________________
>>> 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
>>> ___________________________________________________________________
>>> ________________
>>
>> _____________________________________________________________________
>> ______________
>> 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/nt
>> g-context
>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki     : http://contextgarden.net
>> _____________________________________________________________________
>> ______________
> ___________________________________________________________________________________
> 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] 14+ messages in thread

* Risposta:  line correction
  2017-09-29  3:19         ` Rik Kabel
@ 2017-09-29  9:30           ` MF
  2017-09-29 12:08             ` Hans Hagen
  0 siblings, 1 reply; 14+ messages in thread
From: MF @ 2017-09-29  9:30 UTC (permalink / raw)
  To: ntg-context

Il giorno gio, 28/09/2017 alle 23.19 -0400, Rik Kabel ha scritto:
> Massi and list,
> 
> There is one issue with \startlinecorrection  of which you should be 
> aware. The text is set in a vbox. If the block quotation it encloses
> (or 
> whatever text it encloses) does not fit on the current page, a page 
> break will be generated. This makes it useless with quotes near the 
> bottom of a page.  Enclosed texts longer than a page run over the
> bottom 
> margin of the new page.
> 
Thank you Rik, I overlooked that (and now I'm reading Hans' reply about
line correction being for framed material and not for quotations).

I need to decide whether to 
- turn off grid snapping and adjust every single quotation 
or
- turn grid snapping on, benefit from line correction most of the time
and manually adjust the cases where a quotation is across a page
boundary

It depends on the texts I'm working on.

This question reminds me the chapter about line profiling in the
"Still" manual. There's no general, fully automated solution.

> It would be nice to have an alternative that does not have that
> limitation.
> 

Hans talked about that at the last ConTeXt Meeting. If I understand
well, it's very hard to calculate how much of the vertical space of the
page TeX has used. And once it flushes the page, it frees the memory
and forgets about it.
Add inserts like footnotes to the problem and it gets really hard.

Best regards,
Massi
___________________________________________________________________________________
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] 14+ messages in thread

* Risposta:  line correction
  2017-09-29  8:37         ` Hans Hagen
@ 2017-09-29  9:53           ` MF
  2017-09-29 21:38             ` Rik Kabel
  0 siblings, 1 reply; 14+ messages in thread
From: MF @ 2017-09-29  9:53 UTC (permalink / raw)
  To: ntg-context


> > In general, I'm ok without grid snapping, because the default
> > typesetting of taller formulas inside text is good enough for my
> > goals.
> 
> for a bit more complex doc with many different unpredictable
> elements 
> snapping seldom works ... we never use it (in production it often
> leads 
> to more whitespace than one wants) ... the tex glue model is good
> enough
> 
> (the requirement often comes from cases where snapping is the only
> way 
> to get spacing right ... similar to the use of ragged right and no 
> hyphenation because the used system can't handle it well ... in the 
> worst case the limitations of a system then become undisputable
> 'good 
> practice' and 'it's the default' and 'it's better for reader' etc)
> 

So for quotations and adjust the space around them are you suggesting
manual adjustment?

I was already more convinced of keeping snap-to-grid turned off. Now
the problem is how to adjust the spaces around quotations (and floats)
at the minimum cost.

Since the line heights of the main text and the ones of quotations do
not change, the adjustment depends only on the number of lines of
quotations. I could compile a table for more common cases:

# of lines | adjustment
1 line     | ... pt
2 lines    | ... pt
3 lines    | ... pt
...
20 lines   | ... pt

I should teach users how to insert adjustments, but the task would be
eased because they should only copy a value from a table or insert a
name that corresponds the the number of lines (i.e. "adjust-3-lines",
"adjust-4-lines", etc.)

Greetings,
Massi
___________________________________________________________________________________
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] 14+ messages in thread

* Re: Risposta: line correction
  2017-09-29  9:30           ` Risposta: " MF
@ 2017-09-29 12:08             ` Hans Hagen
  0 siblings, 0 replies; 14+ messages in thread
From: Hans Hagen @ 2017-09-29 12:08 UTC (permalink / raw)
  To: ntg-context

On 9/29/2017 11:30 AM, MF wrote:
> Il giorno gio, 28/09/2017 alle 23.19 -0400, Rik Kabel ha scritto:
>> Massi and list,
>>
>> There is one issue with \startlinecorrection  of which you should be
>> aware. The text is set in a vbox. If the block quotation it encloses
>> (or
>> whatever text it encloses) does not fit on the current page, a page
>> break will be generated. This makes it useless with quotes near the
>> bottom of a page.  Enclosed texts longer than a page run over the
>> bottom
>> margin of the new page.

you can play with widow penalties

\keeplinestogether{10}


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

* Re: Risposta: line correction
  2017-09-29  9:53           ` Risposta: " MF
@ 2017-09-29 21:38             ` Rik Kabel
  0 siblings, 0 replies; 14+ messages in thread
From: Rik Kabel @ 2017-09-29 21:38 UTC (permalink / raw)
  To: ntg-context

On 2017-09-29 05:53, MF wrote:
> So for quotations and adjust the space around them are you suggesting
> manual adjustment?
>
> I was already more convinced of keeping snap-to-grid turned off. Now
> the problem is how to adjust the spaces around quotations (and floats)
> at the minimum cost.
>
> Since the line heights of the main text and the ones of quotations do
> not change, the adjustment depends only on the number of lines of
> quotations. I could compile a table for more common cases:
>
> # of lines | adjustment
> 1 line     | ... pt
> 2 lines    | ... pt
> 3 lines    | ... pt
> ...
> 20 lines   | ... pt
>
> I should teach users how to insert adjustments, but the task would be
> eased because they should only copy a value from a table or insert a
> name that corresponds the the number of lines (i.e. "adjust-3-lines",
> "adjust-4-lines", etc.)
>
> Greetings,
> Massi
> ___________________________________________________________________________________

Be careful not to insert an adjustment after a block that is split over 
two pages.

A more useful (from a user perspective, I do not know about the coding) 
solution would be a command to snap to the nearest grid line (up or 
down, half or whole step).

But both your count and my \snapto suffer from a common problem. Both 
are likely to leave different amounts of space before and after the 
block. A more evenly balanced approach is to compute the height of the 
block plus the vertical space by which it should be set off plus the 
vertical space needed to reach a grid-line or half-grid and, if the 
block stays on the page, split the difference top and bottom. If the 
block does not stay on the page, some portion with the top offset must 
be calculated and placed on the page if it otherwise meets widow/orphan 
tests.

-- 
Rik

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

end of thread, other threads:[~2017-09-29 21:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-28 14:21 line correction MF
2017-09-28 19:48 ` Henri
2017-09-28 21:30   ` mf
2017-09-28 21:47     ` luigi scarso
2017-09-29  8:33       ` Hans Hagen
2017-09-28 21:51     ` Henri
2017-09-28 21:55     ` Henri
2017-09-28 22:35       ` mf
2017-09-29  3:19         ` Rik Kabel
2017-09-29  9:30           ` Risposta: " MF
2017-09-29 12:08             ` Hans Hagen
2017-09-29  8:37         ` Hans Hagen
2017-09-29  9:53           ` Risposta: " MF
2017-09-29 21:38             ` Rik Kabel

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