(py-indent-right, py-outdent-left): new commands, bound to C-c C-r and
[python/dscho.git] / Doc / myformat.sty
blob22d7ad46cf270abb5e88e2cf7bca10bda8244996
1 % Style parameters and macros used by most documents here
3 \input{a4wide.sty} % Take this out if it doesn't exist or doesn't work
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}
9 % Style parameters
10 \raggedbottom
11 \sloppy
12 \parindent = 0mm
13 \parskip = 2mm
15 % Variable used by begin code command
16 \newlength{\codewidth}
18 % Command to start a code block (follow this by \begin{verbatim})
19 \newcommand{\bcode}{
20 % Calculate the text width for the minipage:
21 \setlength{\codewidth}{\linewidth}
22 \addtolength{\codewidth}{-\parindent}
24 \par
25 \vspace{3mm}
26 \indent
27 \begin{minipage}[t]{\codewidth}
30 % Command to end a code block (precede this by \end{verbatim})
31 \newcommand{\ecode}{
32 \end{minipage}
33 \vspace{3mm}
34 \par
35 \noindent
38 % Underscores are not magic throughout the Python documentation.
39 % This still only gives the right effect in the tt font!!!
40 \def\_{\ifnum\fam=\ttfam \char'137\else{\tt\char'137}\fi}
41 \catcode`\_=12
42 \catcode`\_=\active\def_{\ifnum\fam=\ttfam \char'137 \else{\tt\char'137}\fi}
44 % Define \itembreak: force the text after an item to start on a new line
45 \newcommand{\itembreak}{
46 \mbox{}
47 \\*[0mm]
50 % Command to generate two index entries (using subentries)
51 \newcommand{\indexii}[2]{\index{#1!#2}\index{#2!#1}}
53 % And three entries (using only one level of subentries)
54 \newcommand{\indexiii}[3]{\index{#1!#2 #3}\index{#2!#3, #1}\index{#3!#1 #2}}
56 % And four (again, using only one level of subentries)
57 \newcommand{\indexiv}[4]{
58 \index{#1!#2 #3 #4}
59 \index{#2!#3 #4, #1}
60 \index{#3!#4, #1 #2}
61 \index{#4!#1 #2 #3}
64 % Command to generate a reference to a function, statement, keyword, operator
65 \newcommand{\stindex}[1]{\indexii{statement}{#1@{\tt#1}}}
66 \newcommand{\kwindex}[1]{\indexii{keyword}{#1@{\tt#1}}}
67 \newcommand{\opindex}[1]{\indexii{operator}{#1@{\tt#1}}}
68 \newcommand{\exindex}[1]{\indexii{exception}{#1@{\tt#1}}}
69 \newcommand{\obindex}[1]{\indexii{object}{#1}}
70 \newcommand{\bifuncindex}[1]{\index{#1@{\tt#1} (built-in function)}}
72 % Add an index entry for a module
73 \newcommand{\modindex}[2]{\index{#1@{\tt#1} (#2module)}}
74 \newcommand{\bimodindex}[1]{\modindex{#1}{built-in }}
75 \newcommand{\stmodindex}[1]{\modindex{#1}{standard }}
77 % Additional string for an index entry
78 \newcommand{\indexsubitem}{}
79 \newcommand{\ttindex}[1]{\index{#1@{\tt#1} \indexsubitem}}
81 % Define \itemjoin: some negative vspace to join two items together
82 \newcommand{\itemjoin}{
83 \mbox{}
84 \vspace{-\itemsep}
85 \vspace{-\parsep}
88 % Define \funcitem{func}{args}: define a function item
89 \newcommand{\funcitem}[2]{%
90 \ttindex{#1}%
91 %\item[{\tt #1(#2)}]
92 \item[\code{#1(\varvars{#2})}]
97 % from user-level, fulllineitems should be called as an environment
98 \def\fulllineitems{\list{}{\labelwidth \leftmargin \labelsep 0pt
99 \rightmargin 0pt \topsep -\parskip \partopsep \parskip
100 \itemsep -\parsep
101 \let\makelabel\itemnewline}}
102 \let\endfulllineitems\endlist
105 % funcdesc should be called as an \begin{funcdesc} ... \end{funcdesc}
106 \newcommand{\funcline}[2]{\item[\code{#1(\varvars{#2})}]\ttindex{#1}}
107 \newcommand{\funcdesc}[2]{\fulllineitems\funcline{#1}{#2}}
108 \let\endfuncdesc\endfulllineitems
109 \newcommand{\optional}[1]{{\ \Large[}{#1}\hspace{0.5mm}{\Large]}\ }
112 % same for excdesc
113 \newcommand{\excline}[1]{\item[\code{#1}]\ttindex{#1}}
114 \newcommand{\excdesc}[1]{\fulllineitems\excline{#1}}
115 \let\endexcdesc\endfulllineitems
117 % same for datadesc
118 \newcommand{\dataline}[1]{\item[\code{#1}]\ttindex{#1}}
119 \newcommand{\datadesc}[1]{\fulllineitems\dataline{#1}}
120 \let\enddatadesc\endfulllineitems
123 % Define \dataitem{name}: define a data item
124 \newcommand{\dataitem}[1]{%
125 \ttindex{#1}%
126 \item[{\tt #1}]
130 % Define \excitem{name}: define an exception item
131 \newcommand{\excitem}[1]{%
132 \ttindex{#1}%
133 \item[{\tt #1}]
134 \itembreak
137 \let\nodename=\label
139 \newcommand{\ABC}{{\sc abc}}
140 \newcommand{\UNIX}{{\sc Unix}}
141 \newcommand{\ASCII}{{\sc ascii}}
142 %\newcommand{\C}{{\bf C}}
143 \newcommand{\Cpp}{C\protect\raisebox{.18ex}{++}}
144 \newcommand{\C}{C}
145 \newcommand{\EOF}{{\sc eof}}
147 % code is the most difficult one...
148 %\frenchspacing removed, because \section, etc., can't handle it
149 \newcommand{\code}[1]{{\@vobeyspaces\@noligs\def\{{\char`\{}\def\}{\char`\}}\def\~{\char`\~}\def\^{\char`\^}\def\e{\char`\\}\def\${\char`\$}\def\#{\char`\#}\def\&{\char`\&}\def\%{\char`\%}%
150 \mbox{\tt #1}}}
151 %This one does not work
152 %%%% myspecials, same as dospecials, but without {, } and \
153 %%%\def\myspecials{\do\ \do\$\do\&%
154 %%% \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}
155 %%%\newcommand{\code}[1]{\begingroup \catcode``=13 \@noligs
156 %%%\tt \let\do\@makeother \myspecials
157 %%%#1\endgroup}
158 \newcommand{\kbd}[1]{\mbox{\tt #1}}
159 \newcommand{\key}[1]{\mbox{\tt #1}}
160 \newcommand{\samp}[1]{\mbox{`\code{#1}'}}
161 \newcommand{\var}[1]{\mbox{\it#1\/}}
162 \let\file=\samp
163 \newcommand{\dfn}[1]{{\sl #1\/}}
164 \newcommand{\emph}[1]{{\em #1\/}}
165 \newcommand{\strong}[1]{{\bf #1}}
167 %\newcommand{\varvars}[1]{{\catcode`\,=\active\def,{\tt\char`\,\/tt}\var{#1}}}
168 %\newcommand{\varvars}[1]{{\def\,{\/{\tt\char`\,}}\var{#1}}}
169 \newcommand{\varvars}[1]{{\def\,{\/{\tt\char`\,}}\def\({\/{\tt\char`\(}}\def\){\/{\tt\char`\)}}\var{#1}}}
171 \newif\iftexi\texifalse
172 %not supported yet%\newif\iflatex\latextrue
174 \newenvironment{tableii}[4]{\begin{center}\def\lineii##1##2{\csname#2\endcsname{##1}&##2\\}\begin{tabular}{#1}\hline#3&#4\\
175 \hline}{\hline\end{tabular}\end{center}}
177 \newenvironment{tableiii}[5]{\begin{center}\def\lineiii##1##2##3{\csname#2\endcsname{##1}&##2&##3\\}\begin{tabular}{#1}\hline#3&#4&#5\\
178 \hline}{\hline\end{tabular}\end{center}}
180 \newcommand{\itemnewline}[1]{\@tempdima\linewidth
181 \advance\@tempdima \leftmargin\makebox[\@tempdima][l]{#1}}
183 \newcommand{\sectcode}[1]{{\tt #1}}
185 %%%\let\orgchapter\chapter
186 %%%\def\chapter#1{{\let\code\sectcode\orgchapter{#1}}}
187 %%%\let\orgsection\section
188 %%%\def\section#1{{\let\code\sectcode\orgsection{#1}}}
189 %%%\let\orgsubsection\subsection
190 %%%\def\subsection#1{{\let\code\sectcode\orgsubsection{#1}}}
191 %%%\let\orgsubsubsection\subsubsection
192 %%%\def\subsubsection#1{{\let\code\sectcode\orgsubsubsection{#1}}}
193 %%%\let\orgsubsubsubsection\subsubsubsection
194 %%%\def\subsubsubsection#1{{\let\code\sectcode\orgsubsubsubsection{#1}}}