1% Needed to generate footers with total number of pages
2\RequirePackage{lastpage}
3
4% AdaCore specific maketitle
5\renewcommand{\maketitle}{%
6  \begin{titlepage}%
7    \let\footnotesize\small
8    \let\footnoterule\relax
9    \rule{\textwidth}{1pt}%
10    \ifsphinxpdfoutput
11      \begingroup
12      % These \defs are required to deal with multi-line authors; it
13      % changes \\ to ', ' (comma-space), making it pass muster for
14      % generating document info in the PDF file.
15      \def\\{, }
16      \def\and{and }
17      \pdfinfo{
18        /Author (\@author)
19        /Title (\@title)
20      }
21      \endgroup
22    \fi
23    \begin{flushright}%
24      \sphinxlogo%
25      {\rm\Huge \@title \par}%
26      {\em\LARGE\py@HeaderFamily \py@release\releaseinfo \par}
27      \vfill
28      {\LARGE\py@HeaderFamily
29        \par}
30      \vfill\vfill
31      {\large
32       \@date \par
33       \vfill
34       \py@authoraddress \par
35      }%
36    \end{flushright}%\par
37    \@thanks
38  \end{titlepage}%
39  \cleardoublepage%
40  \setcounter{footnote}{0}%
41  \let\thanks\relax\let\maketitle\relax
42}
43
44% AdaCore specific headers/footers
45% Redefine the 'normal' header/footer style when using "fancyhdr" package:
46\@ifundefined{fancyhf}{}{
47  % Use \pagestyle{normal} as the primary pagestyle for text.
48  \fancypagestyle{normal}{
49    \fancyhf{}
50    \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage\ of \pageref*{LastPage}}}
51    \fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
52    \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
53    \fancyhead[LE,RO]{{\py@HeaderFamily \@title, \py@release}}
54    \renewcommand{\headrulewidth}{0.4pt}
55    \renewcommand{\footrulewidth}{0.4pt}
56    % define chaptermark with \@chappos when \@chappos is available for Japanese
57    \ifx\@chappos\undefined\else
58      \def\chaptermark##1{\markboth{\@chapapp\space\thechapter\space\@chappos\space ##1}{}}
59    \fi
60  }
61  % Update the plain style so we get the page number & footer line,
62  % but not a chapter or section title.  This is to keep the first
63  % page of a chapter and the blank page between chapters `clean.'
64  \fancypagestyle{plain}{
65    \fancyhf{}
66    \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage\ of \pageref*{LastPage}}}
67    \fancyfoot[LO,RE]{{\py@HeaderFamily \GNATFullDocumentName}}
68    \fancyhead[LE,RO]{{\py@HeaderFamily \@title\ \GNATVersion}}
69    \renewcommand{\headrulewidth}{0.0pt}
70    \renewcommand{\footrulewidth}{0.4pt}
71  }
72}
73