Source

scikits_index / code / docutils / writers / latex2e / docutils-05-compat.sty

Full commit
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
% ==================================================================
%     Changes to the Docutils latex2e writer since version 0.5
% ==================================================================
% 
% A backwards compatibility style sheet
% *************************************
% 
% :Author:    Guenter Milde
% :Contact:   milde@users.berlios.de
% :Revision:  $Revision: 6152 $
% :Date:      $Date: 2009-02-24$
% :Copyright: © 2009 G. Milde,
%             Released  without warranties or conditions of any kind
%             under the terms of the Apache License, Version 2.0
%             http://www.apache.org/licenses/LICENSE-2.0
% :Abstract:  This file documents changes and provides a style for best
%             possible compatibility to the behaviour of the `latex2e`
%             writer of Doctutils release 0.5.
% 
% ::

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{docutils-05-compat}
[2009/03/26 v0.1 compatibility with rst2latex from Docutils 0.5]

% .. contents::
%    :depth: 3
% 
% Usage
% =====
% 
% * To get an (almost) identic look for your old documents,
%   place ``docutils-05-compat.sty`` in the TEXINPUT path (e.g.
%   the current work directory) and pass the
%   ``--stylesheet=docutils-05-compat`` option to ``rst2latex.py``.
% 
% * To use your custom stylesheets without change, add them to the
%   compatibility style, e.g.
%   ``--stylesheet="docutils-05-compat,mystyle.tex``.
% 
% .. tip:: As the changes include bug fixes that are partly reverted by this
%    style, it is recommended to adapt the stylesheets to the new version or
%    copy just the relevant parts of this style into them.
% 
% Changes since 0.5
% =================
% 
% Bugfixes
% --------
% 
% * Newlines around comments, targets and references prevent run-together
%   paragraphs.
% 
%   + An image directive with hyperlink reference or target did not start a
%     new paragraph (e.g. the first two image examples in
%     standalone_rst_latex.tex).
% 
%   + Paragraphs were not separated if there was a (hyper) target definition
%     inbetween.
% 
%   + Paragraphs did run together, if separated by a comment-paragraph in the
%     rst source.
% 
% * Fixed missing and spurious internal links/targets.
%   Internal links now take you to the correct place.
% 
% * Verbose and linked system messages.
% 
% * `Figure and image alignment`_ now conforms to the rst definition.
% 
% * Put `header and footer directive`__ content in \DUheader respective
%   \DUfooter macros (ignored by the default style/template).
% 
%   (They were put inside hard-coded markup at the top/bottom of the document
%   without an option to get them on every page.)
% 
% __ ../ref/rst/directives.html#document-header-footer
% 
% * Render doctest blocks as literal blocks (fixes bug [1586058] doctest block
%   nested in admonition). I.e.
% 
%   + indent doctest blocks by nesting in a quote environment. This is also
%     the rendering by the HTML writer (html4css2.css).
%   + apply the ``--literal-block-env`` setting also to doctest blocks.
% 
%   .. warning::
%       (``--literal-block-env=verbatim`` and
%       ``--literal-block-env=lstlistings`` fail with literal or doctest
%       blocks nested in an admonition.
% 
% * Two-way hyperlinked footnotes and support for symbol footnotes and
%   ``--footnote-references=brackets`` with ``--use-latex-footnotes``.
% 
% * The packages `fixltx2e` (providing LaTeX patches and the \textsubscript
%   command) and `cmap` (including character maps in the generated PDF for
%   better search and copy-and-paste operations) are now always loaded
%   (configurable with custom templates_).
% 
% Backwards compatibility:
%   "Bug for bug compatibility" is not provided.
% 
% 
% New configuration setting defaults
% ----------------------------------
% 
% - font-encoding: "T1" (formerly implicitely set by 'ae').
% - use-latex-toc: true (ToC with page numbers).
% - use-latex-footnotes: true (no mixup with figures).
% 
% Backwards compatibility:
%   Reset to the former defaults with:
% 
%   | font-encoding: ''
%   | use-latex-toc: False
%   | use-latex-footnotes: False
% 
%   (in the config file) or the command line options:
% 
%     ``--figure-footnotes --use-docutils-toc  --font-encoding=''``
% 
% 
% Cleaner LaTeX source
% --------------------
% 
% New features:
%   * Remove redundant "double protection" from the encoding of the "special
%     printing characters" and square brackets, e.g. ``\%`` instead of
%     ``{\%}``.
%   * Remove some spurious whitespace, e.g. ``\item [what:] -> \item[what:]``.
%   * Use conventional style for "named" macros, e.g. ``\dots{}`` instead of
%     ``{\dots}``
% 
% Backwards compatibility:
%   Changes do not affect the output.
% 
% 
% LaTeX style sheets
% ------------------
% 
% New Feature:
%   LaTeX packages can be used as ``--stylesheet`` argument without
%   restriction.
% 
% Implementation:
%   Use ``\usepackage`` if style sheet ends with ``.sty`` or has no
%   extension and ``\input`` else.
% 
% Rationale:
%   while ``\input`` works with extension as well as without extension,
%   ``\usepackage`` expects the package name without extension. (The latex2e
%   writer will strip a ``.sty`` extension.)
% 
% 
% Backwards compatibility:
%   Up to Docutils 0.5, if no filename extension is given in the
%   ``stylesheet`` argument, ``.tex`` is assumed (by latex).
% 
%   Since Docutils 0.6, a stylesheet without filename extension is assumed to
%   be a LaTeX package (``*.sty``) and referenced with the ``\usepackage``
%   command.
% 
% .. important::
%   Always specify the extension if you want the style sheet to be
%   ``\input`` by LaTeX.
% 
% 
% Templates
% ---------
% 
% New Feature:
%   Advanced configuration via custom templates.
% 
% Implementation:
%   A ``--template`` option and config setting allows specification of a
%   template file.
% 
% See the `LaTeX writer documentation`__ for details.
% 
% __ latex.html#templates
% 
% 
% Custom roles
% ------------
% 
% New Feature: failsave implementation
%   As with classes to HTML objects, class arguments are silently ignored if
%   there is no styling rule for this class in a custom style sheet.
% 
% New Feature: custom roles based on standard roles
%   As class support needs to be handled by the LaTeX writer, this feature was
%   not present "automatically" (as in HTML). Modified visit/depart_*()
%   methods for the standard roles now call visit/depart_inline() if there are
%   class arguments to the node.
% 
% Backwards compatibility:
%   The implementation is fully backwards compatible. (SVN versions 5742 to
%   5861 contained an implementation that did not work with commands expecting
%   an argument.)
% 
% Length units
% ------------
% 
% New Features:
%   1. Add default unit if none given.
%      A poll on docutils-users favoured ``bp`` (Big Point: 1 bp  = 1/72 in).
% 
%   2. Do not change ``px`` to ``pt``.
% 
%   3. Lengths specified in the document with unit "pt" will be written with
%      unit "bp" to the LaTeX source.
% 
% Rationale:
%   1. prevent LaTeX error "missing unit".
% 
%   2. ``px`` is a valid unit in pdftex since version 1.3.0 released on
%      2005-02-04:
% 
%        1px defaults to 1bp (or 72dpi), but can be changed with the
%        ``\pdfpxdimen`` primitive.::

        \pdfpxdimen=1in % 1 dpi
        \divide\pdfpxdimen by 96 % 96 dpi

%        --  http://www.tug.org/applications/pdftex/NEWS
% 
%      Modern TeX distributions use pdftex also for dvi generation (i.e.
%      ``latex`` actually calls ``pdftex`` with some options).
% 
%   3. In Docutils (as well as CSS) the unit symbol "pt" denotes the
%      `Postscript point` or `DTP point` while LaTeX uses "pt" for the `LaTeX
%      point`, which is unknown to Docutils and 0.3 % smaller.
% 
%      The `DTP point` is available in LaTeX as "bp" (big point):
% 
%        1 pt = 1/72.25 in < 1 bp  = 1/72 in
% 
% 
% Backwards compatibility:
%   Images with width specification in ``px`` come out slightly (0.3 %) larger:
% 
%     1 px = 1 bp  = 1/72 in > 1 pt = 1/72.25 in
% 
%   This can be reset with ::

  \pdfpxdimen=1pt

% .. caution:: It is impossible to revert the change of lengths specified with
%    "pt" or without unit in a style sheet, however the 0.3 % change will be
%    imperceptible in most cases.
% 
% .. admonition:: Error ``illegal unit px``
% 
%   The unit ``px`` is not defined in "pure" LaTeX, but introduced by the
%   `pdfTeX` converter on 2005-02-04. `pdfTeX` is used in all modern LaTeX
%   distributions (since ca. 2006) also for conversion into DVI.
% 
%   If you convert the LaTeX source with a legacy program, you might get the
%   error ``illegal unit px``.
% 
%   If updating LaTeX is not an option, just remove the ``px`` from the length
%   specification. HTML/CSS will default to ``px`` while the `latexe2` writer
%   will add the fallback unit ``bp``.
% 
% 
% Font encoding
% -------------
% 
% New feature:
%   Do not mix font-encoding and font settings: do not load the obsolete
%   `ae` and `aeguill` packages unless explicitely required via the
%   ``--stylesheet`` option.
% 
%   :font-encoding = "":  do not load `ae` and `aeguill`, i.e.
% 
%                         * do not change font settings,
%                         * do not use the fontenc package
%                           (implicitely loaded via `ae`),
%                         * use LaTeX default font encoding (OT1)
% 
%   :font-encoding = "OT1": load `fontenc` with ``\usepackage[OT1]{fontenc}``
% 
% Example:
%   ``--font-encoding=LGR,T1`` becomes ``\usepackage[LGR,T1]{fontenc}``
%   (Latin, Latin-1 Supplement, and Greek)
% 
% 
% Backwards compatibility:
%   Load the ae and aeguill packages if fontenc is not used.
% 
% .. tip:: Using `ae` is not recommended. A similar look (but better
%    implementation) can be achieved with the packages `lmodern`, `cmsuper`,
%    or `cmlgr` all providing Computer Modern look-alikes in vector format and
%    T1 encoding, e.g. ``--font-encoding=T1 --stylesheet=lmodern``.
% 
% Sub- and superscript as text
% ----------------------------
% 
% New feature:
%   Set sub- and superscript role argument in text mode not as math.
% 
%   Pass the role content to ``\textsubscript`` or ``\textsuperscript``.
% 
% Backwards compatibility:
%   The old implementation set the role content in Math mode, where
% 
%   * whitespace is ignored,
%   * a different command set and font setting scheme is active,
%   * Latin letters are typeset italic but numbers upright.
% 
%   Although it is possible to redefine ``\textsubscript`` and
%   ``\textsuperscript`` to typeset the content in math-mode, this can lead to
%   errors with certain input and is therefore not done in this style sheet.
% 
% .. tip:: To get italic subscripts, define and use in your document
%    `custom roles`_ like ``.. role:: sub(subscript)`` and
%    ``.. role:: super(superscript)`` and define the "role commands"::

   \newcommand{\DUrolesub}{\itshape}
   \newcommand{\DUrolesuper}{\itshape}

%    Alternatively, if you want all sub- and superscripts in italic, redefine
%    the macros::

   %% \let\DUsup\textsubscript
   %% \let\DUsuper\textsuperscript
   %% \renewcommand*{\textsubscript}{\DUsub\itshape}
   %% \renewcommand*{\textsuperscript}{\DUsuper\itshape}

%    This is not fully backwards compatible, as it will also set numbers in
%    italic shape and not ignore whitespace.
% 
% Page layout
% -----------
% 
% New features:
%   * Margins are configurable via the ``DIV=...`` document option.
% 
%   * The ``\raggedbottom`` setting is no longer inserted into the document. It
%     is the default for article and report classes. If requested in combination
%     with a book class, it can be given in a custom style sheet.
% 
% Backwards compatibility:
%   Up to version 0.5, use of `typearea` and a DIV setting of 12 were
%   hard-coded into the latex2e writer ::

  \usepackage{typearea}
  \typearea{12}

%   and the vertical alignment of lower boundary of the text area in book
%   classes disabled via ::

  \raggedbottom


% ToC and section numbers
% -----------------------
% 
% Better conformance to Docutils specifications.
% 
% New feature:
%   * The "depth" argument of the "contents" and "sectnum" directives is
%     respected.
% 
%   * section numbering independent of 'use-latex-toc':
% 
%     + sections are only numbered if there is a "sectnum" directive in the
%       document
% 
%     + section numbering by LaTeX if the "sectnum_xforms" config setting is
%       False.
% 
% Backwards compatibility:
% 
%   The previous behaviour was to always number sections if 'use-latex-toc' is
%   true, using the document class defaults. It cannot be restored
%   universally, the following code sets the default values of the "article"
%   document class::

  \setcounter{secnumdepth}{3}
  \setcounter{tocdepth}{3}

% .. TODO or not to do? (Back-compatibility problems)
%   * The default "depth" of the LaTeX-created ToC and the LaTeX section
%     numbering is increased to the number of supported section levels.
% 
% New feature:
%   If 'use-latex-toc' is set, local tables of content are typeset using the
%   'minitoc' package (instead of being ignored).
% 
% Backwards compatibility:
%   Disable the creation of local ToCs (ignoring all special commands) by
%   replacing ``\usepackage{minitoc} with ``\usepackage{mtcoff}``.
% 
% 
% Default font in admonitions and sidebar
% ---------------------------------------
% 
% New feature:
%   Use default font in admonitions and sidebar.
% 
% Backward compatibility:
%   See the fallback definitions for admonitions_, `topic title`_ and
%   `sidebar`_.
% 
% 
% Figure placement
% ----------------
% 
% New feature:
%   Use ``\floatplacement`` from the `float` package instead of
%   "hard-coded" optional argument for the global setting.
% 
%   Default to ``\floatplacement{figure}{H}`` (here definitely). This
%   corresponds most closely to the source and HTML placement (principle of
%   least surprise).
% 
% Backwards compatibility:
%   Set the global default back to the previous used value::

  \usepackage{float}
  \floatplacement{figure}{htbp} % here, top, bottom, extra-page


% Figure and image alignment
% --------------------------
% 
% New features:
% 
% a) Fix behaviour of 'align' argument to a figure (do not align figure
%    contents).
% 
%    As the 'figwidth' argument is still ignored and the "natural width" of a
%    figure in LaTeX is 100% \textwidth, setting the 'align' argument of a
%    figure has currently no effect on the LaTeX output.
% 
% b) Set default align of image in a figure to 'center'.
% 
% c) Also center images that are wider than textwidth.
% 
% d) Align images with class "align-[right|center|left]" (allows setting the
%    alignment of an image in a figure).
% 
% Backwards compatibility:
%    There is no "automatic" way to reverse these changes via a style sheet.
% 
% a) The alignment of the image can be set with the "align-left",
%    "align-center" and "align-right" class arguments.
% 
%    As previously, the caption of a figure is aligned according to the
%    document class -- configurable with a style sheet using the "caption"
%    package.
% 
% b) See a)
% 
% c) Set the alignment of "oversized" images to "left" to get back the
%    old placement.
% 
% Shorter preamble
% ----------------
% 
% New feature:
%   The document preamble is pruned to contain only relevant commands and
%   settings.
% 
% Packages that are no longer required
% ````````````````````````````````````
% 
% The following packages where required in pre-0.5 versions and still loaded
% with version 0.5::

