diff options
| author | Jean-François B <2589111+jfbu@users.noreply.github.com> | 2023-04-11 20:02:15 +0200 |
|---|---|---|
| committer | Jean-François B <2589111+jfbu@users.noreply.github.com> | 2023-04-11 20:32:31 +0200 |
| commit | 509cc4533c92adae92997d63c8a7b11295f9e207 (patch) | |
| tree | 135cb91b612bcbcb85426db076140ed264e52e3e /sphinx/templates | |
| parent | 2c83af0aab7080e0b78d4a16981eed878b2cac4c (diff) | |
| download | sphinx-git-509cc4533c92adae92997d63c8a7b11295f9e207.tar.gz | |
LaTeX: get aligned longtable obey current list indent
Fix #11268.
Thanks to @picnixz.
Diffstat (limited to 'sphinx/templates')
| -rw-r--r-- | sphinx/templates/latex/longtable.tex.jinja | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sphinx/templates/latex/longtable.tex.jinja b/sphinx/templates/latex/longtable.tex.jinja index f5cb522ce..3cc9e1e38 100644 --- a/sphinx/templates/latex/longtable.tex.jinja +++ b/sphinx/templates/latex/longtable.tex.jinja @@ -22,15 +22,19 @@ <% if 'nocolorrows' in table.styles -%> \sphinxthistablewithnocolorrowsstyle <% endif -%> -\begin{longtable} -<%- if table.align in ('center', 'default') -%> - [c] -<%- elif table.align == 'left' -%> - [l] -<%- elif table.align == 'right' -%> - [r] -<%- endif -%> -<%= table.get_colspec() %> +\makeatletter +<%- if table.align in ('center', 'default') %> + \setlength\LTleft{\@totalleftmargin plus1fill} + \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill} +<%- elif table.align == 'left' %> + \setlength\LTleft{\@totalleftmargin} + \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill} +<%- elif table.align == 'right' %> + \setlength\LTleft{\@totalleftmargin plus1fill} + \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax} +<%- endif %> +\makeatother +\begin{longtable}<%= table.get_colspec() %> <%- if table.caption -%> \sphinxthelongtablecaptionisattop \caption{<%= ''.join(table.caption) %>\strut}<%= labels %>\\*[\sphinxlongtablecapskipadjust] |
