Sushivam
Sushivam

Reputation: 3107

Rst2pdf: Sphinx - Confused file format for defining custom styles

I am confused with multiple resources saying to define custom PDF styles in different ways. What is its file format (.styles or .json)?

Here is my current folder structure:

/home/sachin/Workspace/Sootballs/pa-amr/docs/.rst2pdf/config/rst2pdf.conf

# This is an example config file. Modify and place in ~/.rst2pdf/config

[general]
# A comma-separated list of custom stylesheets. Example:

# A comma-separated list of custom stylesheets. Example:
# stylesheets="fruity.json,a4paper.json,verasans.json"
stylesheets="paamr.json"

# A colon-separated list of folders to search for stylesheets. Example:
# stylesheet_path="~/styles:/usr/share/styles"
# stylesheet_path="~/Workspace/Sootballs/pa-amr/docs/paamr.style"
stylesheet_path="../styles/paamr.style"   //CONFUSED HERE: Is this how to define styles?

In paamr.style - Defining my custom styles.

# List any fonts you would like to embed in the PDF here
  embeddedFonts: []

  # Default page setup.  Can be overridden by including other
  # stylesheets with -s

  pageSetup:
    size: A4
    width: null
    height: null
    margin-top: 2cm
    margin-bottom: 2cm
    margin-left: 2cm
    margin-right: 2cm
    margin-gutter: 0cm
    spacing-header: 5mm
    spacing-footer: 5mm

Or Should I define my custom style in /home/sachin/Workspace/Sootballs/pa-amr/docs/_styles/paamr.json

{
    "fontsAlias": {
      "stdFont": "Times-Roman",
      "stdBold": "Times-Bold",
      "stdItalic": "Times-Italic",
      "stdBoldItalic": "Times-BoldItalic"
    }
  }

Upvotes: 0

Views: 296

Answers (1)

Lorna Mitchell
Lorna Mitchell

Reputation: 1986

This changed between versions. v0.99 onwards uses the json format - but you can also use yaml which can be a bit easier to work with and edit. The docs aren't well updated yet but I'm actively using the tool (disclaimer, I'm also one of the maintainers these days) and can answer more questions if that's useful.

Upvotes: 0

Related Questions