Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 28f1391

Browse files
committed
Improve separation of document class and python semantic constructs. This
will allow us to have a class of smaller documents as well.
1 parent f888350 commit 28f1391

4 files changed

Lines changed: 144 additions & 134 deletions

File tree

Doc/manual.cls

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
66
\ProvidesClass{manual}
7-
[1998/03/03 Python manual]
7+
[1998/03/03 Document class (Python manual)]
8+
89

910
% Change the options here to get a different set of basic options, This
1011
% is where to add things like "a4paper" or "10pt".
@@ -37,3 +38,63 @@
3738
% This should come last. Do not change this.
3839
%
3940
\RequirePackage{python}
41+
42+
43+
% Change the title page to look a bit better, and fit in with the
44+
% fncychap ``Bjarne'' style a bit better.
45+
%
46+
\renewcommand{\maketitle}{%
47+
\begin{titlepage}%
48+
\let\footnotesize\small
49+
\let\footnoterule\relax
50+
\@ifundefined{ChTitleVar}{}{%
51+
\mghrulefill{\RW}}%
52+
\@ifundefined{pdfinfo}{}{
53+
\pdfinfo
54+
author {\@author}
55+
title {\@title}
56+
}
57+
\begin{flushright}%
58+
{\rm\Huge\HeaderFamily \@title \par}%
59+
{\em\LARGE\HeaderFamily \@release \par}
60+
\vfill
61+
{\LARGE\HeaderFamily \@author \par}
62+
\vfill\vfill
63+
{\large
64+
\@date \par
65+
\vfill
66+
\@authoraddress \par
67+
}%
68+
\end{flushright}%\par
69+
\@thanks
70+
\end{titlepage}%
71+
\setcounter{footnote}{0}%
72+
\let\thanks\relax\let\maketitle\relax
73+
\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
74+
}
75+
76+
77+
% This wraps the \tableofcontents macro with all the magic to get the
78+
% spacing right and have the right number of pages if the 'openright'
79+
% option has been used. This eliminates a fair amount of crud in the
80+
% individual document files.
81+
%
82+
\let\OldTableofcontents=\tableofcontents
83+
\renewcommand{\tableofcontents}{%
84+
\setcounter{page}{1}%
85+
\pagebreak%
86+
\pagestyle{plain}%
87+
{%
88+
\parskip = 0mm%
89+
\OldTableofcontents%
90+
\if@openright%
91+
\ifodd\value{page}%
92+
\typeout{Adding blank page after the table of contents.}%
93+
\pagebreak\hspace{0pt}%
94+
\fi%
95+
\fi%
96+
\cleardoublepage%
97+
}%
98+
\pagenumbering{arabic}%
99+
\@ifundefined{fancyhf}{}{\pagestyle{normal}}%
100+
}

Doc/python.sty

Lines changed: 10 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
% .sty file is distributed with Python, so you should not need to disable
1111
% it. You'd also end up with a mixed page style; uglier than stock LaTeX!
1212
%
13-
\RequirePackage[Bjarne]{fncychap}\typeout{Using nice chapter headings.}
13+
\RequirePackage[Bjarne]{fncychap}\typeout{Using fancy chapter headings.}
1414

1515

1616
% for PDF output, use maximal compression
@@ -121,12 +121,15 @@
121121
% Redefine \cleardoublepage so that the blank page between chapters
122122
% gets the plain style and not the fancy style. This is described
123123
% in the documentation for the fancyhdr package by Piet von Oostrum.
124-
\renewcommand{\cleardoublepage}{
125-
\clearpage\if@openright \ifodd\c@page\else
126-
\hbox{}
127-
\thispagestyle{plain}
128-
\newpage
129-
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
124+
\@ifundefined{chapter}{}{
125+
\renewcommand{\cleardoublepage}{
126+
\clearpage\if@openright \ifodd\c@page\else
127+
\hbox{}
128+
\thispagestyle{plain}
129+
\newpage
130+
\if@twocolumn\hbox{}\newpage\fi\fi\fi
131+
}
132+
}
130133
}
131134

132135
% old code font selections:
@@ -523,31 +526,6 @@
523526
\OldEndAbstract
524527
}
525528

