Sushivam
Sushivam

Reputation: 3107

RinohType sphinx customize the styles in PDF

I am using RinohType for generating my RST files to PDF.

I am trying to understand how to provide custom styles in the PDF for my logo and other elements.

I somehow felt the explanation in the Default matcher doesn't provide examples on how to do this.

conf.py

rinoh_documents = [dict(doc='index',        # top-level file (index.rst)
                        target='manual',
                        template='rinohtype.rtt',
                        logo='_static/rr-logo-vertical2022-1100px-transp.png')]

rhinotype.rtt

[TEMPLATE_CONFIGURATION]
name = my article configuration
template = article
stylesheet = my_stylesheet.rts

parts =
    title
    ;front_matter
    contents
language = fr
abstract_location = title

[SectionTitles]
contents = 'Contents'

[AdmonitionTitles]
caution = 'Careful!'
warning = 'Please be warned'

[VARIABLES]
paper_size = A5

[title]
page_number_format = lowercase roman
end_at_page = left

[contents]
page_number_format = number

[title_page]
top_margin = 2cm

my_stylesheet.rts

Here I am trying to change the width of my logo in the PDF. What is the correct way to give the css properties here.

width: 100px

Upvotes: 0

Views: 638

Answers (1)

Brecht Machiels
Brecht Machiels

Reputation: 3410

The default matcher defines the title page logo style. To adjust the style of this element, you can create a style sheet that builds upon the default sphinx style sheet and tweak the title page logo style:

[STYLESHEET]
name=My Style Sheet
description=My tweaks to the Sphinx style sheet
base=sphinx

[title page logo]
width = 4cm

This style accepts the FlowableStyle style attributes. In the linked documentation, you can see the width attribute supports a bunch of units but not px.

Please stay tuned for better documentation. Something is actually happening in that area!

P.S. If you want to make more changes to the styling of your document, the style log can be very useful to find out which style name corresponds to a particular document element.

Upvotes: 2

Related Questions