4
% http://docutils.python-hosting.com/wiki/NewLatex
7
\providecommand{\Dprinting}{false}
10
\providecommand{\DSearly}{}
11
\providecommand{\DSlate}{}
13
\providecommand{\Ddocumentclass}{scrartcl}
14
\providecommand{\Ddocumentoptions}{a4paper}
16
\documentclass[\Ddocumentoptions]{\Ddocumentclass}
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.
26
% Provide the characters not contained in AE from EC bitmap fonts.
28
% Guillemets ("<<", ">>") in AE.
33
\providecommand{\DSsymbols}{%
35
% The Euro symbol in Computer Modern looks, um, funny. Let's get a
37
\RequirePackage{eurosym}%
38
\renewcommand{\texteuro}{\euro}%
43
% <http://groups.google.de/groups?selm=1i0n5tgtplti420e1omp4pctlv19jpuhbb%404ax.com>
44
% and modified. Used with permission.
45
\providecommand{\Dprovidelength}[2]{%
48
\xdef\@gtempa{{\string#1}}%
50
\expandafter\@ifundefined\@gtempa%
51
{\newlength{#1}\setlength{#1}{#2}}%
55
\providecommand{\Dprovidecounter}[1]{%
56
% Like \newcounter except that it doesn't crash if the counter
58
\@ifundefined{c@#1}{\newcounter{#1}}{}
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}%
69
\providecommand{\Dmakefbox}[1]{%
70
% Make a centered, framed box. Useful e.g. for admonitions.
71
\vspace{0.4\baselineskip}%
73
\fbox{\Dmakeboxminipage{#1}}%
75
\vspace{0.4\baselineskip}%
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}%
90
\RequirePackage{ifthen}
91
\providecommand{\Dfrenchspacing}{true}
92
\ifthenelse{\equal{\Dfrenchspacing}{true}}{\frenchspacing}{}
95
\Dprovidelength{\Dblocklevelvspace}{%
96
% Space between block-level elements other than paragraphs.
97
0.7\baselineskip plus 0.3\baselineskip minus 0.2\baselineskip%
99
\providecommand{\Dauxiliaryspace}{%
100
\ifthenelse{\equal{\Dneedvspace}{true}}{\vspace{\Dblocklevelvspace}}{}%
103
\providecommand{\Dparagraphspace}{\par}
104
\providecommand{\Dneedvspace}{true}
107
\providecommand{\DSlinks}{
108
% Targets and references.
109
\RequirePackage[colorlinks=false,pdfborder={0 0 0}]{hyperref}
111
\providecommand{\Draisedlink}[1]{\Hy@raisedlink{##1}}
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}%
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}%
127
\ifthenelse{\equal{##4}{citationreference}}{%
128
\Dimplicitcitationreference{\###3}{##5}%
130
\Dimplicitreference{\###3}{##5}%
136
\providecommand{\DArefuri}[5]{%
137
\ifthenelse{\equal{##4}{target}}{%
138
% Hyperlink targets can (and should be) ignored because they are
141
% We only have explicit URI references, so one macro suffices.
142
\Durireference{##3}{##5}%
146
\providecommand{\DAids}[5]{%
148
\ifthenelse{\equal{##4}{footnotereference}}{%
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%
155
\Draisedlink{\hypertarget{##3}{}}##5%
158
\Draisedlink{\hypertarget{##3}{}}##5%
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:
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}%
175
\providecommand{\Dimplicitcitationreference}[2]{%
176
% Ditto for citation references.
177
\Dimplicitfootnotereference{##1}{##2}%
179
\ifthenelse{\equal{\Dprinting}{true}}{
180
\providecommand{\Dexplicitreferencecolor}{black}
182
\providecommand{\Dexplicitreferencecolor}{blue}
184
\providecommand{\Dexplicitreference}[2]{%
185
% Create explicit reference to ID, e.g. created with "foo_".
189
\href{##1}{{\color{\Dexplicitreferencecolor}##2}}%
191
\providecommand{\Durireferencecolor}{\Dexplicitreferencecolor}
192
\providecommand{\Durireference}[2]{%
193
% Create reference to URI. Parameters:
196
\href{##1}{{\color{\Durireferencecolor}##2}}%
201
\providecommand{\DSlanguage}{%
203
\ifthenelse{\equal{\Dlanguagebabel}{}}{}{
204
\RequirePackage[\Dlanguagebabel]{babel}
211
\providecommand{\DAclasses}[5]{%
212
\Difdefined{DN#4C#3}{%
213
% Pass only contents, nothing else!
214
\csname DN#4C#3\endcsname{#5}%
217
\csname DC#3\endcsname{#5}%
224
\providecommand{\Difdefined}[3]{\@ifundefined{#1}{#3}{#2}}
226
\providecommand{\Dattr}[5]{%
227
% Global attribute dispatcher.
229
% 1. Attribute number.
231
% 3. Attribute value.
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}%
246
\providecommand{\DNparagraph}[1]{%
247
\ifthenelse{\equal{\Dparagraphindented}{true}}{\indent}{\noindent}%
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}}%
258
\providecommand{\Dtopicsubtitle}[1]{%
259
\noindent\Dformatboxsubtitle{#1}%
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}}%
269
\providecommand{\Ddocumentsubtitle}[1]{%
270
\begin{center}{\huge#1}\end{center}%
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}}%
282
\providecommand{\Dsectiontitlehook}[1]{#1}
283
\providecommand{\Dsectiontitle}[1]{%
285
\Ddispatchsectiontitle{\Dbookmarksectiontitle{\Dformatsectiontitle{#1}}}%
288
\providecommand{\Ddispatchsectiontitle}[1]{%
289
\@ifundefined{Dsectiontitle\roman{Dsectionlevel}}{%
290
\Ddeepsectiontitle{#1}%
292
\csname Dsectiontitle\roman{Dsectionlevel}\endcsname{#1}%
295
\providecommand{\Ddispatchsectionsubtitle}[1]{%
296
\Ddispatchsectiontitle{#1}%
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
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}}%
321
\providecommand{\Dhassubtitle}{false}
322
\providecommand{\DNtitle}[1]{%
323
\csname D\Dparent title\endcsname{#1}%
325
\providecommand{\DNsubtitle}[1]{%
326
\csname D\Dparent subtitle\endcsname{#1}%
328
\newcounter{Dpdfbookmarkid}
329
\setcounter{Dpdfbookmarkid}{0}
330
\providecommand{\Dpdfbookmark}[1]{%
331
% Temporarily decrement Desctionlevel counter.
332
\addtocounter{Dsectionlevel}{-1}%
333
%\typeout{\arabic{Dsectionlevel}}%
335
%\typeout{docutils\roman{Dpdfbookmarkid}}%
337
\pdfbookmark[\arabic{Dsectionlevel}]{#1}{docutils\arabic{Dpdfbookmarkid}}%
338
\addtocounter{Dsectionlevel}{1}%
339
\addtocounter{Dpdfbookmarkid}{1}%
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}%
348
\setlength{\rightmargin}{0pt}%
350
\raggedright\item\noindent\nohyphens{\textnhtt{#1\Dfinalstrut}}%
353
\providecommand{\DNdoctestblock}[1]{%
354
% Treat doctest blocks the same as literal blocks.
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}%
368
\addtocounter{Dtoclevel}{-1}%
374
\providecommand{\Dformatrubric}[1]{\textbf{#1}}
375
\Dprovidelength{\Dprerubricspace}{0.3em}
376
\providecommand{\DNrubric}[1]{%
377
\vspace{\Dprerubricspace}\par\noindent\Dformatrubric{#1}\par%
380
\providecommand{\Dbullet}{}
381
\providecommand{\Dsetbullet}[1]{\renewcommand{\Dbullet}{#1}}
382
\providecommand{\DNbulletlist}[1]{%
386
\Dmakelistenvironment{\Dbullet}{}{#1}%
389
\renewcommand{\@pnumwidth}{2.2em}
390
\providecommand{\DNlistitem}[1]{%
392
\ifthenelse{\equal{\theDtoclevel}{1}\and\equal{\Dlocaltoc}{false}}{%
394
\par\addvspace{1em}\noindent%
396
#1\hfill\pageref{\DcurrentNlistitemAtocrefid}%
399
\@dottedtocline{0}{\Dtocindent}{0em}{#1}{%
400
\pageref{\DcurrentNlistitemAtocrefid}%
407
\providecommand{\DNenumeratedlist}[1]{#1}
408
\newcounter{Dsectionlevel}
409
\providecommand{\Dvisitsectionhook}{}
410
\providecommand{\Ddepartsectionhook}{}
411
\providecommand{\Dvisitsection}{%
412
\addtocounter{Dsectionlevel}{1}%
415
\providecommand{\Ddepartsection}{%
417
\addtocounter{Dsectionlevel}{-1}%
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}
425
\providecommand{\Dtextinlineliteralfirstspace}{{ }}
426
\providecommand{\Dtextinlineliteralsecondspace}{{~}}
428
\Dprovidelength{\Dlistspacing}{0.8\baselineskip}
430
\providecommand{\Dsetlistrightmargin}{%
431
\ifthenelse{\lengthtest{\linewidth>12em}}{%
433
\setlength{\rightmargin}{\leftmargin}%
435
% If the line is narrower than 10em, we don't remove any further
436
% space from the right.
437
\setlength{\rightmargin}{0pt}%
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}%
454
\renewcommand{\Dneedvspace}{false}%
455
% \parsep0.5\baselineskip
456
\renewcommand{\Dresetlistdepth}{false}%
457
\ifnum \@listdepth>5%
458
\protect\renewcommand{\Dresetlistdepth}{true}%
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}%
472
\setlength{\labelsep}{\Doriginallabelsep}%
473
\Dsetlistrightmargin%
479
\ifthenelse{\equal{\Dresetlistdepth}{true}}{\@listdepth=5}{}%
481
\ifthenelse{\equal{\Dinsidetabular}{true}}{\end{minipage}}{}%
483
\providecommand{\Dfinalstrut}{\@finalstrut\@arstrutbox}
484
\providecommand{\DAlastitem}[5]{#5\Dfinalstrut}
486
\Dprovidelength{\Ditemsep}{0pt}
487
\providecommand{\Dmakeenumeratedlist}[6]{%
488
% Make enumerated list.
491
% - type (\arabic, \roman, ...)
493
% - suggested counter name
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:
506
\setlength{\leftmargin}{2.5em}%
507
\Dsetlistrightmargin%
508
\setlength{\itemsep}{\Ditemsep}%
509
% Use counter recommended by Python module.
512
\addtocounter{#4}{#5}%
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}{'}
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
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.
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.
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]{%
558
% This only saves field name and field body in \Dsavefieldname and
559
% \Dsavefieldbody, resp. It does not insert any text into the
562
% Recalculate the real field name width everytime we encounter a
563
% tabular list field because it may have been changed using a
565
\setlength{\Drealfieldnamewidth}{\Dtabularlistfieldnamewidth}%
566
\addtolength{\Drealfieldnamewidth}{\Dtabularlistfieldnamesep}%
567
\Dmakelistenvironment{%
568
\makebox[\Drealfieldnamewidth][l]{\Dsavefieldname}%
570
\setlength{\labelwidth}{\Drealfieldnamewidth}%
571
\setlength{\leftmargin}{\Drealfieldnamewidth}%
572
\setlength{\rightmargin}{0pt}%
573
\setlength{\labelsep}{0pt}%
576
\settowidth{\Dusedfieldnamewidth}{\Dsavefieldname}%
577
\setlength{\Dparskiptemp}{\parskip}%
579
\lengthtest{\Dusedfieldnamewidth>\Dtabularlistfieldnamewidth}%
582
\setlength{\parskip}{0pt}%
585
\setlength{\parskip}{\Dparskiptemp}%
586
%XXX Why did we need this?
587
%\@finalstrut\@arstrutbox%
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}%
601
\providecommand{\DNfieldbody}[1]{\Dtabularlistfieldbody{#1}}
603
\providecommand{\Dformatoptiongroup}[1]{%
604
% Format option group, e.g. "-f file, --input file".
607
\providecommand{\Dformatoption}[1]{%
608
% Format option, e.g. "-f file".
609
% Put into mbox to avoid line-breaking at spaces.
612
\providecommand{\Dformatoptionstring}[1]{%
613
% Format option string, e.g. "-f".
616
\providecommand{\Dformatoptionargument}[1]{%
617
% Format option argument, e.g. "file".
620
\providecommand{\Dformatoptiondescription}[1]{%
621
% Format option description, e.g.
622
% "\DNparagraph{Read input data from file.}"
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).
633
\providecommand{\DNoptionlistitem}[1]{%
634
\Dtabularlistfield{#1}%
636
\providecommand{\DNoptiongroup}[1]{%
637
\renewcommand{\Disfirstoption}{true}%
638
\Dtabularlistfieldname{\Dformatoptiongroup{#1}}%
640
\providecommand{\DNoption}[1]{%
641
% If this is not the first option in this option group, add a
643
\ifthenelse{\equal{\Disfirstoption}{true}}{%
644
\renewcommand{\Disfirstoption}{false}%
650
\providecommand{\DNoptionstring}[1]{\Dformatoptionstring{#1}}
651
\providecommand{\DNoptionargument}[1]{{ }\Dformatoptionargument{#1}}
652
\providecommand{\DNdescription}[1]{%
653
\Dtabularlistfieldbody{\Dformatoptiondescription{#1}}%
656
\providecommand{\DNdefinitionlist}[1]{%
662
\providecommand{\DNdefinitionlistitem}[1]{%
663
% LaTeX expects the label in square brackets; we provide an empty
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}}
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}%
684
% At top level; don't indent.
685
\setlength{\leftmargin}{0pt}%
687
\setlength{\rightmargin}{0pt}%
688
\setlength{\parsep}{0pt}%
693
\providecommand{\DNline}[1]{\item#1}
696
\providecommand{\DNtransition}{%
697
\raisebox{0.25em}{\parbox{\linewidth}{\hspace*{\fill}\hrulefill\hrulefill\hspace*{\fill}}}%
701
\providecommand{\Dformatblockquote}[1]{%
702
% Format contents of block quote.
703
% This occurs in block-level context, so we cannot use \textsl.
706
\providecommand{\Dformatattribution}[1]{---\textup{#1}}
707
\providecommand{\DNblockquote}[1]{%
709
\Dformatblockquote{#1}
712
\providecommand{\DNattribution}[1]{%
714
\begin{flushright}\Dformatattribution{#1}\end{flushright}%
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}
726
\Dprovidelength{\Dsidebarframewidth}{2\fboxrule}
727
% Position ("l" or "r").
728
\providecommand{\Dsidebarposition}{r}
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}%
738
\setlength{\fboxrule}{\Dsidebarframewidth}%
739
\setlength{\fboxsep}{\Dsidebarpadding}%
741
\begin{minipage}[t]{\linewidth}%
742
\setlength{\parindent}{\Dboxparindent}%
747
\vspace{\Dsidebarvmargin}%
753
% Citations and footnotes.
754
\providecommand{\Dformatfootnote}[1]{%
758
% \par is necessary for LaTeX to adjust baselineskip to the
763
\providecommand{\Dformatcitation}[1]{\Dformatfootnote{#1}}
764
\Dprovidelength{\Doriginalbaselineskip}{0pt}
765
\providecommand{\DNfootnotereference}[1]{%
767
% \baselineskip is 0pt in \textsuperscript, so we save it here.
768
\setlength{\Doriginalbaselineskip}{\baselineskip}%
769
\textsuperscript{#1}%
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}%
779
\providecommand{\DNfootnote}[1]{%
780
% See ltfloat.dtx for details.
783
\vspace{\Dfootnotesep}%
784
\Dsetfootnotespacing%
785
\Dformatfootnote{#1}%
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{ }}%
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}}%
800
\providecommand{\Dthislabel}{}
801
\providecommand{\DNlabel}[1]{%
802
\renewcommand{\Dthislabel}{#1}
803
\ifthenelse{\not\equal{\Dsinglebackref}{}}{%
804
\let\Doriginallabel=\Dthislabel%
806
\Dsinglefootnotebacklink{\Dsinglebackref}{\Doriginallabel}%
809
\ifthenelse{\equal{\Dparent}{footnote}}{%
811
\Dformatfootnotelabel{\Dthislabel}%
813
\ifthenelse{\equal{\Dparent}{citation}}{%
815
\Dformatcitationlabel{\Dthislabel}%
818
% If there are multiple backrefs, add them now.
819
\Dformatmultiplebackrefs{\Dmultiplebackrefs}%
821
\providecommand{\Dsinglefootnotebacklink}[2]{%
822
% Create normal backlink of a footnote label. Parameters:
825
% Treat like a footnote reference.
826
\Dimplicitfootnotereference{\##1}{#2}%
828
\providecommand{\Dmultifootnotebacklink}[2]{%
829
% Create generated backlink, as in (1, 2). Parameters:
832
% Treat like a footnote reference.
833
\Dimplicitfootnotereference{\##1}{#2}%
835
\providecommand{\Dsinglecitationbacklink}[2]{\Dsinglefootnotebacklink{#1}{#2}}
836
\providecommand{\Dmulticitationbacklink}[2]{\Dmultifootnotebacklink{#1}{#2}}
839
\RequirePackage{longtable}
840
\providecommand{\Dmaketable}[2]{%
841
% Make table. Parameters:
842
% 1. Table spec (like "|p|p|").
845
\ifthenelse{\equal{\Dinsidetabular}{true}}{%
846
% Inside longtable; we cannot have nested longtables.
852
\renewcommand{\Dinsidetabular}{true}%
853
\begin{longtable}{#1}%
860
\providecommand{\DNthead}[1]{%
864
\providecommand{\DNrow}[1]{%
868
\providecommand{\Dinsidemulticolumn}{false}
869
\providecommand{\Dcompensatingmulticol}[3]{%
870
\multicolumn{#1}{#2}{%
872
\renewcommand{\Dinsidemulticolumn}{true}%
873
% Compensate for weird missing vertical space at top of paragraph.
874
\raisebox{-2.5pt}{#3}%
878
\providecommand{\Dcolspan}[2]{%
879
% Take care of the morecols attribute (but incremented by 1).
881
\Dcompensatingmulticol{#1}{l|}{#2}%
883
\providecommand{\Dcolspanleft}[2]{%
884
% Like \Dmorecols, but called for the leftmost entries in a table
886
\Dcompensatingmulticol{#1}{|l|}{#2}%
888
\providecommand{\Dsubsequententry}[1]{%
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%
899
% No need to add an ampersand ("&"); that's done by \Dsubsequententry.
901
\providecommand{\DAtableheaderentry}[5]{\Dformattableheaderentry{#5}}
902
\providecommand{\Dformattableheaderentry}[1]{{\bfseries#1}}
905
\providecommand{\DNsystemmessage}[1]{%
907
\ifthenelse{\equal{\Dprinting}{false}}{\color{red}}{}%
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.
923
\renewcommand{\Dinsidehalign}{true}%
924
% For some obscure reason \parpic consumes some vertical space.
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}}%
932
\begin{minipage}[b]{\Dalignedimagewidth}%
933
% Compensate for previously added space, but not entirely.
935
\vspace*{\Dfloatimagetopmargin}%
936
\usebox{\Dalignedimagebox}%
938
\vspace*{\Dfloatimagebottommargin}%
941
\renewcommand{\Dinsidehalign}{false}%
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}}{%
955
\ifthenelse{\equal{#3}{right}}{%
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}%
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}%
980
\Dsimpleimage{\Dimagepath}%
983
\Dprovidelength{\Dfloatimagevmargin}{0pt}
984
\providecommand{\Dfloatimagetopmargin}{\Dfloatimagevmargin}
985
\providecommand{\Dfloatimagebottommargin}{\Dfloatimagevmargin}
986
\providecommand{\Dwidthimage}[2]{%
987
% Image with specified width.
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}%
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}%
1004
\renewcommand{\Dcurrentimagemaxwidth}{\Dimagemaxwidth}%
1006
\ifthenelse{\lengthtest{\Dcurrentimagewidth>\Dcurrentimagemaxwidth}}{%
1007
\Dwidthimage{\Dcurrentimagemaxwidth}{#1}%
1009
\Dwidthimage{\Dcurrentimagewidth}{#1}%
1012
\providecommand{\Dwidthimage}[2]{%
1013
% Image with specified width.
1017
\Dwidthimage{#1}{#2}%
1021
\providecommand{\DNfigureAalign}[5]{%
1022
% Hack to make it work Right Now.
1023
%\def\DcurrentNimageAwidth{\DcurrentNfigureAwidth}%
1025
%\def\DcurrentNimageAwidth{\linewidth}%
1026
\DNimageAalign{#1}{#2}{#3}{#4}{%
1027
\begin{minipage}[b]{0.4\linewidth}#5\end{minipage}}%
1028
%\let\DcurrentNimageAwidth=\relax%
1030
%\let\DcurrentNimageAwidth=\relax%
1032
\providecommand{\DNcaption}[1]{\par\noindent{\slshape#1}}
1033
\providecommand{\DNlegend}[1]{\Dauxiliaryspace#1}
1035
\providecommand{\DCborder}[1]{\fbox{#1}}
1036
% No padding between image and border.
1037
\providecommand{\DNimageCborder}[1]{\frame{#1}}
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}{''}
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
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}%
1058
\addtolength{\Dtocindent}{2\Dtocadditionalsectnumwidth}%
1059
\addtolength{\Dtocsectnumwidth}{-2\Dtocadditionalsectnumwidth}%
1060
\renewcommand{\Dlocaltoc}{false}%
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}%
1071
\providecommand{\DNgeneratedCsectnum}[1]{%
1073
% Section number inside TOC.
1074
\makebox[\Dtocsectnumwidth][l]{#1}%
1076
% Section number inside section title.
1080
\providecommand{\Dtocbulletlist}[1]{%
1081
\addtocounter{Dtoclevel}{1}%
1082
\addtolength{\Dtocindent}{\Dtocsectnumwidth}%
1083
\addtolength{\Dtocsectnumwidth}{\Dtocadditionalsectnumwidth}%
1085
\addtolength{\Dtocsectnumwidth}{-\Dtocadditionalsectnumwidth}%
1086
\addtolength{\Dtocindent}{-\Dtocsectnumwidth}%
1087
\addtocounter{Dtoclevel}{-1}%
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}
1098
%\RequirePackage{fixmath}
1099
%\RequirePackage{amsmath}