|
13 | 13 | \parskip = 2mm |
14 | 14 |
|
15 | 15 | % Frequently used system name |
16 | | -\newcommand{\UNIX}{U{\sc nix}} |
| 16 | +%\newcommand{\UNIX}{U{\sc nix}} |
17 | 17 |
|
18 | 18 | % Variable used by begin code command |
19 | 19 | \newlength{\codewidth} |
|
40 | 40 |
|
41 | 41 | % Underscores are not magic throughout the Python documentation. |
42 | 42 | % This still only gives the right effect in the tt font!!! |
43 | | -\catcode`_=12 |
| 43 | +\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} |
44 | 46 |
|
45 | 47 | % Define \itembreak: force the text after an item to start on a new line |
46 | 48 | \newcommand{\itembreak}{ |
|
94 | 96 | } |
95 | 97 |
|
96 | 98 | % Define \funcitem{func}{args}: define a function item |
97 | | -\newcommand{\funcitem}[2]{ |
98 | | -\ttindex{#1} |
99 | | -\item[{\tt #1(#2)}] |
| 99 | +\newcommand{\funcitem}[2]{% |
| 100 | +\ttindex{#1}% |
| 101 | +%\item[{\tt #1(#2)}] |
| 102 | +\item[\code{#1(\varvars{#2})}] |
100 | 103 | \ |
101 | 104 | } |
102 | 105 |
|
| 106 | + |
| 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 | + |
103 | 131 | % Define \dataitem{name}: define a data item |
104 | | -\newcommand{\dataitem}[1]{ |
105 | | -\ttindex{#1} |
| 132 | +\newcommand{\dataitem}[1]{% |
| 133 | +\ttindex{#1}% |
106 | 134 | \item[{\tt #1}] |
107 | 135 | \ |
108 | 136 | } |
109 | 137 |
|
110 | 138 | % Define \excitem{name}: define an exception item |
111 | | -\newcommand{\excitem}[1]{ |
112 | | -\ttindex{#1} |
| 139 | +\newcommand{\excitem}[1]{% |
| 140 | +\ttindex{#1}% |
113 | 141 | \item[{\tt #1}] |
114 | 142 | \itembreak |
115 | 143 | } |
| 144 | + |
| 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\\ |
| 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 | +
|
0 commit comments