sphinx grid table pdf output cell overflow

197 views
Skip to first unread message

recep daban

unread,
Dec 7, 2022, 8:29:21 AM12/7/22
to sphinx-users
Hi, 

I have very long long grid table in terms of width that has 19 columns reaches 478 char length but only has three rows. When try to generate pdf file by sphinx output table looks ugly. The table's cell content do not fit and overflow from the cell. I added screenshot of that part of pdf file 

NOT: I dont have any sphinx table markup before table like .. table::. BTW it doesn't make any affect when added

BR,

grid_table.png

recep daban

unread,
Dec 7, 2022, 8:31:19 AM12/7/22
to sphinx-users
sphinx                        4.5.0       Python documentation generator
sphinx-autodoc-typehints      1.19.1      Type hints (PEP 484) support for the Sphinx autodoc extension
sphinx-copybutton             0.4.0       Add a copy button to each of your code cells.
sphinx-markdown-tables        0.0.15      A Sphinx extension for rendering tables written in markdown
sphinx-material               0.0.32      Material sphinx theme
sphinxcontrib-applehelp       1.0.2       sphinxcontrib-applehelp is a sphinx extension which outputs Apple help books
sphinxcontrib-devhelp         1.0.2       sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document.
sphinxcontrib-htmlhelp        2.0.0       sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files
sphinxcontrib-jsmath          1.0.1       A sphinx extension which renders display math in HTML via JavaScript
sphinxcontrib-mermaid         0.7.1       Mermaid diagrams in yours Sphinx powered docs
sphinxcontrib-qthelp          1.0.3       sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp document.
sphinxcontrib-serializinghtml 1.1.5       sphinxcontrib-serializinghtml is a sphinx extension which outputs "serialized" HTML files (json and pickle).

==========================================================================================================================


pdfTeX 3.141592653-2.6-1.40.24 (TeX Live 2022)
kpathsea version 6.3.4
Copyright 2022 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.03



Nico Gulden

unread,
Dec 8, 2022, 4:29:43 AM12/8/22
to sphinx...@googlegroups.com
Hello Recep,

when you table has 19 columns and only three rows, have you thought
about transforming it to 3 columns and 19 rows? That approach would give
each column more space for the content.

I fear, there is not technical solution for the problem, but rather a
content structure solution.

I hope, this helps.

Best regards,
Nico

Am 07.12.22 um 14:29 schrieb recep daban:
> --
> You received this message because you are subscribed to the Google
> Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sphinx-users...@googlegroups.com
> <mailto:sphinx-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sphinx-users/9c37d0d8-1ed4-40a3-8792-fc33533e4e58n%40googlegroups.com <https://groups.google.com/d/msgid/sphinx-users/9c37d0d8-1ed4-40a3-8792-fc33533e4e58n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Nico Gulden
E-Mail: ngu...@gmx.de
1024D/B2691D50 5415 501F AC07 D04A EB03 D01C 786D 966B B269 1D50

Hardware runs the world, software controls the hardware,
code generates the software, have you coded today?
OpenPGP_signature

recep daban

unread,
Dec 8, 2022, 6:42:07 AM12/8/22
to sphinx-users
Hi Nico,

Thanks for advice but unfortunately I do not no option restructure the table for smaller size. After reading your advice an idea came to my mind :)
I can change paper size so added latex_element configuration paper size like following

latex_elements = { 'papersize' : 'a1paper' }  

It seems nicer than before.

BR,

Wol

unread,
Dec 12, 2022, 6:36:10 PM12/12/22
to sphinx...@googlegroups.com
On 08/12/2022 11:42, recep daban wrote:
> Hi Nico,
>
> Thanks for advice but unfortunately I do not no option restructure the
> table for smaller size. After reading your advice an idea came to my mind :)
> I can change paper size so added latex_element configuration paper size
> like following
>
> latex_elements = { 'papersize' : 'a1paper' }
>
> It seems nicer than before.
>
But probably not for people who prefer dead-tree documentation ...

What happens if you make it A4 landscape?

I know it might be tricky, but A4 landscape and making the text wrap to
fit in the cells will please people (like me) who actually want to be
able to print things.

Cheers,
Wol

recep daban

unread,
Dec 13, 2022, 3:31:58 AM12/13/22
to sphinx-users
Hi Wol,

Thanks for advice. Do you how to configure this in the conf.py file ? 

BR,
Recep 

Wols Lists

unread,
Dec 13, 2022, 4:00:45 AM12/13/22
to sphinx...@googlegroups.com
On 13/12/2022 08:31, recep daban wrote:
> Hi Wol,
>
> Thanks for advice. Do you how to configure this in the conf.py file ?

Hi Recep,

Sorry - mention python to me and my eyes glaze over. I'm a FORTRAN /
DATABasic / C guy. I'm trying to catch up with the modern world and
failing miserably :-)

Cheers,
Wol
> --
> You received this message because you are subscribed to the Google
> Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sphinx-users...@googlegroups.com
> <mailto:sphinx-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sphinx-users/d3982b86-08b0-49c3-ba70-925a425f28d0n%40googlegroups.com <https://groups.google.com/d/msgid/sphinx-users/d3982b86-08b0-49c3-ba70-925a425f28d0n%40googlegroups.com?utm_medium=email&utm_source=footer>.

recep daban

unread,
Dec 13, 2022, 4:28:04 AM12/13/22
to sphinx-users
Hi Wol,

No worries, thanks for advice. I will try to find out configuration for landscape mode.

BR,
Recep

Nico Gulden

unread,
Dec 13, 2022, 4:41:08 AM12/13/22
to sphinx...@googlegroups.com
Hello Recep,

to configure landscape orientation for your PDF output, you must check
the LaTeX settings, see https://www.sphinx-doc.org/en/master/latex.html

And I found:
https://tex.stackexchange.com/questions/147504/how-to-make-a-latex-document-in-landscape

In my conf.py, I added the following:

latex_elements = {
"extraclassoptions": "landscape",
# ... you may have more options
}

It adds the parameter "landscape" to "documentclass". I just tested it
and it worked for me.

Best regards,
Nico

Am 13.12.22 um 10:28 schrieb recep daban:
> https://groups.google.com/d/msgid/sphinx-users/d3982b86-08b0-49c3-ba70-925a425f28d0n%40googlegroups.com <https://groups.google.com/d/msgid/sphinx-users/d3982b86-08b0-49c3-ba70-925a425f28d0n%40googlegroups.com> <https://groups.google.com/d/msgid/sphinx-users/d3982b86-08b0-49c3-ba70-925a425f28d0n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/sphinx-users/d3982b86-08b0-49c3-ba70-925a425f28d0n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sphinx-users...@googlegroups.com
> <mailto:sphinx-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sphinx-users/7c5b7904-2ff6-448a-9f1e-5d9428b5bcf7n%40googlegroups.com <https://groups.google.com/d/msgid/sphinx-users/7c5b7904-2ff6-448a-9f1e-5d9428b5bcf7n%40googlegroups.com?utm_medium=email&utm_source=footer>.
OpenPGP_signature

recep daban

unread,
Dec 13, 2022, 5:21:19 AM12/13/22
to sphinx-users
Thanks Nico, it also worked for me 
Reply all
Reply to author
Forward
0 new messages