ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Vanishing floats with location=split and \start ... \stopsplittext within
@ 2024-06-04 13:57 Давыдов, Кирилл Александрович
  2024-06-04 16:22 ` [NTG-context] " Hans Hagen via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Давыдов, Кирилл Александрович @ 2024-06-04 13:57 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1574 bytes --]

Greetings,

I have run into an issue whilst using \start ... \stopsplittext. I intended
to use it for large code listings (using the t-vim module), however floats
with location=split using that environment seem to vanish if there is
nearly not enough text before the float to fill a page. Not only that, a
second float like that seems to lead to fatal errors related to an unclosed
group, however the document compiles regardless. The following MWE is an
example of this. I am using ConTeXt version 2024.05.27 18:16.

\definefloat[codelisting][codelistings]
\setupcaption[codelisting][location=top]
\setuplabeltext[english][codelisting=Listing ]

%\showboxes
\starttext

\input knuth
\input knuth
\input knuth
\input knuth
% Filler. Filler. Filler. Filler. % uncomment to push out a full page. the
float will appear

\startplacecodelisting[
    title=My great C program on display!,
    location=split,
]
\startsplittext
\tt \input zapf
\stopsplittext
\stopplacecodelisting

\input ward

\startplacecodelisting[
    title=My second great C program on display!,
    location=split,
]
\startsplittext
\tt \input ward
\stopsplittext

\stoptext

On a related note, one can also observe that with specific amounts of text
a float may end up being split in two on a single page, however I could not
replicate it. Additionally, code listings done with t-vim's commands seem
to lose line numbering within \start ... \stopsplittext in splittable
floats, but I figure that's more on the module authors. In any case, is
there more I can do other than not use floats for code listings?

[-- Attachment #1.2: Type: text/html, Size: 1788 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Vanishing floats with location=split and \start ... \stopsplittext within
  2024-06-04 13:57 [NTG-context] Vanishing floats with location=split and \start ... \stopsplittext within Давыдов, Кирилл Александрович
@ 2024-06-04 16:22 ` Hans Hagen via ntg-context
  2024-06-04 18:44   ` Kirill Davidov
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen via ntg-context @ 2024-06-04 16:22 UTC (permalink / raw)
  To: Давыдов,
	Кирилл
	Александрович,
	mailing list for ConTeXt users
  Cc: Hans Hagen

On 6/4/2024 3:57 PM, Давыдов, Кирилл Александрович wrote:
> Greetings,
> 
> I have run into an issue whilst using \start ... \stopsplittext. I 
> intended to use it for large code listings (using the t-vim module), 
> however floats with location=split using that environment seem to vanish 
> if there is nearly not enough text before the float to fill a page. Not 
> only that, a second float like that seems to lead to fatal errors 
> related to an unclosed group, however the document compiles regardless. 
> The following MWE is an example of this. I am using ConTeXt version 
> 2024.05.27 18:16.
> 
> \definefloat[codelisting][codelistings]
> \setupcaption[codelisting][location=top]
> \setuplabeltext[english][codelisting=Listing ]
> 
> %\showboxes
> \starttext
> 
> \input knuth
> \input knuth
> \input knuth
> \input knuth
> % Filler. Filler. Filler. Filler. % uncomment to push out a full page. 
> the float will appear
> 
> \startplacecodelisting[
>      title=My great C program on display!,
>      location=split,
> ]
> \startsplittext
> \tt \input zapf
> \stopsplittext
> \stopplacecodelisting
> 
> \input ward
> 
> \startplacecodelisting[
>      title=My second great C program on display!,
>      location=split,
> ]
> \startsplittext
> \tt \input ward
> \stopsplittext
> 
> \stoptext
> 
> On a related note, one can also observe that with specific amounts of 
> text a float may end up being split in two on a single page, however I 
> could not replicate it. Additionally, code listings done with t-vim's 
> commands seem to lose line numbering within \start ... \stopsplittext in 
> splittable floats, but I figure that's more on the module authors. In 
> any case, is there more I can do other than not use floats for code 
> listings?
best add a missing \stopplacecodelisting

-----------------------------------------------------------------
                                           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 / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

* [NTG-context] Re: Vanishing floats with location=split and \start ... \stopsplittext within
  2024-06-04 16:22 ` [NTG-context] " Hans Hagen via ntg-context
@ 2024-06-04 18:44   ` Kirill Davidov
  0 siblings, 0 replies; 3+ messages in thread
From: Kirill Davidov @ 2024-06-04 18:44 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users

On 6/4/24 21:22, Hans Hagen wrote:
> best add a missing \stopplacecodelisting
That one's on me, thank you. Unfortunately, this does not fix the main
issue. Checking the MWE's logs reveals that the splitting command found
nothing to split, even if there's enough text for multiple pages. My
best guess is that something goes awry when checking how much vertical
space is available, since uncommenting the filler line leaves no space
for an additional line in the page.

On 6/4/2024 3:57 PM, Давыдов, Кирилл Александрович wrote:
> On a related note, one can also observe that with specific amounts of
> text a float may end up being split in two on a single page, however I
> could not replicate it.
Replicated it:
\definefloat[codelisting][codelistings]
\setupcaption[codelisting][location=top]
\setuplabeltext[english][codelisting=Listing ]
\showboxes
\starttext
%\dorecurse{37}{line\crlf} % splits fine up to this point
\dorecurse{38}{line\crlf} % split on the same page
%\dorecurse{39}{line\crlf} % float vanishes, "there is nothing to split"
%\dorecurse{40}{line\crlf} % all fine
\startplacecodelisting[
    title=My great C program on display!,
    location=split,
]
\startsplittext
\tt\dorecurse{6}{\input zapf}
\stopsplittext
\stopplacecodelisting
\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2024-06-04 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-04 13:57 [NTG-context] Vanishing floats with location=split and \start ... \stopsplittext within Давыдов, Кирилл Александрович
2024-06-04 16:22 ` [NTG-context] " Hans Hagen via ntg-context
2024-06-04 18:44   ` Kirill Davidov

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