REDINDEX.STY 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. \ifx\ps@REDUCEreference\undefined
  2. \else\endinput\fi
  3. \typeout{Document style option `redindex' version 1.24 -- RmS 1994/01/20}
  4. \ifx\COMPATNOTE\undefined
  5. \@@input reduce.sty\relax
  6. \fi
  7. \ifx\extrarowheight\undefined
  8. \@@input array.sty\relax
  9. \fi
  10. %\newcommand{\REDUCE}{REDUCE}
  11. \if@twoside\else\ds@twoside\fi
  12. \def\ps@REDUCEreference{\let\@evenhead\@empty\let\@oddhead\@empty
  13. \def\@oddfoot{\rm \hfil REDUCE Reference\ \ \thepage}%
  14. \def\@evenfoot{\rm \thepage\ \ REDUCE Reference\hfil}}
  15. \newcommand{\indexentry}[1]{\newpage
  16. \markboth{#1}{#1}\section*{#1}}
  17. \def\in@#1#2{%
  18. \def\in@@##1#1##2##3\in@@{%
  19. \ifx\in@##2\in@false\else\in@true\fi}%
  20. \in@@#2#1\in@\in@@}
  21. \newif\ifin@
  22. \newtoks\double@list
  23. \double@list={}
  24. \def\add@to@double@list#1{\double@list=\expandafter{\the\double@list#1\relax}}
  25. \def\check@double@list#1{%
  26. \def\@tempa{\in@{#1}}%
  27. \expandafter\@tempa\expandafter{\the\double@list}}
  28. \catcode`\_=12
  29. \def\other@underscore{_}
  30. \catcode`\_=\active
  31. \def_{\ifmmode\expandafter\sb\else\_\fi}
  32. \def\redindex@sanitize{\@sanitize\catcode`\ =10\relax
  33. \catcode`\\=0\relax
  34. \catcode`\{=1\relax
  35. \catcode`\}=2\relax
  36. \catcode`\_=\active}
  37. \def\check@multiple@label#1,#2,#3{% #1 is name, #2 is type, #3 is value
  38. \@ifundefined{r@#1}{\newlabel@{#1}{#3}}{%
  39. \typeout{Double found: #1, list: \the\double@list}%
  40. \check@double@list{#1}\ifin@\else\global\add@to@double@list{#1}\fi}}
  41. \let\newlabel@=\newlabel
  42. \def\newlabel{\begingroup
  43. \redindex@sanitize
  44. \newlabel@@
  45. }
  46. \def\newlabel@@#1#2{%\tracingall
  47. % \begingroup
  48. \let_=\other@underscore
  49. \newlabel@{#1}{#2}%
  50. \in@,{#1}\ifin@\check@multiple@label#1,{#2}\fi
  51. \endgroup}
  52. \let\enddocument@=\enddocument
  53. \def\enddocument{\let_=\other@underscore
  54. \immediate\write\@mainaux{\string\add@to@double@list{\the\double@list}}%
  55. \enddocument@}
  56. \def\enddocument{\@checkend{document}\clearpage\begingroup
  57. \if@filesw
  58. \let_=\other@underscore
  59. \immediate\write\@mainaux{\string\add@to@double@list{\the\double@list}}%
  60. \immediate\closeout\@mainaux
  61. \def\global\@namedef##1##2{}\def\newlabel{\@testdef r}%
  62. \def\bibcite{\@testdef b}\@tempswafalse \makeatletter
  63. \redindex@sanitize\input \jobname.aux
  64. \if@tempswa \@@warning{Label(s) may have changed. Rerun to get
  65. cross-references right}\fi\fi\endgroup\deadcycles\z@\@@end}
  66. \def\@testdef #1#2#3{\def\@tempa{#3}\expandafter \ifx \csname #1@#2\endcsname
  67. \@tempa \else
  68. \typeout{Testing #2 failed: old: \csname #1@#2\endcsname <-> new: #3}
  69. \@tempswatrue \fi}
  70. \newcount\newitem@penalty
  71. \newskip\newitem@preskip
  72. \newskip\newitem@postskip
  73. \newskip\newitem@headsep
  74. %\def\newitem#1#2{% #1 is type, #2 is name
  75. \def\newitem#1[#2]#3{% #1 is type, #2 is ref key, #3 is name
  76. \endgroup
  77. \ifvmode\else\par\fi
  78. \addpenalty\newitem@penalty
  79. \addvspace\newitem@postskip
  80. \hrule
  81. \nobreak
  82. \vskip \newitem@preskip
  83. \hbox to\hsize{\LARGE\bf\sf \uppercase{#3}\hfil #1}%
  84. \nobreak
  85. \vskip \newitem@headsep
  86. \begingroup
  87. \let_=\other@underscore
  88. \index{#3}\index{#1!#3}%
  89. \def\_{_}\label{#2,#1}\nobreak
  90. \endgroup}
  91. \newitem@penalty=\@beginparpenalty
  92. \newitem@postskip = 20pt plus 5pt minus 5pt
  93. \newitem@preskip = 10pt
  94. \newitem@headsep = 5pt
  95. \parskip = 5pt plus 2pt
  96. \parindent = 0pt
  97. \def\newitemEnv#1{%
  98. \expandafter\edef\csname#1\endcsname{%
  99. \begingroup\noexpand\redindex@sanitize\csname#1@\endcsname}%
  100. \@namedef{#1@}{\@dblarg{\newitem{#1}}}%
  101. \@namedef{end#1}{}}
  102. \newitemEnv{Command}
  103. \newitemEnv{Operator}
  104. \newitemEnv{Function}
  105. \newitemEnv{Switch}
  106. \newitemEnv{Variable}
  107. \newitemEnv{Declaration}
  108. \newitemEnv{Package}
  109. \newitemEnv{Concept}
  110. \newitemEnv{Constant}
  111. \newitemEnv{Type}
  112. \newitemEnv{info}
  113. \newitemEnv{Introduction}
  114. \newskip\itemsec@sep
  115. \newcount\itemsec@penalty
  116. \itemsec@penalty=\@beginparpenalty
  117. \itemsec@sep=5pt
  118. \def\begin@itemsection#1{\par\everypar={}%
  119. \addvspace\itemsec@sep
  120. \addpenalty\itemsec@penalty
  121. \hbox{\large\bf\sf #1}\nobreak}
  122. \def\end@itemsection{\par}
  123. \def\Comments{\begin@itemsection{Comments}}
  124. \let\endComments\end@itemsection
  125. \begingroup
  126. \catcode`\^=\active \catcode`\&=\active \catcode`\_=\active
  127. \def\x{\def\setup@special@chars{\catcode`\^=\active \let^=\special@uparrow
  128. \catcode`\&=\active \let&=\special@ampersand}%
  129. \def\protectspecialchars{\def^{\char`\^}\def_{\char`\_}}%
  130. \def\normalspecialchars{\let^=\sp\let_=\sb}%
  131. \def\activespecialchars{\let^=\special@uparrow}}
  132. \expandafter\endgroup\x
  133. \let\begin@=\begin
  134. \let\end@=\end
  135. \def\@ifstar#1#2{\def\@tempa{#1}\def\@tempb{#2}\futurelet
  136. \@tempc\@if@star@}
  137. \def\@if@star@{\ifx \@tempc*\def\@tempd*{\@tempa}\else\let\@tempd\@tempb\fi\@tempd}
  138. \def\Examples{\begin@itemsection{Examples}%
  139. \setup@special@chars\protectspecialchars%\tracingall
  140. \def\{{{\tt\char`\{}}%
  141. \def\}{{\tt\char`\}}}%
  142. \def\arraystretch{1.5}%
  143. \extrarowheight=1mm
  144. \def\end{%
  145. \ifnum\catcode`\{=12\relax \expandafter \special@ampersand\fi\end@}%
  146. \let \protect \relax
  147. \lineskip \z@
  148. \baselineskip \z@
  149. \frenchspacing
  150. \m@th
  151. \def\\{{\ifnum 0=`}\fi
  152. \@ifstar {\@xarraycr\noalign{\penalty\@M}} \@xarraycr}
  153. \let\par=\@empty
  154. \setbox \@arstrutbox \hbox{\vrule
  155. \@height \arraystretch \ht \strutbox
  156. \@depth \arraystretch \dp \strutbox
  157. \@width \z@}%
  158. \ialign\bgroup\@arstrut
  159. \global\@startnewrowfalse
  160. \catcode`\{=12\relax
  161. \catcode`\}=12\relax
  162. \catcode`\%=12\relax
  163. \catcode`\$=12\relax
  164. \catcode`\~=12\relax
  165. \setbox0=\hbox\bgroup\protect\tt##\unskip\hfil\egroup\checkcolwidth
  166. &$\quad\protect\Rightarrow\quad$%
  167. \global\setbox0=\hbox\bgroup\activespecialchars##\egroup\checkcolwidtho\cr
  168. }
  169. \def\endExamples{\crcr\egroup\end@itemsection}
  170. %\def\Examples{\begin@itemsection{Examples}%
  171. % \setup@special@chars\protectspecialchars%\tracingall
  172. % \def\{{{\tt\char`\{}}%
  173. % \def\}{{\tt\char`\}}}%
  174. % \def\arraystretch{1.5}%
  175. % \extrarowheight=1mm
  176. % \def\end{%
  177. % \ifnum\catcode`\{=12\relax \expandafter \special@ampersand\fi\end@}%
  178. % \begin{tabular}[b]{>{%\protectspecialchars
  179. % \global\@startnewrowfalse
  180. % \catcode`\{=12\relax
  181. % \catcode`\}=12\relax
  182. % \catcode`\%=12\relax
  183. % \catcode`\$=12\relax
  184. % \setbox0=\hbox\bgroup\protect\tt}l<{\egroup\checkcolwidth}%
  185. % >{$\quad\protect\Rightarrow\quad$%
  186. % \global\setbox0=\hbox\bgroup\activespecialchars}l%
  187. % <{\egroup\checkcolwidtho}}}
  188. %\def\endExamples{\end{tabular}\end@itemsection}
  189. \def\explanationi#1{\multicolumn{2}{p{0.95\textwidth}}{%
  190. \normalspecialchars \em#1}}
  191. \let\explanation=\explanationi
  192. \def\explanationo#1{\parbox[t]{0.95\MaxOutputWidth}{\em#1}}
  193. \def\start@new@row@for@output{%
  194. \multicolumn{2}{@{\protect\DoOutputIndent}l}{\box0}}
  195. \def\DoOutputIndent{
  196. \dimen@=\textwidth
  197. \advance\dimen@ -\wd\z@
  198. \ifdim\dimen@>\OutputIndent \dimen@=\OutputIndent
  199. \else\ifdim\dimen@<\z@ \dimen@=\OutputIndent\fi\fi
  200. \hspace{\dimen@}}
  201. \newdimen\OutputIndent \OutputIndent=10mm
  202. \begingroup \catcode `|=0 \catcode `[= 1
  203. \catcode`]=2 \catcode `\{=12 \catcode `\}=12
  204. \catcode`\\=12 |gdef|@bixample#1\end{Bigexample}[#1|end[Bigexample]]
  205. |endgroup
  206. \def\Bigexample{\begin@itemsection{Example}%
  207. \@verbatim \frenchspacing\@vobeyspaces \@bixample}
  208. \def\endBigexample{\endtrivlist\end@itemsection}
  209. \def\Related{\begin@itemsection{Related information}\begin{description}}
  210. \def\endRelated{\end{description}}
  211. \newif\if@startnewrow \@startnewrowfalse
  212. \newif\if@startneworow \@startneworowfalse
  213. \def\special@uparrow#1{\vbox{\vskip2\p@
  214. \hbox{\raise.8\normalbaselineskip\hbox{#1}}}}
  215. \def\special@ampersand{&\if@startnewrow\expandafter\startnewrow\fi\tt}
  216. \def\startnewrow{\omit\\&\global\@startnewrowfalse}
  217. \newdimen\maxexamplecolwidth
  218. \maxexamplecolwidth = 5cm
  219. \def\checkcolwidth{%
  220. \ifdim\wd0>\maxexamplecolwidth
  221. \hbox to\maxexamplecolwidth{\unhbox0\hss}%
  222. \hskip-25pt\null
  223. \global\@startnewrowtrue
  224. \else \unhbox0 \fi
  225. }
  226. \def\checkcolwidtho{%
  227. \ifdim\wd0>\MaxOutputWidth
  228. \global\everycr={\start@new@row@for@output
  229. \global\everycr={}\cr}%
  230. % \global\@startneworowtrue
  231. \else \unhbox0 \fi
  232. }
  233. \def\multilineinput{\catcode`\{=1 \catcode`\}=2
  234. \begin{minipage}[b]{\maxexamplecolwidth}\@vobeyspaces\obeylines}
  235. \def\endmultilineinput{\end{minipage}}
  236. \def\multilineoutput#1{\begin{minipage}[t]{#1}\@vobeyspaces\obeylines
  237. \baselineskip =1.5\baselineskip}
  238. \def\endmultilineoutput{\end{minipage}}
  239. \newdimen\MaxOutputWidth \MaxOutputWidth=7cm
  240. \def\multilineoutput#1{%
  241. \vtop\bgroup\@parboxrestore
  242. \lineskip \baselineskip
  243. \@tempswafalse
  244. \def\par{\if@tempswa\egroup
  245. \ifdim\wd0>\z@\box0\fi
  246. \setbox0=\hbox\bgroup\fi
  247. \@tempswatrue}
  248. \@vobeyspaces\obeylines
  249. \setbox0=\hbox\bgroup}
  250. \def\endmultilineoutput{\egroup\ifdim\wd0>\z@\box0\fi \egroup}
  251. \def\multilineinput{%
  252. \vbox\bgroup\@parboxrestore
  253. \def\end{\catcode`\{=1 \catcode`\}=2 \end@}%
  254. \@tempswafalse
  255. \def\par{\if@tempswa\egroup
  256. \ifdim\wd0>\z@\box0\fi
  257. \setbox0=\hbox\bgroup\fi
  258. \@tempswatrue}
  259. \@vobeyspaces\obeylines
  260. \addvspace{.8\baselineskip}%
  261. \setbox0=\hbox\bgroup}
  262. \let\endmultilineinput=\endmultilineoutput
  263. \def\privateshowbox{\showboxbreadth\maxdimen\showboxdepth\maxdimen\showbox}
  264. \def\rfrac#1#2{\begingroup
  265. \lineskip2pt \baselineskip \z@
  266. \setbox0=\hbox{\tt#1}%
  267. \setbox1=\hbox{\tt#2}%
  268. \setbox2=\hbox{\tt-}%
  269. \ifdim \wd0>\wd1 \dimen@=\wd0 \else \dimen@=\wd1 \fi
  270. \advance \dimen@ by2\wd2\relax
  271. \setbox3=\vtop{\hbox to\dimen@{\hss\unhcopy0\hss}%
  272. \hbox to\dimen@{\leaders\copy2\hfill}%
  273. \hbox to\dimen@{\hss\unhcopy1\hss}}%
  274. \dimen@=\dp0 \advance\dimen@ by\ht2 \advance\dimen@ by\lineskip
  275. \@tempdima=\ht3 \advance \@tempdima by\dimen@ \ht3=\@tempdima
  276. \@tempdima=\dp3 \advance \@tempdima by-\dimen@ \dp3=\@tempdima
  277. % \privateshowbox3
  278. \box3
  279. \endgroup}
  280. \def\def@protected#1#2{%
  281. \expandafter\edef\csname#1\endcsname{\begingroup\noexpand\redindex@sanitize
  282. \catcode32=10
  283. \csname#1@\endcsname}%
  284. \@namedef{#1@}##1{\endgroup#2}}
  285. \def@protected{name}{\mbox{\tt#1}}
  286. %\let\keyw=\name
  287. %\let\operator=\name
  288. \def@protected{nameindex}{\name{#1}\index{#1}\label{#1}}
  289. \def@protected{hyperref}{#1}
  290. %\def@protected{nameref}{\name{#1}, p.~\pageref{#1}}
  291. \def@protected{nameref}{\name{#1}}
  292. \def@protected{see}{(see \hyperref@{#1})}
  293. \def@protected{key}{\fbox{\sf #1}}
  294. \def@protected{arg}{\mbox{\it #1}}
  295. \newdimen \Syntaxindent \Syntaxindent=2mm
  296. \def\Syntax{\large
  297. \list{}{\leftmargin\Syntaxindent\def\({$(}\def\){)$}%
  298. \mathcode`\ =32768}\item[]}
  299. \def\endSyntax{\endlist}
  300. \def\repeated{$+$}
  301. \def\optional{\relax\ifmmode\ast\else$\ast$\fi}
  302. %\def\meta#1{\mbox{\it#1}}
  303. \def\meta{\begingroup\catcode`\_=\active\meta@}
  304. \def\meta@#1{\ifmmode\mbox\fi{\it#1\/}\endgroup}
  305. \def\alternative{$\displaystyle
  306. \left\{\begin{tabular}{l}}
  307. \def\endalternative{\end{tabular}\right\}$}
  308. \def\section{\@startsection {section}{1}{\z@}{-3.5ex plus-1ex minus
  309. -.2ex}{2.3ex plus.2ex}{\reset@font\LARGE\bf}}
  310. \def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus-1ex
  311. minus-.2ex}{1.5ex plus.2ex}{\reset@font\Large\bf}}
  312. \def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus
  313. -1ex minus-.2ex}{1.5ex plus.2ex}{\reset@font\large\bf}}
  314. %%%%
  315. %%%% error message file
  316. %%%%
  317. \def\tableoferrormessages{\@restonecolfalse
  318. \if@twocolumn\@restonecoltrue\onecolumn\fi
  319. \chapter*{\contentsname
  320. \@mkboth{\uppercase{\contentsname}}{\uppercase{\contentsname}}}%
  321. \@starttoc{emg}\if@restonecol\twocolumn\fi}
  322. \def\ErrorMessage#1{%
  323. \addcontentsline{emg}{#1}}
  324. %%%% conditionals
  325. \def\IFTEX#1#2{#1}
  326. \long\def\INFO#1\end#2{\def\@tempa{#2}\def\@tempb{INFO}%
  327. \ifx\@tempa\@tempb\else\errmessage{\string\end{#2} not allowed
  328. inside INFO environment.}\@eha\fi
  329. \end{INFO}}
  330. \def\endINFO{\global\@ignoretrue}
  331. \def\TEX{}
  332. \def\endTEX{\global\@ignoretrue}
  333. \@ifundefined{reset@font}{\let\reset@font\@empty}{}
  334. \pagestyle{REDUCEreference}
  335. \endinput