~ubuntu-branches/ubuntu/karmic/python-docutils/karmic

« back to all changes in this revision

Viewing changes to docutils/writers/newlatex2e/base.tex

  • Committer: Bazaar Package Importer
  • Author(s): martin f. krafft
  • Date: 2006-07-10 11:45:05 UTC
  • mfrom: (2.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20060710114505-otkhqcslevewxmz5
Tags: 0.4-3
Added build dependency on python-central (closes: #377580).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
\makeatletter
 
2
 
 
3
% Development notes at
 
4
% http://docutils.python-hosting.com/wiki/NewLatex
 
5
 
 
6
 
 
7
\providecommand{\Dprinting}{false}
 
8
 
 
9
 
 
10
\providecommand{\DSearly}{}
 
11
\providecommand{\DSlate}{}
 
12
 
 
13
\providecommand{\Ddocumentclass}{scrartcl}
 
14
\providecommand{\Ddocumentoptions}{a4paper}
 
15
 
 
16
\documentclass[\Ddocumentoptions]{\Ddocumentclass}
 
17
 
 
18
\DSearly
 
19
 
 
20
 
 
21
\providecommand{\DSfontencoding}{
 
22
  % Set up font encoding.
 
23
  % AE is a T1-emulation.  It provides most characters and features
 
24
  % as T1-encoded fonts but doesn't use ugly bitmap fonts.
 
25
  \usepackage{ae}
 
26
  % Provide the characters not contained in AE from EC bitmap fonts.
 
27
  \usepackage{aecompl}
 
28
  % Guillemets ("<<", ">>") in AE.
 
29
  \usepackage{aeguill}
 
30
}
 
31
 
 
32
 
 
33
\providecommand{\DSsymbols}{%
 
34
  % Fix up symbols.
 
35
  % The Euro symbol in Computer Modern looks, um, funny.  Let's get a
 
36
  % proper Euro symbol.
 
37
  \RequirePackage{eurosym}%
 
38
  \renewcommand{\texteuro}{\euro}%
 
39
}
 
40
 
 
41
 
 
42
% Taken from
 
43
% <http://groups.google.de/groups?selm=1i0n5tgtplti420e1omp4pctlv19jpuhbb%404ax.com>
 
44
% and modified.  Used with permission.
 
45
\providecommand{\Dprovidelength}[2]{%
 
46
  \begingroup%
 
47
    \escapechar\m@ne%
 
48
    \xdef\@gtempa{{\string#1}}%
 
49
  \endgroup%
 
50
  \expandafter\@ifundefined\@gtempa%
 
51
  {\newlength{#1}\setlength{#1}{#2}}%
 
52
  {}%
 
53
}
 
54
 
 
55
\providecommand{\Dprovidecounter}[1]{%
 
56
  % Like \newcounter except that it doesn't crash if the counter
 
57
  % already exists.
 
58
  \@ifundefined{c@#1}{\newcounter{#1}}{}
 
59
}
 
60
 
 
61
\Dprovidelength{\Dboxparindent}{\parindent}
 
62
\providecommand{\Dmakeboxminipage}[1]{%
 
63
  % Make minipage for use in a box created by \Dmakefbox.
 
64
  \begin{minipage}[t]{0.9\linewidth}%
 
65
    \setlength{\parindent}{\Dboxparindent}%
 
66
    #1%
 
67
  \end{minipage}%
 
68
}
 
69
\providecommand{\Dmakefbox}[1]{%
 
70
  % Make a centered, framed box.  Useful e.g. for admonitions.
 
71
  \vspace{0.4\baselineskip}%
 
72
  \begin{center}%
 
73
    \fbox{\Dmakeboxminipage{#1}}%
 
74
  \end{center}%
 
75
  \vspace{0.4\baselineskip}%
 
76
}
 
77
\providecommand{\Dmakebox}[1]{%
 
78
  % Make a centered, frameless box.  Useful e.g. for block quotes.
 
79
  % Do not use minipages here, but create pseudo-lists to allow
 
80
  % page-breaking.  (Don't use KOMA-script's addmargin environment
 
81
  % because it messes up bullet lists.)
 
82
  \Dmakelistenvironment{}{}{%
 
83
    \setlength{\parskip}{0pt}%
 
84
    \setlength{\parindent}{\Dboxparindent}%
 
85
    \item{#1}%
 
86
  }%
 
87
}
 
88
 
 
89
 
 
90
\RequirePackage{ifthen}
 
91
\providecommand{\Dfrenchspacing}{true}
 
92
\ifthenelse{\equal{\Dfrenchspacing}{true}}{\frenchspacing}{}
 
93
 
 
94
 
 
95
\Dprovidelength{\Dblocklevelvspace}{%
 
96
  % Space between block-level elements other than paragraphs.
 
97
  0.7\baselineskip plus 0.3\baselineskip minus 0.2\baselineskip%
 
98
}
 
99
\providecommand{\Dauxiliaryspace}{%
 
100
  \ifthenelse{\equal{\Dneedvspace}{true}}{\vspace{\Dblocklevelvspace}}{}%
 
101
  \par\noindent%
 
102
}
 
103
\providecommand{\Dparagraphspace}{\par}
 
104
\providecommand{\Dneedvspace}{true}
 
105
 
 
106
 
 
107
\providecommand{\DSlinks}{
 
108
  % Targets and references.
 
109
  \RequirePackage[colorlinks=false,pdfborder={0 0 0}]{hyperref}
 
110
 
 
111
  \providecommand{\Draisedlink}[1]{\Hy@raisedlink{##1}}
 
112
  
 
113
  % References.
 
114
  % We're assuming here that the "refid" and "refuri" attributes occur
 
115
  % only in inline context (in TextElements).
 
116
  \providecommand{\DArefid}[5]{%
 
117
    \ifthenelse{\equal{##4}{reference}}{%
 
118
      \Dexplicitreference{\###3}{##5}%
 
119
    }{%
 
120
      % If this is not a target node (targets with refids are
 
121
      % uninteresting and should be silently dropped).
 
122
      \ifthenelse{\not\equal{##4}{target}}{%
 
123
        % If this is a footnote reference, call special macro.
 
124
        \ifthenelse{\equal{##4}{footnotereference}}{%
 
125
          \Dimplicitfootnotereference{\###3}{##5}%
 
126
        }{%
 
127
          \ifthenelse{\equal{##4}{citationreference}}{%
 
128
            \Dimplicitcitationreference{\###3}{##5}%
 
129
          }{%
 
130
            \Dimplicitreference{\###3}{##5}%
 
131
          }%
 
132
        }%
 
133
      }{}%
 
134
    }%
 
135
  }
 
136
  \providecommand{\DArefuri}[5]{%
 
137
    \ifthenelse{\equal{##4}{target}}{%
 
138
      % Hyperlink targets can (and should be) ignored because they are
 
139
      % invisible.
 
140
    }{%
 
141
      % We only have explicit URI references, so one macro suffices.
 
142
      \Durireference{##3}{##5}%
 
143
    }%
 
144
  }
 
145
  % Targets.
 
146
  \providecommand{\DAids}[5]{%
 
147
    \label{##3}%
 
148
    \ifthenelse{\equal{##4}{footnotereference}}{%
 
149
      {%
 
150
        \renewcommand{\HyperRaiseLinkDefault}{%
 
151
          % Dirty hack to make backrefs to footnote references work.
 
152
          % For some reason, \baselineskip is 0pt in fn references.
 
153
          0.5\Doriginalbaselineskip%
 
154
        }%
 
155
        \Draisedlink{\hypertarget{##3}{}}##5%
 
156
      }%
 
157
    }{%
 
158
      \Draisedlink{\hypertarget{##3}{}}##5%
 
159
    }%
 
160
  }
 
161
  % Color in references.
 
162
  \RequirePackage{color}
 
163
  \providecommand{\Dimplicitreference}[2]{%
 
164
    % Create implicit reference to ID.  Implicit references occur
 
165
    % e.g. in TOC-backlinks of section titles.  Parameters:
 
166
    % 1. Target.
 
167
    % 2. Link text.
 
168
    \href{##1}{##2}%
 
169
  }
 
170
  \providecommand{\Dimplicitfootnotereference}[2]{%
 
171
    % Ditto, but for the special case of footnotes.
 
172
    % We want them to be rendered like explicit references.
 
173
    \Dexplicitreference{##1}{##2}%
 
174
  }
 
175
  \providecommand{\Dimplicitcitationreference}[2]{%
 
176
    % Ditto for citation references.
 
177
    \Dimplicitfootnotereference{##1}{##2}%
 
178
  }
 
179
  \ifthenelse{\equal{\Dprinting}{true}}{
 
180
    \providecommand{\Dexplicitreferencecolor}{black}
 
181
  }{
 
182
    \providecommand{\Dexplicitreferencecolor}{blue}
 
183
  }
 
184
  \providecommand{\Dexplicitreference}[2]{%
 
185
    % Create explicit reference to ID, e.g. created with "foo_".
 
186
    % Parameters:
 
187
    % 1. Target.
 
188
    % 2. Link text.
 
189
    \href{##1}{{\color{\Dexplicitreferencecolor}##2}}%
 
190
  }
 
191
  \providecommand{\Durireferencecolor}{\Dexplicitreferencecolor}
 
192
  \providecommand{\Durireference}[2]{%
 
193
    % Create reference to URI.  Parameters:
 
194
    % 1. Target.
 
195
    % 2. Link text.
 
196
    \href{##1}{{\color{\Durireferencecolor}##2}}%
 
197
  }
 
198
}
 
199
 
 
200
 
 
201
\providecommand{\DSlanguage}{%
 
202
  % Set up babel.
 
203
  \ifthenelse{\equal{\Dlanguagebabel}{}}{}{
 
204
    \RequirePackage[\Dlanguagebabel]{babel}
 
205
  }
 
206
}
 
207
 
 
208
 
 
209
 
 
210
 
 
211
\providecommand{\DAclasses}[5]{%
 
212
  \Difdefined{DN#4C#3}{%
 
213
    % Pass only contents, nothing else!
 
214
    \csname DN#4C#3\endcsname{#5}%
 
215
  }{%
 
216
    \Difdefined{DC#3}{%
 
217
      \csname DC#3\endcsname{#5}%
 
218
    }{%
 
219
      #5%
 
220
    }%
 
221
  }%
 
222
}
 
223
 
 
224
\providecommand{\Difdefined}[3]{\@ifundefined{#1}{#3}{#2}}
 
225
 
 
226
\providecommand{\Dattr}[5]{%
 
227
  % Global attribute dispatcher.
 
228
  % Parameters:
 
229
  % 1. Attribute number.
 
230
  % 2. Attribute name.
 
231
  % 3. Attribute value.
 
232
  % 4. Node name.
 
233
  % 5. Node contents.
 
234
  \Difdefined{DN#4A#2V#3}{%
 
235
    \csname DN#4A#2V#3\endcsname{#1}{#2}{#3}{#4}{#5}%
 
236
  }{\Difdefined{DN#4A#2}{%
 
237
    \csname DN#4A#2\endcsname{#1}{#2}{#3}{#4}{#5}%
 
238
  }{\Difdefined{DA#2V#3}{%
 
239
    \csname DA#2V#3\endcsname{#1}{#2}{#3}{#4}{#5}%
 
240
  }{\Difdefined{DA#2}{%
 
241
    \csname DA#2\endcsname{#1}{#2}{#3}{#4}{#5}%
 
242
  }{#5%
 
243
  }}}}%
 
244
}
 
245
 
 
246
\providecommand{\DNparagraph}[1]{%
 
247
  \ifthenelse{\equal{\Dparagraphindented}{true}}{\indent}{\noindent}%
 
248
  #1%
 
249
}
 
250
\providecommand{\Dformatboxtitle}[1]{{\Large\textbf{#1}}}
 
251
\providecommand{\Dformatboxsubtitle}[1]{{\large\textbf{#1}}}
 
252
\providecommand{\Dtopictitle}[1]{%
 
253
  \Difinsidetoc{\vspace{1em}\par}{}%
 
254
  \noindent\Dformatboxtitle{#1}%
 
255
  \ifthenelse{\equal{\Dhassubtitle}{false}}{\vspace{1em}}{\vspace{0.5em}}%
 
256
  \par%
 
257
}
 
258
\providecommand{\Dtopicsubtitle}[1]{%
 
259
  \noindent\Dformatboxsubtitle{#1}%
 
260
  \vspace{1em}%
 
261
  \par%
 
262
}
 
263
\providecommand{\Dsidebartitle}[1]{\Dtopictitle{#1}}
 
264
\providecommand{\Dsidebarsubtitle}[1]{\Dtopicsubtitle{#1}}
 
265
\providecommand{\Ddocumenttitle}[1]{%
 
266
  \begin{center}{\Huge#1}\end{center}%
 
267
  \ifthenelse{\equal{\Dhassubtitle}{true}}{\vspace{0.1cm}}{\vspace{1cm}}%
 
268
}
 
269
\providecommand{\Ddocumentsubtitle}[1]{%
 
270
  \begin{center}{\huge#1}\end{center}%
 
271
  \vspace{1cm}%
 
272
}
 
273
% Can be overwritten by user stylesheet.
 
274
\providecommand{\Dformatsectiontitle}[1]{#1}
 
275
\providecommand{\Dformatsectionsubtitle}[1]{\Dformatsectiontitle{#1}}
 
276
\providecommand{\Dbookmarksectiontitle}[1]{%
 
277
  % Return text suitable for use in \section*, \subsection*, etc.,
 
278
  % containing a PDF bookmark.  Parameter:  The title (as node tree).
 
279
  \Draisedlink{\Dpdfbookmark{\Dtitleastext}}%
 
280
  #1%
 
281
}
 
282
\providecommand{\Dsectiontitlehook}[1]{#1}
 
283
\providecommand{\Dsectiontitle}[1]{%
 
284
  \Dsectiontitlehook{%
 
285
    \Ddispatchsectiontitle{\Dbookmarksectiontitle{\Dformatsectiontitle{#1}}}%
 
286
  }%
 
287
}
 
288
\providecommand{\Ddispatchsectiontitle}[1]{%
 
289
  \@ifundefined{Dsectiontitle\roman{Dsectionlevel}}{%
 
290
    \Ddeepsectiontitle{#1}%
 
291
  }{%
 
292
    \csname Dsectiontitle\roman{Dsectionlevel}\endcsname{#1}%
 
293
  }%
 
294
}
 
295
\providecommand{\Ddispatchsectionsubtitle}[1]{%
 
296
  \Ddispatchsectiontitle{#1}%
 
297
}
 
298
\providecommand{\Dsectiontitlei}[1]{\section*{#1}}
 
299
\providecommand{\Dsectiontitleii}[1]{\subsection*{#1}}
 
300
\providecommand{\Ddeepsectiontitle}[1]{%
 
301
  % Anything below \subsubsection (like \paragraph or \subparagraph)
 
302
  % is useless because it uses the same font.  The only way to
 
303
  % (visually) distinguish such deeply nested sections is to use
 
304
  % section numbering.
 
305
  \subsubsection*{#1}%
 
306
}
 
307
\providecommand{\Dsectionsubtitlehook}[1]{#1}
 
308
\Dprovidelength{\Dsectionsubtitleraisedistance}{0.7em}
 
309
\providecommand{\Dsectionsubtitlescaling}{0.85}
 
310
\providecommand{\Dsectionsubtitle}[1]{%
 
311
  \Dsectionsubtitlehook{%
 
312
    % Move the subtitle nearer to the title.
 
313
    \vspace{-\Dsectionsubtitleraisedistance}%
 
314
    % Don't create a PDF bookmark.
 
315
    \Ddispatchsectionsubtitle{%
 
316
      \Dformatsectionsubtitle{\scalebox{\Dsectionsubtitlescaling}{#1}}%
 
317
    }%
 
318
  }%
 
319
}
 
320
% Boolean variable.
 
321
\providecommand{\Dhassubtitle}{false}
 
322
\providecommand{\DNtitle}[1]{%
 
323
  \csname D\Dparent title\endcsname{#1}%
 
324
}
 
325
\providecommand{\DNsubtitle}[1]{%
 
326
  \csname D\Dparent subtitle\endcsname{#1}%
 
327
}
 
328
\newcounter{Dpdfbookmarkid}
 
329
\setcounter{Dpdfbookmarkid}{0}
 
330
\providecommand{\Dpdfbookmark}[1]{%
 
331
  % Temporarily decrement Desctionlevel counter.
 
332
  \addtocounter{Dsectionlevel}{-1}%
 
333
  %\typeout{\arabic{Dsectionlevel}}%
 
334
  %\typeout{#1}%
 
335
  %\typeout{docutils\roman{Dpdfbookmarkid}}%
 
336
  %\typeout{}%
 
337
  \pdfbookmark[\arabic{Dsectionlevel}]{#1}{docutils\arabic{Dpdfbookmarkid}}%
 
338
  \addtocounter{Dsectionlevel}{1}%
 
339
  \addtocounter{Dpdfbookmarkid}{1}%
 
340
}
 
341
 
 
342
%\providecommand{\DNliteralblock}[1]{\begin{quote}\ttfamily\raggedright#1\end{quote}}
 
343
\providecommand{\DNliteralblock}[1]{%
 
344
  \Dmakelistenvironment{}{%
 
345
    \ifthenelse{\equal{\Dinsidetabular}{true}}{%
 
346
      \setlength{\leftmargin}{0pt}%
 
347
    }{}%
 
348
    \setlength{\rightmargin}{0pt}%
 
349
  }{%
 
350
    \raggedright\item\noindent\nohyphens{\textnhtt{#1\Dfinalstrut}}%
 
351
  }%
 
352
}
 
353
\providecommand{\DNdoctestblock}[1]{%
 
354
  % Treat doctest blocks the same as literal blocks.
 
355
  \DNliteralblock{#1}%
 
356
}
 
357
\RequirePackage{hyphenat}
 
358
\providecommand{\DNliteral}[1]{\textnhtt{#1}}
 
359
\providecommand{\DNemphasis}[1]{\emph{#1}}
 
360
\providecommand{\DNstrong}[1]{\textbf{#1}}
 
361
\providecommand{\Dvisitdocument}{\begin{document}\noindent}
 
362
\providecommand{\Ddepartdocument}{\end{document}}
 
363
\providecommand{\DNtopic}[1]{%
 
364
  \ifthenelse{\equal{\DcurrentNtopicAcontents}{1}}{%
 
365
    \addtocounter{Dtoclevel}{1}%
 
366
    \par\noindent%
 
367
    #1%
 
368
    \addtocounter{Dtoclevel}{-1}%
 
369
  }{%
 
370
    \par\noindent%
 
371
    \Dmakebox{#1}%
 
372
  }%
 
373
}
 
374
\providecommand{\Dformatrubric}[1]{\textbf{#1}}
 
375
\Dprovidelength{\Dprerubricspace}{0.3em}
 
376
\providecommand{\DNrubric}[1]{%
 
377
  \vspace{\Dprerubricspace}\par\noindent\Dformatrubric{#1}\par%
 
378
}
 
379
 
 
380
\providecommand{\Dbullet}{}
 
381
\providecommand{\Dsetbullet}[1]{\renewcommand{\Dbullet}{#1}}
 
382
\providecommand{\DNbulletlist}[1]{%
 
383
  \Difinsidetoc{%
 
384
    \Dtocbulletlist{#1}%
 
385
  }{%
 
386
    \Dmakelistenvironment{\Dbullet}{}{#1}%
 
387
  }%
 
388
}
 
389
\renewcommand{\@pnumwidth}{2.2em}
 
390
\providecommand{\DNlistitem}[1]{%
 
391
  \Difinsidetoc{%
 
392
    \ifthenelse{\equal{\theDtoclevel}{1}\and\equal{\Dlocaltoc}{false}}{%
 
393
      {%
 
394
        \par\addvspace{1em}\noindent%
 
395
        \sectfont%
 
396
        #1\hfill\pageref{\DcurrentNlistitemAtocrefid}%
 
397
      }%
 
398
    }{%
 
399
      \@dottedtocline{0}{\Dtocindent}{0em}{#1}{%
 
400
        \pageref{\DcurrentNlistitemAtocrefid}%
 
401
      }%
 
402
    }%
 
403
  }{%
 
404
    \item{#1}%
 
405
  }%
 
406
}
 
407
\providecommand{\DNenumeratedlist}[1]{#1}
 
408
\newcounter{Dsectionlevel}
 
409
\providecommand{\Dvisitsectionhook}{}
 
410
\providecommand{\Ddepartsectionhook}{}
 
411
\providecommand{\Dvisitsection}{%
 
412
  \addtocounter{Dsectionlevel}{1}%
 
413
  \Dvisitsectionhook%
 
414
}
 
415
\providecommand{\Ddepartsection}{%
 
416
  \Ddepartsectionhook%
 
417
  \addtocounter{Dsectionlevel}{-1}%
 
418
}
 
419
 
 
420
% Using \_ will cause hyphenation after _ even in \textnhtt-typewriter
 
421
% because the hyphenat package redefines \_.  So we use
 
422
% \textunderscore here.
 
423
\providecommand{\Dtextunderscore}{\textunderscore}
 
424
 
 
425
\providecommand{\Dtextinlineliteralfirstspace}{{ }}
 
426
\providecommand{\Dtextinlineliteralsecondspace}{{~}}
 
427
 
 
428
\Dprovidelength{\Dlistspacing}{0.8\baselineskip}
 
429
 
 
430
\providecommand{\Dsetlistrightmargin}{%
 
431
  \ifthenelse{\lengthtest{\linewidth>12em}}{%
 
432
    % Equal margins.
 
433
    \setlength{\rightmargin}{\leftmargin}%
 
434
  }{%
 
435
    % If the line is narrower than 10em, we don't remove any further
 
436
    % space from the right.
 
437
    \setlength{\rightmargin}{0pt}%
 
438
  }%
 
439
}
 
440
\providecommand{\Dresetlistdepth}{false}
 
441
\Dprovidelength{\Doriginallabelsep}{\labelsep}
 
442
\providecommand{\Dmakelistenvironment}[3]{%
 
443
  % Make list environment with support for unlimited nesting and with
 
444
  % reasonable default lengths.  Parameters:
 
445
  % 1. Label (same as in list environment).
 
446
  % 2. Spacing (same as in list environment).
 
447
  % 3. List contents (contents of list environment).
 
448
  \ifthenelse{\equal{\Dinsidetabular}{true}}{%
 
449
    % Unfortunately, vertical spacing doesn't work correctly when
 
450
    % using lists inside tabular environments, so we use a minipage.
 
451
    \begin{minipage}[t]{\linewidth}%
 
452
  }{}%
 
453
    {%
 
454
      \renewcommand{\Dneedvspace}{false}%
 
455
      % \parsep0.5\baselineskip
 
456
      \renewcommand{\Dresetlistdepth}{false}%
 
457
      \ifnum \@listdepth>5%
 
458
      \protect\renewcommand{\Dresetlistdepth}{true}%
 
459
      \@listdepth=5%
 
460
      \fi%
 
461
      \begin{list}{%
 
462
          #1%
 
463
        }{%
 
464
          \setlength{\itemsep}{0pt}%
 
465
          \setlength{\partopsep}{0pt}%
 
466
          \setlength{\topsep}{0pt}%
 
467
                                  % List should take 90% of total width.
 
468
          \setlength{\leftmargin}{0.05\linewidth}%
 
469
          \ifthenelse{\lengthtest{\leftmargin<1.8em}}{%
 
470
            \setlength{\leftmargin}{1.8em}%
 
471
          }{}%
 
472
          \setlength{\labelsep}{\Doriginallabelsep}%
 
473
          \Dsetlistrightmargin%
 
474
          #2%
 
475
        }{%
 
476
          #3%
 
477
        }%
 
478
      \end{list}%
 
479
      \ifthenelse{\equal{\Dresetlistdepth}{true}}{\@listdepth=5}{}%
 
480
    }%
 
481
  \ifthenelse{\equal{\Dinsidetabular}{true}}{\end{minipage}}{}%
 
482
}
 
483
\providecommand{\Dfinalstrut}{\@finalstrut\@arstrutbox}
 
484
\providecommand{\DAlastitem}[5]{#5\Dfinalstrut}
 
485
 
 
486
\Dprovidelength{\Ditemsep}{0pt}
 
487
\providecommand{\Dmakeenumeratedlist}[6]{%
 
488
  % Make enumerated list.
 
489
  % Parameters:
 
490
  % - prefix
 
491
  % - type (\arabic, \roman, ...)
 
492
  % - suffix
 
493
  % - suggested counter name
 
494
  % - start number - 1
 
495
  % - list contents
 
496
  \newcounter{#4}%
 
497
  \Dmakelistenvironment{#1#2{#4}#3}{%
 
498
    % Use as much space as needed for the label.
 
499
    \setlength{\labelwidth}{10em}%
 
500
    % Reserve enough space so that the label doesn't go beyond the
 
501
    % left margin of preceding paragraphs.  Like that:
 
502
    %
 
503
    %    A paragraph.
 
504
    %
 
505
    %   1. First item.
 
506
    \setlength{\leftmargin}{2.5em}%
 
507
    \Dsetlistrightmargin%
 
508
    \setlength{\itemsep}{\Ditemsep}%
 
509
    % Use counter recommended by Python module.
 
510
    \usecounter{#4}%
 
511
    % Set start value.
 
512
    \addtocounter{#4}{#5}%
 
513
  }{%
 
514
    % The list contents.
 
515
    #6%
 
516
  }%
 
517
}
 
518
 
 
519
 
 
520
% Single quote in literal mode.  \textquotesingle from package
 
521
% textcomp has wrong width when using package ae, so we use a normal
 
522
% single curly quote here.
 
523
\providecommand{\Dtextliteralsinglequote}{'}
 
524
 
 
525
 
 
526
% "Tabular lists" are field lists and options lists (not definition
 
527
% lists because there the term always appears on its own line).  We'll
 
528
% use the terminology of field lists now ("field", "field name",
 
529
% "field body"), but the same is also analogously applicable to option
 
530
% lists.
 
531
%
 
532
% We want these lists to be breakable across pages.  We cannot
 
533
% automatically get the narrowest possible size for the left column
 
534
% (i.e. the field names or option groups) because tabularx does not
 
535
% support multi-page tables, ltxtable needs to have the table in an
 
536
% external file and we don't want to clutter the user's directories
 
537
% with auxiliary files created by the filecontents environment, and
 
538
% ltablex is not included in teTeX.
 
539
%
 
540
% Thus we set a fixed length for the left column and use list
 
541
% environments.  This also has the nice side effect that breaking is
 
542
% now possible anywhere, not just between fields.
 
543
%
 
544
% Note that we are creating a distinct list environment for each
 
545
% field.  There is no macro for a whole tabular list!
 
546
\Dprovidelength{\Dtabularlistfieldnamewidth}{6em}
 
547
\Dprovidelength{\Dtabularlistfieldnamesep}{0.5em}
 
548
\providecommand{\Dinsidetabular}{false}
 
549
\providecommand{\Dsavefieldname}{}
 
550
\providecommand{\Dsavefieldbody}{}
 
551
\Dprovidelength{\Dusedfieldnamewidth}{0pt}
 
552
\Dprovidelength{\Drealfieldnamewidth}{0pt}
 
553
\providecommand{\Dtabularlistfieldname}[1]{\renewcommand{\Dsavefieldname}{#1}}
 
554
\providecommand{\Dtabularlistfieldbody}[1]{\renewcommand{\Dsavefieldbody}{#1}}
 
555
\Dprovidelength{\Dparskiptemp}{0pt}
 
556
\providecommand{\Dtabularlistfield}[1]{%
 
557
  {%
 
558
    % This only saves field name and field body in \Dsavefieldname and
 
559
    % \Dsavefieldbody, resp.  It does not insert any text into the
 
560
    % document.
 
561
    #1%
 
562
    % Recalculate the real field name width everytime we encounter a
 
563
    % tabular list field because it may have been changed using a
 
564
    % "raw" node.
 
565
    \setlength{\Drealfieldnamewidth}{\Dtabularlistfieldnamewidth}%
 
566
    \addtolength{\Drealfieldnamewidth}{\Dtabularlistfieldnamesep}%
 
567
    \Dmakelistenvironment{%
 
568
      \makebox[\Drealfieldnamewidth][l]{\Dsavefieldname}%
 
569
    }{%
 
570
      \setlength{\labelwidth}{\Drealfieldnamewidth}%
 
571
      \setlength{\leftmargin}{\Drealfieldnamewidth}%
 
572
      \setlength{\rightmargin}{0pt}%
 
573
      \setlength{\labelsep}{0pt}%
 
574
    }{%
 
575
      \item%
 
576
      \settowidth{\Dusedfieldnamewidth}{\Dsavefieldname}%
 
577
      \setlength{\Dparskiptemp}{\parskip}%
 
578
      \ifthenelse{%
 
579
        \lengthtest{\Dusedfieldnamewidth>\Dtabularlistfieldnamewidth}%
 
580
      }{%
 
581
        \mbox{}\par%
 
582
        \setlength{\parskip}{0pt}%
 
583
      }{}%
 
584
      \Dsavefieldbody%
 
585
      \setlength{\parskip}{\Dparskiptemp}%
 
586
      %XXX Why did we need this?
 
587
      %\@finalstrut\@arstrutbox%
 
588
    }%
 
589
    \par%
 
590
  }%
 
591
}
 
592
 
 
593
\providecommand{\Dformatfieldname}[1]{\textbf{#1:}}
 
594
\providecommand{\DNfieldlist}[1]{#1}
 
595
\providecommand{\DNfield}[1]{\Dtabularlistfield{#1}}
 
596
\providecommand{\DNfieldname}[1]{%
 
597
  \Dtabularlistfieldname{%
 
598
    \Dformatfieldname{#1}%
 
599
  }%
 
600
}
 
601
\providecommand{\DNfieldbody}[1]{\Dtabularlistfieldbody{#1}}
 
602
 
 
603
\providecommand{\Dformatoptiongroup}[1]{%
 
604
  % Format option group, e.g. "-f file, --input file".
 
605
  \texttt{#1}%
 
606
}
 
607
\providecommand{\Dformatoption}[1]{%
 
608
  % Format option, e.g. "-f file".
 
609
  % Put into mbox to avoid line-breaking at spaces.
 
610
  \mbox{#1}%
 
611
}
 
612
\providecommand{\Dformatoptionstring}[1]{%
 
613
  % Format option string, e.g. "-f".
 
614
  #1%
 
615
}
 
616
\providecommand{\Dformatoptionargument}[1]{%
 
617
  % Format option argument, e.g. "file".
 
618
  \textsl{#1}%
 
619
}
 
620
\providecommand{\Dformatoptiondescription}[1]{%
 
621
  % Format option description, e.g.
 
622
  % "\DNparagraph{Read input data from file.}"
 
623
  #1%
 
624
}
 
625
\providecommand{\DNoptionlist}[1]{#1}
 
626
\providecommand{\Doptiongroupjoiner}{,{ }}
 
627
\providecommand{\Disfirstoption}{%
 
628
  % Auxiliary macro indicating if a given option is the first child
 
629
  % of its option group (if it's not, it has to preceded by
 
630
  % \Doptiongroupjoiner).
 
631
  false%
 
632
}
 
633
\providecommand{\DNoptionlistitem}[1]{%
 
634
  \Dtabularlistfield{#1}%
 
635
}
 
636
\providecommand{\DNoptiongroup}[1]{%
 
637
  \renewcommand{\Disfirstoption}{true}%
 
638
  \Dtabularlistfieldname{\Dformatoptiongroup{#1}}%
 
639
}
 
640
\providecommand{\DNoption}[1]{%
 
641
  % If this is not the first option in this option group, add a
 
642
  % joiner.
 
643
  \ifthenelse{\equal{\Disfirstoption}{true}}{%
 
644
    \renewcommand{\Disfirstoption}{false}%
 
645
  }{%
 
646
    \Doptiongroupjoiner%
 
647
  }%
 
648
  \Dformatoption{#1}%
 
649
}
 
650
\providecommand{\DNoptionstring}[1]{\Dformatoptionstring{#1}}
 
651
\providecommand{\DNoptionargument}[1]{{ }\Dformatoptionargument{#1}}
 
652
\providecommand{\DNdescription}[1]{%
 
653
  \Dtabularlistfieldbody{\Dformatoptiondescription{#1}}%
 
654
}
 
655
 
 
656
\providecommand{\DNdefinitionlist}[1]{%
 
657
  \begin{description}%
 
658
    \parskip0pt%
 
659
    #1%
 
660
  \end{description}%
 
661
}
 
662
\providecommand{\DNdefinitionlistitem}[1]{%
 
663
  % LaTeX expects the label in square brackets; we provide an empty
 
664
  % label.
 
665
  \item[]#1%
 
666
}
 
667
\providecommand{\Dformatterm}[1]{#1}
 
668
\providecommand{\DNterm}[1]{\hspace{-5pt}\Dformatterm{#1}}
 
669
% I'm still not sure what's the best rendering for classifiers.  The
 
670
% colon syntax is used by reStructuredText, so it's at least WYSIWYG.
 
671
% Use slanted text because italic would cause too much emphasis.
 
672
\providecommand{\Dformatclassifier}[1]{\textsl{#1}}
 
673
\providecommand{\DNclassifier}[1]{~:~\Dformatclassifier{#1}}
 
674
\providecommand{\Dformatdefinition}[1]{#1}
 
675
\providecommand{\DNdefinition}[1]{\par\Dformatdefinition{#1}}
 
676
 
 
677
\providecommand{\Dlineblockindentation}{2.5em}
 
678
\providecommand{\DNlineblock}[1]{%
 
679
  \Dmakelistenvironment{}{%
 
680
    \ifthenelse{\equal{\Dparent}{lineblock}}{%
 
681
      % Parent is a line block, so indent.
 
682
      \setlength{\leftmargin}{\Dlineblockindentation}%
 
683
    }{%
 
684
      % At top level; don't indent.
 
685
      \setlength{\leftmargin}{0pt}%
 
686
    }%
 
687
    \setlength{\rightmargin}{0pt}%
 
688
    \setlength{\parsep}{0pt}%
 
689
  }{%
 
690
    #1%
 
691
  }%
 
692
}
 
693
\providecommand{\DNline}[1]{\item#1}
 
694
 
 
695
 
 
696
\providecommand{\DNtransition}{%
 
697
  \raisebox{0.25em}{\parbox{\linewidth}{\hspace*{\fill}\hrulefill\hrulefill\hspace*{\fill}}}%
 
698
}
 
699
 
 
700
 
 
701
\providecommand{\Dformatblockquote}[1]{%
 
702
  % Format contents of block quote.
 
703
  % This occurs in block-level context, so we cannot use \textsl.
 
704
  {\slshape#1}%
 
705
}
 
706
\providecommand{\Dformatattribution}[1]{---\textup{#1}}
 
707
\providecommand{\DNblockquote}[1]{%
 
708
  \Dmakebox{%
 
709
    \Dformatblockquote{#1}
 
710
  }%
 
711
}
 
712
\providecommand{\DNattribution}[1]{%
 
713
  \par%
 
714
  \begin{flushright}\Dformatattribution{#1}\end{flushright}%
 
715
}
 
716
 
 
717
 
 
718
% Sidebars:
 
719
\RequirePackage{picins}
 
720
% Vertical and horizontal margins.
 
721
\Dprovidelength{\Dsidebarvmargin}{0.5em}
 
722
\Dprovidelength{\Dsidebarhmargin}{1em}
 
723
% Padding (space between contents and frame).
 
724
\Dprovidelength{\Dsidebarpadding}{1em}
 
725
% Frame width.
 
726
\Dprovidelength{\Dsidebarframewidth}{2\fboxrule}
 
727
% Position ("l" or "r").
 
728
\providecommand{\Dsidebarposition}{r}
 
729
% Width.
 
730
\Dprovidelength{\Dsidebarwidth}{0.45\linewidth}
 
731
\providecommand{\DNsidebar}[1]{
 
732
  \parpic[\Dsidebarposition]{%
 
733
    \begin{minipage}[t]{\Dsidebarwidth}%
 
734
      % Doing this with nested minipages is ugly, but I haven't found
 
735
      % another way to place vertical space before and after the fbox.
 
736
      \vspace{\Dsidebarvmargin}%
 
737
      {%
 
738
        \setlength{\fboxrule}{\Dsidebarframewidth}%
 
739
        \setlength{\fboxsep}{\Dsidebarpadding}%
 
740
        \fbox{%
 
741
          \begin{minipage}[t]{\linewidth}%
 
742
            \setlength{\parindent}{\Dboxparindent}%
 
743
            #1%
 
744
          \end{minipage}%
 
745
        }%
 
746
      }%
 
747
      \vspace{\Dsidebarvmargin}%
 
748
    \end{minipage}%
 
749
  }%
 
750
}
 
751
 
 
752
 
 
753
% Citations and footnotes.
 
754
\providecommand{\Dformatfootnote}[1]{%
 
755
  % Format footnote.
 
756
  {%
 
757
    \footnotesize#1%
 
758
    % \par is necessary for LaTeX to adjust baselineskip to the
 
759
    % changed font size.
 
760
    \par%
 
761
  }%
 
762
}
 
763
\providecommand{\Dformatcitation}[1]{\Dformatfootnote{#1}}
 
764
\Dprovidelength{\Doriginalbaselineskip}{0pt}
 
765
\providecommand{\DNfootnotereference}[1]{%
 
766
  {%
 
767
    % \baselineskip is 0pt in \textsuperscript, so we save it here.
 
768
    \setlength{\Doriginalbaselineskip}{\baselineskip}%
 
769
    \textsuperscript{#1}%
 
770
  }%
 
771
}
 
772
\providecommand{\DNcitationreference}[1]{{[}#1{]}}
 
773
\Dprovidelength{\Dfootnotesep}{3.5pt}
 
774
\providecommand{\Dsetfootnotespacing}{%
 
775
  % Spacing commands executed at the beginning of footnotes.
 
776
  \setlength{\parindent}{0pt}%
 
777
  \hspace{1em}%
 
778
}
 
779
\providecommand{\DNfootnote}[1]{%
 
780
  % See ltfloat.dtx for details.
 
781
  {%
 
782
    \insert\footins{%
 
783
      \vspace{\Dfootnotesep}%
 
784
      \Dsetfootnotespacing%
 
785
      \Dformatfootnote{#1}%
 
786
    }%
 
787
  }%
 
788
}
 
789
\providecommand{\DNcitation}[1]{\DNfootnote{#1}}
 
790
\providecommand{\Dformatfootnotelabel}[1]{%
 
791
  % Keep \footnotesize in footnote labels (\textsuperscript would
 
792
  % reduce the font size even more).
 
793
  \textsuperscript{\footnotesize#1{ }}%
 
794
}
 
795
\providecommand{\Dformatcitationlabel}[1]{{[}#1{]}{ }}
 
796
\providecommand{\Dformatmultiplebackrefs}[1]{%
 
797
  % If in printing mode, do not write out multiple backrefs.
 
798
  \ifthenelse{\equal{\Dprinting}{true}}{}{\textsl{#1}}%
 
799
}
 
800
\providecommand{\Dthislabel}{}
 
801
\providecommand{\DNlabel}[1]{%
 
802
  \renewcommand{\Dthislabel}{#1}
 
803
  \ifthenelse{\not\equal{\Dsinglebackref}{}}{%
 
804
    \let\Doriginallabel=\Dthislabel%
 
805
    \def\Dthislabel{%
 
806
      \Dsinglefootnotebacklink{\Dsinglebackref}{\Doriginallabel}%
 
807
    }%
 
808
  }{}%
 
809
  \ifthenelse{\equal{\Dparent}{footnote}}{%
 
810
    % Footnote label.
 
811
    \Dformatfootnotelabel{\Dthislabel}%
 
812
  }{%
 
813
    \ifthenelse{\equal{\Dparent}{citation}}{%
 
814
      % Citation label.
 
815
      \Dformatcitationlabel{\Dthislabel}%
 
816
    }{}%
 
817
  }%
 
818
  % If there are multiple backrefs, add them now.
 
819
  \Dformatmultiplebackrefs{\Dmultiplebackrefs}%
 
820
}
 
821
\providecommand{\Dsinglefootnotebacklink}[2]{%
 
822
  % Create normal backlink of a footnote label.  Parameters:
 
823
  % 1. ID.
 
824
  % 2. Link text.
 
825
  % Treat like a footnote reference.
 
826
  \Dimplicitfootnotereference{\##1}{#2}%
 
827
}
 
828
\providecommand{\Dmultifootnotebacklink}[2]{%
 
829
  % Create generated backlink, as in (1, 2).  Parameters:
 
830
  % 1. ID.
 
831
  % 2. Link text.
 
832
  % Treat like a footnote reference.
 
833
  \Dimplicitfootnotereference{\##1}{#2}%
 
834
}
 
835
\providecommand{\Dsinglecitationbacklink}[2]{\Dsinglefootnotebacklink{#1}{#2}}
 
836
\providecommand{\Dmulticitationbacklink}[2]{\Dmultifootnotebacklink{#1}{#2}}
 
837
 
 
838
 
 
839
\RequirePackage{longtable}
 
840
\providecommand{\Dmaketable}[2]{%
 
841
  % Make table.  Parameters:
 
842
  % 1. Table spec (like "|p|p|").
 
843
  % 2. Table contents.
 
844
  {%
 
845
    \ifthenelse{\equal{\Dinsidetabular}{true}}{%
 
846
      % Inside longtable; we cannot have nested longtables.
 
847
      \begin{tabular}{#1}%
 
848
        \hline%
 
849
        #2%
 
850
      \end{tabular}%
 
851
    }{%
 
852
      \renewcommand{\Dinsidetabular}{true}%
 
853
      \begin{longtable}{#1}%
 
854
        \hline%
 
855
        #2%
 
856
      \end{longtable}%
 
857
    }%
 
858
  }%
 
859
}
 
860
\providecommand{\DNthead}[1]{%
 
861
  #1%
 
862
  \endhead%
 
863
}
 
864
\providecommand{\DNrow}[1]{%
 
865
  #1\tabularnewline%
 
866
  \hline%
 
867
}
 
868
\providecommand{\Dinsidemulticolumn}{false}
 
869
\providecommand{\Dcompensatingmulticol}[3]{%
 
870
  \multicolumn{#1}{#2}{%
 
871
    {%
 
872
      \renewcommand{\Dinsidemulticolumn}{true}%
 
873
      % Compensate for weird missing vertical space at top of paragraph.
 
874
      \raisebox{-2.5pt}{#3}%
 
875
    }%
 
876
  }%
 
877
}
 
878
\providecommand{\Dcolspan}[2]{%
 
879
  % Take care of the morecols attribute (but incremented by 1).
 
880
  &%
 
881
  \Dcompensatingmulticol{#1}{l|}{#2}%
 
882
}
 
883
\providecommand{\Dcolspanleft}[2]{%
 
884
  % Like \Dmorecols, but called for the leftmost entries in a table
 
885
  % row.
 
886
  \Dcompensatingmulticol{#1}{|l|}{#2}%
 
887
}
 
888
\providecommand{\Dsubsequententry}[1]{%
 
889
  &#1%
 
890
}
 
891
\providecommand{\DNentry}[1]{%
 
892
  % The following sequence adds minimal vertical space above the top
 
893
  % lines of the first cell paragraph, so that vertical space is
 
894
  % balanced at the top and bottom of table cells.
 
895
  \ifthenelse{\equal{\Dinsidemulticolumn}{false}}{%
 
896
    \vspace{-1em}\vspace{-\parskip}\par%
 
897
  }{}%
 
898
  #1%
 
899
  % No need to add an ampersand ("&"); that's done by \Dsubsequententry.
 
900
}
 
901
\providecommand{\DAtableheaderentry}[5]{\Dformattableheaderentry{#5}}
 
902
\providecommand{\Dformattableheaderentry}[1]{{\bfseries#1}}
 
903
 
 
904
 
 
905
\providecommand{\DNsystemmessage}[1]{%
 
906
  {%
 
907
    \ifthenelse{\equal{\Dprinting}{false}}{\color{red}}{}%
 
908
    \bfseries%
 
909
    #1%
 
910
  }%
 
911
}
 
912
 
 
913
 
 
914
\providecommand{\Dinsidehalign}{false}
 
915
\newsavebox{\Dalignedimagebox}
 
916
\Dprovidelength{\Dalignedimagewidth}{0pt}
 
917
\providecommand{\Dhalign}[2]{%
 
918
  % Horizontally align the contents to the left or right so that the
 
919
  % text flows around it.
 
920
  % Parameters:
 
921
  % 1. l or r
 
922
  % 2. Contents.
 
923
  \renewcommand{\Dinsidehalign}{true}%
 
924
  % For some obscure reason \parpic consumes some vertical space.
 
925
  \vspace{-3pt}%
 
926
  % Now we do something *really* ugly, but this enables us to wrap the
 
927
  % image in a minipage while still allowing tight frames when
 
928
  % class=border (see \DNimageCborder).
 
929
  \sbox{\Dalignedimagebox}{#2}%
 
930
  \settowidth{\Dalignedimagewidth}{\usebox{\Dalignedimagebox}}%
 
931
  \parpic[#1]{%
 
932
    \begin{minipage}[b]{\Dalignedimagewidth}%
 
933
      % Compensate for previously added space, but not entirely.
 
934
      \vspace*{2.0pt}%
 
935
      \vspace*{\Dfloatimagetopmargin}%
 
936
      \usebox{\Dalignedimagebox}%
 
937
      \vspace*{1.5pt}%
 
938
      \vspace*{\Dfloatimagebottommargin}%
 
939
    \end{minipage}%
 
940
  }%
 
941
  \renewcommand{\Dinsidehalign}{false}%
 
942
}
 
943
 
 
944
 
 
945
\RequirePackage{graphicx}
 
946
% Maximum width of an image.
 
947
\providecommand{\Dimagemaxwidth}{\linewidth}
 
948
\providecommand{\Dfloatimagemaxwidth}{0.5\linewidth}
 
949
% Auxiliary variable.
 
950
\Dprovidelength{\Dcurrentimagewidth}{0pt}
 
951
\providecommand{\DNimageAalign}[5]{%
 
952
  \ifthenelse{\equal{#3}{left}}{%
 
953
    \Dhalign{l}{#5}%
 
954
  }{%
 
955
    \ifthenelse{\equal{#3}{right}}{%
 
956
      \Dhalign{r}{#5}%
 
957
    }{%
 
958
      \ifthenelse{\equal{#3}{center}}{%
 
959
        % Text floating around centered figures is a bad idea.  Thus
 
960
        % we use a center environment.  Note that no extra space is
 
961
        % added by the writer, so the space added by the center
 
962
        % environment is fine.
 
963
        \begin{center}#5\end{center}%
 
964
      }{%
 
965
        #5%
 
966
      }%
 
967
    }%
 
968
  }%
 
969
}
 
970
% Base path for images.
 
971
\providecommand{\Dimagebase}{}
 
972
% Auxiliary command.  Current image path.
 
973
\providecommand{\Dimagepath}{}
 
974
\providecommand{\DNimageAuri}[5]{%
 
975
  % Insert image.  We treat the URI like a path here.
 
976
  \renewcommand{\Dimagepath}{\Dimagebase#3}%
 
977
  \Difdefined{DcurrentNimageAwidth}{%
 
978
    \Dwidthimage{\DcurrentNimageAwidth}{\Dimagepath}%
 
979
  }{%
 
980
    \Dsimpleimage{\Dimagepath}%
 
981
  }%
 
982
}
 
983
\Dprovidelength{\Dfloatimagevmargin}{0pt}
 
984
\providecommand{\Dfloatimagetopmargin}{\Dfloatimagevmargin}
 
985
\providecommand{\Dfloatimagebottommargin}{\Dfloatimagevmargin}
 
986
\providecommand{\Dwidthimage}[2]{%
 
987
  % Image with specified width.
 
988
  % Parameters:
 
989
  % 1. Image width.
 
990
  % 2. Image path.
 
991
  % Need to make bottom-alignment dependent on align attribute (add
 
992
  % functional test first).  Need to observe height attribute.
 
993
  %\begin{minipage}[b]{#1}%
 
994
    \includegraphics[width=#1,height=\textheight,keepaspectratio]{#2}%
 
995
  %\end{minipage}%
 
996
}  
 
997
\providecommand{\Dcurrentimagemaxwidth}{}
 
998
\providecommand{\Dsimpleimage}[1]{%
 
999
  % Insert image, without much parametrization.
 
1000
  \settowidth{\Dcurrentimagewidth}{\includegraphics{#1}}%
 
1001
  \ifthenelse{\equal{\Dinsidehalign}{true}}{%
 
1002
    \renewcommand{\Dcurrentimagemaxwidth}{\Dfloatimagemaxwidth}%
 
1003
  }{%
 
1004
    \renewcommand{\Dcurrentimagemaxwidth}{\Dimagemaxwidth}%
 
1005
  }%
 
1006
  \ifthenelse{\lengthtest{\Dcurrentimagewidth>\Dcurrentimagemaxwidth}}{%
 
1007
    \Dwidthimage{\Dcurrentimagemaxwidth}{#1}%
 
1008
  }{%
 
1009
    \Dwidthimage{\Dcurrentimagewidth}{#1}%
 
1010
  }%
 
1011
}
 
1012
\providecommand{\Dwidthimage}[2]{%
 
1013
  % Image with specified width.
 
1014
  % Parameters:
 
1015
  % 1. Image width.
 
1016
  % 2. Image path.
 
1017
  \Dwidthimage{#1}{#2}%
 
1018
}
 
1019
 
 
1020
% Figures.
 
1021
\providecommand{\DNfigureAalign}[5]{%
 
1022
  % Hack to make it work Right Now.
 
1023
  %\def\DcurrentNimageAwidth{\DcurrentNfigureAwidth}%
 
1024
  %
 
1025
    %\def\DcurrentNimageAwidth{\linewidth}%
 
1026
    \DNimageAalign{#1}{#2}{#3}{#4}{%
 
1027
      \begin{minipage}[b]{0.4\linewidth}#5\end{minipage}}%
 
1028
    %\let\DcurrentNimageAwidth=\relax%
 
1029
  %
 
1030
  %\let\DcurrentNimageAwidth=\relax%
 
1031
}
 
1032
\providecommand{\DNcaption}[1]{\par\noindent{\slshape#1}}
 
1033
\providecommand{\DNlegend}[1]{\Dauxiliaryspace#1}
 
1034
 
 
1035
\providecommand{\DCborder}[1]{\fbox{#1}}
 
1036
% No padding between image and border.
 
1037
\providecommand{\DNimageCborder}[1]{\frame{#1}}
 
1038
 
 
1039
 
 
1040
% Need to replace with language-specific stuff.  Maybe look at
 
1041
% csquotes.sty and ask the author for permission to use parts of it.
 
1042
\providecommand{\Dtextleftdblquote}{``}
 
1043
\providecommand{\Dtextrightdblquote}{''}
 
1044
 
 
1045
% Table of contents:
 
1046
\Dprovidelength{\Dtocininitialsectnumwidth}{2.4em}
 
1047
\Dprovidelength{\Dtocadditionalsectnumwidth}{0.7em}
 
1048
% Level inside a table of contents.  While this is at -1, we are not
 
1049
% inside a TOC.
 
1050
\Dprovidecounter{Dtoclevel}%
 
1051
\setcounter{Dtoclevel}{-1}
 
1052
\providecommand{\Dlocaltoc}{false}%
 
1053
\providecommand{\DNtopicClocal}[1]{%
 
1054
  \renewcommand{\Dlocaltoc}{true}%
 
1055
  \addtolength{\Dtocsectnumwidth}{2\Dtocadditionalsectnumwidth}%
 
1056
  \addtolength{\Dtocindent}{-2\Dtocadditionalsectnumwidth}%
 
1057
  #1%
 
1058
  \addtolength{\Dtocindent}{2\Dtocadditionalsectnumwidth}%
 
1059
  \addtolength{\Dtocsectnumwidth}{-2\Dtocadditionalsectnumwidth}%
 
1060
  \renewcommand{\Dlocaltoc}{false}%
 
1061
}
 
1062
\Dprovidelength{\Dtocindent}{0pt}%
 
1063
\Dprovidelength{\Dtocsectnumwidth}{\Dtocininitialsectnumwidth}
 
1064
% Compensate for one additional TOC indentation space so that the
 
1065
% top-level is unindented.
 
1066
\addtolength{\Dtocsectnumwidth}{-\Dtocadditionalsectnumwidth}
 
1067
\addtolength{\Dtocindent}{-\Dtocsectnumwidth}
 
1068
\providecommand{\Difinsidetoc}[2]{%
 
1069
  \ifthenelse{\not\equal{\theDtoclevel}{-1}}{#1}{#2}%
 
1070
}
 
1071
\providecommand{\DNgeneratedCsectnum}[1]{%
 
1072
  \Difinsidetoc{%
 
1073
    % Section number inside TOC.
 
1074
    \makebox[\Dtocsectnumwidth][l]{#1}%
 
1075
  }{%
 
1076
    % Section number inside section title.
 
1077
    #1\quad%
 
1078
  }%
 
1079
}
 
1080
\providecommand{\Dtocbulletlist}[1]{%
 
1081
  \addtocounter{Dtoclevel}{1}%
 
1082
  \addtolength{\Dtocindent}{\Dtocsectnumwidth}%
 
1083
  \addtolength{\Dtocsectnumwidth}{\Dtocadditionalsectnumwidth}%
 
1084
  #1%
 
1085
  \addtolength{\Dtocsectnumwidth}{-\Dtocadditionalsectnumwidth}%
 
1086
  \addtolength{\Dtocindent}{-\Dtocsectnumwidth}%
 
1087
  \addtocounter{Dtoclevel}{-1}%
 
1088
}
 
1089
 
 
1090
 
 
1091
% For \Dpixelunit, the length value is pre-multiplied with 0.75, so by
 
1092
% specifying "pt" we get the same notion of "pixel" as graphicx.
 
1093
\providecommand{\Dpixelunit}{pt}
 
1094
% Normally lengths are relative to the current linewidth.
 
1095
\providecommand{\Drelativeunit}{\linewidth}
 
1096
 
 
1097
 
 
1098
%\RequirePackage{fixmath}
 
1099
%\RequirePackage{amsmath}
 
1100
 
 
1101
 
 
1102
\DSfontencoding
 
1103
\DSlanguage
 
1104
\DSlinks
 
1105
\DSsymbols
 
1106
\DSlate
 
1107
 
 
1108
\makeatother