Skip to content

Commit

Permalink
LaTeX: add custom page header with url
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Dec 19, 2017
1 parent f40e8f7 commit e23954d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,37 @@ def setup(app):

# -- LATEX ---------------------------------------------------------------

latex_macros += r'''
\makeatletter
\ltx@ifundefined{fancyhf}{}{
% Use \pagestyle{normal} as the primary pagestyle for text.
\fancypagestyle{normal}{
\fancyhf{}
% (for \py@HeaderFamily cf "TITLES")
\fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
\fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
\fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
\fancyhead[LE,RO]{{\py@HeaderFamily
\href{http://sfstoolbox.org/}{\color{black}http://sfstoolbox.org/} \hfill \py@release}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
% define chaptermark with \@chappos when \@chappos is available for Japanese
\ltx@ifundefined{@chappos}{}
{\def\chaptermark##1{\markboth{\@chapapp\space\thechapter\space\@chappos\space ##1}{}}}
}
% Update the plain style so we get the page number & footer line,
% but not a chapter or section title. This is to keep the first
% page of a chapter and the blank page between chapters `clean.'
\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}
}
}
\makeatother
'''

latex_elements = {
'papersize': 'a4paper',
'pointsize': '10pt',
Expand Down

0 comments on commit e23954d

Please sign in to comment.