\usepackage{shortvrb}
\usepackage{amsmath}


% Packages that are conditionally loaded
% ``````````````````````````````````````
% 
% Additional to the `typearea` for `page layout`_, the following packages are
% only loaded if actually required by doctree elements:
% 
% Tables
% ^^^^^^
% 
% Standard package for tables across several pages::

\usepackage{longtable}

% Extra space between text in tables and the line above them
% ('array' is implicitely loaded by 'tabularx', see below)::

\usepackage{array}
\setlength{\extrarowheight}{2pt}

% Table cells spanning multiple rows::

\usepackage{multirow}

% Docinfo
% ^^^^^^^
% 
% One-page tables with auto-width columns::

\usepackage{tabularx}

% Images
% ^^^^^^
% Include graphic files::

\usepackage{graphicx}

% Problematic, Sidebar
% ^^^^^^^^^^^^^^^^^^^^
% Set text and/or background colour, coloured boxes with ``\colorbox``::

\usepackage{color}

% Floats for footnotes settings
% `````````````````````````````
% 
% Settings for the use of floats for footnotes are only included if
% 
% * the option "use-latex-footnotes" is False, and
% * there is at least one footnote in the document.
% 
% ::

% begin: floats for footnotes tweaking.
\setlength{\floatsep}{0.5em}
\setlength{\textfloatsep}{\fill}
\addtolength{\textfloatsep}{3em}
\renewcommand{\textfraction}{0.5}
\renewcommand{\topfraction}{0.5}
\renewcommand{\bottomfraction}{0.5}
\setcounter{totalnumber}{50}
\setcounter{topnumber}{50}
\setcounter{bottomnumber}{50}
% end floats for footnotes


% Special lengths, commands, and environments
% -------------------------------------------
% 
% Removed definitions
% ```````````````````
% 
% admonition width
% ^^^^^^^^^^^^^^^^
% The ``admonitionwith`` lenght is replaced by the more powerful
% ``\DUadmonition`` command (see admonitions_).
% 
% Backwards compatibility:
%   The default value (90 % of the textwidth) is unchanged.
% 
%   To configure the admonition width, you must redefine the ``DUadmonition``
%   command instead of changing the ``admonitionwith`` length value.
% 
% 
% Renamed definitions (now conditional)
% `````````````````````````````````````
% 
% The names for special doctree elements are now prefixed with ``DU``.
% 
% Up to version 0.5, all definitions were included in the preamble (before the
% style sheet) of every document -- even if not used in the body. Since
% version 0.6, fallback definitions are included after the style sheet and
% only if required.
% 
% Customization is done by an alternative definition in a style sheet with
% ``\newcommand`` instead of the former ``\renewcommand``.
% 
% The following code provides the old definitions and maps them (or their
% custom variants) to the new interface.
% 
% docinfo width
% ^^^^^^^^^^^^^
% ::

\newlength{\docinfowidth}
\setlength{\docinfowidth}{0.9\textwidth}

\newlength{\DUdocinfowidth}
\AtBeginDocument{\setlength{\DUdocinfowidth}{\docinfowidth}}

% line block
% ^^^^^^^^^^
% ::

\newlength{\lineblockindentation}
\setlength{\lineblockindentation}{2.5em}
\newenvironment{lineblock}[1]
{\begin{list}{}
  {\setlength{\partopsep}{\parskip}
   \addtolength{\partopsep}{\baselineskip}
   \topsep0pt\itemsep0.15\baselineskip\parsep0pt
   \leftmargin#1}
 \raggedright}
{\end{list}}

\newlength{\DUlineblockindent}
\AtBeginDocument{\setlength{\DUlineblockindent}{\lineblockindentation}}
\newenvironment{DUlineblock}[1]
  {\begin{lineblock}{#1}}
  {\end{lineblock}}

% local line width
% ^^^^^^^^^^^^^^^^
% 
% The ``\locallinewidth`` length for internal use in tables is replaced
% by ``\DUtablewidth``. It was never intended for customization::

\newlength{\locallinewidth}

% option lists
% ^^^^^^^^^^^^
% ::

\newcommand{\optionlistlabel}[1]{\bf #1 \hfill}
\newenvironment{optionlist}[1]
{\begin{list}{}
  {\setlength{\labelwidth}{#1}
   \setlength{\rightmargin}{1cm}
   \setlength{\leftmargin}{\rightmargin}
   \addtolength{\leftmargin}{\labelwidth}
   \addtolength{\leftmargin}{\labelsep}
   \renewcommand{\makelabel}{\optionlistlabel}}
}{\end{list}}

\newcommand{\DUoptionlistlabel}{\optionlistlabel}
\newenvironment{DUoptionlist}
  {\begin{optionlist}{3cm}}
  {\end{optionlist}}

% rubric
% ^^^^^^
% Now less prominent (not bold, normal size) restore with::

\newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}}
\newcommand{\DUrubric}[2][class-arg]{\rubric{#2}}

% title reference role
% ^^^^^^^^^^^^^^^^^^^^
% ::

\newcommand{\titlereference}[1]{\textsl{#1}}
\newcommand{\DUroletitlereference}[1]{\titlereference{#1}}


% New definitions
% ```````````````
% 
% New Feature:
%   Enable customization of some more Docutils elements with special commands
% 
%   :admonition: ``DUadmonition`` command (replacing ``\admonitionwidth``),
%   :field list: ``DUfieldlist``  environment,
%   :legend:     ``DUlegend``     environment,
%   :sidebar:    ``\DUsidebar``, ``\DUtitle``, and
%                ``DUsubtitle`` commands,
%   :topic:      ``\DUtopic`` and ``\DUtitle`` commands,
%   :transition: ``\DUtransition`` command.
%   :footnotes:  ``\DUfootnotemark`` and ``\DUfootnotetext`` commands with
%                hyperlink support using the Docutils-provided footnote label.
% 
% Backwards compatibility:
%   In most cases, the default definition corresponds to the previously used
%   construct. The following definitions restore the old behaviour in case of
%   changes.
% 
% admonitions
% ^^^^^^^^^^^
% Use sans-serif fonts::

