Rinohtype Export To Pdf - Document Header With Chapter Name And Title
Solution 1:
I'd like to define and style header as shown on the picture - the light part contains chapter name, document title is in the dark one.
Unfortunately, this functionality is not yet documented well. Here are the steps necessary to obtain this:
Set a custom template configuration in
conf.py
if you haven't done so yetrinoh_documents = [dict(doc='index', target='manual', template='my_template.rtt')]
Define the page header content in the template configuration (
my_template.rtt
)[TEMPLATE_CONFIGURATION]name = My Template template = article stylesheet = my_stylesheet.rts [contents_page]header_text = '\t''{SECTION_TITLE(1)}' (header section title) '\t' '{DOCUMENT_TITLE}' (header document title)
Style the header text and adjust the tab stop positions and alignment in the style sheet (
my_stylesheet.rts
)[STYLESHEET]name = My Style Sheet base = sphinx_article [header]tab_stops=12cm RIGHT, 100% RIGHT [header section title : StyledText('header section title')]base = default font_weight = bold [header document title : StyledText('header document title')]base = header section title font_slant = italic
Also how can I insert those squares (in front of the text) into the layout?
For black squares, you can insert a unicode character, for example the aptly named BLACK SQUARE character using python-style escape sequences or simply pasting the character into the template configuration:
[contents_page]header_text = '\t''\N{BLACK SQUARE} {SECTION_TITLE(1)}' (header section title)
'\t' '■' (header square) ' {DOCUMENT_TITLE}' (header document title)
As you can see, you an style the square differently (e.g. larger font).
You can also use inline images, if unicode (or the font) doesn't cover your needs:
[contents_page]header_text = '\t' IMAGE('img/square.png', scale=0.3) ' {SECTION_TITLE(1)}' (header section title)
'\t' IMAGE('img/circle.png', scale=0.3) '{DOCUMENT_TITLE}' (header document title)
Also how can I insert those squares into the layout?Adding a background for the page headers
You can set a background image on the page template in your template configuration. You can draw this in a vector drawing application such as Inkscape and export it to PDF.
[contents_page]background='img/contents_background.pdf' scale=fill
You can adjust the placement of the header text by adjusting the margins and header_footer_distance in the page template configuration and .
Post a Comment for "Rinohtype Export To Pdf - Document Header With Chapter Name And Title"