diff --git a/sphinx/templates/latex/tabular.tex_t b/sphinx/templates/latex/tabular.tex_t index 26e4ff107..67d71c985 100644 --- a/sphinx/templates/latex/tabular.tex_t +++ b/sphinx/templates/latex/tabular.tex_t @@ -15,7 +15,7 @@ \sphinxcaption{<%= ''.join(table.caption) %>}<%= labels %> \sphinxaftercaption <% elif labels -%> -\phantomsection<%= labels %> +\phantomsection<%= labels %>\nobreak <% endif -%> \begin{tabular}[t]<%= table.get_colspec() -%> \hline diff --git a/sphinx/templates/latex/tabulary.tex_t b/sphinx/templates/latex/tabulary.tex_t index 385076529..4d3571a7b 100644 --- a/sphinx/templates/latex/tabulary.tex_t +++ b/sphinx/templates/latex/tabulary.tex_t @@ -15,7 +15,7 @@ \sphinxcaption{<%= ''.join(table.caption) %>}<%= labels %> \sphinxaftercaption <% elif labels -%> -\phantomsection<%= labels %> +\phantomsection<%= labels %>\nobreak <% endif -%> \begin{tabulary}{\linewidth}[t]<%= table.get_colspec() -%> \hline diff --git a/tests/roots/test-latex-table/expects/table_having_widths.tex b/tests/roots/test-latex-table/expects/table_having_widths.tex index 5a69d5b22..b4fcea04e 100644 --- a/tests/roots/test-latex-table/expects/table_having_widths.tex +++ b/tests/roots/test-latex-table/expects/table_having_widths.tex @@ -2,7 +2,7 @@ \begin{savenotes}\sphinxattablestart \centering -\phantomsection\label{\detokenize{tabular:namedtabular}}\label{\detokenize{tabular:mytabular}} +\phantomsection\label{\detokenize{tabular:namedtabular}}\label{\detokenize{tabular:mytabular}}\nobreak \begin{tabular}[t]{|\X{30}{100}|\X{70}{100}|} \hline \sphinxstyletheadfamily