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