Fix #2201: wrong table caption for tables with over 30 rows

This commit is contained in:
Takeshi KOMIYA 2016-01-01 19:31:36 +09:00
parent 532dec6076
commit b0f376fdb8
4 changed files with 96 additions and 1 deletions

View File

@ -23,6 +23,7 @@ Bugs fixed
* #2193: Fix shutil.SameFileError if source directory and destination directory are same
* #2178: Fix unparseable C++ cross-reference when referencing a function with :cpp:any:
* #2206: Fix Sphinx latex doc build failed due to a footnotes
* #2201: Fix wrong table caption for tables with over 30 rows
Release 1.3.3 (released Dec 2, 2015)

View File

@ -948,7 +948,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
else:
self.body.append('{|' + ('L|' * self.table.colcount) + '}\n')
if self.table.longtable and self.table.caption is not None:
self.body.append(u'\\caption{%s}' % self.table.caption)
self.body.append(u'\\caption{')
for caption in self.table.caption:
self.body.append(caption)
self.body.append('}')
for id in self.next_table_ids:
self.body.append(self.hypertarget(id, anchor=False))
self.next_table_ids.clear()

View File

@ -52,3 +52,89 @@ Footnote in term [#]_
This is the figure caption with a footnote to [#]_.
.. [#] Footnote in caption
.. list-table:: footnote [#]_ in caption of normal table
:widths: 1 1
:header-rows: 1
* - name
- desc
* - a
- b
* - a
- b
.. [#] Foot note in table
.. list-table:: footnote [#]_ in caption of longtable
:widths: 1 1
:header-rows: 1
* - name
- desc
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
* - a
- b
.. [#] Foot note in longtable

View File

@ -335,6 +335,11 @@ def test_reference_in_caption(app, status, warning):
assert ('\\caption{This is the figure caption with a footnote to '
'\\protect\\footnotemark[5].}\end{figure}\n'
'\\footnotetext[5]{\nFootnote in caption\n}')in result
assert ('\\caption{footnote \\protect\\footnotemark[6] '
'in caption of normal table}') in result
assert '\\end{threeparttable}\n\n\\footnotetext[6]{\nFoot note in table\n}' in result
assert '\\caption{footnote \\protect\\footnotemark[7] in caption of longtable}' in result
assert '\end{longtable}\n\n\\footnotetext[7]{\nFoot note in longtable\n}' in result
@with_app(buildername='latex', testroot='footnotes',