pandoc icon indicating copy to clipboard operation
pandoc copied to clipboard

ConTeXt writer: Override hard-coded table location placement

Open DaveJarvis opened this issue 6 years ago • 6 comments

Re: https://github.com/jgm/pandoc/pull/4223#issuecomment-356103589

to always print a (possibly empty) caption, but I see no reason to break with the previous behaviour here.

My understanding is that the location attribute controls how the table is inserted relative to the text, although it could also control placement of the caption. (If so, this is going to be a deeper issue.)

With the hard-coded setting of location=none, the following output is produced:

location-none

Clearly the intent is incorrect, as what follows in the text is not a table but the following subsection. This can be changed in multiple ways. Currently I use:

sed -i "s/location=none/location=force/g" proposal.tex

This generates the expected output (widows and orphans notwithstanding):

location-force

It would be convenient if there was a way to override the value of none as per the complete list of options.

DaveJarvis avatar Sep 19 '18 00:09 DaveJarvis

@hmenke ?

mb21 avatar Sep 19 '18 07:09 mb21

I'll take a look.

hmenke avatar Sep 19 '18 07:09 hmenke

Currently the default behaviour for inserts like tables and figures is to float (same for the LaTeX writer).

https://github.com/jgm/pandoc/blob/1feb62cb24a8fda5ce8ea823ec102abc0bd6e2ec/src/Text/Pandoc/Writers/ConTeXt.hs#L180

https://github.com/jgm/pandoc/blob/1feb62cb24a8fda5ce8ea823ec102abc0bd6e2ec/src/Text/Pandoc/Writers/ConTeXt.hs#L269-L273

I think this is a sensible default. I could implement a writer extension, e.g. +nofloat, which fixes all floats. More fine grained access is not possible without special annotations for pandoc in the source file. This however is not an option because formats like Markdown don't have comments and therefore those annotations would appear in the rendering when processed with a different tool. That's not acceptable.

N.B.: That's also an opportunity to switch to the new \start...\stopplacefigure syntax.

hmenke avatar Sep 19 '18 11:09 hmenke

I think this is a sensible default. I could implement a writer extension, e.g. +nofloat, which fixes all floats.

Yes, it looks a bit complicated. For example:

|Heading|Heading|
|:-----:|------:|
|Item|123.00|
Table: Item Costs

Appears to generate:

\startplacetable[title={Item Costs}]

It isn't clear how to then force the table's location because providing a caption excludes the location setting.

What's the default for location? If it is none, then there's no need to write location=none to the document. That would allow the location value to be set for the entire document using the corresponding \setup macro.

ghost avatar Sep 19 '18 15:09 ghost

Henri Menke [email protected] writes:

Currently the default behaviour for inserts like tables and figures is to float (same for the LaTeX writer).

Not exactly the same, because LaTeX uses longtable, which isn't actually a floating environment.

I don't know if there's something equivalent in ConTeXt.

jgm avatar Sep 19 '18 16:09 jgm

@hmenke have you consider to just drop the line 271 and leave default behaviour with no location setting at all?

It seems like it fixes not splitting tables issue, as for me at least. While that workaround with setting a title to table is a thing, it's not quite obvious though. So it's confusing when you're set all required settings in context template prelude, but a table still didn't splits until you've set some title to it through md extension syntax. And it takes a while to debug things until it brings you here.

yaroslavyaroslav avatar Aug 31 '22 18:08 yaroslavyaroslav