diff --git a/sphinx/templates/latex/longtable.tex.jinja b/sphinx/templates/latex/longtable.tex.jinja index 3cc9e1e38..83790f4b2 100644 --- a/sphinx/templates/latex/longtable.tex.jinja +++ b/sphinx/templates/latex/longtable.tex.jinja @@ -24,14 +24,14 @@ <% endif -%> \makeatletter <%- if table.align in ('center', 'default') %> - \setlength\LTleft{\@totalleftmargin plus1fill} - \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill} + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill <%- elif table.align == 'left' %> - \setlength\LTleft{\@totalleftmargin} - \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill} + \LTleft \@totalleftmargin + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill <%- elif table.align == 'right' %> - \setlength\LTleft{\@totalleftmargin plus1fill} - \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax} + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax <%- endif %> \makeatother \begin{longtable}<%= table.get_colspec() %> diff --git a/tests/roots/test-latex-table/expects/longtable.tex b/tests/roots/test-latex-table/expects/longtable.tex index f74eb080c..1fe1022b7 100644 --- a/tests/roots/test-latex-table/expects/longtable.tex +++ b/tests/roots/test-latex-table/expects/longtable.tex @@ -5,8 +5,8 @@ \sphinxthistablewithglobalstyle \sphinxthistablewithborderlessstyle \makeatletter - \setlength\LTleft{\@totalleftmargin plus1fill} - \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill} + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill \makeatother \begin{longtable}{ll} \sphinxtoprule diff --git a/tests/roots/test-latex-table/expects/longtable_having_align.tex b/tests/roots/test-latex-table/expects/longtable_having_align.tex index 8a3e8a955..4a4df1824 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_align.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_align.tex @@ -4,8 +4,8 @@ \sphinxatlongtablestart \sphinxthistablewithglobalstyle \makeatletter - \setlength\LTleft{\@totalleftmargin plus1fill} - \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax} + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax \makeatother \begin{longtable}{|l|l|} \sphinxtoprule diff --git a/tests/roots/test-latex-table/expects/longtable_having_caption.tex b/tests/roots/test-latex-table/expects/longtable_having_caption.tex index 603a3c108..a1aa65d7a 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_caption.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_caption.tex @@ -4,8 +4,8 @@ \sphinxatlongtablestart \sphinxthistablewithglobalstyle \makeatletter - \setlength\LTleft{\@totalleftmargin plus1fill} - \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill} + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill \makeatother \begin{longtable}{|l|l|} \sphinxthelongtablecaptionisattop diff --git a/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex index 479bdfafe..240a76093 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex @@ -4,8 +4,8 @@ \sphinxatlongtablestart \sphinxthistablewithglobalstyle \makeatletter - \setlength\LTleft{\@totalleftmargin plus1fill} - \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill} + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill \makeatother \begin{longtable}{|*{2}{\X{1}{2}|}} \sphinxtoprule diff --git a/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex index 9ae535c19..897830b1c 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex @@ -4,8 +4,8 @@ \sphinxatlongtablestart \sphinxthistablewithglobalstyle \makeatletter - \setlength\LTleft{\@totalleftmargin plus1fill} - \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill} + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill \makeatother \begin{longtable}{|*{3}{\X{1}{3}|}} \sphinxtoprule diff --git a/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex b/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex index 029bc54c2..b9f75129c 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex @@ -4,8 +4,8 @@ \sphinxatlongtablestart \sphinxthistablewithglobalstyle \makeatletter - \setlength\LTleft{\@totalleftmargin plus1fill} - \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill} + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill \makeatother \begin{longtable}{|*{2}{\X{1}{2}|}} \sphinxtoprule diff --git a/tests/roots/test-latex-table/expects/longtable_having_widths.tex b/tests/roots/test-latex-table/expects/longtable_having_widths.tex index 706061cd8..24dad79fd 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_widths.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_widths.tex @@ -4,8 +4,8 @@ \sphinxatlongtablestart \sphinxthistablewithglobalstyle \makeatletter - \setlength\LTleft{\@totalleftmargin plus1fill} - \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill} + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill \makeatother \begin{longtable}{|\X{30}{100}|\X{70}{100}|} \noalign{\phantomsection\label{\detokenize{longtable:namedlongtable}}\label{\detokenize{longtable:mylongtable}}}% diff --git a/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex index f24ca827d..b4758caa0 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex @@ -4,8 +4,8 @@ \sphinxatlongtablestart \sphinxthistablewithglobalstyle \makeatletter - \setlength\LTleft{\@totalleftmargin plus1fill} - \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill} + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill \makeatother \begin{longtable}{|\X{30}{100}|\X{70}{100}|} \sphinxtoprule diff --git a/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex b/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex index 57960d7e0..4c380fed7 100644 --- a/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex +++ b/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex @@ -5,8 +5,8 @@ \sphinxthistablewithglobalstyle \sphinxthistablewithvlinesstyle \makeatletter - \setlength\LTleft{\@totalleftmargin plus1fill} - \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill} + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill \makeatother \begin{longtable}{|c|c|} \sphinxtoprule