'Sphinx conf.py - pass additional document specific data to each PDF like document title and author
My goal is to create a set of PDF documents using Sphinx in an automated process, except I've found I'm too limited in what document specific information I can pass using latex_documents tuple in conf.py. I'll try to explain what I've tried so far, how this is limits what I would like to do and an example "hypothetical" solution.
What I've tried so far:
As stated, my goal is to create a set of documents and my configuration uses a single conf.py. To create a set of documents from a single conf.py, the "latex_documents" keyword references document specific information. It does so using a list of tuples, one tuple per document. This tuple, for example, contains reference to each specific document's index file, author and title (the index file then references the relevant restructured text etc).
This is great because I can update the name of the document's specific author and title on each title page, and the body of the text is picked up from the index.
Here is an example of a single tuple, representing one document, associated with the latex_documents keyword:
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [('path/to/index', 'document_name', 'my document title', 'JSt', 'howto')]
In this example, Sphinx can make JSt, the author's name, appear on the title page.
What is the limitation?
But what if we also wanted to pass to each document's title page, automatically, more information: an executive summary, reviewer name, approver name, document number and even more. This is information, like author, is document specific and will be placed on the generic title page and / or headers and footers (and therefore cannot be put in the restructuredtext or markdown input either).
Hypothetical solution
An example solution, if latex_documents input wasn't / isn't prescriptive, could be as follows.
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, reviewer, approver, document number, documentclass [howto, manual, or own class]).
latex_documents = [('path/to/index', 'document_name', 'my document title', 'JSt', 'ABc', 'ZYx', 'DOC007' 'howto')]
Which by calling in the title page as somthing like:
\@author
\@reviewer
\@approver
\@docnum
Will create something like the following in the tex.
\author{JSt}
\reviewer{ABc}
\approver{ZYx}
\docnum{DOC007}
Does anyone have advice on passing additional document specific information to the title page, headers and footers of a document in the same way author is?
Thanks in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
