From 1c38710ed282f5d3d38d027f9a5190e558b27be3 Mon Sep 17 00:00:00 2001 From: jfbu Date: Sat, 11 Feb 2017 17:52:36 +0100 Subject: [PATCH] update latex table tests and CHANGES for PR#3415 --- CHANGES | 4 ++++ tests/roots/test-latex-table/tabular.rst | 2 +- tests/test_build_latex.py | 17 ++++++++++------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 8e25b84ff..64ad089dd 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,9 @@ Incompatible changes has the custom code to fit image to available width if oversized. * The subclasses of ``sphinx.domains.Index`` should override ``generate()`` method. The default implementation raises NotImplementedError +* LaTeX positioned long tables horizontally centered, and short ones + flushed left (no text flow around table.) The position now defaults to center in + both cases, and it will obey Docutils 0.13 ``:align:`` option (refs #3415, #3377) Features removed ---------------- @@ -49,6 +52,7 @@ Features added * #3402: Allow to suppress "download file not readable" warnings using :confval:`suppress_warnings`. * #3377: latex: Add support for Docutils 0.13 ``:align:`` option for tables + (but does not implement text flow around table). Bugs fixed ---------- diff --git a/tests/roots/test-latex-table/tabular.rst b/tests/roots/test-latex-table/tabular.rst index 9dad36edd..5577c496e 100644 --- a/tests/roots/test-latex-table/tabular.rst +++ b/tests/roots/test-latex-table/tabular.rst @@ -30,7 +30,7 @@ table having :align: option (tabulary) -------------------------------------- .. table:: - :align: center + :align: right ======= ======= header1 header2 diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index 95b7273f0..9a91bf0b5 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -831,23 +831,24 @@ def test_latex_table_tabulars(app, status, warning): # simple_table table = tables['simple table'] - assert ('\\begin{tabulary}{\\linewidth}{|L|L|}' in table) + assert ('\\begingroup\n\\centering\n\\begin{tabulary}{\\linewidth}{|L|L|}' in table) assert ('\\hline\n' '\\sphinxstylethead{\\relax \nheader1\n\\unskip}\\relax &' '\\sphinxstylethead{\\relax \nheader2\n\\unskip}\\relax' in table) assert ('\\hline\ncell1-1\n&\ncell1-2\n\\\\' in table) assert ('\\hline\ncell2-1\n&\ncell2-2\n\\\\' in table) assert ('\\hline\ncell3-1\n&\ncell3-2\n\\\\' in table) - assert ('\\hline\n\\end{tabulary}' in table) + assert ('\\hline\n\\end{tabulary}\n\\par\n\\endgroup' in table) # table having :widths: option table = tables['table having :widths: option'] - assert ('\\begin{tabular}{|\\X{30}{100}|\\X{70}{100}|}' in table) - assert ('\\hline\n\\end{tabular}' in table) + assert ('\\begingroup\n\\centering\n' + '\\begin{tabular}{|\\X{30}{100}|\\X{70}{100}|}' in table) + assert ('\\hline\n\\end{tabular}\n\\par\n\\endgroup' in table) # table having :align: option (tabulary) table = tables['table having :align: option (tabulary)'] - assert ('\\begingroup\n\\centering\n' + assert ('\\begingroup\n\\raggedleft\n' '\\begin{tabulary}{\\linewidth}{|L|L|}\n' in table) assert ('\\hline\n\\end{tabulary}\n\\par\n\\endgroup' in table) @@ -863,10 +864,12 @@ def test_latex_table_tabulars(app, status, warning): # table having caption table = tables['table having caption'] - assert ('\\begin{threeparttable}\n\\capstart\\caption{caption for table}' + assert ('\\begingroup\n\\centering\n' + '\\begin{threeparttable}\n\\capstart\\caption{caption for table}' '\\label{\\detokenize{tabular:id1}}' in table) assert ('\\begin{tabulary}{\\linewidth}{|L|L|}' in table) - assert ('\\hline\n\\end{tabulary}\n\\end{threeparttable}' in table) + assert ('\\hline\n\\end{tabulary}\n\\end{threeparttable}' + '\n\\par\n\\endgroup' in table) # table having verbatim table = tables['table having verbatim']