diff --git a/CHANGES b/CHANGES index 94a4dd0e4..322f39a64 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ Bugs fixed ---------- * #2134 Fix figure caption with reference causes latex build error +* #2094 Fix rubric with reference not working in Latex Release 1.3.3 (released Dec 2, 2015) diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 2164e14c1..0edc6dd83 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -749,8 +749,10 @@ class LaTeXTranslator(nodes.NodeVisitor): raise nodes.SkipNode self.body.append('\\paragraph{') self.context.append('}\n') + self.in_title = 1 def depart_rubric(self, node): + self.in_title = 0 self.body.append(self.context.pop()) def visit_footnote(self, node): diff --git a/tests/roots/test-references-in-caption/index.rst b/tests/roots/test-references-in-caption/index.rst index f71a7b8f4..decec1bad 100644 --- a/tests/roots/test-references-in-caption/index.rst +++ b/tests/roots/test-references-in-caption/index.rst @@ -17,4 +17,6 @@ The section with a reference to [AuthorYear]_ * - Content - Content +.. rubric:: The rubric title with a reference to [AuthorYear]_ + .. [AuthorYear] Author, Title, Year diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index 77b8dd731..be8b7b604 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -331,3 +331,4 @@ def test_reference_in_caption(app, status, warning): '{\\hyperref[index:authoryear]{\\emph{{[}AuthorYear{]}}}}.}' in result) assert '\\chapter{The section with a reference to {[}AuthorYear{]}}' in result assert '\\caption{The table title with a reference to {[}AuthorYear{]}}' in result + assert '\\paragraph{The rubric title with a reference to {[}AuthorYear{]}}' in result