~ubuntu-branches/debian/sid/simpleitk/sid

« back to all changes in this revision

Viewing changes to Wrapping/R/Packaging/SimpleITK/vignettes/InsightJournal.sty

  • Committer: Package Import Robot
  • Author(s): Ghislain Antony Vaillant
  • Date: 2017-11-02 08:49:18 UTC
  • Revision ID: package-import@ubuntu.com-20171102084918-7hs09ih668xq87ej
Tags: upstream-1.0.1
ImportĀ upstreamĀ versionĀ 1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%
 
2
% Insight.sty for the Insight docummentation  [works only with with Latex2e]
 
3
%
 
4
 
 
5
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
 
6
\ProvidesPackage{InsightJournal}
 
7
             [1998/01/11 LaTeX package (Insight markup)]
 
8
 
 
9
\RequirePackage{longtable}
 
10
\RequirePackage{graphics}
 
11
%\RequirePackage{picins}
 
12
\RequirePackage{floatflt}
 
13
\RequirePackage{url}
 
14
\RequirePackage{amsmath}
 
15
\RequirePackage{pslatex}
 
16
\RequirePackage{verbatim}
 
17
 
 
18
 
 
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''
 
24
 
 
25
% These packages can be used to add marginal annotations which indicate
 
26
% index entries and labels; useful for reviewing this messy documentation!
 
27
%
 
28
%\RequirePackage{showkeys}
 
29
%\RequirePackage{showidx}
 
30
 
 
31
% for PDF output, use maximal compression & a lot of other stuff
 
32
% (test for PDF recommended by Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov>)
 
33
%
 
34
\newif\ifitk@doing@page@targets
 
35
\itk@doing@page@targetsfalse
 
36
 
 
37
\ifx\pdfoutput\undefined\else\ifcase\pdfoutput
 
38
\else
 
39
  \input{pdfcolor}
 
40
  \let\itk@LinkColor=\NavyBlue
 
41
  \let\itk@NormalColor=\Black
 
42
  \pdfcompresslevel=9
 
43
  \pdfpagewidth=\paperwidth    % page width of PDF output
 
44
  \pdfpageheight=\paperheight  % page height of PDF output
 
45
  %
 
46
  % Pad the number with '0' to 3 digits wide so no page name is a prefix
 
47
  % of any other.
 
48
  %
 
49
  \newcommand{\itk@targetno}[1]{\ifnum#1<100 0\fi\ifnum#1<10 0\fi#1}
 
50
  \newcommand{\itk@pageno}{\itk@targetno\thepage}
 
51
  %
 
52
  % This definition allows the entries in the page-view of the ToC to be
 
53
  % active links.  Some work, some don't.
 
54
  %
 
55
  \let\itk@OldContentsline=\contentsline
 
56
  %
 
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
 
60
  % this style file.
 
61
  \newcommand{\itk@linkToName}[2]{%
 
62
    \pdfannotlink attr{/Border [0 0 0]} goto name{#1}%
 
63
      \itk@LinkColor#2\itk@NormalColor%
 
64
    \pdfendlink%
 
65
  }
 
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}%
 
71
  }
 
72
  \AtEndDocument{
 
73
    \InputIfFileExists{\jobname.bkm}{\pdfcatalog{/PageMode /UseOutlines}}{}
 
74
  }
 
