Fix empty cell in table header causes LaTeX error (#1574)

This commit is contained in:
Takeshi KOMIYA 2015-12-24 12:41:07 +09:00
parent 02f013aba5
commit ee7e3cc078
2 changed files with 14 additions and 2 deletions

View File

@ -1061,8 +1061,11 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.remember_multirowcol[self.table.col] = node.get('morecols') self.remember_multirowcol[self.table.col] = node.get('morecols')
self.table.col += node.get('morecols') self.table.col += node.get('morecols')
if isinstance(node.parent.parent, nodes.thead): if isinstance(node.parent.parent, nodes.thead):
self.body.append('\\textsf{\\relax ') if len(node) == 1 and isinstance(node[0], nodes.paragraph) and node.astext() == '':
context += '}' pass
else:
self.body.append('\\textsf{\\relax ')
context += '}'
while self.remember_multirow.get(self.table.col + 1, 0): while self.remember_multirow.get(self.table.col + 1, 0):
self.table.col += 1 self.table.col += 1
self.remember_multirow[self.table.col] -= 1 self.remember_multirow[self.table.col] -= 1

View File

@ -187,6 +187,15 @@ Tables
| 2 | Empty cells: | | | 2 | Empty cells: | |
+----+----------------+----+ +----+----------------+----+
.. table:: empty cell in table header
===== ======
\
===== ======
1 2
3 4
===== ======
Tables with multirow and multicol: Tables with multirow and multicol:
.. only:: latex .. only:: latex