|
1 | 1 | % Style parameters and macros used by some documents here |
2 | 2 |
|
3 | | -% Style parameters |
4 | | -\raggedbottom |
5 | | -\sloppy |
6 | | -\parindent = 0mm |
7 | | -\parskip = 2mm |
8 | | - |
9 | | -% Page style parameters for A4 (European standard paper size) |
| 3 | +% Page format parameters for A4 (European standard paper size) |
10 | 4 | %\textwidth = 160mm |
11 | 5 | %\textheight = 240mm |
12 | 6 | %\topmargin = -11mm |
13 | 7 |
|
14 | | -% Page style parameters for U.S. standard paper size |
| 8 | +% Page format parameters for U.S. standard paper size |
15 | 9 | \textwidth = 160mm |
16 | 10 | \textheight = 220mm |
17 | 11 | \topmargin = -11mm |
18 | 12 |
|
19 | 13 | \oddsidemargin = 1.5mm |
20 | 14 | \evensidemargin = 1.5mm |
21 | 15 |
|
| 16 | +% Style parameters |
| 17 | +\raggedbottom |
| 18 | +\sloppy |
| 19 | +\parindent = 0mm |
| 20 | +\parskip = 2mm |
| 21 | + |
22 | 22 | % Frequently used system name |
23 | 23 | \newcommand{\UNIX}{U{\sc nix}} |
24 | 24 |
|
25 | 25 | % Variable used by begin code command |
26 | 26 | \newlength{\codewidth} |
27 | 27 |
|
| 28 | +% Command to start a code block (follow this by \begin{verbatim}) |
28 | 29 | \newcommand{\bcode}{ |
29 | 30 | % Calculate the text width for the minipage: |
30 | 31 | \setlength{\codewidth}{\linewidth} |
|
36 | 37 | \begin{minipage}[t]{\codewidth} |
37 | 38 | } |
38 | 39 |
|
| 40 | +% Command to end a code block (precede this by \end{verbatim}) |
39 | 41 | \newcommand{\ecode}{ |
40 | 42 | \end{minipage} |
41 | 43 | \vspace{3mm} |
42 | 44 | \par |
43 | 45 | \noindent |
44 | 46 | } |
| 47 | + |
| 48 | +% Underscores are not magic throughout the Python documentation |
| 49 | +\catcode`_=12 |
| 50 | + |
| 51 | +% Dummy \cbstart and \cbend so I can leave changebars in... |
| 52 | +\newcommand{\cbstart}{} |
| 53 | +\newcommand{\cbend}{} |
| 54 | + |
| 55 | +% Define \itembreak: force the text after an item to start on a new line |
| 56 | +\newcommand{\itembreak}{ |
| 57 | +\mbox{} |
| 58 | +\\*[0mm] |
| 59 | +} |
| 60 | + |
| 61 | +% Command to generate two index entries (using subentries) |
| 62 | +\newcommand{\indexii}[2]{ |
| 63 | +\index{#1!#2} |
| 64 | +\index{#2!#1} |
| 65 | +} |
| 66 | + |
| 67 | +% And three entries (using only one level of subentries) |
| 68 | +\newcommand{\indexiii}[3]{ |
| 69 | +\index{#1!#2 #3} |
| 70 | +\index{#2!#3, #1} |
| 71 | +\index{#3!#1 #2} |
| 72 | +} |
| 73 | + |
| 74 | +% And four (again, using only one level of subentries) |
| 75 | +\newcommand{\indexiv}[4]{ |
| 76 | +\index{#1!#2 #3 #4} |
| 77 | +\index{#2!#3 #4, #1} |
| 78 | +\index{#3!#4, #1 #2} |
| 79 | +\index{#4!#1 #2 #3} |
| 80 | +} |
| 81 | + |
| 82 | +% Command to generate a reference to a function, statement, keyword, operator |
| 83 | +\newcommand{\stindex}[1]{\indexii{statement}{#1@{\tt#1}}} |
| 84 | +\newcommand{\kwindex}[1]{\indexii{keyword}{#1@{\tt#1}}} |
| 85 | +\newcommand{\opindex}[1]{\indexii{operator}{#1@{\tt#1}}} |
| 86 | +\newcommand{\bifuncindex}[1]{\index{#1@{\tt#1} (built-in function)}} |
| 87 | + |
| 88 | +% Add an index entry for a module |
| 89 | +\newcommand{\modindex}[2]{\index{#1@{\tt#1} (#2module)}} |
| 90 | +\newcommand{\bimodindex}[1]{\modindex{#1}{built-in }} |
| 91 | +\newcommand{\stmodindex}[1]{\modindex{#1}{standard }} |
| 92 | + |
| 93 | +% Additional string for an index entry |
| 94 | +\newcommand{\indexsubitem}{} |
| 95 | +\newcommand{\ttindex}[1]{\index{#1@{\tt#1} \indexsubitem}} |
| 96 | + |
| 97 | +% Define \itemjoin: some negative vspace to join two items together |
| 98 | +\newcommand{\itemjoin}{ |
| 99 | +\mbox{} |
| 100 | +\vspace{-\itemsep} |
| 101 | +\vspace{-\parsep} |
| 102 | +} |
| 103 | + |
| 104 | +% Define \funcitem{func}{args}: define a function item |
| 105 | +\newcommand{\funcitem}[2]{ |
| 106 | +\ttindex{#1} |
| 107 | +\item[{\tt #1(#2)}] |
| 108 | +\ |
| 109 | +} |
| 110 | + |
| 111 | +% Define \dataitem{name}: define a data item |
| 112 | +\newcommand{\dataitem}[1]{ |
| 113 | +\ttindex{#1} |
| 114 | +\item[{\tt #1}] |
| 115 | +\ |
| 116 | +} |
| 117 | + |
| 118 | +% Define \excitem{name}: define an exception item |
| 119 | +\newcommand{\excitem}[1]{ |
| 120 | +\ttindex{#1} |
| 121 | +\item[{\tt #1}] |
| 122 | +\itembreak |
| 123 | +} |
0 commit comments