\funcitem{}, \dataitem{}, \excitem{}: Removed obsolete macros; there are no
longer used anywhere. Use the {*desc} environments instead. \var{}: Ensure that the argument is always set in roman italic, in case an alternate font is being used for code. These keeps the result of \var{} consistent. Some minor changes to allow easier exploration of alternate fonts for code in the running text. Haven't changed the selected font; I haven't found one that has everything required! (The best non-monospaced font so far was missing the <, >, and | characters, or at least had them at the wrong locations. It also allowed confusion between upper-case I and lower-case L.)
This commit is contained in:
parent
b660b63edf
commit
9e24309bb5
|
@ -21,6 +21,13 @@
|
|||
\parindent = 0mm
|
||||
\parskip = 2mm
|
||||
|
||||
% old code font selections:
|
||||
\let\codefont=\tt
|
||||
\let\sectcodefont=\tt
|
||||
|
||||
% (Haven't found a new one that gets <, >, and _ right without being
|
||||
% monospaced.)
|
||||
|
||||
% Variable used by begin code command
|
||||
\newlength{\codewidth}
|
||||
|
||||
|
@ -88,14 +95,14 @@
|
|||
}
|
||||
|
||||
% Command to generate a reference to a function, statement, keyword, operator
|
||||
\newcommand{\stindex}[1]{\indexii{statement}{#1@{\tt#1}}}
|
||||
\newcommand{\opindex}[1]{\indexii{operator}{#1@{\tt#1}}}
|
||||
\newcommand{\exindex}[1]{\indexii{exception}{#1@{\tt#1}}}
|
||||
\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{\obindex}[1]{\indexii{object}{#1}}
|
||||
\newcommand{\bifuncindex}[1]{\index{#1@{\tt#1} (built-in function)}}
|
||||
\newcommand{\bifuncindex}[1]{\index{#1@{\codefont#1} (built-in function)}}
|
||||
|
||||
% Add an index entry for a module
|
||||
\newcommand{\refmodule}[2]{\index{#1@{\tt#1} (#2module)}}
|
||||
\newcommand{\refmodule}[2]{\index{#1@{\codefont#1} (#2module)}}
|
||||
\newcommand{\refmodindex}[1]{\refmodule{#1}{}}
|
||||
\newcommand{\refbimodindex}[1]{\refmodule{#1}{built-in }}
|
||||
\newcommand{\refstmodindex}[1]{\refmodule{#1}{standard }}
|
||||
|
@ -105,14 +112,14 @@
|
|||
\openout\modindexfile=modules.idx
|
||||
|
||||
% Add the defining entry for a module
|
||||
\newcommand{\defmodindex}[2]{\index{#1@{\tt#1} (#2module)|textbf}%
|
||||
\newcommand{\defmodindex}[2]{\index{#1@{\codefont#1} (#2module)|textbf}%
|
||||
\write\modindexfile{#1 \thepage}}
|
||||
\newcommand{\bimodindex}[1]{\defmodindex{#1}{built-in }}
|
||||
\newcommand{\stmodindex}[1]{\defmodindex{#1}{standard }}
|
||||
|
||||
% Additional string for an index entry
|
||||
\newcommand{\indexsubitem}{}
|
||||
\newcommand{\ttindex}[1]{\index{#1@{\tt#1} \indexsubitem}}
|
||||
\newcommand{\ttindex}[1]{\index{#1@{\codefont#1} \indexsubitem}}
|
||||
|
||||
% Define \itemjoin: some negative vspace to join two items together
|
||||
\newcommand{\itemjoin}{
|
||||
|
@ -121,14 +128,6 @@
|
|||
\vspace{-\parsep}
|
||||
}
|
||||
|
||||
% Define \funcitem{func}{args}: define a function item
|
||||
\newcommand{\funcitem}[2]{%
|
||||
\ttindex{#1}%
|
||||
\item[\code{#1(\varvars{#2})}]
|
||||
\
|
||||
}
|
||||
|
||||
|
||||
% from user-level, fulllineitems should be called as an environment
|
||||
\def\fulllineitems{\list{}{\labelwidth \leftmargin \labelsep 0pt
|
||||
\rightmargin 0pt \topsep -\parskip \partopsep \parskip
|
||||
|
@ -177,20 +176,6 @@
|
|||
\let\endopcodedesc\endfulllineitems
|
||||
|
||||
|
||||
% Define \dataitem{name}: define a data item
|
||||
\newcommand{\dataitem}[1]{%
|
||||
\ttindex{#1}%
|
||||
\item[{\tt #1}]
|
||||
\
|
||||
}
|
||||
|
||||
% Define \excitem{name}: define an exception item
|
||||
\newcommand{\excitem}[1]{%
|
||||
\ttindex{#1}%
|
||||
\item[{\tt #1}]
|
||||
\itembreak
|
||||
}
|
||||
|
||||
\let\nodename=\label
|
||||
|
||||
%% For these commands, use \command{} to get the typography right, not
|
||||
|
@ -205,12 +190,14 @@
|
|||
|
||||
% code is the most difficult one...
|
||||
\newcommand{\code}[1]{{\@vobeyspaces\@noligs\def\{{\char`\{}\def\}{\char`\}}\def\~{\char`\~}\def\^{\char`\^}\def\e{\char`\\}\def\${\char`\$}\def\#{\char`\#}\def\&{\char`\&}\def\%{\char`\%}%
|
||||
\mbox{\tt #1}}}
|
||||
\mbox{\codefont{#1}}}}
|
||||
|
||||
\newcommand{\kbd}[1]{\mbox{\tt #1}}
|
||||
\newcommand{\key}[1]{\mbox{\tt #1}}
|
||||
\newcommand{\samp}[1]{\mbox{`\code{#1}'}}
|
||||
\newcommand{\var}[1]{\mbox{\it#1\/}}
|
||||
% This weird definition of \var{} allows it to always appear in roman italics,
|
||||
% and won't be sans-serif in code fragments.
|
||||
\newcommand{\var}[1]{\mbox{\textrm{\textit{#1\/}}}}
|
||||
\let\file=\samp
|
||||
\newcommand{\dfn}[1]{{\em #1\/}}
|
||||
\renewcommand{\emph}[1]{{\em #1\/}}
|
||||
|
@ -230,7 +217,7 @@
|
|||
\newcommand{\itemnewline}[1]{\@tempdima\linewidth
|
||||
\advance\@tempdima \leftmargin\makebox[\@tempdima][l]{#1}}
|
||||
|
||||
\newcommand{\sectcode}[1]{{\tt #1}}
|
||||
\newcommand{\sectcode}[1]{{\sectcodefont{#1}}}
|
||||
|
||||
% Cross-referencing (AMK)
|
||||
% Sample usage:
|
||||
|
@ -240,7 +227,7 @@
|
|||
% \end{seealso}
|
||||
|
||||
\newenvironment{seealso}[0]{{\bf See Also:}\par}{\par}
|
||||
\newcommand{\seemodule}[2]{\ref{module-#1}: {\tt #1} (#2)}
|
||||
\newcommand{\seemodule}[2]{\ref{module-#1}: {\codefont #1} (#2)}
|
||||
\newcommand{\seetext}[1]{\par{#1}}
|
||||
|
||||
% Fix the theindex environment to add an entry to the Table of Contents;
|
||||
|
|
Loading…
Reference in New Issue