File size: 1,244 Bytes
f9bc0c1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | -- Keep prose in two columns while allowing tables and figures to use the page.
-- Pandoc's default LaTeX tables use longtable, which cannot run inside
-- multicol. Closing and reopening the columns also keeps dense evidence tables
-- and vector figures legible in the generated paper.
function Pandoc(doc)
local blocks = {}
local in_columns = false
for _, block in ipairs(doc.blocks) do
-- Keep the paper title and author line full width. Begin the two-column
-- body at the abstract, as in a conventional conference manuscript.
if not in_columns and block.t == "Header" and block.level == 2
and pandoc.utils.stringify(block.content) == "Abstract" then
table.insert(blocks, pandoc.RawBlock("latex", "\\begin{multicols}{2}"))
in_columns = true
end
if in_columns and (block.t == "Table" or block.t == "Figure") then
table.insert(blocks, pandoc.RawBlock("latex", "\\end{multicols}"))
table.insert(blocks, block)
table.insert(blocks, pandoc.RawBlock("latex", "\\begin{multicols}{2}"))
else
table.insert(blocks, block)
end
end
if in_columns then
table.insert(blocks, pandoc.RawBlock("latex", "\\end{multicols}"))
end
doc.blocks = blocks
return doc
end
|