blob: 398c2f33b1c0f253739db1b18751f26091ef135f [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 Rossum95cd2ef1992-12-08 14:37:55 +000016%\newcommand{\UNIX}{U{\sc nix}}
Guido van Rossum515834a1991-01-22 11:45:29 +000017
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 Rossum95cd2ef1992-12-08 14:37:55 +000043\def\_{\ifnum\fam=\ttfam \char'137\else{\tt\char'137}\fi}
44\catcode`\_=12
45\catcode`\_=\active\def_{\ifnum\fam=\ttfam \char'137 \else{\tt\char'137}\fi}
Guido van Rossum5badc751992-03-06 10:55:46 +000046
Guido van Rossum5badc751992-03-06 10:55:46 +000047% Define \itembreak: force the text after an item to start on a new line
48\newcommand{\itembreak}{
49\mbox{}
50\\*[0mm]
51}
52
53% Command to generate two index entries (using subentries)
54\newcommand{\indexii}[2]{
55\index{#1!#2}
56\index{#2!#1}
57}
58
59% And three entries (using only one level of subentries)
60\newcommand{\indexiii}[3]{
61\index{#1!#2 #3}
62\index{#2!#3, #1}
63\index{#3!#1 #2}
64}
65
66% And four (again, using only one level of subentries)
67\newcommand{\indexiv}[4]{
68\index{#1!#2 #3 #4}
69\index{#2!#3 #4, #1}
70\index{#3!#4, #1 #2}
71\index{#4!#1 #2 #3}
72}
73
74% Command to generate a reference to a function, statement, keyword, operator
75\newcommand{\stindex}[1]{\indexii{statement}{#1@{\tt#1}}}
76\newcommand{\kwindex}[1]{\indexii{keyword}{#1@{\tt#1}}}
77\newcommand{\opindex}[1]{\indexii{operator}{#1@{\tt#1}}}
Guido van Rossum6886c831992-04-03 14:44:27 +000078\newcommand{\exindex}[1]{\indexii{exception}{#1@{\tt#1}}}
79\newcommand{\obindex}[1]{\indexii{object}{#1}}
Guido van Rossum5badc751992-03-06 10:55:46 +000080\newcommand{\bifuncindex}[1]{\index{#1@{\tt#1} (built-in function)}}
81
82% Add an index entry for a module
83\newcommand{\modindex}[2]{\index{#1@{\tt#1} (#2module)}}
84\newcommand{\bimodindex}[1]{\modindex{#1}{built-in }}
85\newcommand{\stmodindex}[1]{\modindex{#1}{standard }}
86
87% Additional string for an index entry
88\newcommand{\indexsubitem}{}
89\newcommand{\ttindex}[1]{\index{#1@{\tt#1} \indexsubitem}}
90
91% Define \itemjoin: some negative vspace to join two items together
92\newcommand{\itemjoin}{
93\mbox{}
94\vspace{-\itemsep}
95\vspace{-\parsep}
96}
97
98% Define \funcitem{func}{args}: define a function item
Guido van Rossum95cd2ef1992-12-08 14:37:55 +000099\newcommand{\funcitem}[2]{%
100\ttindex{#1}%
101%\item[{\tt #1(#2)}]
102\item[\code{#1(\varvars{#2})}]
Guido van Rossum5badc751992-03-06 10:55:46 +0000103\
104}
105
Guido van Rossum95cd2ef1992-12-08 14:37:55 +0000106
107% from user-level, fulllineitems should be called as an environment
108\def\fulllineitems{\list{}{\labelwidth \leftmargin \labelsep 0pt
109\rightmargin 0pt \topsep -\parskip \partopsep \parskip
110\itemsep -\parsep
111\let\makelabel\itemnewline}}
112\let\endfulllineitems\endlist
113
114
115% funcdesc should be called as an \begin{funcdesc} ... \end{funcdesc}
116\newcommand{\funcline}[2]{\item[\code{#1(\varvars{#2})}]\ttindex{#1}}
117\newcommand{\funcdesc}[2]{\fulllineitems\funcline{#1}{#2}}
118\let\endfuncdesc\endfulllineitems
119
120% same for excdesc
121\newcommand{\excline}[1]{\item[\code{#1}]\ttindex{#1}}
122\newcommand{\excdesc}[1]{\fulllineitems\excline{#1}}
123\let\endexcdesc\endfulllineitems
124
125% same for datadesc
126\newcommand{\dataline}[1]{\item[\code{#1}]\ttindex{#1}}
127\newcommand{\datadesc}[1]{\fulllineitems\dataline{#1}}
128\let\enddatadesc\endfulllineitems
129
130
Guido van Rossum5badc751992-03-06 10:55:46 +0000131% Define \dataitem{name}: define a data item
Guido van Rossum95cd2ef1992-12-08 14:37:55 +0000132\newcommand{\dataitem}[1]{%
133\ttindex{#1}%
Guido van Rossum5badc751992-03-06 10:55:46 +0000134\item[{\tt #1}]
135\
136}
137
138% Define \excitem{name}: define an exception item
Guido van Rossum95cd2ef1992-12-08 14:37:55 +0000139\newcommand{\excitem}[1]{%
140\ttindex{#1}%
Guido van Rossum5badc751992-03-06 10:55:46 +0000141\item[{\tt #1}]
142\itembreak
143}
Guido van Rossum95cd2ef1992-12-08 14:37:55 +0000144
145\let\nodename=\label
146
147\newcommand{\ABC}{{\sc abc}}
148\newcommand{\UNIX}{{\sc Unix}}
149\newcommand{\ASCII}{{\sc ascii}}
150%\newcommand{\C}{{\bf C}}
151\newcommand{\C}{C}
152\newcommand{\EOF}{{\sc eof}}
153
154% code is the most difficult one...
155%\frenchspacing removed, because \section, etc., can't handle it
156\newcommand{\code}[1]{{\@vobeyspaces\@noligs\def\{{\char`\{}\def\}{\char`\}}\def\~{\char`\~}\def\^{\char`\^}\def\e{\char`\\}\def\${\char`\$}\def\#{\char`\#}\def\&{\char`\&}\def\%{\char`\%}%
157\mbox{\tt #1}}}
158%This one does not work
159%%%% myspecials, same as dospecials, but without {, } and \
160%%%\def\myspecials{\do\ \do\$\do\&%
161%%% \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}
162%%%\newcommand{\code}[1]{\begingroup \catcode``=13 \@noligs
163%%%\tt \let\do\@makeother \myspecials
164%%%#1\endgroup}
165\newcommand{\kbd}[1]{\mbox{\tt #1}}
166\newcommand{\key}[1]{\mbox{\tt #1}}
167\newcommand{\samp}[1]{\mbox{`\code{#1}'}}
168\newcommand{\var}[1]{\mbox{\it#1\/}}
169\let\file=\samp
170\newcommand{\dfn}[1]{{\sl #1\/}}
171\newcommand{\emph}[1]{{\em #1\/}}
172\newcommand{\strong}[1]{{\bf #1}}
173
174%\newcommand{\varvars}[1]{{\catcode`\,=\active\def,{\tt\char`\,\/tt}\var{#1}}}
175%\newcommand{\varvars}[1]{{\def\,{\/{\tt\char`\,}}\var{#1}}}
176\newcommand{\varvars}[1]{{\def\,{\/{\tt\char`\,}}\def\({\/{\tt\char`\(}}\def\){\/{\tt\char`\)}}\var{#1}}}
177
178\newif\iftexi\texifalse
179%not supported yet%\newif\iflatex\latextrue
180
181\newenvironment{tableiii}[5]{\begin{center}\def\lineiii##1##2##3{\csname#2\endcsname{##1}&##2&##3\\}\begin{tabular}{#1}\hline#3&#4&#5\\
182\hline}{\hline\end{tabular}\end{center}}
183
184\newcommand{\itemnewline}[1]{\@tempdima\linewidth
185\advance\@tempdima \leftmargin\makebox[\@tempdima][l]{#1}}
186
187\newcommand{\sectcode}[1]{{\tt #1}}
188%%%
189%%%\let\orgchapter\chapter
190%%%\def\chapter#1{{\let\code\sectcode\orgchapter{#1}}}
191%%%\let\orgsection\section
192%%%\def\section#1{{\let\code\sectcode\orgsection{#1}}}
193%%%\let\orgsubsection\subsection
194%%%\def\subsection#1{{\let\code\sectcode\orgsubsection{#1}}}
195%%%\let\orgsubsubsection\subsubsection
196%%%\def\subsubsection#1{{\let\code\sectcode\orgsubsubsection{#1}}}
197%%%\let\orgsubsubsubsection\subsubsubsection
198%%%\def\subsubsubsection#1{{\let\code\sectcode\orgsubsubsubsection{#1}}}
199