\newcommand{\DUadmonition}[2][class-arg]{%
  \begin{center}
    \fbox{\parbox{0.9\textwidth}{\sffamily #2}}
  \end{center}
}

% dedication
% ^^^^^^^^^^
% Do not center::

\newcommand{\DUtopicdedication}[1]{#1}

% But center the title::

\newcommand*{\DUtitlededication}[1]{\centerline{\textbf{#1}}}

% sidebar
% ^^^^^^^
% Use sans-serif fonts, a frame, and a darker shade of grey::

\providecommand{\DUsidebar}[2][class-arg]{%
  \begin{center}
    \sffamily
    \fbox{\colorbox[gray]{0.80}{\parbox{0.9\textwidth}{#2}}}
  \end{center}
}

% sidebar sub-title
% ^^^^^^^^^^^^^^^^^
% Bold instead of emphasized::

\providecommand*{\DUsubtitlesidebar}[1]{\hspace*{\fill}\\
  \textbf{#1}\smallskip}

% topic
% ^^^^^
% No quote but normal text::

\newcommand{\DUtopic}[2][class-arg]{%
  \ifcsname DUtopic#1\endcsname%
    \csname DUtopic#1\endcsname{#2}%
  \else
    #2
  \fi
}

% topic title
% ^^^^^^^^^^^
% Title for "topics" (admonitions, sidebar).
% 
% Larger font size::

\providecommand*{\DUtitletopic}[1]{\textbf{\large #1}\smallskip}

% transition
% ^^^^^^^^^^
% Do not add vertical space after the transition. ::

\providecommand*{\DUtransition}[1][class-arg]{%
  \hspace*{\fill}\hrulefill\hspace*{\fill}}