75
  \newcommand{\itk@target}[1]{%
 
76
    \ifitk@doing@page@targets%
 
77
      {\pdfdest name{#1} xyz}%
 
78
    \fi%
 
79
  }
 
80
  \let\itk@OldLabel=\label
 
81
  \renewcommand{\label}[1]{%
 
82
    \itk@OldLabel{#1}%
 
83
    \itk@target{label-#1}%
 
84
  }
 
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.
 
88
  %
 
89
  % This is *heavily* based on the hyperref package.
 
90
  %
 
91
  \def\@begindvi{%
 
92
    \unvbox \@begindvibox
 
93
    \@hyperfixhead
 
94
  }
 
95
  \def\@hyperfixhead{%
 
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}%
 
101
  }
 
102
\fi\fi
 
103
 
 
104
% Increase printable page size (copied from fullpage.sty)
 
105
\topmargin 0.25in
 
106
\advance \topmargin by -\headheight
 
107
\advance \topmargin by -\headsep
 
108
 
 
109
% attempt to work a little better for A4 users
 
110
\textheight \paperheight
 
111
\advance\textheight by -2in
 
112
 
 
113
\oddsidemargin 20pt
 
114
\evensidemargin -20pt
 
115
\marginparwidth 0.25in
 
116
 
 
117
\textwidth \paperwidth
 
118
\advance\textwidth by -2in
 
119
 
 
120
 
 
121
% Style parameters and macros used by most documents here
 
122
\raggedbottom
 
123
\sloppy
 
124
\parindent = 0mm
 
125
\parskip = 2mm
 
126
\hbadness = 5000                % don't print trivial gripes
 
127
 
 
128
\pagestyle{empty}               % start this way; change for
 
129
\pagenumbering{roman}           % ToC & chapters
 
130
 
 
131
% Use this to set the font family for headers and other decor:
 
132
\newcommand{\itk@HeaderFamily}{\sffamily}
 
133
 
 
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}{
 
138
    \fancyhf{}
 
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}
 
144
  }
 
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}{
 
149
    \fancyhf{}
 
150
    \renewcommand{\headrulewidth}{0pt}
 
151
    \renewcommand{\footrulewidth}{0pt}
 
152
  }
 
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
 
159
      \hbox{}
 
160
      \thispagestyle{plain}
 
161
      \newpage
 
162
      \if@twocolumn\hbox{}\newpage\fi\fi\fi
 
163
    }
 
164
  }
 
165
}
 
166
 
 
167
 
 
168
 
 
169
% This does a similar thing for the {alltt} environment:
 
170
\RequirePackage{alltt}
 
171
\let\itk@OldAllTT=\alltt
 
172
\let\itk@OldEndAllTT=\endalltt
 
173
 
 
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}%
 
179
  %
 
180
  \par\indent%
 
181
  \begin{minipage}[t]{\itk@codewidth}%
 
182
    \small%
 
183
    \itk@OldAllTT%
 
184
}
 
185
\renewcommand{\endalltt}{%
 
186
    \itk@OldEndAllTT%
 
187
  \end{minipage}%
 
188
}
 
189
 
 
190
 
 
191
\newcommand{\itk@modulebadkey}{{--just-some-junk--}}
 
192
 
 
193
 
 
194
%%  Lots of index-entry generation support.
 
195
 
 
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.
 
200
%
 
201
\newcommand{\itk@idxcode}[1]{\texttt{#1}}
 
202
%\renewcommand{\itk@idxcode}[1]{#1}
 
203
 
 
204
% Command to generate two index entries (using subentries)
 
205
\newcommand{\indexii}[2]{\index{#1!#2}\index{#2!#1}}
 
206
 
 
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}}
 
209
 
 
210
% And four (again, using only one level of subentries)
 
211
\newcommand{\indexiv}[4]{
 
212
\index{#1!#2 #3 #4}
 
213
\index{#2!#3 #4, #1}
 
214
\index{#3!#4, #1 #2}
 
215
\index{#4!#1 #2 #3}
 
216
}
 
217
 
 
218
% Command to generate a reference to a function, statement, keyword,
 
219
% operator.
 
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)}}
 
227
 
 
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 }}
 
234
 
 
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}}
 
239
}{%
 
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}}%
 
243
  }
 
244
}
 
245
 
 
246
% support for the module index
 
247
\newif\ifitk@UseModuleIndex
 
248
\itk@UseModuleIndexfalse
 
249
 
 
250
\newcommand{\makemodindex}{
 
251
  \newwrite\modindexfile
 
252
  \openout\modindexfile=mod\jobname.idx
 
253
  \itk@UseModuleIndextrue
 
254
}
 
255
 
 
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}}%
 
266
    }
 
267
  \fi%
 
268
}
 
269
 
 
270
% *** XXX *** THE NEXT FOUR MACROS ARE NOW OBSOLETE !!! ***
 
271
 
 
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!}}
 
277
 
 
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!}}
 
