diff options
-rw-r--r-- | Doc/myformat.sty | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/Doc/myformat.sty b/Doc/myformat.sty index 0261387..0eadab8 100644 --- a/Doc/myformat.sty +++ b/Doc/myformat.sty @@ -74,11 +74,15 @@ %\catcode`\_=12 %\catcode`\_=\active\def_{\ifnum\fam=\ttfamily \char'137 \else{\tt\char'137}\fi} -% Define \itembreak: force the text after an item to start on a new line -\newcommand{\itembreak}{ -\mbox{} -\\*[0mm] -} + +%% Lots of index-entry generation support. + +% Command to wrap around stuff that refers to function/module/attribute names +% in the index. Default behavior: like \code{}. To just keep the index +% entries in the roman font, uncomment the second definition to use instead; +% it matches O'Reilly style more. +\newcommand{\idxcode}[1]{\codefont{#1}} +%\renewcommand{\idxcode}[1]{#1} % Command to generate two index entries (using subentries) \newcommand{\indexii}[2]{\index{#1!#2}\index{#2!#1}} @@ -95,14 +99,14 @@ } % Command to generate a reference to a function, statement, keyword, operator -\newcommand{\stindex}[1]{\indexii{statement}{#1@{\codefont#1}}} -\newcommand{\opindex}[1]{\indexii{operator}{#1@{\codefont#1}}} -\newcommand{\exindex}[1]{\indexii{exception}{#1@{\codefont#1}}} +\newcommand{\stindex}[1]{\indexii{statement}{#1@{\idxcode{#1}}}} +\newcommand{\opindex}[1]{\indexii{operator}{#1@{\idxcode{#1}}}} +\newcommand{\exindex}[1]{\indexii{exception}{#1@{\idxcode{#1}}}} \newcommand{\obindex}[1]{\indexii{object}{#1}} -\newcommand{\bifuncindex}[1]{\index{#1@{\codefont#1} (built-in function)}} +\newcommand{\bifuncindex}[1]{\index{#1@{\idxcode{#1}} (built-in function)}} % Add an index entry for a module -\newcommand{\refmodule}[2]{\index{#1@{\codefont#1} (#2module)}} +\newcommand{\refmodule}[2]{\index{#1@{\idxcode{#1}} (#2module)}} \newcommand{\refmodindex}[1]{\refmodule{#1}{}} \newcommand{\refbimodindex}[1]{\refmodule{#1}{built-in }} \newcommand{\refstmodindex}[1]{\refmodule{#1}{standard }} @@ -112,7 +116,8 @@ \openout\modindexfile=modules.idx % Add the defining entry for a module -\newcommand{\defmodindex}[2]{\index{#1@{\codefont#1} (#2module)|textbf}% +\newcommand{\defmodindex}[2]{% + \index{#1@{\idxcode{#1}} (#2module)|textbf}% \write\modindexfile{#1 \thepage}} \newcommand{\modindex}[1]{\defmodindex{#1}{}} \newcommand{\bimodindex}[1]{\defmodindex{#1}{built-in }} @@ -120,14 +125,8 @@ % Additional string for an index entry \newcommand{\indexsubitem}{} -\newcommand{\ttindex}[1]{\index{#1@{\codefont#1} \indexsubitem}} +\newcommand{\ttindex}[1]{\index{#1@{\idxcode{#1}} \indexsubitem}} -% Define \itemjoin: some negative vspace to join two items together -\newcommand{\itemjoin}{ -\mbox{} -\vspace{-\itemsep} -\vspace{-\parsep} -} % from user-level, fulllineitems should be called as an environment \def\fulllineitems{\list{}{\labelwidth \leftmargin \labelsep 0pt |