526-
% This wraps the \tableofcontents macro with all the magic to get the
527-
% spacing right and have the right number of pages if the 'openright'
528-
% option has been used. This eliminates a fair amount of crud in the
529-
% individual document files.
530-
%
531-
\let\OldTableofcontents=\tableofcontents
532-
\renewcommand{\tableofcontents}[0]{%
533-
\setcounter{page}{1}%
534-
\pagebreak%
535-
\pagestyle{plain}%
536-
{%
537-
\parskip = 0mm%
538-
\OldTableofcontents%
539-
\if@openright%
540-
\ifodd\value{page}%
541-
\typeout{Adding blank page after the table of contents.}%
542-
\pagebreak\hspace{0pt}%
543-
\fi%
544-
\fi%
545-
}%
546-
\cleardoublepage%
547-
\pagenumbering{arabic}%
548-
\@ifundefined{fancyhf}{}{\pagestyle{normal}}%
549-
}
550-
551529
% Allow the release number to be specified independently of the
552530
% \date{}. This allows the date to reflect the document's date and
553531
% release to specify the Python release that is documented.
@@ -566,39 +544,6 @@
566544
\newcommand{\@authoraddress}{}
567545
\newcommand{\authoraddress}[1]{\renewcommand{\@authoraddress}{#1}}
568546

569-
% Change the title page to look a bit better, and fit in with the
570-
% fncychap ``Bjarne'' style a bit better.
571-
%
572-
\renewcommand{\maketitle}{%
573-
\begin{titlepage}%
574-
\let\footnotesize\small
575-
\let\footnoterule\relax
576-
\@ifundefined{ChTitleVar}{}{%
577-
\mghrulefill{\RW}}%
578-
\@ifundefined{pdfinfo}{}{
579-
\pdfinfo
580-
author {\@author}
581-
title {\@title}
582-
}
583-
\begin{flushright}%
584-
{\rm\Huge\HeaderFamily \@title \par}%
585-
{\em\LARGE\HeaderFamily \@release \par}
586-
\vfill
587-
{\LARGE\HeaderFamily \@author \par}
588-
\vfill\vfill
589-
{\large
590-
\@date \par
591-
\vskip 3em
592-
\@authoraddress \par
593-
}%
594-
\end{flushright}%\par
595-
\@thanks
596-
\end{titlepage}%
597-
\setcounter{footnote}{0}%
598-
\let\thanks\relax\let\maketitle\relax
599-
\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
600-
}
601-
602547
% This sets up the fancy chapter headings that make the documents look
603548
% at least a little better than the usual LaTeX output.
604549
%
@@ -616,7 +561,6 @@
616561
\DOTI{#1}
617562
}
618563
}
619-
\typeout{Using fancy chapter headings.}
620564
}
621565

622566
% Tell TeX about pathological hyphenation cases:

Doc/texinputs/manual.cls

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
66
\ProvidesClass{manual}
7-
[1998/03/03 Python manual]
7+
[1998/03/03 Document class (Python manual)]
8+
89

910
% Change the options here to get a different set of basic options, This
1011
% is where to add things like "a4paper" or "10pt".
@@ -37,3 +38,63 @@
3738
% This should come last. Do not change this.
3839
%
3940
\RequirePackage{python}
41+
42+
43+
% Change the title page to look a bit better, and fit in with the
44+
% fncychap ``Bjarne'' style a bit better.
45+
%
46+
\renewcommand{\maketitle}{%
47+
\begin{titlepage}%
48+
\let\footnotesize\small
49+
\let\footnoterule\relax
50+
\@ifundefined{ChTitleVar}{}{%
51+
\mghrulefill{\RW}}%
52+
\@ifundefined{pdfinfo}{}{
53+
\pdfinfo
54+
author {\@author}
55+
title {\@title}
56+
}
57+
\begin{flushright}%
58+
{\rm\Huge\HeaderFamily \@title \par}%
59+
{\em\LARGE\HeaderFamily \@release \par}
60+
\vfill
61+
{\LARGE\HeaderFamily \@author \par}
62+
\vfill\vfill
63+
{\large
64+
\@date \par
65+
\vfill
66+
\@authoraddress \par
67+
}%
68+
\end{flushright}%\par
69+
\@thanks
70+
\end{titlepage}%
71+
\setcounter{footnote}{0}%
72+
\let\thanks\relax\let\maketitle\relax
73+
\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
74+
}
75+
76+
77+
% This wraps the \tableofcontents macro with all the magic to get the
78+
% spacing right and have the right number of pages if the 'openright'
79+
% option has been used. This eliminates a fair amount of crud in the
80+
% individual document files.
81+
%
82+
\let\OldTableofcontents=\tableofcontents
83+
\renewcommand{\tableofcontents}{%
84+
\setcounter{page}{1}%
85+
\pagebreak%
86+
\pagestyle{plain}%
87+
{%
88+
\parskip = 0mm%
89+
\OldTableofcontents%
90+
\if@openright%
91+
\ifodd\value{page}%
92+
\typeout{Adding blank page after the table of contents.}%
93+
\pagebreak\hspace{0pt}%
94+
\fi%
95+
\fi%
96+
\cleardoublepage%
97+
}%
98+
\pagenumbering{arabic}%
99+
\@ifundefined{fancyhf}{}{\pagestyle{normal}}%
100+
}

