blob: 609ee8196ffe4605d42ad2cf835208e0d3748c6c [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 Rossumec24f1f1992-04-06 14:02:23 +00003\input{a4wide.sty} % Take this out if it doesn't exist or doesn't work
4
Guido van Rossum643d9321992-03-31 18:53:47 +00005% This has to be tuned each time the repair person takes the printer apart:
6\addtolength{\oddsidemargin}{-2.5mm}
7\addtolength{\evensidemargin}{-2.5mm}
Guido van Rossum515834a1991-01-22 11:45:29 +00008
Guido van Rossum5badc751992-03-06 10:55:46 +00009% Style parameters
10\raggedbottom
11\sloppy
12\parindent = 0mm
13\parskip = 2mm
14
Guido van Rossum4410c751991-06-04 20:22:18 +000015% Frequently used system name
Guido van Rossum515834a1991-01-22 11:45:29 +000016\newcommand{\UNIX}{U{\sc nix}}
17
Guido van Rossum4c22cb21991-01-25 13:28:15 +000018% Variable used by begin code command
Guido van Rossum44000ed1991-01-24 16:54:29 +000019\newlength{\codewidth}
Guido van Rossum44000ed1991-01-24 16:54:29 +000020
Guido van Rossum5badc751992-03-06 10:55:46 +000021% Command to start a code block (follow this by \begin{verbatim})
Guido van Rossum4c22cb21991-01-25 13:28:15 +000022\newcommand{\bcode}{
23 % Calculate the text width for the minipage:
24 \setlength{\codewidth}{\linewidth}
25 \addtolength{\codewidth}{-\parindent}
26 %
Guido van Rossum4c22cb21991-01-25 13:28:15 +000027 \par
Guido van Rossum92fba021991-11-12 15:44:51 +000028 \vspace{3mm}
Guido van Rossum4c22cb21991-01-25 13:28:15 +000029 \indent
30 \begin{minipage}[t]{\codewidth}
31}
32
Guido van Rossum5badc751992-03-06 10:55:46 +000033% Command to end a code block (precede this by \end{verbatim})
Guido van Rossum4c22cb21991-01-25 13:28:15 +000034\newcommand{\ecode}{
35 \end{minipage}
36 \vspace{3mm}
37 \par
38 \noindent
39}
Guido van Rossum5badc751992-03-06 10:55:46 +000040
Guido van Rossumb7fc4af1992-08-07 16:06:42 +000041% Underscores are not magic throughout the Python documentation.
42% This still only gives the right effect in the tt font!!!
Guido van Rossum5badc751992-03-06 10:55:46 +000043\catcode`_=12
44
Guido van Rossum5badc751992-03-06 10:55:46 +000045% Define \itembreak: force the text after an item to start on a new line
46\newcommand{\itembreak}{
47\mbox{}
48\\*[0mm]
49}
50
51% Command to generate two index entries (using subentries)
52\newcommand{\indexii}[2]{
53\index{#1!#2}
54\index{#2!#1}
55}
56
57% And three entries (using only one level of subentries)
58\newcommand{\indexiii}[3]{
59\index{#1!#2 #3}
60\index{#2!#3, #1}
61\index{#3!#1 #2}
62}
63
64% And four (again, using only one level of subentries)
65\newcommand{\indexiv}[4]{
66\index{#1!#2 #3 #4}
67\index{#2!#3 #4, #1}
68\index{#3!#4, #1 #2}
69\index{#4!#1 #2 #3}
70}
71
72% Command to generate a reference to a function, statement, keyword, operator
73\newcommand{\stindex}[1]{\indexii{statement}{#1@{\tt#1}}}
74\newcommand{\kwindex}[1]{\indexii{keyword}{#1@{\tt#1}}}
75\newcommand{\opindex}[1]{\indexii{operator}{#1@{\tt#1}}}
Guido van Rossum6886c831992-04-03 14:44:27 +000076\newcommand{\exindex}[1]{\indexii{exception}{#1@{\tt#1}}}
77\newcommand{\obindex}[1]{\indexii{object}{#1}}
Guido van Rossum5badc751992-03-06 10:55:46 +000078\newcommand{\bifuncindex}[1]{\index{#1@{\tt#1} (built-in function)}}
79
80% Add an index entry for a module
81\newcommand{\modindex}[2]{\index{#1@{\tt#1} (#2module)}}
82\newcommand{\bimodindex}[1]{\modindex{#1}{built-in }}
83\newcommand{\stmodindex}[1]{\modindex{#1}{standard }}
84
85% Additional string for an index entry
86\newcommand{\indexsubitem}{}
87\newcommand{\ttindex}[1]{\index{#1@{\tt#1} \indexsubitem}}
88
89% Define \itemjoin: some negative vspace to join two items together
90\newcommand{\itemjoin}{
91\mbox{}
92\vspace{-\itemsep}
93\vspace{-\parsep}
94}
95
96% Define \funcitem{func}{args}: define a function item
97\newcommand{\funcitem}[2]{
98\ttindex{#1}
99\item[{\tt #1(#2)}]
100\
101}
102
103% Define \dataitem{name}: define a data item
104\newcommand{\dataitem}[1]{
105\ttindex{#1}
106\item[{\tt #1}]
107\
108}
109
110% Define \excitem{name}: define an exception item
111\newcommand{\excitem}[1]{
112\ttindex{#1}
113\item[{\tt #1}]
114\itembreak
115}