diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index af1c6af7a..192207bce 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1061,8 +1061,11 @@ class LaTeXTranslator(nodes.NodeVisitor): self.remember_multirowcol[self.table.col] = node.get('morecols') self.table.col += node.get('morecols') if isinstance(node.parent.parent, nodes.thead): - self.body.append('\\textsf{\\relax ') - context += '}' + if len(node) == 1 and isinstance(node[0], nodes.paragraph) and node.astext() == '': + pass + else: + self.body.append('\\textsf{\\relax ') + context += '}' while self.remember_multirow.get(self.table.col + 1, 0): self.table.col += 1 self.remember_multirow[self.table.col] -= 1 diff --git a/tests/root/markup.txt b/tests/root/markup.txt index 9e8c6bc86..b322b39fa 100644 --- a/tests/root/markup.txt +++ b/tests/root/markup.txt @@ -187,6 +187,15 @@ Tables | 2 | Empty cells: | | +----+----------------+----+ +.. table:: empty cell in table header + + ===== ====== + \ + ===== ====== + 1 2 + 3 4 + ===== ====== + Tables with multirow and multicol: .. only:: latex