mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Better references to tables, as well.
This commit is contained in:
parent
f3c2220ad1
commit
5b2b0ecfd3
@ -225,6 +225,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
self.top_sectionlevel = 1
|
self.top_sectionlevel = 1
|
||||||
self.next_section_ids = set()
|
self.next_section_ids = set()
|
||||||
self.next_figure_ids = set()
|
self.next_figure_ids = set()
|
||||||
|
self.next_table_ids = set()
|
||||||
# flags
|
# flags
|
||||||
self.verbatim = None
|
self.verbatim = None
|
||||||
self.in_title = 0
|
self.in_title = 0
|
||||||
@ -634,7 +635,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
self.body.append('{|' + ('L|' * self.table.colcount) + '}\n')
|
self.body.append('{|' + ('L|' * self.table.colcount) + '}\n')
|
||||||
if self.table.longtable and self.table.caption is not None:
|
if self.table.longtable and self.table.caption is not None:
|
||||||
self.body.append(u'\\caption{%s} \\\\\n' % self.table.caption)
|
self.body.append(u'\\caption{%s} \\\\\n' % self.table.caption)
|
||||||
|
if self.table.caption is not None:
|
||||||
|
for id in self.next_table_ids:
|
||||||
|
self.body.append(self.hypertarget(id, anchor=False))
|
||||||
|
self.next_table_ids.clear()
|
||||||
if self.table.longtable:
|
if self.table.longtable:
|
||||||
self.body.append('\\hline\n')
|
self.body.append('\\hline\n')
|
||||||
self.body.append('\\endfirsthead\n\n')
|
self.body.append('\\endfirsthead\n\n')
|
||||||
@ -989,10 +993,19 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
self.next_section_ids.update(node['ids'])
|
self.next_section_ids.update(node['ids'])
|
||||||
return
|
return
|
||||||
elif isinstance(next, nodes.figure):
|
elif isinstance(next, nodes.figure):
|
||||||
|
# labels for figures go in the figure body, not before
|
||||||
if node.get('refid'):
|
if node.get('refid'):
|
||||||
self.next_figure_ids.add(node['refid'])
|
self.next_figure_ids.add(node['refid'])
|
||||||
self.next_figure_ids.update(node['ids'])
|
self.next_figure_ids.update(node['ids'])
|
||||||
return
|
return
|
||||||
|
elif isinstance(next, nodes.table):
|
||||||
|
# same for tables, but only if they have a caption
|
||||||
|
for n in node:
|
||||||
|
if isinstance(n, nodes.title):
|
||||||
|
if node.get('refid'):
|
||||||
|
self.next_table_ids.add(node['refid'])
|
||||||
|
self.next_table_ids.update(node['ids'])
|
||||||
|
return
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
if 'refuri' in node:
|
if 'refuri' in node:
|
||||||
|
Loading…
Reference in New Issue
Block a user