blob: 79938d1846dfe79607ccfe22fb2d5978a142f671 [file] [log] [blame]
Guido van Rossum643d9321992-03-31 18:53:47 +00001% Style parameters and macros used by most documents here
Guido van Rossum515834a1991-01-22 11:45:29 +00002
Guido van Rossum643d9321992-03-31 18:53:47 +00003% This has to be tuned each time the repair person takes the printer apart:
4\addtolength{\oddsidemargin}{-2.5mm}
5\addtolength{\evensidemargin}{-2.5mm}
Guido van Rossum515834a1991-01-22 11:45:29 +00006
Guido van Rossum5badc751992-03-06 10:55:46 +00007% Style parameters
8\raggedbottom
9\sloppy
10\parindent = 0mm
11\parskip = 2mm
12
Guido van Rossum4410c751991-06-04 20:22:18 +000013% Frequently used system name
Guido van Rossum515834a1991-01-22 11:45:29 +000014\newcommand{\UNIX}{U{\sc nix}}
15
Guido van Rossum4c22cb21991-01-25 13:28:15 +000016% Variable used by begin code command
Guido van Rossum44000ed1991-01-24 16:54:29 +000017\newlength{\codewidth}
Guido van Rossum44000ed1991-01-24 16:54:29 +000018
Guido van Rossum5badc751992-03-06 10:55:46 +000019% Command to start a code block (follow this by \begin{verbatim})
Guido van Rossum4c22cb21991-01-25 13:28:15 +000020\newcommand{\bcode}{
21 % Calculate the text width for the minipage:
22 \setlength{\codewidth}{\linewidth}
23 \addtolength{\codewidth}{-\parindent}
24 %
Guido van Rossum4c22cb21991-01-25 13:28:15 +000025 \par
Guido van Rossum92fba021991-11-12 15:44:51 +000026 \vspace{3mm}
Guido van Rossum4c22cb21991-01-25 13:28:15 +000027 \indent
28 \begin{minipage}[t]{\codewidth}
29}
30
Guido van Rossum5badc751992-03-06 10:55:46 +000031% Command to end a code block (precede this by \end{verbatim})
Guido van Rossum4c22cb21991-01-25 13:28:15 +000032\newcommand{\ecode}{
33 \end{minipage}
34 \vspace{3mm}
35 \par
36 \noindent
37}
Guido van Rossum5badc751992-03-06 10:55:46 +000038
39% Underscores are not magic throughout the Python documentation
40\catcode`_=12
41
42% Dummy \cbstart and \cbend so I can leave changebars in...
43\newcommand{\cbstart}{}
44\newcommand{\cbend}{}
45
46% Define \itembreak: force the text after an item to start on a new line
47\newcommand{\itembreak}{
48\mbox{}
49\\*[0mm]
50}
51
52% Command to generate two index entries (using subentries)
53\newcommand{\indexii}[2]{
54\index{#1!#2}
55\index{#2!#1}
56}
57
58% And three entries (using only one level of subentries)
59\newcommand{\indexiii}[3]{
60\index{#1!#2 #3}
61\index{#2!#3, #1}
62\index{#3!#1 #2}
63}
64
65% And four (again, using only one level of subentries)
66\newcommand{\indexiv}[4]{
67\index{#1!#2 #3 #4}
68\index{#2!#3 #4, #1}
69\index{#3!#4, #1 #2}
70\index{#4!#1 #2 #3}
71}
72
73% Command to generate a reference to a function, statement, keyword, operator
74\newcommand{\stindex}[1]{\indexii{statement}{#1@{\tt#1}}}
75\newcommand{\kwindex}[1]{\indexii{keyword}{#1@{\tt#1}}}
76\newcommand{\opindex}[1]{\indexii{operator}{#1@{\tt#1}}}
77\newcommand{\bifuncindex}[1]{\index{#1@{\tt#1} (built-in function)}}
78
79% Add an index entry for a module
80\newcommand{\modindex}[2]{\index{#1@{\tt#1} (#2module)}}
81\newcommand{\bimodindex}[1]{\modindex{#1}{built-in }}
82\newcommand{\stmodindex}[1]{\modindex{#1}{standard }}
83
84% Additional string for an index entry
85\newcommand{\indexsubitem}{}
86\newcommand{\ttindex}[1]{\index{#1@{\tt#1} \indexsubitem}}
87
88% Define \itemjoin: some negative vspace to join two items together
89\newcommand{\itemjoin}{
90\mbox{}
91\vspace{-\itemsep}
92\vspace{-\parsep}
93}
94
95% Define \funcitem{func}{args}: define a function item
96\newcommand{\funcitem}[2]{
97\ttindex{#1}
98\item[{\tt #1(#2)}]
99\
100}
101
102% Define \dataitem{name}: define a data item
103\newcommand{\dataitem}[1]{
104\ttindex{#1}
105\item[{\tt #1}]
106\
107}
108
109% Define \excitem{name}: define an exception item
110\newcommand{\excitem}[1]{
111\ttindex{#1}
112\item[{\tt #1}]
113\itembreak
114}