brechtm / rinohtype

The Python document processor
http://www.mos6581.org/rinohtype
GNU Affero General Public License v3.0
499 stars 59 forks source link

Where does a .rtt file need to go? #366

Closed techauthoruk closed 1 year ago

techauthoruk commented 1 year ago

I'm very new to rinohtype, and struggling to get the configuration for my use case just right.

I generate my pdf files using Sphinx (make rinoh) which works absolutely as it should and the pdf is created fine using the book template. however, instead of 'Chapter' appearing I want to use 'Section' instead. I believe I need to create a .rtt file to override the chapter titles as detailed here: http://www.mos6581.org/rinohtype/master/basicstyling.html#configuring-a-template

Fine with that, but I need to save it as (say) book.rtt and then detail this in my Sphinx conf.py file as per the example:

rinoh_documents = [
    dict(doc='index', target='manual', toctree_only=False,
         template='manual.rtt', logo='logo.pdf'),
    dict(doc='ref', target='reference', title='Reference Manual',
         template='reference.rtt', stamp='DRAFT'),
]

This is where I'm getting really confused. I have created a .rtt file, but have two issues:

  1. where does it need to sit?
  2. do I need to have both dict lines (as in the example)

I have put the .rtt file in the same directory as the template files, but when I build, I get an error like:

rinoh.resource.ResourceNotFound: (<class 'rinoh.template.DocumentTemplate'>, 'book.rtt', 'book.rtt')

So obviously my .rtt file is in the wrong place. Apologies for being so dim about this, but can anyone point me in the right direction?

techauthoruk commented 1 year ago

OK, I said I was dim! Finally figured out that the .rtt file needs to go in the Sphinx source directory.

All sorted now, so closing this off.

brechtm commented 1 year ago

Good to see you've figured it out!

The .rtt (and .rts) file can go anywhere. The path pointing to it in conf.py just needs to be relative to the directory where conf.py sits. Or I suppose it can be an absolute path, but you'd never want that in practice.

brechtm commented 1 year ago

I just want to add that this one of many things that needs to be documented properly!