283
 
 
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]{%
 
290
  \ifitk@usingsubitem
 
291
    \index{#1@{\itk@idxcode{#1}}\itk@indexsubitem}%
 
292
  \else%
 
293
    \index{#1@{\itk@idxcode{#1}}}%
 
294
  \fi%
 
295
}
 
296
\newcommand{\withsubitem}[2]{%
 
297
  \begingroup%
 
298
    \def\ttindex##1{\index{##1@{\itk@idxcode{##1}} #1}}%
 
299
    #2%
 
300
  \endgroup%
 
301
}
 
302
 
 
303
 
 
304
% Module synopsis processing -----------------------------------------------
 
305
%
 
306
\newcommand{\itk@thisclass}{}
 
307
\newcommand{\itk@thismodule}{}
 
308
\newcommand{\itk@thismodulekey}{}
 
309
\newcommand{\itk@thismoduletype}{}
 
310
 
 
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}{}}
 
315
 
 
316
\newif\ifitk@HaveModSynopsis       \itk@HaveModSynopsisfalse
 
317
\newif\ifitk@ModSynopsisFileIsOpen \itk@ModSynopsisFileIsOpenfalse
 
318
\newif\ifitk@HaveModPlatform       \itk@HaveModPlatformfalse
 
319
 
 
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}
 
326
  \else
 
