[NTG-context] Float control

Max Chernoff mseven at telus.net
Thu Mar 2 00:22:45 CET 2023

Hi Denis,

> The floats where jumping around, appearing in a different order than
> in the source file

Tables and figures can appear in different orders than each other, and a
top float could appear at the top of the page that it is mentioned, but
if you ever see Figure 2 before Figure 1 or a float appearing before it
is placed in the source (with the exception of the top issue), then
you've probably found a bug.

> some positioning keys had not the intended effect (e.g. top)

I've had mixed results with some of the positioning keys too, but "top"
should generally work okay. If you're using columns, weird stuff can
sometimes happen with top/bottom floats, but you should still be able to
make them work. You can also try adding

at the start of you're document. I've had that fix an otherwise-
unexplainable bug once.

> I know, TeX's float positioning algorithm should be rather reliable
> and stable

Not as much as you would expect. The TeX page breaking algorithm is
greedy, single-pass, and dependant on every page prior, so you can get
some pretty chaotic results in pathological situations. "Typical"
documents don't usually have any issues, but you can (even accidentally)
make a document that gives some really weird results.

> Anyway, I'd like to learn more about the whole float issue. Is there anything particular I could read to learn more about the whole thing?

The only float documentation for ConTeXt that I'm aware of is a short
section in It's in the Details

and another short section in the old Reference Manual

There's also the Wiki page

and the source code

I haven't been able to find anything that really goes into the details
though. (If there's something that I'm missing here, please let me know!
I've been looking for awhile now)

> Maybe I'm missing out on something fundamental...

At the TeX level, floats are known as \insert's/insertions. The end of
Chapter 15 in The TeXbook goes into detail here. TeX By Topic also has a
good description in Chapter 29

Then there's also Low Level TeX which documents the changes in LMTX

Inserts are (in my opinion) the most complicated part of TeX. Even at an
engine level, they aren't that well documented. When writing the
footnote code for lua-widow-control, I had to read through "TeX the
program" since some of the details weren't documented anywhere else.

And as Peter mentioned, if you post a specific example someone will
probably come along and help.

-- Max

More information about the ntg-context mailing list