Skip to content

Commit 951beec

Browse files
authored
always put the label in the caption (#140)
1 parent 64fe8d6 commit 951beec

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

filter/tabularx.lua

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -301,18 +301,13 @@ function Table(tbl)
301301
-- Create the first header. This consists of the caption, a top line, and any header lines.
302302
--
303303

304-
if escaped_caption ~= '' then
305-
latex_code = latex_code .. string.format('\\%s{%s}\n', caption_cmd, escaped_caption)
306-
end
307-
308-
--
309-
-- Add the label, if we have an identifier for this table.
310-
--
311-
if tbl.identifier ~= '' then
312-
latex_code = latex_code .. string.format('\\label{%s}\n', tbl.identifier)
313-
end
314-
315304
if escaped_caption ~= '' or tbl.identifier ~= '' then
305+
if tbl.identifier ~= '' then
306+
-- The label, if we have one, goes inside of the caption command.
307+
latex_code = latex_code .. string.format('\\%s{%s \\label{%s}}\n', caption_cmd, escaped_caption, tbl.identifier)
308+
else
309+
latex_code = latex_code .. string.format('\\%s{%s}\n', caption_cmd, escaped_caption)
310+
end
316311
latex_code = latex_code .. '\\\\\n'
317312
end
318313

0 commit comments

Comments
 (0)