327
    \renewcommand{\itk@thismodulekey}{#1}
 
328
  \fi
 
329
  \@ifundefined{itk@#2IndexModule}{%
 
330
    \typeout{*** MACRO declaremodule called with unknown module type: `#2'}
 
331
    \itk@IndexModule{#3}%
 
332
  }{%
 
333
    \csname itk@#2IndexModule\endcsname{#3}%
 
334
  }
 
335
  \label{module-\itk@thismodulekey}
 
336
}
 
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
 
344
  \fi
 
345
}
 
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}%
 
350
  \fi%
 
351
  \csname itk@modplat@\itk@key\endcsname%
 
352
}
 
353
\newcommand{\ignorePlatformAnnotation}[1]{}
 
354
 
 
355
% \moduleauthor{name}{email}
 
356
\newcommand{\moduleauthor}[2]{}
 
357
 
 
358
% \sectionauthor{name}{email}
 
359
\newcommand{\sectionauthor}[2]{}
 
360
 
 
361
 
 
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}
 
367
}
 
368
 
 
369
% define the file
 
370
\newwrite\itk@ModSynopsisFile
 
371
 
 
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}%
 
376
      {\string#1}%
 
377
}
 
378
\newcommand{\itk@closeModSynopsisFile}{
 
379
  \ifitk@ModSynopsisFileIsOpen
 
380
    \closeout\itk@ModSynopsisFile
 
381
    \itk@ModSynopsisFileIsOpenfalse
 
382
  \fi
 
383
}
 
384
\newcommand{\itk@openModSynopsisFile}{
 
385
  \ifitk@ModSynopsisFileIsOpen\else
 
386
    \openout\itk@ModSynopsisFile=\itk@ModSynopsisFilename
 
387
    \itk@ModSynopsisFileIsOpentrue
 
388
  \fi
 
389
}
 
390
 
 
391
\newcommand{\itk@ProcessModSynopsis}{
 
392
  \ifitk@HaveModSynopsis
 
393
    \itk@writeModSynopsisFile{\modulesynopsis%
 
394
      {\itk@thismodulekey}{\itk@thismodule}%
 
395
      {\itk@thismoduletype}{\itk@modulesynopsis}}%
 
396
    \itk@HaveModSynopsisfalse
 
397
  \fi
 
398
  \renewcommand{\itk@modulesynopsis}{\itk@defsynopsis}
 
399
}
 
400
\AtEndDocument{\itk@ProcessModSynopsis\itk@closeModSynopsisFile}
 
401
 
 
402
 
 
403
\long\def\itk@writeModPlatformFile#1{%
 
404
  \protected@write\itk@ModPlatformFile%
 
405
    {\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}%
 
406
    {\string#1}%
 
407
}
 
408
 
 
409
 
 
410
\newcommand{\localmoduletable}{
 
411
  \IfFileExists{\itk@ModSynopsisFilename}{
 
412
    \begin{synopsistable}
 
413
      \input{\itk@ModSynopsisFilename}
 
414
    \end{synopsistable}
 
415
  }{}
 
416
}
 
417
 
 
418
\@ifundefined{pdfoutput}{
 
419
  \newcommand{\itk@ModSynopsisSummary}[4]{\bfcode{#2} & #4\\}
 
420
}{
 
421
  \newcommand{\itk@ModSynopsisSummary}[4]{%
 
422
    \itk@linkToName{label-module-#1}{\bfcode{#2}} & #4\\
 
423
  }
 
424
}
 
425
\newenvironment{synopsistable}{
 
426
  % key, name, type, synopsis
 
427
  \let\modulesynopsis=\itk@ModSynopsisSummary
 
428
  \begin{tabular}{ll}
 
429
}{
 
430
  \end{tabular}
 
431
}
 
432
%
 
433
% --------------------------------------------------------------------------
 
434
 
 
435
 
 
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}{}
 
443
}
 
444
 
 
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}%
 
450
                                    {2.3ex \@plus.2ex}%
 
451
                                    {\reset@font\Large\itk@HeaderFamily}}
 
452
\renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}%
 
453
                                    {-3.25ex\@plus -1ex \@minus -.2ex}%
 
454
                                    {1.5ex \@plus .2ex}%
 
455
                                    {\reset@font\large\itk@HeaderFamily}}
 
456
\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}%
 
457
                                    {-3.25ex\@plus -1ex \@minus -.2ex}%
 
458
                                    {1.5ex \@plus .2ex}%
 
459
                                    {\reset@font\normalsize\itk@HeaderFamily}}
 
460
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}%
 
461
                                    {3.25ex \@plus1ex \@minus.2ex}%
 
462
                                    {-1em}%
 
463
                                    {\reset@font\normalsize\itk@HeaderFamily}}
 
464
\renewcommand{\subparagraph}{\@startsection{subparagraph}{5}{\parindent}%
 
465
                                    {3.25ex \@plus1ex \@minus .2ex}%
 
466
                                    {-1em}%
 
467
                                    {\reset@font\normalsize\itk@HeaderFamily}}
 
468
 
 
469
 
 
470
% This gets the underscores closer to the right width; the only change
 
471
% from standard LaTeX is the width specified.
 
472
 
 
473
\DeclareTextCommandDefault{\textunderscore}{%
 
474
  \leavevmode \kern.06em\vbox{\hrule\@width.55em}}
 
475
 
 
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.
 
479
 
 
480
 
 
481
% {fulllineitems} is used in one place in libregex.tex, but is really for
 
482
% internal use in this file.
 
483
%
 
484
\newcommand{\itk@itemnewline}[1]{%
 
485
  \@tempdima\linewidth%
 
486
  \advance\@tempdima \leftmargin\makebox[\@tempdima][l]{#1}%
 
487
}
 
488
 
 
489
\newenvironment{fulllineitems}{
 
490
  \begin{list}{}{\labelwidth \leftmargin \labelsep 0pt
 
491
                 \rightmargin 0pt \topsep -\parskip \partopsep \parskip
 
492
                 \itemsep -\parsep
 
493
                 \let\makelabel=\itk@itemnewline}
 
494
}{\end{list}}
 
495
 
 
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.
 
499
%
 
500
% Typical usage:
 
501
%
 
502
%     \begin{funcdesc}{myfunc}{reqparm\optional{, optparm}}
 
503
%                                    ^^^       ^^^
 
504
%                          No space here       No space here
 
505
%
 
506
% When a function has multiple optional parameters, \optional should be
 
507
% nested, not chained.  This is right:
 
508
%
 
509
%     \begin{funcdesc}{myfunc}{\optional{parm1\optional{, parm2}}}
 
510
%
 
511
\let\itk@badkey=\@undefined
 
512
 
 
513
\newcommand{\optional}[1]{%
 
514
  {\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}}
 
515
 
 
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}{...}
 
519
 
 
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
 
522
% something else.
 
523
\newcommand{\itk@unspecified}{...}
 
524
 
 
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}.}\\
 
534
    \fi
 
535
}{\end{fulllineitems}}
 
536
 
 
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}}
 
543
 
 
544
% C data types -----------------------------------------------------------
 
545
% \begin{ctypedesc}[index name]{typedef name}
 
546
\newenvironment{ctypedesc}[2][\itk@badkey]{
 
547
  \begin{fulllineitems}
 
548
    \item[\bfcode{#2}%
 
549
    \ifx#1\@undefined%
 
550
      \index{#2@{\itk@idxcode{#2}} (C type)}
 
551
    \else%
 
552
      \index{#2@{\itk@idxcode{#1}} (C type)}
 
553
    \fi]
 
554
}{\end{fulllineitems}}
 
555
 
 
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}}
 
563
 
 
564
% simple functions (not methods) -----------------------------------------
 
565
% \begin{funcdesc}{name}{args}
 
566
\newcommand{\funcline}[2]{%
 
567
  \funclineni{#1}{#2}%
 
568
  \index{#1@{\itk@idxcode{#1()}} (in module \itk@thismodule)}}
 
569
\newenvironment{funcdesc}[2]{
 
570
  \begin{fulllineitems}
 
571
    \funcline{#1}{#2}
 
572
}{\end{fulllineitems}}
 
573
 
 
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}
 
578
    \funclineni{#1}{#2}
 
579
}{\end{fulllineitems}}
 
580
 
 
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}}
 
590
 
 
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}}
 
599
 
 
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}}
 
609
 
 
610
% There is no corresponding {excclassdesc*} environment.  To describe
 
611
% a class exception without parameters, use the {excdesc} environment.
 
612
 
 
613
 
 
614
\let\itk@classbadkey=\@undefined
 
615
 
 
616
% object method ----------------------------------------------------------
 
617
% \begin{methoddesc}[classname]{methodname}{args}
 
618
\newcommand{\methodline}[3][\@undefined]{
 
619
  \methodlineni{#2}{#3}
 
620
  \ifx#1\@undefined
 
621
    \index{#2@{\itk@idxcode{#2()}} (\itk@thisclass\ method)}
 
622
  \else
 
623
    \index{#2@{\itk@idxcode{#2()}} (#1 method)}
 
624
  \fi
 
625
}
 
626
\newenvironment{methoddesc}[3][\@undefined]{
 
627
  \begin{fulllineitems}
 
628
    \ifx#1\@undefined
 
629
      \methodline{#2}{#3}
 
630
    \else
 
631
      \def\itk@thisclass{#1}
 
632
      \methodline{#2}{#3}
 
633
    \fi
 
634
}{\end{fulllineitems}}
 
635
 
 
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}}
 
644
 
 
645
% object data attribute --------------------------------------------------
 
646
% \begin{memberdesc}[classname]{membername}
 
647
\newcommand{\memberline}[2][\itk@classbadkey]{%
 
648
  \ifx#1\@undefined
 
649
    \memberlineni{#2}
 
650
    \index{#2@{\itk@idxcode{#2}} (\itk@thisclass\ attribute)}
 
651
  \else
 
652
    \memberlineni{#2}
 
653
    \index{#2@{\itk@idxcode{#2}} (#1 attribute)}
 
654
  \fi
 
655
}
 
656
\newenvironment{memberdesc}[2][\itk@classbadkey]{
 
657
  \begin{fulllineitems}
 
658
    \ifx#1\@undefined
 
659
      \memberline{#2}
 
660
    \else
 
661
      \def\itk@thisclass{#1}
 
662
      \memberline{#2}
 
663
    \fi
 
664
}{\end{fulllineitems}}
 
665
 
 
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}
 
671
    \memberlineni{#2}
 
672
}{\end{fulllineitems}}
 
673
 
 
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}}
 
682
 
 
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}
 
689
    \dataline{#1}
 
690
}{\end{fulllineitems}}
 
691
 
 
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}
 
696
    \datalineni{#1}
 
697
}{\end{fulllineitems}}
 
698
 
 
699
% bytecode instruction ---------------------------------------------------
 
700
% \begin{opcodedesc}{name}{var}
 
701
% -- {var} may be {}
 
702
\newenvironment{opcodedesc}[2]{
 
703
  \begin{fulllineitems}
 
704
    \item[\bfcode{#1}\quad\var{#2}]
 
705
}{\end{fulllineitems}}
 
706
 
 
707
 
 
708
\newcommand{\nodename}[1]{\label{#1}}
 
709
 
 
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}{++}}
 
717
\newcommand{\C}{C}
 
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}}
 
723
 
 
724
% Also for consistency: spell Insight "Insight", not "insight"!
 
725
 
 
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`\%}%
 
728
\texttt{#1}}}
 
729
 
 
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]{%
 
737
  \ifmmode%
 
738
    \hbox{\normalsize\textrm{\textit{#1\/}}}%
 
739
  \else%
 
740
    \normalsize\textrm{\textit{#1\/}}%
 
741
  \fi%
 
742
}
 
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}}}
 
749
 
 
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}}}
 
754
}{
 
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
 
761
  }%                                    formatting "box".
 
