ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* grid snapping problem
@ 2016-12-02 14:09 Csikos Bela
  2016-12-06 18:06 ` Csikos Bela
  0 siblings, 1 reply; 4+ messages in thread
From: Csikos Bela @ 2016-12-02 14:09 UTC (permalink / raw)
  To: ntg-context

Dear context users:

I would like to use grid snapping in my document: main text lines
should be aligned to grid lines but figure caption text should not.

I have this code:

\setuplayout[grid=yes]
\showgrid

\setupcaptions[width=fit,align=last,headstyle={\ss\bfx},style={\ss\tfx}]

\starttext
\subsection{Subsection title}
\input dawkins
\input dawkins

%startlinecorrection
\startbaselinecorrection  \setuplocalinterlinespace[line=2.2ex]
\placefigure[][]{\input zapf }{\framed[width=0.6\textwidth,height=10ex]{figure}}
\stopbaselinecorrection
%stoplinecorrection

\subsection{Subsection title}
\input dawkins
\subsection{Subsection title}
\input dawkins
\input dawkins
\stoptext

You can see that the caption is typeset as I wanted: smaller line height
and it is not aligned to grid lines. But the main text after the figure is not
aligned to the grid on the same page. How can I correct this?
On the next page the main text is snapped to the grid again.

Thank you in advance,

bcsikos
___________________________________________________________________________________
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

* Re: grid snapping problem
  2016-12-02 14:09 grid snapping problem Csikos Bela
@ 2016-12-06 18:06 ` Csikos Bela
  2016-12-06 20:53   ` Henri Menke
  0 siblings, 1 reply; 4+ messages in thread
From: Csikos Bela @ 2016-12-06 18:06 UTC (permalink / raw)
  To: ntg-context

>I would like to use grid snapping in my document: main text lines
>should be aligned to grid lines but figure caption text should not.
>
>I have this code:
>
>\setuplayout[grid=yes]
>\showgrid
>
>\setupcaptions[width=fit,align=last,headstyle={\ss\bfx},style={\ss\tfx}]
>
>\starttext
>\subsection{Subsection title}
>\input dawkins
>\input dawkins
>
>%startlinecorrection
>\startbaselinecorrection  \setuplocalinterlinespace[line=2.2ex]
>\placefigure[][]{\input zapf }{\framed[width=0.6\textwidth,height=10ex]{figure}}
>\stopbaselinecorrection
>%stoplinecorrection
>
>\subsection{Subsection title}
>\input dawkins
>\subsection{Subsection title}
>\input dawkins
>\input dawkins
>\stoptext
>
>You can see that the caption is typeset as I wanted: smaller line height
>and it is not aligned to grid lines. But the main text after the figure is not
>aligned to the grid on the same page. How can I correct this?
>On the next page the main text is snapped to the grid again.

Since I haven't got any answer to my question I think the code above contains
some obvious error, but I don't know what. What do I do wrong? Or is it just
not possible to achieve what I want? 

Thank you,

bcsikos

___________________________________________________________________________________
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

* Re: grid snapping problem
  2016-12-06 18:06 ` Csikos Bela
@ 2016-12-06 20:53   ` Henri Menke
  2016-12-07 17:00     ` Csikos Bela
  0 siblings, 1 reply; 4+ messages in thread
From: Henri Menke @ 2016-12-06 20:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users

The following should do the trick.  However, you have to keep \setnostrut and \setstrut around the figure because the before and after keys for captions are not (yet) implemented.

\setuplayout[grid=yes]
\showgrid

\starttexdefinition caption:text #1
  \setuplocalinterlinespace[line=2.2ex] #1
\stoptexdefinition

\setupcaptions
  [
    width=fit,
    align=last,
    headstyle={\ss\bfx},
    style={\ss\tfx},
    before={\setnostrut},
    textcommand=\getvalue{caption:text},
  ]

\starttext

\startsubsection[title={Subsection title}]
  \input dawkins
  \input dawkins

  \setnostrut
  \startplacefigure
    [title={\input zapf }]
    \framed[width=0.6\textwidth,height=10ex]{figure}
  \stopplacefigure
  \setstrut

\stopsubsection

\startsubsection[title={Subsection title}]
  \input dawkins
\stopsubsection

\startsubsection[title={Subsection title}]
  \input dawkins
  \input dawkins
\stopsubsection

\stoptext

