diff options
author | tk0miya <i.tkomiya@gmail.com> | 2014-10-06 20:24:57 +0900 |
---|---|---|
committer | tk0miya <i.tkomiya@gmail.com> | 2014-10-06 20:24:57 +0900 |
commit | e70e6f970747fc542a406fde17824cd2855985be (patch) | |
tree | 9bf7e38fb9e23dbaae321f8b1eb8e3a373dd532a | |
parent | 79692ed6a52d5358e3c893c86ec893e22f1a4270 (diff) | |
download | sphinx-e70e6f970747fc542a406fde17824cd2855985be.tar.gz |
Fix position of \label tag for table was invalid in LaTeX
-rw-r--r-- | sphinx/writers/latex.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 2687fc7c..5a4c8a61 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -682,6 +682,9 @@ class LaTeXTranslator(nodes.NodeVisitor): if not self.table.longtable and self.table.caption is not None: self.body.append(u'\n\n\\begin{threeparttable}\n' u'\\capstart\\caption{%s}\n' % self.table.caption) + for id in self.next_table_ids: + self.body.append(self.hypertarget(id, anchor=False)) + self.next_table_ids.clear() if self.table.longtable: self.body.append('\n\\begin{longtable}') endmacro = '\\end{longtable}\n\n' @@ -709,11 +712,11 @@ 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} \\\\\n' % self.table.caption) - if self.table.caption is not None: + self.body.append(u'\\caption{%s}' % self.table.caption) for id in self.next_table_ids: self.body.append(self.hypertarget(id, anchor=False)) self.next_table_ids.clear() + self.body.append(u'\\\\\n') if self.table.longtable: self.body.append('\\hline\n') self.body.extend(self.tableheaders) @@ -1114,7 +1117,7 @@ class LaTeXTranslator(nodes.NodeVisitor): return elif isinstance(next, nodes.table): # same for tables, but only if they have a caption - for n in node: + for n in next: if isinstance(n, nodes.title): if node.get('refid'): self.next_table_ids.add(node['refid']) |