Generating a table from python in Latex (tabulary) with no border/internal lines

48 views
Skip to first unread message

Jim Fehrle

unread,
Dec 3, 2019, 7:57:16 PM12/3/19
to sphinx-users
IIUC "colspec" is used to control whether vertical lines appear in the table.  For example the default "{|T|T|T|}" gives vertical lines while "{TTT}" omits them.  In sphinx/writers/latex.py, Table.get_colspec() will use self.colspec, if set, as the column specification, but I can't figure out how to set that value from Python using docutils.  Hardcoding the value in latex.py to "{TTT}" does indeed get rid of the vertical lines.

Here's what I have at the moment:

self.table = nodes.table(classes=["prodn"], colspec="{TTT}")
widths = [1, 1, 100]
tgroup = nodes.tgroup(cols=len(widths), colspec="{TTT}")
for width in widths:
    tgroup += nodes.colspec(colwidth=width)
self.tbody = nodes.tbody(colspec="{TTT}")


        <table classes="prodn" colspec="{TTT}">
<tgroup cols="3" colspec="{TTT}">
<colspec colwidth="1"/>
<colspec colwidth="1"/>
<colspec colwidth="100"/>
<tbody colspec="{TTT}">


For the horizontal lines, I don't even see an option to control this. The "\hline"s appear to be hard coded.

Any suggestions?

I'd consider submitting a Spinx PR to support these, if necessary. Provided it's not a large change.

skyscribe

unread,
Apr 15, 2022, 9:42:43 AMApr 15
to sphinx-users
Is this problem resolved?
Reply all
Reply to author
Forward
0 new messages