2
% Insight.sty for the Insight docummentation [works only with with Latex2e]
5
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
6
\ProvidesPackage{InsightJournal}
7
[1998/01/11 LaTeX package (Insight markup)]
9
\RequirePackage{longtable}
10
\RequirePackage{graphics}
11
%\RequirePackage{picins}
12
\RequirePackage{floatflt}
14
\RequirePackage{amsmath}
15
\RequirePackage{pslatex}
16
\RequirePackage{verbatim}
19
% Uncomment these two lines to ignore the paper size and make the page
20
% size more like a typical published manual.
21
%\renewcommand{\paperheight}{9.25in}
22
%\renewcommand{\paperwidth}{7.5in} % typical squarish manual
23
%\renewcommand{\paperwidth}{7in} % O'Reilly ``Programmming Insight''
25
% These packages can be used to add marginal annotations which indicate
26
% index entries and labels; useful for reviewing this messy documentation!
28
%\RequirePackage{showkeys}
29
%\RequirePackage{showidx}
31
% for PDF output, use maximal compression & a lot of other stuff
32
% (test for PDF recommended by Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov>)
34
\newif\ifitk@doing@page@targets
35
\itk@doing@page@targetsfalse
37
\ifx\pdfoutput\undefined\else\ifcase\pdfoutput
40
\let\itk@LinkColor=\NavyBlue
41
\let\itk@NormalColor=\Black
43
\pdfpagewidth=\paperwidth % page width of PDF output
44
\pdfpageheight=\paperheight % page height of PDF output
46
% Pad the number with '0' to 3 digits wide so no page name is a prefix
49
\newcommand{\itk@targetno}[1]{\ifnum#1<100 0\fi\ifnum#1<10 0\fi#1}
50
\newcommand{\itk@pageno}{\itk@targetno\thepage}
52
% This definition allows the entries in the page-view of the ToC to be
53
% active links. Some work, some don't.
55
\let\itk@OldContentsline=\contentsline
57
% Macro that takes two args: the name to link to and the content of
58
% the link. This takes care of the PDF magic, getting the colors
59
% the same for each link, and avoids having lots of garbage all over
61
\newcommand{\itk@linkToName}[2]{%
62
\pdfannotlink attr{/Border [0 0 0]} goto name{#1}%
63
\itk@LinkColor#2\itk@NormalColor%
66
% Compute the padded page number separately since we end up with a pair of
67
% \relax tokens; this gets the right string computed and works.
68
\renewcommand{\contentsline}[3]{%
69
\def\my@pageno{\itk@targetno{#3}}%
70
\itk@OldContentsline{#1}{\itk@linkToName{page\my@pageno}{#2}}{#3}%
73
\InputIfFileExists{\jobname.bkm}{\pdfcatalog{/PageMode /UseOutlines}}{}
75
\newcommand{\itk@target}[1]{%
76
\ifitk@doing@page@targets%
77
{\pdfdest name{#1} xyz}%
80
\let\itk@OldLabel=\label
81
\renewcommand{\label}[1]{%
83
\itk@target{label-#1}%
85
% This stuff adds a page# destination to every PDF page, where # is three
86
% digits wide, padded with leading zeros. This doesn't really help with
87
% the frontmatter, but does fine with the body.
89
% This is *heavily* based on the hyperref package.
96
\let\H@old@thehead\@thehead
97
\global\def\@foo{\itk@target{page\itk@pageno}}%
98
\expandafter\ifx\expandafter\@empty\H@old@thehead
99
\def\H@old@thehead{\hfil}\fi
100
\def\@thehead{\@foo\relax\H@old@thehead}%
104
% Increase printable page size (copied from fullpage.sty)
106
\advance \topmargin by -\headheight
107
\advance \topmargin by -\headsep
109
% attempt to work a little better for A4 users
110
\textheight \paperheight
111
\advance\textheight by -2in
114
\evensidemargin -20pt
115
\marginparwidth 0.25in
117
\textwidth \paperwidth
118
\advance\textwidth by -2in
121
% Style parameters and macros used by most documents here
126
\hbadness = 5000 % don't print trivial gripes
128
\pagestyle{empty} % start this way; change for
129
\pagenumbering{roman} % ToC & chapters
131
% Use this to set the font family for headers and other decor:
132
\newcommand{\itk@HeaderFamily}{\sffamily}
134
% Redefine the 'normal' header/footer style when using "fancyhdr" package:
135
\@ifundefined{fancyhf}{}{
136
% Use \pagestyle{normal} as the primary pagestyle for text.
137
\fancypagestyle{normal}{
139
\fancyhead[LE,RO]{{\itk@HeaderFamily\thepage}}
140
\fancyhead[LO]{{\itk@HeaderFamily\nouppercase{\rightmark}}}
141
\fancyhead[RE]{{\itk@HeaderFamily\nouppercase{\leftmark}}}
142
\renewcommand{\headrulewidth}{0.4pt}
143
\renewcommand{\footrulewidth}{0pt}
145
% Update the plain style so we get the page number & footer line,
146
% but not a chapter or section title. This is to keep the first
147
% page of a chapter and the blank page between chapters `clean.'
148
\fancypagestyle{plain}{
150
\renewcommand{\headrulewidth}{0pt}
151
\renewcommand{\footrulewidth}{0pt}
153
% Redefine \cleardoublepage so that the blank page between chapters
154
% gets the plain style and not the fancy style. This is described
155
% in the documentation for the fancyhdr package by Piet von Oostrum.
156
\@ifundefined{chapter}{}{
157
\renewcommand{\cleardoublepage}{
158
\clearpage\if@openright \ifodd\c@page\else
160
\thispagestyle{plain}
162
\if@twocolumn\hbox{}\newpage\fi\fi\fi
169
% This does a similar thing for the {alltt} environment:
170
\RequirePackage{alltt}
171
\let\itk@OldAllTT=\alltt
172
\let\itk@OldEndAllTT=\endalltt
174
\renewcommand{\alltt}{%
175
\setlength{\parindent}{1cm}%
176
% Calculate the text width for the minipage:
177
\setlength{\itk@codewidth}{\linewidth}%
178
\addtolength{\itk@codewidth}{-\parindent}%
181
\begin{minipage}[t]{\itk@codewidth}%
185
\renewcommand{\endalltt}{%
191
\newcommand{\itk@modulebadkey}{{--just-some-junk--}}
194
%% Lots of index-entry generation support.
196
% Command to wrap around stuff that refers to function / module /
197
% attribute names in the index. Default behavior: like \code{}. To
198
% just keep the index entries in the roman font, uncomment the second
199
% definition; it matches O'Reilly style more.
201
\newcommand{\itk@idxcode}[1]{\texttt{#1}}
202
%\renewcommand{\itk@idxcode}[1]{#1}
204
% Command to generate two index entries (using subentries)
205
\newcommand{\indexii}[2]{\index{#1!#2}\index{#2!#1}}
207
% And three entries (using only one level of subentries)
208
\newcommand{\indexiii}[3]{\index{#1!#2 #3}\index{#2!#3, #1}\index{#3!#1 #2}}
210
% And four (again, using only one level of subentries)
211
\newcommand{\indexiv}[4]{
218
% Command to generate a reference to a function, statement, keyword,
220
\newcommand{\kwindex}[1]{\indexii{keyword}{#1@{\itk@idxcode{#1}}}}
221
\newcommand{\stindex}[1]{\indexii{statement}{#1@{\itk@idxcode{#1}}}}
222
\newcommand{\opindex}[1]{\indexii{operator}{#1@{\itk@idxcode{#1}}}}
223
\newcommand{\exindex}[1]{\indexii{exception}{#1@{\itk@idxcode{#1}}}}
224
\newcommand{\obindex}[1]{\indexii{object}{#1}}
225
\newcommand{\bifuncindex}[1]{%
226
\index{#1@{\itk@idxcode{#1()}} (built-in function)}}
228
% Add an index entry for a module
229
\newcommand{\itk@refmodule}[2]{\index{#1@{\itk@idxcode{#1}} (#2module)}}
230
\newcommand{\refmodindex}[1]{\itk@refmodule{#1}{}}
231
\newcommand{\refbimodindex}[1]{\itk@refmodule{#1}{built-in }}
232
\newcommand{\refexmodindex}[1]{\itk@refmodule{#1}{extension }}
233
\newcommand{\refstmodindex}[1]{\itk@refmodule{#1}{standard }}
235
% Refer to a module's documentation using a hyperlink of the module's
236
% name, at least if we're building PDF:
237
\@ifundefined{pdfannotlink}{%
238
\newcommand{\refmodule}[2][\itk@modulebadkey]{\module{#2}}
240
\newcommand{\refmodule}[2][\itk@modulebadkey]{%
241
\ifx\itk@modulebadkey#1\def\itk@modulekey{#2}\else\def\itk@modulekey{#1}\fi%
242
\itk@linkToName{label-module-\itk@modulekey}{\module{#2}}%
246
% support for the module index
247
\newif\ifitk@UseModuleIndex
248
\itk@UseModuleIndexfalse
250
\newcommand{\makemodindex}{
251
\newwrite\modindexfile
252
\openout\modindexfile=mod\jobname.idx
253
\itk@UseModuleIndextrue
256
% Add the defining entry for a module
257
\newcommand{\itk@modindex}[2]{%
258
\renewcommand{\itk@thismodule}{#1}
259
\setindexsubitem{(in module #1)}%
260
\index{#1@{\itk@idxcode{#1}} (#2module)|textbf}%
261
\ifitk@UseModuleIndex%
262
\@ifundefined{itk@modplat@\itk@thismodulekey}{
263
\write\modindexfile{\protect\indexentry{#1@{\texttt{#1}}}{\thepage}}%
264
}{\write\modindexfile{\protect\indexentry{#1@{\texttt{#1} %
265
\emph{(\itk@platformof[\itk@thismodulekey]{})}}}{\thepage}}%
270
% *** XXX *** THE NEXT FOUR MACROS ARE NOW OBSOLETE !!! ***
272
% built-in & Insight modules in the main distribution
273
\newcommand{\bimodindex}[1]{\itk@modindex{#1}{built-in }%
274
\typeout{*** MACRO bimodindex IS OBSOLETE -- USE declaremodule INSTEAD!}}
275
\newcommand{\stmodindex}[1]{\itk@modindex{#1}{standard }%
276
\typeout{*** MACRO stmodindex IS OBSOLETE -- USE declaremodule INSTEAD!}}
278
% Insight & extension modules outside the main distribution
279
\newcommand{\modindex}[1]{\itk@modindex{#1}{}%
280
\typeout{*** MACRO modindex IS OBSOLETE -- USE declaremodule INSTEAD!}}
281
\newcommand{\exmodindex}[1]{\itk@modindex{#1}{extension }%
282
\typeout{*** MACRO exmodindex IS OBSOLETE -- USE declaremodule INSTEAD!}}
284
% Additional string for an index entry
285
\newif\ifitk@usingsubitem\itk@usingsubitemfalse
286
\newcommand{\itk@indexsubitem}{}
287
\newcommand{\setindexsubitem}[1]{\renewcommand{\itk@indexsubitem}{ #1}%
288
\itk@usingsubitemtrue}
289
\newcommand{\ttindex}[1]{%
291
\index{#1@{\itk@idxcode{#1}}\itk@indexsubitem}%
293
\index{#1@{\itk@idxcode{#1}}}%
296
\newcommand{\withsubitem}[2]{%
298
\def\ttindex##1{\index{##1@{\itk@idxcode{##1}} #1}}%
304
% Module synopsis processing -----------------------------------------------
306
\newcommand{\itk@thisclass}{}
307
\newcommand{\itk@thismodule}{}
308
\newcommand{\itk@thismodulekey}{}
309
\newcommand{\itk@thismoduletype}{}
311
\newcommand{\itk@standardIndexModule}[1]{\itk@modindex{#1}{standard }}
312
\newcommand{\itk@builtinIndexModule}[1]{\itk@modindex{#1}{built-in }}
313
\newcommand{\itk@extensionIndexModule}[1]{\itk@modindex{#1}{extension }}
314
\newcommand{\itk@IndexModule}[1]{\itk@modindex{#1}{}}
316
\newif\ifitk@HaveModSynopsis \itk@HaveModSynopsisfalse
317
\newif\ifitk@ModSynopsisFileIsOpen \itk@ModSynopsisFileIsOpenfalse
318
\newif\ifitk@HaveModPlatform \itk@HaveModPlatformfalse
320
% \declaremodule[key]{type}{name}
321
\newcommand{\declaremodule}[3][\itk@modulebadkey]{
322
\itk@openModSynopsisFile
323
\renewcommand{\itk@thismoduletype}{#2}
324
\ifx\itk@modulebadkey#1
325
\renewcommand{\itk@thismodulekey}{#3}
327
\renewcommand{\itk@thismodulekey}{#1}
329
\@ifundefined{itk@#2IndexModule}{%
330
\typeout{*** MACRO declaremodule called with unknown module type: `#2'}
331
\itk@IndexModule{#3}%
333
\csname itk@#2IndexModule\endcsname{#3}%
335
\label{module-\itk@thismodulekey}
337
\newif\ifitk@ModPlatformFileIsOpen \itk@ModPlatformFileIsOpenfalse
338
\newcommand{\itk@ModPlatformFilename}{\jobname.pla}
339
\newcommand{\platform}[1]{
340
\ifitk@ModPlatformFileIsOpen\else
341
\newwrite\itk@ModPlatformFile
342
\openout\itk@ModPlatformFile=\itk@ModPlatformFilename
343
\itk@ModPlatformFileIsOpentrue
346
\InputIfFileExists{\jobname.pla}{}{}
347
\newcommand{\itk@platformof}[2][\itk@modulebadkey]{%
348
\ifx\itk@modulebadkey#1 \def\itk@key{#2}%
349
\else \def\itk@key{#1}%
351
\csname itk@modplat@\itk@key\endcsname%
353
\newcommand{\ignorePlatformAnnotation}[1]{}
355
% \moduleauthor{name}{email}
356
\newcommand{\moduleauthor}[2]{}
358
% \sectionauthor{name}{email}
359
\newcommand{\sectionauthor}[2]{}
362
\newcommand{\itk@defsynopsis}{Module has no synopsis.}
363
\newcommand{\itk@modulesynopsis}{\itk@defsynopsis}
364
\newcommand{\modulesynopsis}[1]{
365
\itk@HaveModSynopsistrue
366
\renewcommand{\itk@modulesynopsis}{#1}
370
\newwrite\itk@ModSynopsisFile
372
% hacked from \addtocontents from latex.ltx:
373
\long\def\itk@writeModSynopsisFile#1{%
374
\protected@write\itk@ModSynopsisFile%
375
{\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}%
378
\newcommand{\itk@closeModSynopsisFile}{
379
\ifitk@ModSynopsisFileIsOpen
380
\closeout\itk@ModSynopsisFile
381
\itk@ModSynopsisFileIsOpenfalse
384
\newcommand{\itk@openModSynopsisFile}{
385
\ifitk@ModSynopsisFileIsOpen\else
386
\openout\itk@ModSynopsisFile=\itk@ModSynopsisFilename
387
\itk@ModSynopsisFileIsOpentrue
391
\newcommand{\itk@ProcessModSynopsis}{
392
\ifitk@HaveModSynopsis
393
\itk@writeModSynopsisFile{\modulesynopsis%
394
{\itk@thismodulekey}{\itk@thismodule}%
395
{\itk@thismoduletype}{\itk@modulesynopsis}}%
396
\itk@HaveModSynopsisfalse
398
\renewcommand{\itk@modulesynopsis}{\itk@defsynopsis}
400
\AtEndDocument{\itk@ProcessModSynopsis\itk@closeModSynopsisFile}
403
\long\def\itk@writeModPlatformFile#1{%
404
\protected@write\itk@ModPlatformFile%
405
{\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}%
410
\newcommand{\localmoduletable}{
411
\IfFileExists{\itk@ModSynopsisFilename}{
412
\begin{synopsistable}
413
\input{\itk@ModSynopsisFilename}
418
\@ifundefined{pdfoutput}{
419
\newcommand{\itk@ModSynopsisSummary}[4]{\bfcode{#2} & #4\\}
421
\newcommand{\itk@ModSynopsisSummary}[4]{%
422
\itk@linkToName{label-module-#1}{\bfcode{#2}} & #4\\
425
\newenvironment{synopsistable}{
426
% key, name, type, synopsis
427
\let\modulesynopsis=\itk@ModSynopsisSummary
433
% --------------------------------------------------------------------------
436
\newcommand{\itk@reset}{
437
\itk@usingsubitemfalse
438
\itk@ProcessModSynopsis
439
\renewcommand{\itk@thisclass}{}
440
\renewcommand{\itk@thismodule}{}
441
\renewcommand{\itk@thismodulekey}{}
442
\renewcommand{\itk@thismoduletype}{}
445
% Augment the sectioning commands used to get our own font family in place,
446
% and reset some internal data items:
447
\renewcommand{\section}{\itk@reset%
448
\@startsection{section}{1}{\z@}%
449
{-3.5ex \@plus -1ex \@minus -.2ex}%
451
{\reset@font\Large\itk@HeaderFamily}}
452
\renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}%
453
{-3.25ex\@plus -1ex \@minus -.2ex}%
455
{\reset@font\large\itk@HeaderFamily}}
456
\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}%
457
{-3.25ex\@plus -1ex \@minus -.2ex}%
459
{\reset@font\normalsize\itk@HeaderFamily}}
460
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}%
461
{3.25ex \@plus1ex \@minus.2ex}%
463
{\reset@font\normalsize\itk@HeaderFamily}}
464
\renewcommand{\subparagraph}{\@startsection{subparagraph}{5}{\parindent}%
465
{3.25ex \@plus1ex \@minus .2ex}%
467
{\reset@font\normalsize\itk@HeaderFamily}}
470
% This gets the underscores closer to the right width; the only change
471
% from standard LaTeX is the width specified.
473
\DeclareTextCommandDefault{\textunderscore}{%
474
\leavevmode \kern.06em\vbox{\hrule\@width.55em}}
476
% Now for a lot of semantically-loaded environments that do a ton of magical
477
% things to get the right formatting and index entries for the stuff in
478
% Insight modules and C API.
481
% {fulllineitems} is used in one place in libregex.tex, but is really for
482
% internal use in this file.
484
\newcommand{\itk@itemnewline}[1]{%
485
\@tempdima\linewidth%
486
\advance\@tempdima \leftmargin\makebox[\@tempdima][l]{#1}%
489
\newenvironment{fulllineitems}{
490
\begin{list}{}{\labelwidth \leftmargin \labelsep 0pt
491
\rightmargin 0pt \topsep -\parskip \partopsep \parskip
493
\let\makelabel=\itk@itemnewline}
496
% \optional is mostly for use in the arguments parameters to the various
497
% {*desc} environments defined below, but may be used elsewhere. Known to
498
% be used in the debugger chapter.
502
% \begin{funcdesc}{myfunc}{reqparm\optional{, optparm}}
504
% No space here No space here
506
% When a function has multiple optional parameters, \optional should be
507
% nested, not chained. This is right:
509
% \begin{funcdesc}{myfunc}{\optional{parm1\optional{, parm2}}}
511
\let\itk@badkey=\@undefined
513
\newcommand{\optional}[1]{%
514
{\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}}
516
% This can be used when a function or method accepts an varying number
517
% of arguments, such as by using the *args syntax in the parameter list.
518
\newcommand{\itk@moreargs}{...}
520
% This can be used when you don't want to document the parameters to a
521
% function or method, but simply state that it's an alias for
523
\newcommand{\itk@unspecified}{...}
525
% C functions ------------------------------------------------------------
526
% \begin{cfuncdesc}[refcount]{type}{name}{arglist}
527
% Note that the [refcount] slot should only be filled in by
528
% tools/anno-api.py; it pulls the value from the refcounts database.
529
\newenvironment{cfuncdesc}[4][\itk@badkey]{
530
\begin{fulllineitems}
531
\item[\code{#2 \bfcode{#3}(\itk@varvars{#4})}\index{#3@{\itk@idxcode{#3()}}}]
532
\ifx#1\@undefined\else%
533
\emph{Return value: \textbf{#1}.}\\
535
}{\end{fulllineitems}}
537
% C variables ------------------------------------------------------------
538
% \begin{cvardesc}{type}{name}
539
\newenvironment{cvardesc}[2]{
540
\begin{fulllineitems}
541
\item[\code{#1 \bfcode{#2}}\index{#2@{\itk@idxcode{#2}}}]
542
}{\end{fulllineitems}}
544
% C data types -----------------------------------------------------------
545
% \begin{ctypedesc}[index name]{typedef name}
546
\newenvironment{ctypedesc}[2][\itk@badkey]{
547
\begin{fulllineitems}
550
\index{#2@{\itk@idxcode{#2}} (C type)}
552
\index{#2@{\itk@idxcode{#1}} (C type)}
554
}{\end{fulllineitems}}
556
% Funky macros -----------------------------------------------------------
557
% \begin{csimplemacro}{name}
558
% -- "simple" because it has no args; NOT for constant definitions!
559
\newenvironment{csimplemacrodesc}[1]{
560
\begin{fulllineitems}
561
\item[\bfcode{#1}\index{#1@{\itk@idxcode{#1}} (macro)}]
562
}{\end{fulllineitems}}
564
% simple functions (not methods) -----------------------------------------
565
% \begin{funcdesc}{name}{args}
566
\newcommand{\funcline}[2]{%
568
\index{#1@{\itk@idxcode{#1()}} (in module \itk@thismodule)}}
569
\newenvironment{funcdesc}[2]{
570
\begin{fulllineitems}
572
}{\end{fulllineitems}}
574
% similar to {funcdesc}, but doesn't add to the index
575
\newcommand{\funclineni}[2]{\item[\code{\bfcode{#1}(\itk@varvars{#2})}]}
576
\newenvironment{funcdescni}[2]{
577
\begin{fulllineitems}
579
}{\end{fulllineitems}}
581
% classes ----------------------------------------------------------------
582
% \begin{classdesc}{name}{constructor args}
583
\newenvironment{classdesc}[2]{
584
% Using \renewcommand doesn't work for this, for unknown reasons:
585
\global\def\itk@thisclass{#1}
586
\begin{fulllineitems}
587
\item[\strong{class }\code{\bfcode{#1}(\itk@varvars{#2})}%
588
\index{#1@{\itk@idxcode{#1}} (class in \itk@thismodule)}]
589
}{\end{fulllineitems}}
591
% \begin{classdesc*}{name}
592
\newenvironment{classdesc*}[1]{
593
% Using \renewcommand doesn't work for this, for unknown reasons:
594
\global\def\itk@thisclass{#1}
595
\begin{fulllineitems}
596
\item[\strong{class }\code{\bfcode{#1}}%
597
\index{#1@{\itk@idxcode{#1}} (class in \itk@thismodule)}]
598
}{\end{fulllineitems}}
600
% \begin{excclassdesc}{name}{constructor args}
601
% but indexes as an exception
602
\newenvironment{excclassdesc}[2]{
603
% Using \renewcommand doesn't work for this, for unknown reasons:
604
\global\def\itk@thisclass{#1}
605
\begin{fulllineitems}
606
\item[\strong{exception }\code{\bfcode{#1}(\itk@varvars{#2})}%
607
\index{#1@{\itk@idxcode{#1}} (exception in \itk@thismodule)}]
608
}{\end{fulllineitems}}
610
% There is no corresponding {excclassdesc*} environment. To describe
611
% a class exception without parameters, use the {excdesc} environment.
614
\let\itk@classbadkey=\@undefined
616
% object method ----------------------------------------------------------
617
% \begin{methoddesc}[classname]{methodname}{args}
618
\newcommand{\methodline}[3][\@undefined]{
619
\methodlineni{#2}{#3}
621
\index{#2@{\itk@idxcode{#2()}} (\itk@thisclass\ method)}
623
\index{#2@{\itk@idxcode{#2()}} (#1 method)}
626
\newenvironment{methoddesc}[3][\@undefined]{
627
\begin{fulllineitems}
631
\def\itk@thisclass{#1}
634
}{\end{fulllineitems}}
636
% similar to {methoddesc}, but doesn't add to the index
637
% (never actually uses the optional argument)
638
\newcommand{\methodlineni}[3][\itk@classbadkey]{%
639
\item[\code{\bfcode{#2}(\itk@varvars{#3})}]}
640
\newenvironment{methoddescni}[3][\itk@classbadkey]{
641
\begin{fulllineitems}
642
\methodlineni{#2}{#3}
643
}{\end{fulllineitems}}
645
% object data attribute --------------------------------------------------
646
% \begin{memberdesc}[classname]{membername}
647
\newcommand{\memberline}[2][\itk@classbadkey]{%
650
\index{#2@{\itk@idxcode{#2}} (\itk@thisclass\ attribute)}
653
\index{#2@{\itk@idxcode{#2}} (#1 attribute)}
656
\newenvironment{memberdesc}[2][\itk@classbadkey]{
657
\begin{fulllineitems}
661
\def\itk@thisclass{#1}
664
}{\end{fulllineitems}}
666
% similar to {memberdesc}, but doesn't add to the index
667
% (never actually uses the optional argument)
668
\newcommand{\memberlineni}[2][\itk@classbadkey]{\item[\bfcode{#2}]}
669
\newenvironment{memberdescni}[2][\itk@classbadkey]{
670
\begin{fulllineitems}
672
}{\end{fulllineitems}}
674
% For exceptions: --------------------------------------------------------
675
% \begin{excdesc}{name}
676
% -- for constructor information, use excclassdesc instead
677
\newenvironment{excdesc}[1]{
678
\begin{fulllineitems}
679
\item[\strong{exception }\bfcode{#1}%
680
\index{#1@{\itk@idxcode{#1}} (exception in \itk@thismodule)}]
681
}{\end{fulllineitems}}
683
% Module data or constants: ----------------------------------------------
684
% \begin{datadesc}{name}
685
\newcommand{\dataline}[1]{%
686
\datalineni{#1}\index{#1@{\itk@idxcode{#1}} (data in \itk@thismodule)}}
687
\newenvironment{datadesc}[1]{
688
\begin{fulllineitems}
690
}{\end{fulllineitems}}
692
% similar to {datadesc}, but doesn't add to the index
693
\newcommand{\datalineni}[1]{\item[\bfcode{#1}]\nopagebreak}
694
\newenvironment{datadescni}[1]{
695
\begin{fulllineitems}
697
}{\end{fulllineitems}}
699
% bytecode instruction ---------------------------------------------------
700
% \begin{opcodedesc}{name}{var}
702
\newenvironment{opcodedesc}[2]{
703
\begin{fulllineitems}
704
\item[\bfcode{#1}\quad\var{#2}]
705
}{\end{fulllineitems}}
708
\newcommand{\nodename}[1]{\label{#1}}
710
% For these commands, use \command{} to get the typography right, not
711
% {\command}. This works better with the texinfo translation.
712
\newcommand{\ABC}{{\sc abc}}
713
\newcommand{\UNIX}{{\sc Unix}}
714
\newcommand{\POSIX}{POSIX}
715
\newcommand{\ASCII}{{\sc ascii}}
716
\newcommand{\Cpp}{C\protect\raisebox{.18ex}{++}}
718
\newcommand{\EOF}{{\sc eof}}
719
\newcommand{\NULL}{\constant{NULL}}
720
\newcommand{\infinity}{\ensuremath{\infty}}
721
\newcommand{\plusminus}{\ensuremath{\pm}}
722
\newcommand{\menuselection}[1]{{\def\sub{ \ensuremath{>} }#1}}
724
% Also for consistency: spell Insight "Insight", not "insight"!
726
% code is the most difficult one...
727
\newcommand{\code}[1]{\textrm{\@vobeyspaces\@noligs\def\{{\char`\{}\def\}{\char`\}}\def\~{\char`\~}\def\^{\char`\^}\def\e{\char`\\}\def\${\char`\$}\def\#{\char`\#}\def\&{\char`\&}\def\%{\char`\%}%
730
\newcommand{\bfcode}[1]{\code{\bfseries#1}} % bold-faced code font
731
\newcommand{\kbd}[1]{\code{#1}}
732
\newcommand{\samp}[1]{`\code{#1}'}
733
% This weird definition of \var{} allows it to always appear in roman
734
% italics, and won't get funky in code fragments when we play around
735
% with fonts. This also works directly in math mode.
736
\newcommand{\var}[1]{%
738
\hbox{\normalsize\textrm{\textit{#1\/}}}%
740
\normalsize\textrm{\textit{#1\/}}%
743
\renewcommand{\emph}[1]{{\em #1}}
744
\newcommand{\dfn}[1]{\emph{#1}}
745
\newcommand{\strong}[1]{{\bf #1}}
746
% let's experiment with a new font:
747
\newcommand{\file}[1]{`{\small\textsf{#1}}'}
748
\newcommand{\filenq}[1]{{\small\textsf{#1}}}
750
% Use this def/redef approach for \url{} since hyperref defined this already,
751
% but only if we actually used hyperref:
752
\@ifundefined{pdfannotlink}{
753
\newcommand{\itk@url}[1]{\mbox{\small\textsf{#1}}}
755
\newcommand{\itk@url}[1]{{%
756
\pdfannotlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}%
757
\itk@LinkColor% color of the link text
758
\mbox{\small\textsf{#1}}%
759
\itk@NormalColor% Turn it back off; these are declarative
760
\pdfendlink}% and don't appear bound to the current
764
\newcommand{\email}[1]{{\small\textsf{#1}}}
765
\newcommand{\newsgroup}[1]{{\small\textsf{#1}}}
767
\newcommand{\itk@varvars}[1]{{%
768
{\let\unspecified=\itk@unspecified%
769
\let\moreargs=\itk@moreargs%
772
% I'd really like to get rid of this!
773
\newif\iftexi\texifalse
775
% This is used to get l2h to put the copyright and abstract on
776
% a separate HTML page.
777
\newif\ifhtml\htmlfalse
780
% These should be used for all references to identifiers which are
781
% used to refer to instances of specific language constructs. See the
782
% names for specific semantic assignments.
784
% For now, don't do anything really fancy with them; just use them as
785
% logical markup. This might change in the future.
787
\newcommand{\module}[1]{\texttt{#1}}
788
\newcommand{\keyword}[1]{\texttt{#1}}
789
\newcommand{\exception}[1]{\texttt{#1}}
790
\newcommand{\class}[1]{\texttt{#1}}
791
\newcommand{\function}[1]{\texttt{#1}}
792
\newcommand{\member}[1]{\texttt{#1}}
793
\newcommand{\method}[1]{\texttt{#1}}
795
\newcommand{\pytype}[1]{#1} % built-in Insight type
797
\newcommand{\cfunction}[1]{\texttt{#1}}
798
\newcommand{\ctype}[1]{\texttt{#1}} % C struct or typedef name
799
\newcommand{\cdata}[1]{\texttt{#1}} % C variable, typically global
801
\newcommand{\mimetype}[1]{{\small\textsf{#1}}}
802
% The \! is a "negative thin space" in math mode.
803
\newcommand{\regexp}[1]{%
804
{\tiny$^{^\lceil}\!\!$%
805
{\normalsize\code{#1}}%
808
\newcommand{\envvar}[1]{%
811
\index{environment variables!{#1}}%
813
\newcommand{\makevar}[1]{#1} % variable in a Makefile
814
\newcommand{\character}[1]{\samp{#1}}
816
% constants defined in Insight modules or C headers, not language constants:
817
\newcommand{\constant}[1]{\code{#1}} % manifest constant, not syntactic
819
\newcommand{\manpage}[2]{{\emph{#1}(#2)}}
820
\newcommand{\pep}[1]{PEP #1\index{Insight Enhancement Proposals!PEP #1}}
821
\newcommand{\rfc}[1]{RFC #1\index{RFC!RFC #1}}
822
\newcommand{\program}[1]{\strong{#1}}
823
\newcommand{\programopt}[1]{\strong{#1}}
824
% Note that \longprogramopt provides the '--'!
825
\newcommand{\longprogramopt}[1]{\strong{-{}-#1}}
826
% \ulink{link text}{URL}
827
\newcommand{\ulink}[2]{#1}
829
% cited titles: \citetitle{Title of Work}
830
% online: \citetitle[url-to-resource]{Title of Work}
831
\newcommand{\citetitle}[2][URL]{\emph{#2}}
834
\newenvironment{productionlist}[1][\itk@badkey]{
835
\def\optional##1{{\Large[}##1{\Large]}}
836
\def\production##1##2{\code{##1}&::=&\code{##2}\\}
837
\def\orgroup##1{{\def\or{\textbar\ }##1}}
847
% Should be extended to allow an index / list of deprecated stuff. But
848
% there's a lot of stuff that needs to be done to make that automatable.
850
% First parameter is the release number that deprecates the feature, the
851
% second is the action the should be taken by users of the feature.
854
% \deprecated{1.5.1}{Use \method{frobnicate()} instead.}
856
\newcommand{\deprecated}[2]{%
857
\strong{Deprecated since release #1.} #2\par}
860
% This should be used to mark things which have been added to the
861
% development tree but that aren't in the release, but are documented.
862
% This allows release of documentation that already includes updated
863
% descriptions. Place at end of descriptor environment.
866
% \versionadded{1.5.2}
867
% \versionchanged[short explanation]{2.0}
869
\newcommand{\versionadded}[2][\itk@badkey]{%
871
{ New in version #2. }%
873
{ New in version #2:\ #1. }%
876
\newcommand{\versionchanged}[2][\itk@badkey]{%
878
{ Changed in version #2. }%
880
{ Changed in version #2:\ #1. }%
887
\newenvironment{tableii}[4]{%
889
\def\lineii##1##2{\csname#2\endcsname{##1}&##2\\}%
890
\begin{tabular}{#1}\strong{#3}&\strong{#4} \\* \hline%
896
\newenvironment{longtableii}[4]{%
898
\def\lineii##1##2{\csname#2\endcsname{##1}&##2\\}%
899
\begin{longtable}[c]{#1}\strong{#3}&\strong{#4} \\* \hline\endhead%
905
\newenvironment{tableiii}[5]{%
907
\def\lineiii##1##2##3{\csname#2\endcsname{##1}&##2&##3\\}%
908
\begin{tabular}{#1}\strong{#3}&\strong{#4}&\strong{#5} \\%
915
\newenvironment{longtableiii}[5]{%
917
\def\lineiii##1##2##3{\csname#2\endcsname{##1}&##2&##3\\}%
918
\begin{longtable}[c]{#1}\strong{#3}&\strong{#4}&\strong{#5} \\%
925
\newenvironment{tableiv}[6]{%
927
\def\lineiv##1##2##3##4{\csname#2\endcsname{##1}&##2&##3&##4\\}%
928
\begin{tabular}{#1}\strong{#3}&\strong{#4}&\strong{#5}&\strong{#6} \\%
935
\newenvironment{longtableiv}[6]{%
937
\def\lineiv##1##2##3##4{\csname#2\endcsname{##1}&##2&##3&##4\\}%
938
\begin{longtable}[c]{#1}\strong{#3}&\strong{#4}&\strong{#5}&\strong{#6}%
946
\newenvironment{tablev}[7]{%
948
\def\linev##1##2##3##4##5{\csname#2\endcsname{##1}&##2&##3&##4&##5\\}%
949
\begin{tabular}{#1}\strong{#3}&\strong{#4}&\strong{#5}&\strong{#6}&\strong{#7} \\%
956
\newenvironment{longtablev}[7]{%
958
\def\linev##1##2##3##4##5{\csname#2\endcsname{##1}&##2&##3&##4&##5\\}%
959
\begin{longtable}[c]{#1}\strong{#3}&\strong{#4}&\strong{#5}&\strong{#6}&\strong{#7}%
967
% Cross-referencing (AMK, new impl. FLD)
970
% \seemodule{rand}{Uniform random number generator.}; % Module xref
971
% \seetext{\emph{Encyclopedia Britannica}}. % Ref to a book
973
% % A funky case: module name contains '_'; have to supply an optional key
974
% \seemodule[copyreg]{copy_reg}{Interface constructor registration for
978
% Note that the last parameter for \seemodule and \seetext should be complete
979
% sentences and be terminated with the proper punctuation.
981
\@ifundefined{pdfannotlink}{%
982
\newcommand{\itk@seemodule}[3][\itk@modulebadkey]{%
984
\ifx\itk@modulebadkey#1\def\itk@modulekey{#2}\else\def\itk@modulekey{#1}\fi%
985
\begin{fulllineitems}
986
\item[Module \module{#2} (section \ref{module-\itk@modulekey}):]
990
}{\newcommand{\itk@seemodule}[3][\itk@modulebadkey]{%
992
\ifx\itk@modulebadkey#1\def\itk@modulekey{#2}\else\def\itk@modulekey{#1}\fi%
993
\begin{fulllineitems}
994
\item[\itk@linkToName{label-module-\itk@modulekey}{Module \module{#2}}
995
(section \ref{module-\itk@modulekey}):]
1000
% \seetitle[url]{title}{why it's interesting}
1001
\newcommand{\itk@seetitle}[3][\itk@modulebadkey]{%
1003
\begin{fulllineitems}
1004
\item[\citetitle{#2}]
1005
\ifx\itk@modulebadkey#1\else
1006
\item[{\small{(\url{#1})}}]
1011
% \seepep{number}{title}{why it's interesting}
1012
\newcommand{\itk@seepep}[3]{%
1014
\begin{fulllineitems}
1015
\item[\pep{#1}, ``\emph{#2}'']
1019
% \seerfc{number}{title}{why it's interesting}
1020
\newcommand{\itk@seerfc}[3]{%
1022
\begin{fulllineitems}
1023
\item[\rfc{#1}, ``\emph{#2}'']
1027
% \seeurl{url}{why it's interesting}
1028
\newcommand{\itk@seeurl}[2]{%
1030
\begin{fulllineitems}
1035
\newenvironment{seealso}[0]{
1037
\strong{See Also:}\par
1038
\def\seetext##1{\par{##1}}
1039
\let\seemodule=\itk@seemodule
1040
\let\seepep=\itk@seepep
1041
\let\seerfc=\itk@seerfc
1042
\let\seetitle=\itk@seetitle
1043
\let\seeurl=\itk@seeurl
1047
% Allow the Insight release number to be specified independently of the
1048
% \date{}. This allows the date to reflect the document's date and
1049
% release to specify the Insight release that is documented.
1051
\newcommand{\itk@release}{}
1052
\newcommand{\version}{}
1053
\newcommand{\shortversion}{}
1054
\newcommand{\releaseinfo}{}
1055
\newcommand{\releasename}{Release}
1056
\newcommand{\release}[1]{%
1057
\renewcommand{\itk@release}{\releasename\space\version}%
1058
\renewcommand{\version}{#1}}
1059
\newcommand{\setshortversion}[1]{%
1060
\renewcommand{\shortversion}{#1}}
1061
\newcommand{\setreleaseinfo}[1]{%
1062
\renewcommand{\releaseinfo}{#1}}
1064
% Allow specification of the author's address separately from the
1065
% author's name. This can be used to format them differently, which
1068
\newcommand{\itk@authoraddress}{}
1069
\newcommand{\authoraddress}[1]{\renewcommand{\itk@authoraddress}{#1}}
1070
\let\developersaddress=\authoraddress
1071
\let\developer=\author
1072
\let\developers=\author
1074
% This sets up the fancy chapter headings that make the documents look
1075
% at least a little better than the usual LaTeX output.
1077
\@ifundefined{ChTitleVar}{}{
1078
\ChNameVar{\raggedleft\normalsize\itk@HeaderFamily}
1079
\ChNumVar{\raggedleft \bfseries\Large\itk@HeaderFamily}
1080
\ChTitleVar{\raggedleft \rm\Huge\itk@HeaderFamily}
1081
% This creates chapter heads without the leading \vspace*{}:
1082
\def\@makechapterhead#1{%
1083
{\parindent \z@ \raggedright \normalfont
1084
\ifnum \c@secnumdepth >\m@ne
1087
\interlinepenalty\@M
1094
% Definition lists; requested by AMK for HOWTO documents. Probably useful
1095
% elsewhere as well, so keep in in the general style support.
1097
\newenvironment{definitions}{%
1098
\begin{description}%
1099
\def\term##1{\item[##1]\mbox{}\\*[0mm]}
1104
% Tell TeX about pathological hyphenation cases:
1105
\hyphenation{Base-HTTP-Re-quest-Hand-ler}
1109
% Commands for adding the link reference to the URL in the Insight Journal
1111
\newcommand{\urlhandle}[1]{
1112
\url{http://hdl.handle.net/10380/#1}}
1114
\newcommand{\IJhandle}[1]{
1115
Latest version available at the \href{http://www.insight-journal.org}{Insight Journal} [\urlhandle{#1}]\\
1116
Distributed under \href{http://creativecommons.org/licenses/by/3.0/us/}{Creative Commons Attribution License}}
1118
\newcommand{\IJhandlefooter}[1]{
1122
\newcommand{\IJhandlenote}[1]{
1123
\fbox{ \parbox[t][1.5cm][t]{\textwidth}{\center{\IJhandle{#1}}} }}