admin管理员组文章数量:1345452
I want to control the vertical and horizontal alignment of the cells in a table generated with sphinx and texlive, and I want to be able to force a new line in my csv file. I'm using python==3.13.2
and sphinx==8.2.3
I was able to figure out the horizontal alignment, but I haven't been able to figure out the vertical alignment or how to add a new line in the csv file. I've tried adding \newline
(and variations with more slashes) to try and force the column labeled "column header" to be split across multiple rows. For example, column\\\\newlineheader
in the csv file didn't work.
table.csv:
run,column header,really long center column header,really long left column header,really long left column header,really long right column header,small
1,1,1,1,1,1,1
2,2,2,2,2,2,2
3,3,3,3,3,3,3
4,4,4,4,4,4,4
5,5,5,5,5,5,5
Sphinx syntax:
.. tabularcolumns:: |>{\centering\arraybackslash}\X{1}{12}|>{\raggedleft\arraybackslash}\X{2}{12}|>{\centering\arraybackslash}\X{2}{12}|>{\raggedright\arraybackslash}\X{2}{12}|>{\raggedright\arraybackslash}\X{2}{12}|>{\raggedleft\arraybackslash}\X{2}{12}|>{\center\arraybackslash}\X{1}{12}|
.. csv-table:: My CSV Table with X{}
:file: _static/table.csv
:header-rows: 1
:align: center
The above code produces the image below. What I want is for the column "column header" to be split across multiple rows like "column\nheader" and all of the cells should be vertically centered. For some reason it looks like the "small" column isn't top aligned, but the rest are.
本文标签: pythonHow can I adjust alignment in a sphinx PDF tableStack Overflow
版权声明:本文标题:python - How can I adjust alignment in a sphinx PDF table? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743813233a2543454.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论