762
}
 
763
\let\url=\itk@url
 
764
\newcommand{\email}[1]{{\small\textsf{#1}}}
 
765
\newcommand{\newsgroup}[1]{{\small\textsf{#1}}}
 
766
 
 
767
\newcommand{\itk@varvars}[1]{{%
 
768
  {\let\unspecified=\itk@unspecified%
 
769
   \let\moreargs=\itk@moreargs%
 
770
   \var{#1}}}}
 
771
 
 
772
% I'd really like to get rid of this!
 
773
\newif\iftexi\texifalse
 
774
 
 
775
% This is used to get l2h to put the copyright and abstract on
 
776
% a separate HTML page.
 
777
\newif\ifhtml\htmlfalse
 
778
 
 
779
 
 
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.
 
783
%
 
784
% For now, don't do anything really fancy with them; just use them as
 
785
% logical markup.  This might change in the future.
 
786
%
 
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}}
 
794
 
 
795
\newcommand{\pytype}[1]{#1}             % built-in Insight type
 
796
 
 
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
 
800
 
 
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}}%
 
806
   $\!\rfloor\!$%
 
807
  }}
 
808
\newcommand{\envvar}[1]{%
 
809
  #1%
 
810
  \index{#1@{#1}}%
 
811
  \index{environment variables!{#1}}%
 
812
}
 
813
\newcommand{\makevar}[1]{#1}            % variable in a Makefile
 
814
\newcommand{\character}[1]{\samp{#1}}
 
815
 
 
816
% constants defined in Insight modules or C headers, not language constants:
 
817
\newcommand{\constant}[1]{\code{#1}}    % manifest constant, not syntactic
 
818
 
 
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}
 
828
 
 
829
% cited titles:  \citetitle{Title of Work}
 
830
%       online:  \citetitle[url-to-resource]{Title of Work}
 
831
\newcommand{\citetitle}[2][URL]{\emph{#2}}
 
832
 
 
833
 
 
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}}
 
838
  \def\token##1{##1}
 
839
  \begin{center}
 
840
    \begin{tabular}{lcl}
 
841
}{%
 
842
    \end{tabular}
 
843
  \end{center}
 
844
}
 
845
 
 
846
% Deprecation stuff.
 
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.
 
849
%
 
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.
 
852
%
 
853
% Example:
 
854
%  \deprecated{1.5.1}{Use \method{frobnicate()} instead.}
 
855
%
 
856
\newcommand{\deprecated}[2]{%
 
857
  \strong{Deprecated since release #1.}  #2\par}
 
858
 
 
859
% New stuff.
 
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.
 
864
%
 
865
% Example:
 
866
%  \versionadded{1.5.2}
 
867
%  \versionchanged[short explanation]{2.0}
 
868
%
 
869
\newcommand{\versionadded}[2][\itk@badkey]{%
 
870
  \ifx#1\@undefined%
 
871
    {  New in version #2.  }%
 
872
  \else%
 
873
    {  New in version #2:\ #1.  }%
 
874
  \fi%
 
875
}
 
876
\newcommand{\versionchanged}[2][\itk@badkey]{%
 
877
  \ifx#1\@undefined%
 
878
    {  Changed in version #2.  }%
 
879
  \else%
 
880
    {  Changed in version #2:\ #1.  }%
 
881
  \fi%
 
882
}
 
883
 
 
884
 
 
885
% Tables.
 
886
%
 
887
\newenvironment{tableii}[4]{%
 
888
  \begin{center}%
 
889
    \def\lineii##1##2{\csname#2\endcsname{##1}&##2\\}%
 
890
    \begin{tabular}{#1}\strong{#3}&\strong{#4} \\* \hline%
 
891
}{%
 
892
    \end{tabular}%
 
893
  \end{center}%
 
894
}
 
895
 
 
896
\newenvironment{longtableii}[4]{%
 
897
  \begin{center}%
 
898
    \def\lineii##1##2{\csname#2\endcsname{##1}&##2\\}%
 
899
    \begin{longtable}[c]{#1}\strong{#3}&\strong{#4} \\* \hline\endhead%
 
900
}{%
 
901
    \end{longtable}%
 
902
  \end{center}%
 
903
}
 
904
 
 
905
\newenvironment{tableiii}[5]{%
 
906
  \begin{center}%
 
907
    \def\lineiii##1##2##3{\csname#2\endcsname{##1}&##2&##3\\}%
 
908
    \begin{tabular}{#1}\strong{#3}&\strong{#4}&\strong{#5} \\%
 
909
      \hline%
 
910
}{%
 
911
    \end{tabular}%
 
912
  \end{center}%
 
913
}
 
914
 
 
915
\newenvironment{longtableiii}[5]{%
 
916
  \begin{center}%
 
917
    \def\lineiii##1##2##3{\csname#2\endcsname{##1}&##2&##3\\}%
 
918
    \begin{longtable}[c]{#1}\strong{#3}&\strong{#4}&\strong{#5} \\%
 
919
      \hline\endhead%
 
920
}{%
 
921
    \end{longtable}%
 
922
  \end{center}%
 
923
}
 
924
 
 
925
\newenvironment{tableiv}[6]{%
 
926
  \begin{center}%
 
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} \\%
 
929
      \hline%
 
930
}{%
 
931
    \end{tabular}%
 
932
  \end{center}%
 
933
}
 
934
 
 
935
\newenvironment{longtableiv}[6]{%
 
936
  \begin{center}%
 
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}%
 
939
      \\%
 
940
      \hline\endhead%
 
941
}{%
 
942
    \end{longtable}%
 
943
  \end{center}%
 
944
}
 
945
 
 
946
\newenvironment{tablev}[7]{%
 
947
  \begin{center}%
 
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} \\%
 
950
      \hline%
 
951
}{%
 
952
    \end{tabular}%
 
953
  \end{center}%
 
954
}
 
955
 
 
956
\newenvironment{longtablev}[7]{%
 
957
  \begin{center}%
 
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}%
 
960
      \\%
 
961
      \hline\endhead%
 
962
}{%
 
963
    \end{longtable}%
 
964
  \end{center}%
 
965
}
 
966
 
 
967
% Cross-referencing (AMK, new impl. FLD)
 
968
% Sample usage:
 
969
%  \begin{seealso}
 
970
%    \seemodule{rand}{Uniform random number generator.}; % Module xref
 
971
%    \seetext{\emph{Encyclopedia Britannica}}.           % Ref to a book
 
972
%
 
973
%    % A funky case: module name contains '_'; have to supply an optional key
 
974
%    \seemodule[copyreg]{copy_reg}{Interface constructor registration for
 
975
%                                  \module{pickle}.}
 
976
%  \end{seealso}
 
977
%
 
978
% Note that the last parameter for \seemodule and \seetext should be complete
 
979
% sentences and be terminated with the proper punctuation.
 
980
 
 
981
\@ifundefined{pdfannotlink}{%
 
982
  \newcommand{\itk@seemodule}[3][\itk@modulebadkey]{%
 
983
    \par%
 
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}):]
 
987
      #3
 
988
    \end{fulllineitems}
 
989
  }
 
990
}{\newcommand{\itk@seemodule}[3][\itk@modulebadkey]{%
 
991
    \par%
 
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}):]
 
996
      #3
 
997
    \end{fulllineitems}
 
998
  }
 
999
}
 
1000
% \seetitle[url]{title}{why it's interesting}
 
1001
\newcommand{\itk@seetitle}[3][\itk@modulebadkey]{%
 
1002
  \par
 
1003
  \begin{fulllineitems}
 
1004
    \item[\citetitle{#2}]
 
1005
    \ifx\itk@modulebadkey#1\else
 
1006
      \item[{\small{(\url{#1})}}]
 
1007
    \fi
 
1008
    #3
 
1009
  \end{fulllineitems}
 
1010
}
 
1011
% \seepep{number}{title}{why it's interesting}
 
1012
\newcommand{\itk@seepep}[3]{%
 
1013
  \par%
 
1014
  \begin{fulllineitems}
 
1015
    \item[\pep{#1}, ``\emph{#2}'']
 
1016
    #3
 
1017
  \end{fulllineitems}
 
1018
}
 
1019
% \seerfc{number}{title}{why it's interesting}
 
1020
\newcommand{\itk@seerfc}[3]{%
 
1021
  \par%
 
1022
  \begin{fulllineitems}
 
1023
    \item[\rfc{#1}, ``\emph{#2}'']
 
1024
    #3
 
1025
  \end{fulllineitems}
 
1026
}
 
1027
% \seeurl{url}{why it's interesting}
 
1028
\newcommand{\itk@seeurl}[2]{%
 
1029
  \par%
 
1030
  \begin{fulllineitems}
 
1031
    \item[\url{#1}]
 
1032
    #2
 
1033
  \end{fulllineitems}
 
1034
}
 
1035
\newenvironment{seealso}[0]{
 
1036
  \par
 
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
 
1044
}{\par}
 
1045
 
 
1046
 
 
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.
 
1050
%
 
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}}
 
1063
 
 
1064
% Allow specification of the author's address separately from the
 
1065
% author's name.  This can be used to format them differently, which
 
1066
% is a good thing.
 
1067
%
 
1068
\newcommand{\itk@authoraddress}{}
 
1069
\newcommand{\authoraddress}[1]{\renewcommand{\itk@authoraddress}{#1}}
 
1070
\let\developersaddress=\authoraddress
 
1071
\let\developer=\author
 
1072
\let\developers=\author
 
1073
 
 
1074
% This sets up the fancy chapter headings that make the documents look
 
1075
% at least a little better than the usual LaTeX output.
 
1076
%
 
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
 
1085
        \DOCH
 
1086
      \fi
 
1087
      \interlinepenalty\@M
 
1088
      \DOTI{#1}
 
1089
    }
 
1090
  }
 
1091
}
 
1092
 
 
1093
 
 
1094
% Definition lists; requested by AMK for HOWTO documents.  Probably useful
 
1095
% elsewhere as well, so keep in in the general style support.
 
1096
%
 
1097
\newenvironment{definitions}{%
 
1098
  \begin{description}%
 
1099
  \def\term##1{\item[##1]\mbox{}\\*[0mm]}
 
1100
}{%
 
1101
  \end{description}%
 
1102
}
 
1103
 
 
1104
% Tell TeX about pathological hyphenation cases:
 
1105
\hyphenation{Base-HTTP-Re-quest-Hand-ler}
 
1106
 
 
1107
 
 
1108
%
 
1109
%  Commands for adding the link reference to the URL in the Insight Journal
 
1110
%
 
1111
\newcommand{\urlhandle}[1]{
 
1112
\url{http://hdl.handle.net/10380/#1}}
 
1113
 
 
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}}
 
1117
 
 
1118
\newcommand{\IJhandlefooter}[1]{
 
1119
\fancyfoot[CO,CE]{
 
1120
  \IJhandle{#1} }}
 
1121
 
 
1122
\newcommand{\IJhandlenote}[1]{
 
1123
  \fbox{ \parbox[t][1.5cm][t]{\textwidth}{\center{\IJhandle{#1}}} }}