Guido van Rossum | 643d932 | 1992-03-31 18:53:47 +0000 | [diff] [blame] | 1 | % Style parameters and macros used by most documents here |
Guido van Rossum | 515834a | 1991-01-22 11:45:29 +0000 | [diff] [blame] | 2 | |
Guido van Rossum | ec24f1f | 1992-04-06 14:02:23 +0000 | [diff] [blame] | 3 | \input{a4wide.sty} % Take this out if it doesn't exist or doesn't work |
| 4 | |
Guido van Rossum | 643d932 | 1992-03-31 18:53:47 +0000 | [diff] [blame] | 5 | % 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 Rossum | 515834a | 1991-01-22 11:45:29 +0000 | [diff] [blame] | 8 | |
Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 9 | % Style parameters |
| 10 | \raggedbottom |
| 11 | \sloppy |
| 12 | \parindent = 0mm |
| 13 | \parskip = 2mm |
| 14 | |
Guido van Rossum | 4410c75 | 1991-06-04 20:22:18 +0000 | [diff] [blame] | 15 | % Frequently used system name |
Guido van Rossum | 515834a | 1991-01-22 11:45:29 +0000 | [diff] [blame] | 16 | \newcommand{\UNIX}{U{\sc nix}} |
| 17 | |
Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 18 | % Variable used by begin code command |
Guido van Rossum | 44000ed | 1991-01-24 16:54:29 +0000 | [diff] [blame] | 19 | \newlength{\codewidth} |
Guido van Rossum | 44000ed | 1991-01-24 16:54:29 +0000 | [diff] [blame] | 20 | |
Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 21 | % Command to start a code block (follow this by \begin{verbatim}) |
Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 22 | \newcommand{\bcode}{ |
| 23 | % Calculate the text width for the minipage: |
| 24 | \setlength{\codewidth}{\linewidth} |
| 25 | \addtolength{\codewidth}{-\parindent} |
| 26 | % |
Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 27 | \par |
Guido van Rossum | 92fba02 | 1991-11-12 15:44:51 +0000 | [diff] [blame] | 28 | \vspace{3mm} |
Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 29 | \indent |
| 30 | \begin{minipage}[t]{\codewidth} |
| 31 | } |
| 32 | |
Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 33 | % Command to end a code block (precede this by \end{verbatim}) |
Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 34 | \newcommand{\ecode}{ |
| 35 | \end{minipage} |
| 36 | \vspace{3mm} |
| 37 | \par |
| 38 | \noindent |
| 39 | } |
Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 40 | |
Guido van Rossum | b7fc4af | 1992-08-07 16:06:42 +0000 | [diff] [blame^] | 41 | % Underscores are not magic throughout the Python documentation. |
| 42 | % This still only gives the right effect in the tt font!!! |
Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 43 | \catcode`_=12 |
| 44 | |
| 45 | % Dummy \cbstart and \cbend so I can leave changebars in... |
| 46 | \newcommand{\cbstart}{} |
| 47 | \newcommand{\cbend}{} |
| 48 | |
| 49 | % Define \itembreak: force the text after an item to start on a new line |
| 50 | \newcommand{\itembreak}{ |
| 51 | \mbox{} |
| 52 | \\*[0mm] |
| 53 | } |
| 54 | |
| 55 | % Command to generate two index entries (using subentries) |
| 56 | \newcommand{\indexii}[2]{ |
| 57 | \index{#1!#2} |
| 58 | \index{#2!#1} |
| 59 | } |
| 60 | |
| 61 | % And three entries (using only one level of subentries) |
| 62 | \newcommand{\indexiii}[3]{ |
| 63 | \index{#1!#2 #3} |
| 64 | \index{#2!#3, #1} |
| 65 | \index{#3!#1 #2} |
| 66 | } |
| 67 | |
| 68 | % And four (again, using only one level of subentries) |
| 69 | \newcommand{\indexiv}[4]{ |
| 70 | \index{#1!#2 #3 #4} |
| 71 | \index{#2!#3 #4, #1} |
| 72 | \index{#3!#4, #1 #2} |
| 73 | \index{#4!#1 #2 #3} |
| 74 | } |
| 75 | |
| 76 | % Command to generate a reference to a function, statement, keyword, operator |
| 77 | \newcommand{\stindex}[1]{\indexii{statement}{#1@{\tt#1}}} |
| 78 | \newcommand{\kwindex}[1]{\indexii{keyword}{#1@{\tt#1}}} |
| 79 | \newcommand{\opindex}[1]{\indexii{operator}{#1@{\tt#1}}} |
Guido van Rossum | 6886c83 | 1992-04-03 14:44:27 +0000 | [diff] [blame] | 80 | \newcommand{\exindex}[1]{\indexii{exception}{#1@{\tt#1}}} |
| 81 | \newcommand{\obindex}[1]{\indexii{object}{#1}} |
Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 82 | \newcommand{\bifuncindex}[1]{\index{#1@{\tt#1} (built-in function)}} |
| 83 | |
| 84 | % Add an index entry for a module |
| 85 | \newcommand{\modindex}[2]{\index{#1@{\tt#1} (#2module)}} |
| 86 | \newcommand{\bimodindex}[1]{\modindex{#1}{built-in }} |
| 87 | \newcommand{\stmodindex}[1]{\modindex{#1}{standard }} |
| 88 | |
| 89 | % Additional string for an index entry |
| 90 | \newcommand{\indexsubitem}{} |
| 91 | \newcommand{\ttindex}[1]{\index{#1@{\tt#1} \indexsubitem}} |
| 92 | |
| 93 | % Define \itemjoin: some negative vspace to join two items together |
| 94 | \newcommand{\itemjoin}{ |
| 95 | \mbox{} |
| 96 | \vspace{-\itemsep} |
| 97 | \vspace{-\parsep} |
| 98 | } |
| 99 | |
| 100 | % Define \funcitem{func}{args}: define a function item |
| 101 | \newcommand{\funcitem}[2]{ |
| 102 | \ttindex{#1} |
| 103 | \item[{\tt #1(#2)}] |
| 104 | \ |
| 105 | } |
| 106 | |
| 107 | % Define \dataitem{name}: define a data item |
| 108 | \newcommand{\dataitem}[1]{ |
| 109 | \ttindex{#1} |
| 110 | \item[{\tt #1}] |
| 111 | \ |
| 112 | } |
| 113 | |
| 114 | % Define \excitem{name}: define an exception item |
| 115 | \newcommand{\excitem}[1]{ |
| 116 | \ttindex{#1} |
| 117 | \item[{\tt #1}] |
| 118 | \itembreak |
| 119 | } |