Configuring a Template. rinohtype provides a number of standard_templates. These can be customized by means of a template configuration file; a plain text file in the INI1 format with the .rtt extension. Here is an example configuration for the article template: name = my article configuration template = article parts = title ;front_matter contents stylesheet = sphinx_base14 language = fr abstract_location = title contents = 'Contents' caution = 'Careful!' warning = 'Please be warned' paper_size = A5 page_number_format = lowercase roman end_at_page = left page_number_format = number top_margin = 2cm The TEMPLATE_CONFIGURATION sections collects global template options. Set name to provide a short label for your template configuration. template identifies the document template to configure. All document templates consist of a number of document parts. The Article template defines three parts: title, front_matter and contents. The order of these parts can be changed (although that makes little sense for the article template), and individual parts can optionally be hidden by setting the parts configuration option. The configuration above hides the front matter part (com- mented out using a semicolon), for example. The template configuration also specifies which style sheet is used for styling document elements. The DocumentTemplate.stylesheet option takes the name of an installed style sheet (see rinoh --list-stylesheets) or the filename of a stylesheet file (.rts). The language option sets the default language for the document. It determines which language is used for standard document strings such as section and admonition titles. The Article template defines two custom template options. The abstract_location option deter- mines where the (optional) article abstract is placed, on the title page or in the front matter part. table_of_contents allows hiding the table of contents section. Empty document parts will not be included in the document. When the table of contents section is suppressed and there is no abstract in the input document or abstract_location is set to title, the front matter document part will not appear in the PDF. The standard document strings configured by the language option described above can be over- ridden by user-defined strings in the SectionTitles and AdmonitionTitles sections of the configu- ration file. For example, the default title for the table of contents section (Table of Contents) is replaced with Contents. The configuration also sets custom titles for the caution and warning admonitions. The others sections in the configuration file are the VARIABLES section, followed by document part and page template sections. Similar to style sheets, the variables can be referenced in the template configuration sections. Here, the paper_size variable is set, which is being referenced by by all page templates in Article (although indirectly through the page base page template). For document part templates, page_number_format determines how page numbers are format- ▇▇▇. When a document part uses the same page number format as the preceding part, the numbering is continued. The DocumentPartTemplate.end_at_page option controls at which page the document part ends. This is set to left for the title part in the example configuration to make the contents part start on a right page. Each document part finds page templates by name. They will first look for specific left/right page templates by appending _left_page or _right_page to the document part name. If these page templates have not been defined in the template, it will look for the more general <docu- ment part name>_page template. Note that, if left and right page templates have been defined by the template (such as the book template), the configuration will need to override these, as they will have priority over the general page template defined in the configuration. The example configuration only adjusts the top margin for the TitlePageTemplate, but many more aspects of the page templates are configurable. Refer to standard_templates for details. base for part template?
Appears in 1 contract
Sources: User Manual
Configuring a Template. rinohtype provides a number of standard_templates. These can be customized by means of a template configuration file; a plain text file in the INI1 format with the .rtt extension. Here is an example configuration for the article template: name = my article configuration template = article parts = title ;front_matter contents stylesheet = sphinx_base14 language = fr abstract_location = title contents = 'Contents' caution = 'Careful!' warning = 'Please be warned' paper_size = A5 page_number_format = lowercase roman end_at_page = left page_number_format = number top_margin = 2cm The TEMPLATE_CONFIGURATION sections collects global template options. Set name to provide a short label for your template configuration. template identifies the document template to configure. All document templates consist of a number of document parts. The Article template defines three parts: title, front_matter and contents. The order of these parts can be changed (although that makes little sense for the article template), and individual parts can optionally be hidden by setting the parts configuration option. The configuration above hides the front matter part (com- mented commented out using a semicolon), for example. The template configuration also specifies which style sheet is used for styling document elements. The DocumentTemplate.stylesheet option takes the name of an installed style sheet (see rinoh --list-stylesheets) or the filename of a stylesheet file (.rts). The language option sets the default language for the document. It determines which language is used for standard document strings such as section and admonition titles. The Article template defines two custom template options. The abstract_location option deter- mines determines where the (optional) article abstract is placed, on the title page or in the front matter part. table_of_contents allows hiding the table of contents section. Empty document parts will not be included in the document. When the table of contents section is suppressed and there is no abstract in the input document or abstract_location is set to title, the front matter document part will not appear in the PDF. The standard document strings configured by the language option described above can be over- ridden overridden by user-defined strings in the SectionTitles and AdmonitionTitles sections of the configu- ration configuration file. For example, the default title for the table of contents section (Table of Contents) is replaced with Contents. The configuration also sets custom titles for the caution and warning admonitions. The others sections in the configuration file are the VARIABLES section, followed by document part and page template sections. Similar to style sheets, the variables can be referenced in the template configuration sections. Here, the paper_size variable is set, which is being referenced refer- enced by by all page templates in Article (although indirectly through the page base page template). For document part templates, page_number_format determines how page numbers are format- ▇▇▇formatted. When a document part uses the same page number format as the preceding part, the numbering is continued. The DocumentPartTemplate.end_at_page option controls at which page the document part ends. This is set to left for the title part in the example configuration to make the contents part start on a right page. Each document part finds page templates by name. They will first look for specific left/right page templates by appending _left_page or _right_page to the document part name. If these page templates have not been defined in the template, it will look for the more general <docu- ment document part name>_page template. Note that, if left and right page templates have been defined by the template (such as the book template), the configuration will need to override these, as they will have priority over the general page template defined in the configuration. The example configuration only adjusts the top margin for the TitlePageTemplate, but many more aspects of the page templates are configurable. Refer to standard_templates for details. base for part template?
Appears in 1 contract
Sources: User Manual