On 12/06/2016 07:06 PM, Csikos Bela wrote:
>> I would like to use grid snapping in my document: main text lines
>> should be aligned to grid lines but figure caption text should not.
>>
>> I have this code:
>>
>> \setuplayout[grid=yes]
>> \showgrid
>>
>> \setupcaptions[width=fit,align=last,headstyle={\ss\bfx},style={\ss\tfx}]
>>
>> \starttext
>> \subsection{Subsection title}
>> \input dawkins
>> \input dawkins
>>
>> %startlinecorrection
>> \startbaselinecorrection  \setuplocalinterlinespace[line=2.2ex]
>> \placefigure[][]{\input zapf }{\framed[width=0.6\textwidth,height=10ex]{figure}}
>> \stopbaselinecorrection
>> %stoplinecorrection
>>
>> \subsection{Subsection title}
>> \input dawkins
>> \subsection{Subsection title}
>> \input dawkins
>> \input dawkins
>> \stoptext
>>
>> You can see that the caption is typeset as I wanted: smaller line height
>> and it is not aligned to grid lines. But the main text after the figure is not
>> aligned to the grid on the same page. How can I correct this?
>> On the next page the main text is snapped to the grid again.
> 
> Since I haven't got any answer to my question I think the code above contains
> some obvious error, but I don't know what. What do I do wrong? Or is it just
> not possible to achieve what I want? 
> 
> Thank you,
> 
> bcsikos
> 
> ___________________________________________________________________________________
> 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] 4+ messages in thread

* Re: grid snapping problem
  2016-12-06 20:53   ` Henri Menke
@ 2016-12-07 17:00     ` Csikos Bela
  0 siblings, 0 replies; 4+ messages in thread
From: Csikos Bela @ 2016-12-07 17:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Henri Menke írta:
>The following should do the trick.

Thank you very much. Your code indeed fixes the snap to grid problem but it also
pushes the second subsection after the float and leaves a big empty space in the
lower part of the first page, which is not desirable. The text should fill the whole first
page. Is it possible?

>However, you have to keep \setnostrut and \setstrut around the figure because the
>before and after keys for captions are not (yet) implemented.

It's fine, not a problem.

I guess I can use simply \subsection command instead of \startsubsection and
\stopsubsection comands, because I find the command pairs counterproductive
in case of long text parts (part, section, subsection etc.).

Thank you again,

bcsikos



>\setuplayout[grid=yes]
>\showgrid
>
>\starttexdefinition caption:text #1
>  \setuplocalinterlinespace[line=2.2ex] #1
>\stoptexdefinition
>
>\setupcaptions
>  [
>    width=fit,
>    align=last,
>    headstyle={\ss\bfx},
>    style={\ss\tfx},
>    before={\setnostrut},
>    textcommand=\getvalue{caption:text},
>  ]
>
>\starttext
>
>\startsubsection[title={Subsection title}]
>  \input dawkins
>  \input dawkins
>
>  \setnostrut
>  \startplacefigure
>    [title={\input zapf }]
>    \framed[width=0.6\textwidth,height=10ex]{figure}
>  \stopplacefigure
>  \setstrut
>
>\stopsubsection
>
>\startsubsection[title={Subsection title}]
>  \input dawkins
>\stopsubsection
>
>\startsubsection[title={Subsection title}]
>  \input dawkins
>  \input dawkins
>\stopsubsection
>
>\stoptext
>
>On 12/06/2016 07:06 PM, Csikos Bela wrote:
>>> I would like to use grid snapping in my document: main text lines
>>> should be aligned to grid lines but figure caption text should not.
>>>
>>> I have this code:
>>>
>>> \setuplayout[grid=yes]
>>> \showgrid
>>>
>>> \setupcaptions[width=fit,align=last,headstyle={\ss\bfx},style={\ss\tfx}]
>>>
>>> \starttext
>>> \subsection{Subsection title}
>>> \input dawkins
>>> \input dawkins
>>>
>>> %startlinecorrection
>>> \startbaselinecorrection  \setuplocalinterlinespace[line=2.2ex]
>>> \placefigure[][]{\input zapf }{\framed[width=0.6\textwidth,height=10ex]{figure}}
>>> \stopbaselinecorrection
>>> %stoplinecorrection
>>>
>>> \subsection{Subsection title}
>>> \input dawkins
>>> \subsection{Subsection title}
>>> \input dawkins
>>> \input dawkins
>>> \stoptext
>>>
>>> You can see that the caption is typeset as I wanted: smaller line height
>>> and it is not aligned to grid lines. But the main text after the figure is not
>>> aligned to the grid on the same page. How can I correct this?
>>> On the next page the main text is snapped to the grid again.
>> 
>> Since I haven't got any answer to my question I think the code above contains
>> some obvious error, but I don't know what. What do I do wrong? Or is it just
>> not possible to achieve what I want? 
>> 
>> Thank you,
>> 
>> bcsikos

___________________________________________________________________________________
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:[~2016-12-07 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-02 14:09 grid snapping problem Csikos Bela
2016-12-06 18:06 ` Csikos Bela
2016-12-06 20:53   ` Henri Menke
2016-12-07 17:00     ` Csikos Bela

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