pandoc
pandoc copied to clipboard
ConTeXt writer: Override hard-coded table location placement
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:
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):
It would be convenient if there was a way to override the value of none
as per the complete list of options.
@hmenke ?
I'll take a look.
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.
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.
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.
@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.