On Thu, 15 Dec 2016, Peter Burdine wrote:
I can't share my exact coverpage, but here are some references I used when
learning how to do it:
* https://github.com/mapserver/docs
* https://github.com/i6/ibg
I generate a variety of documents, but they all have the "same" title page
format, but the title, document number, etc differ. I store my preamble in a file that
is a
string.Template and then load it.
PREAMBLE = string.Template(open(
os.path.join(os.path.abspath('.'),'latex_templates/preamble.tex')
).read())
I have been just including the text of the preamble in conf.py for
simplicity. I did verify that it was written unchanged to the generated
.tex file.
Then I define the following for the front matter (note that some of these are
commands defined in the preamble or other included .tex/.sty file):
latex_contents = r'''
\setupHeadFootForFrontMatter
This is far beyond what I am trying to do. I literally just need to put
the title of the page on the left instead of the right. Elite level
would be changing fonts and maybe drawing a blue box. Seriously.
Now apply them in latex_elements:
latex_elements = {
# ... put your stuff here
# Customize below for your template
'preamble': PREAMBLE.substitute(docrevision=document_rev,
documentnumber=documentnumber,
Hmm. These are extra parameters? The normal expected parameters
(title, date, author) were already defined in the .tex file:
\title{Title of Book}
\date{Dec 15, 2016}
\release{.1}
...
Now here is what my title pages looks like:
\renewcommand{\maketitle}{%
\begin{titlepage}%
\pagenumbering{roman}
\thispagestyle{titlepage}
\let\footnotesize\small
\let\footnoterule\relax
%\rule{\textwidth}{1pt}%
\ifsphinxpdfoutput
\begingroup
% These \defs are required to deal with multi-line authors; it
% changes \\ to ', ' (comma-space), making it pass muster for
% generating document info in the PDF file.
\def\\{, }
\def\and{and }
\pdfinfo{
/Author (\@author)
/Title (\@title)
}
\endgroup
\fi
\begin{center}%
{\rm\Huge\py@HeaderFamily \@title \par}%
{\em\LARGE\py@HeaderFamily \py@release\releaseinfo \par}
\vfill
{\LARGE\py@HeaderFamily
\begin{tabular}[t]{c}
\@author
\end{tabular}
\par}
\py@authoraddress \par
\vfill\vfill
{\large
\vfill
%\@date \par
\vfill
}%
\end{center}%\par
\@thanks
\end{titlepage}%
\cleardoublepage%
\setcounter{footnote}{0}%
\let\thanks\relax\let\maketitle\relax
%\@ifundefined{fancyhf}{}{\pagestyle{normal}}%
}
I have seen that section of code enough today to memorize it and
recognize your changes. Yours gives me a new '<argument>
\undefinedpagestyle' error, but that is trivial. Commenting that gives
the error I have seen with monotonous regularity:
! Missing number, treated as zero.
<to be read again>
The preamble has sections that look like this to make it work like a template:
\def\documentnumber{${documentnumber}}
\def\docrevision{${docrevision}}
It really is only a slightly modified version, but I broke out the table of
contents into latex_contents. Then added table of tables, table of figures,
modified the
headers/footer, etc there as well.
If you look around, you can find other open sourced projects that are good
examples.
Oh, I found them. :) What I have not yet found is one that actually
works at all in this Sphinx environment. If the TeX code compiles, it
does not substitute variable values. More often, it gives the missing
number error, which appears to be the tex general error.
Latex is its own language and with most languages, there are about 15 ways of
doing thing. I spent a lot of time googling how things work before I was able
to get
something working that looked nice.
Well, there is doing something with stock LaTeX, and there is doing
something within the Sphinx environment with it. The contrast between the
simplified markup of Sphinx and being thrown into full-blown TeX (well,
LaTeX) just to modify a title page is... interesting. This seems like
it should be a trivial thing, or if non-trivial, at least have been
needed so often that there would be an example of it in the manual. If I
can develop that, I will contribute it.
In any case, I appreciate your help. I will keep banging my head on
this.
On Thursday, December 15, 2016 at 8:04:46 AM UTC-8, Warren Block wrote:
Is there an actual, complete example that shows the magical mix of files
and latex commands to produce a modified cover sheet? A trivial example
would be fine.
It appears that \maketitle needs to be redefined, but my attempts at
that fail with TeX errors. Or I could define my own and set 'maketitle'
in latex_elements in conf.py. Maybe. So far, none of the examples I
have found show an actual, complete, working example.
Given that this is the only way to create a custom cover page with the
default Sphinx configuration, such an example should be part of the
Sphinx docs.
I am using Sphinx 1.4.8.
--
You received this message because you are subscribed to the Google Groups
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.