Embedded tables in LaTeX/PDF

33 views
Skip to first unread message

Libor Jelinek

unread,
Nov 11, 2019, 9:23:31 AM11/11/19
to sphinx...@googlegroups.com
Hello!
The following snippets works great for HTML builder:

.. list-table:: Table containing another table
    :widths: 10 5 10 50
    :header-rows: 1
    :stub-columns: 1

    * - List table
      - Header 1
      - Header 2
      - Header 3 long. Lorem ipsum dolor sit amet.
    * - Stub Row 1
      - Row 1
      - Column 2
      - Column 3 long. Lorem ipsum dolor sit amet.

        .. list-table:: Embedded table
           :widths: 10 5 10 50
           :header-rows: 1
           :stub-columns: 1

           * - List table
             - Header 1
             - Header 2
             - Header 3 long. Lorem ipsum dolor sit amet.
           * - Stub Row 1
             - Row 1
             - Column 2
             - Column 3 long. Lorem ipsum dolor sit amet.


But when building PDF (make latexpdf) I encounter "Markup is unsupported in LaTeX: path/to/file:: nested tables are not yet implemented" error.

Are nested tables still unsupported? Is it a lack of Sphinx or LaTeX? Is there any workaround?

Thanks
Libor

jfbu

unread,
Nov 12, 2019, 8:38:58 AM11/12/19
to sphinx...@googlegroups.com
Hi,
Yes they are still unsupported for LaTeX builder at dev repo.

https://github.com/sphinx-doc/sphinx/issues/2588 and possibly other issues exist about this.

There are technical difficulties at LaTeX side but to some extent partial support could be provided.

Currently table rendering is very difficult in LaTeX because the available packages are not well adapted to automated production. Already Sphinx has added various advanced LaTeXing via extra macros (see for example the file sphinxmulticell.sty) to work around deficiencies of available LaTeX packages.

Sphinx is still in a non-satisfactory state of using three different ways of rendering LaTeX tables:

- tabulary: tries to adjust column widths automatically; incompatible with code-blocks, does not allow pagebreaks

- tabular: fall-back when tabulary usage is impossible; compatible with cells containing code-blocks, does not allow pagebreaks either

- longtable: does allows pagebreak, and is compatible with cells containing code-blocks

All of the above have issues with footnotes and again Sphinx needed some advanced LaTeXing to work around the problems

Regarding nesting, let's use TY=tabulary, TR=tabular, LT=longtable in table below


A can be nested in B:

A\B TR TY LT

TR YES YES YES
TY YES NO YES
LT NO NO NO

Some of the above I tested, others are just my expectation. Perhaps the NO for TY nested in TY has some workaround but it will be expert LaTeX hacking if at all possible.


Thus at some point yes, Sphinx could support nested tables for LaTeX output.

Jean-François

Reply all
Reply to author
Forward
0 new messages