Skip to content

Commit

Permalink
always put the label in the caption (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisfenner committed Mar 3, 2024
1 parent 64fe8d6 commit 951beec
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions filter/tabularx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -301,18 +301,13 @@ function Table(tbl)
-- Create the first header. This consists of the caption, a top line, and any header lines.
--

if escaped_caption ~= '' then
latex_code = latex_code .. string.format('\\%s{%s}\n', caption_cmd, escaped_caption)
end

--
-- Add the label, if we have an identifier for this table.
--
if tbl.identifier ~= '' then
latex_code = latex_code .. string.format('\\label{%s}\n', tbl.identifier)
end

if escaped_caption ~= '' or tbl.identifier ~= '' then
if tbl.identifier ~= '' then
-- The label, if we have one, goes inside of the caption command.
latex_code = latex_code .. string.format('\\%s{%s \\label{%s}}\n', caption_cmd, escaped_caption, tbl.identifier)
else
latex_code = latex_code .. string.format('\\%s{%s}\n', caption_cmd, escaped_caption)
end
latex_code = latex_code .. '\\\\\n'
end

Expand Down

0 comments on commit 951beec

Please sign in to comment.