Skip to content
\n

I've tried a few things in the stylesheet and have messed around with overriding the _align() method in Flowable, but I am not having much success.

\n

Is there anything that could be done to to achieve this? I appreciate that custom centering like this may be a niche request, so I would understand if this is beyond the capabilities of rinohtype at the moment.

\n

Any advice would be greatly appreciated 😄

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

I can see merit in supporting this, but I'm not convinced rinohtype should provide extra style properties for such a specific case...

\n

You can however achieve this with some more manual intervention by defining a wide table style definition for which you set a left margin of -2cm. This wide table style should match tables for which e.g. the wide class is set.

\n

I haven't tested this, but it should be a good start:

\n
[wide table : Table(has_class='wide')]\nbase = table\nmargin_left = -2cm\n# optionally: width = 100%
\n
.. table:: Wide table\n   :class: wide\n\n   +------------------------+------------+----------+----------+\n   | Header row, column 1   | Header 2   | Header 3 | Header 4 |\n   | (header rows optional) |            |          |          |\n   +========================+============+==========+==========+\n   | body row 1, column 1   | column 2   | column 3 | column 4 |\n   +------------------------+------------+----------+----------+\n   | body row 2             | Cells may span columns.          |\n   +------------------------+------------+---------------------+\n   | body row 3             | Cells may  | - Table cells       |\n   +------------------------+ span rows. | - contain           |\n   | body row 4             |            | - body elements.    |\n   +------------------------+------------+----------+----------+\n   | body row 5             | Cells may also be     |          |\n   |                        | empty: ``-->``        |          |\n   +------------------------+-----------------------+----------+
\n

Of course, this isn't yet documented properly. In the meantime, you can have a look at the table* examples in https://github.com/brechtm/rinohtype/tree/master/tests_regression/rst.

","upvoteCount":2,"url":"https://github.com/brechtm/rinohtype/discussions/402#discussioncomment-5177166"}}}

How to use custom aligning relative to margins #402

Answered by brechtm
th0mr asked this question in Q&A
Discussion options

You must be logged in to vote

I can see merit in supporting this, but I'm not convinced rinohtype should provide extra style properties for such a specific case...

You can however achieve this with some more manual intervention by defining a wide table style definition for which you set a left margin of -2cm. This wide table style should match tables for which e.g. the wide class is set.

I haven't tested this, but it should be a good start:

[wide table : Table(has_class='wide')]
base = table
margin_left = -2cm
# optionally: width = 100%
.. table:: Wide table
   :class: wide

   +------------------------+------------+----------+----------+
   | Header row, column 1   | Header 2   | Header 3 | Header 4 |
   | (header ro…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@th0mr
Comment options

Answer selected by th0mr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants