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 | 643d932 | 1992-03-31 18:53:47 +0000 | [diff] [blame^] | 3 | % 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 Rossum | 515834a | 1991-01-22 11:45:29 +0000 | [diff] [blame] | 6 | |
Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 7 | % Style parameters |
| 8 | \raggedbottom |
| 9 | \sloppy |
| 10 | \parindent = 0mm |
| 11 | \parskip = 2mm |
| 12 | |
Guido van Rossum | 4410c75 | 1991-06-04 20:22:18 +0000 | [diff] [blame] | 13 | % Frequently used system name |
Guido van Rossum | 515834a | 1991-01-22 11:45:29 +0000 | [diff] [blame] | 14 | \newcommand{\UNIX}{U{\sc nix}} |
| 15 | |
Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 16 | % Variable used by begin code command |
Guido van Rossum | 44000ed | 1991-01-24 16:54:29 +0000 | [diff] [blame] | 17 | \newlength{\codewidth} |
Guido van Rossum | 44000ed | 1991-01-24 16:54:29 +0000 | [diff] [blame] | 18 | |
Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 19 | % Command to start a code block (follow this by \begin{verbatim}) |
Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 20 | \newcommand{\bcode}{ |
| 21 | % Calculate the text width for the minipage: |
| 22 | \setlength{\codewidth}{\linewidth} |
| 23 | \addtolength{\codewidth}{-\parindent} |
| 24 | % |
Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 25 | \par |
Guido van Rossum | 92fba02 | 1991-11-12 15:44:51 +0000 | [diff] [blame] | 26 | \vspace{3mm} |
Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 27 | \indent |
| 28 | \begin{minipage}[t]{\codewidth} |
| 29 | } |
| 30 | |
Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 31 | % Command to end a code block (precede this by \end{verbatim}) |
Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 32 | \newcommand{\ecode}{ |
| 33 | \end{minipage} |
| 34 | \vspace{3mm} |
| 35 | \par |
| 36 | \noindent |
| 37 | } |
Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 38 | |
| 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 | } |