Doc/texinputs/python.sty

Lines changed: 10 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
% .sty file is distributed with Python, so you should not need to disable
1111
% it. You'd also end up with a mixed page style; uglier than stock LaTeX!
1212
%
13-
\RequirePackage[Bjarne]{fncychap}\typeout{Using nice chapter headings.}
13+
\RequirePackage[Bjarne]{fncychap}\typeout{Using fancy chapter headings.}
1414

1515

1616
% for PDF output, use maximal compression
@@ -121,12 +121,15 @@
121121
% Redefine \cleardoublepage so that the blank page between chapters
122122
% gets the plain style and not the fancy style. This is described
123123
% in the documentation for the fancyhdr package by Piet von Oostrum.
124-
\renewcommand{\cleardoublepage}{
125-
\clearpage\if@openright \ifodd\c@page\else
126-
\hbox{}
127-
\thispagestyle{plain}
128-
\newpage
129-
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
124+
\@ifundefined{chapter}{}{
125+
\renewcommand{\cleardoublepage}{
126+
\clearpage\if@openright \ifodd\c@page\else
127+
\hbox{}
128+
\thispagestyle{plain}
129+
\newpage
130+
\if@twocolumn\hbox{}\newpage\fi\fi\fi
131+
}
132+
}
130133
}
131134

132135
% old code font selections:
@@ -523,31 +526,6 @@
523526
\OldEndAbstract
524527
}
525528

526-
% This wraps the \tableofcontents macro with all the magic to get the
527-
% spacing right and have the right number of pages if the 'openright'
528-
% option has been used. This eliminates a fair amount of crud in the
529-
% individual document files.
530-
%
531-
\let\OldTableofcontents=\tableofcontents
532-
\renewcommand{\tableofcontents}[0]{%
533-
\setcounter{page}{1}%
534-
\pagebreak%
535-
\pagestyle{plain}%
536-
{%
537-
\parskip = 0mm%
538-
\OldTableofcontents%
539-
\if@openright%
540-
\ifodd\value{page}%
541-
\typeout{Adding blank page after the table of contents.}%
542-
\pagebreak\hspace{0pt}%
543-
\fi%
544-
\fi%
545-
}%
546-
\cleardoublepage%
547-
\pagenumbering{arabic}%
548-
\@ifundefined{fancyhf}{}{\pagestyle{normal}}%
549-
}
550-
551529
% Allow the release number to be specified independently of the
552530
% \date{}. This allows the date to reflect the document's date and
553531
% release to specify the Python release that is documented.
@@ -566,39 +544,6 @@
566544
\newcommand{\@authoraddress}{}
567545
\newcommand{\authoraddress}[1]{\renewcommand{\@authoraddress}{#1}}
568546

569-
% Change the title page to look a bit better, and fit in with the
570-
% fncychap ``Bjarne'' style a bit better.
571-
%
572-
\renewcommand{\maketitle}{%
573-
\begin{titlepage}%
574-
\let\footnotesize\small
575-
\let\footnoterule\relax
576-
\@ifundefined{ChTitleVar}{}{%
577-
\mghrulefill{\RW}}%
578-
\@ifundefined{pdfinfo}{}{
579-
\pdfinfo
580-
author {\@author}
581-
title {\@title}
582-
}
583-
\begin{flushright}%
584-
{\rm\Huge\HeaderFamily \@title \par}%
585-
{\em\LARGE\HeaderFamily \@release \par}
586-
\vfill
587-
{\LARGE\HeaderFamily \@author \par}
588-
\vfill\vfill
589-
{\large
590-
\@date \par
591-
\vskip 3em
592-
\@authoraddress \par
593-
}%
594-
\end{flushright}%\par
595-
\@thanks
596-
\end{titlepage}%
597-
\setcounter{footnote}{0}%
598-
\let\thanks\relax\let\maketitle\relax
599-
\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
600-
}
601-
602547
% This sets up the fancy chapter headings that make the documents look
603548
% at least a little better than the usual LaTeX output.
604549
%
@@ -616,7 +561,6 @@
616561
\DOTI{#1}
617562
}
618563
}
619-
\typeout{Using fancy chapter headings.}
620564
}
621565

622566
% Tell TeX about pathological hyphenation cases:

0 commit comments

Comments
 (0)