1 \documentclass[a4paper]{article
}
2 % generated by Docutils <http://docutils.sourceforge.net/>
3 \usepackage{cmap
} % fix search and cut-and-paste in Acrobat
5 \usepackage[T1]{fontenc}
6 \usepackage[utf8
]{inputenc}
7 \DeclareUnicodeCharacter{21D4
}{\ensuremath{\Leftrightarrow}}
8 \DeclareUnicodeCharacter{2660}{\ensuremath{\spadesuit}}
9 \DeclareUnicodeCharacter{2663}{\ensuremath{\clubsuit}}
11 \usepackage[british,french,
ngerman,english
]{babel
}
12 % Prevent side-effects if French hyphenation patterns are not loaded:
13 \frenchbsetup{StandardLayout
}
14 \AtBeginDocument{\selectlanguage{english
}\noextrasfrench}
16 \usepackage{float
} % float configuration
17 \floatplacement{figure
}{H
} % place figures here definitely
22 \setcounter{secnumdepth
}{0}
23 \usepackage{longtable,ltcaption,array
}
24 \setlength{\extrarowheight}{2pt
}
25 \newlength{\DUtablewidth} % internal use in tables
27 \usepackage{textcomp
} % text symbol macros
29 %%% Custom LaTeX preamble
31 \usepackage{mathptmx
} % Times
32 \usepackage[scaled=
.90]{helvet
}
35 %%% User specified packages and stylesheets
37 %%% Fallback definitions for Docutils-specific commands
39 % class handling for environments (block-level elements)
40 % \begin{DUclass}{spam} tries \DUCLASSspam and
41 % \end{DUclass}{spam} tries \endDUCLASSspam
42 \ifx\DUclass\undefined % poor man's "provideenvironment"
43 \newenvironment{DUclass
}[1]%
44 {\def\DocutilsClassFunctionName{DUCLASS
#1}% arg cannot be used in end-part of environment.
45 \csname \DocutilsClassFunctionName \endcsname}%
46 {\csname end
\DocutilsClassFunctionName \endcsname}%
49 % providelength (provide a length variable and set default, if it is new)
50 \providecommand*
{\DUprovidelength}[2]{
51 \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
55 \providecommand*
{\DUtitleabstract}[1]{\centerline{\textbf{#1}}}
57 % admonition (specially marked topic)
58 \providecommand{\DUadmonition}[2][class-arg
]{%
59 % try \DUadmonition#1{#2}:
60 \ifcsname DUadmonition
#1\endcsname%
61 \csname DUadmonition
#1\endcsname{#2}%
64 \fbox{\parbox{0.9\linewidth}{#2}}
70 \providecommand*
{\DUCLASSdedication}{%
71 \renewenvironment{quote
}{\begin{center
}}{\end{center
}}%
74 % docinfo (width of docinfo table)
75 \DUprovidelength{\DUdocinfowidth}{0.9\linewidth}
77 % subtitle (in document title)
78 \providecommand*
{\DUdocumentsubtitle}[1]{{\large #1}}
81 % error admonition title
82 \providecommand*
{\DUtitleerror}[1]{\DUtitle{\color{red
}#1}}
84 % fieldlist environment
85 \ifthenelse{\isundefined{\DUfieldlist}}{
86 \newenvironment{DUfieldlist
}%
88 {\enddescription\endquote}
90 % numeric or symbol footnotes with hyperlinks
91 \providecommand*
{\DUfootnotemark}[3]{%
92 \raisebox{1em
}{\hypertarget{#1}{}}%
93 \hyperlink{#2}{\textsuperscript{#3}}%
95 \providecommand{\DUfootnotetext}[4]{%
97 \renewcommand{\thefootnote}{%
98 \protect\raisebox{1em
}{\protect\hypertarget{#1}{}}%
99 \protect\hyperlink{#2}{#3}}%
104 % inline markup (custom roles)
105 % \DUrole{#1}{#2} tries \DUrole#1{#2}
106 \providecommand*
{\DUrole}[2]{%
107 % backwards compatibility: try \docutilsrole#1{#2}
108 \ifcsname docutilsrole
#1\endcsname%
109 \csname docutilsrole
#1\endcsname{#2}%
111 \csname DUrole
#1\endcsname{#2}%
116 \ifthenelse{\isundefined{\DUlegend}}{
117 \newenvironment{DUlegend
}{\small}{}
120 % lineblock environment
121 \DUprovidelength{\DUlineblockindent}{2.5em
}
122 \ifthenelse{\isundefined{\DUlineblock}}{
123 \newenvironment{DUlineblock
}[1]{%
124 \list{}{\setlength{\partopsep}{\parskip}
125 \addtolength{\partopsep}{\baselineskip}
126 \setlength{\topsep}{0pt
}
127 \setlength{\itemsep}{0.15\baselineskip}
128 \setlength{\parsep}{0pt
}
129 \setlength{\leftmargin}{#1}}
135 % optionlist environment
136 \providecommand*
{\DUoptionlistlabel}[1]{\bf #1 \hfill}
137 \DUprovidelength{\DUoptionlistindent}{3cm
}
138 \ifthenelse{\isundefined{\DUoptionlist}}{
139 \newenvironment{DUoptionlist
}{%
140 \list{}{\setlength{\labelwidth}{\DUoptionlistindent}
141 \setlength{\rightmargin}{1cm
}
142 \setlength{\leftmargin}{\rightmargin}
143 \addtolength{\leftmargin}{\labelwidth}
144 \addtolength{\leftmargin}{\labelsep}
145 \renewcommand{\makelabel}{\DUoptionlistlabel}}
150 % rubric (informal heading)
151 \providecommand*
{\DUrubric}[1]{%
152 \subsubsection*
{\centering\textit{\textmd{#1}}}}
154 % sidebar (text outside the main text flow)
155 \providecommand{\DUsidebar}[1]{%
157 \colorbox[gray
]{0.80}{\parbox{0.9\linewidth}{#1}}
161 % subtitle (for topic/sidebar)
162 \providecommand*
{\DUsubtitle}[1]{\par\emph{#1}\smallskip}
164 % text mode subscript
165 \ifx\textsubscript\undefined
166 \usepackage{fixltx2e
} % since 2015 loaded by default
169 % title for topics, admonitions, unsupported section levels, and sidebar
170 \providecommand*
{\DUtitle}[2][class-arg
]{%
171 % call \DUtitle#1{#2} if it exists:
172 \ifcsname DUtitle
#1\endcsname%
173 \csname DUtitle
#1\endcsname{#2}%
175 \smallskip\noindent\textbf{#2}\smallskip%
179 % titlereference role
180 \providecommand*
{\DUroletitlereference}[1]{\textsl{#1}}
182 % transition (break, fancybreak, anonymous section)
183 \providecommand*
{\DUtransition}{%
184 \hspace*
{\fill}\hrulefill\hspace*
{\fill}
185 \vskip 0.5\baselineskip
189 \ifthenelse{\isundefined{\hypersetup}}{
190 \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue
]{hyperref
}
191 \usepackage{bookmark
}
192 \urlstyle{same
} % normal text font (alternatives: tt, rm, sf)
195 pdftitle=
{reStructuredText Test Document
},
196 pdfauthor=
{David Goodger;Me;Myself;I
}
200 \title{\phantomsection%
201 reStructuredText Test Document
%
202 \label{restructuredtext-test-
document}%
205 \DUdocumentsubtitle{Examples of Syntax Constructs
}%
206 \label{examples-of-syntax-constructs
}%
217 \begin{tabularx
}{\DUdocinfowidth}{lX
}
226 \href{mailto:goodger@python.org
}{goodger@python.org
} \\
233 \textbf{Organization
}: &
236 Now, or yesterday. Or maybe even
\emph{before
} yesterday. \\
238 This is a “work in progress” \\
240 is managed by a version control system. \\
243 \textbf{Copyright
}: &
244 This
document has been placed in the public domain. You
245 may do with it as you wish. You may copy, modify,
246 redistribute, reattribute, sell, buy, rent, lease,
247 destroy, or improve it, quote it at length, excerpt,
248 incorporate, collate, fold, staple, or mutilate it, or do
249 anything else to it that your or anyone else’s heart
251 \textbf{field name
}: &
252 This is a “generic bibliographic field”.
254 \textbf{field name “
2”
}: &
255 Generic bibliographic fields may contain multiple body elements.
262 \begin{DUclass
}{dedication
}
264 \DUtitle[dedication
]{Dedication
}
266 For Docutils users \& co-developers.
270 \begin{DUclass
}{abstract
}
272 \DUtitle[abstract
]{Abstract
}
274 This is a test
document, containing at least one example of each
275 reStructuredText construct.
279 % This is a comment. Note how any initial comments are moved by
280 % transforms to after the document title, subtitle, and docinfo.
282 % Above is the document title, and below is the subtitle.
283 % They are transformed from section titles after parsing.
285 % bibliographic fields (which also require a transform):
287 \pagebreak[4] % start ToC on new page
289 \phantomsection\label{table-of-contents
}
290 \pdfbookmark[1]{Table of Contents
}{table-of-contents
}
291 \renewcommand{\contentsname}{Table of Contents
}
295 \section{1 Structural Elements
%
296 \label{structural-elements
}%
300 \subsection{1.1 Section Title
%
301 \label{section-title
}%
303 \subsubsection*
{Section Subtitle
}
305 Lone subsections are converted to a section subtitle by a transform
306 activated with the
\texttt{-
{}-section-subtitles
} command line option or the
307 \texttt{sectsubtitle-xform
} configuration value.
310 \subsection{1.2 Empty Section
%
311 \label{empty-section
}%
315 \subsection{1.3 Transitions
%
321 %___________________________________________________________________________
324 It divides the section. Transitions may also occur between sections:
326 %___________________________________________________________________________
330 \section{2 Body Elements
%
331 \label{body-elements
}%
335 \subsection{2.1 Paragraphs
%
342 \subsubsection{2.1.1 Inline Markup
%
343 \label{inline-markup
}%
346 Paragraphs contain text and may contain inline markup:
\emph{emphasis
},
347 \textbf{strong emphasis
},
\texttt{inline literals
}, standalone hyperlinks
348 (
\url{http://www.python.org
}), external hyperlinks (
\href{http://www.python.org/
}{Python
}\DUfootnotemark{id30
}{id29
}{5}), internal
349 cross-references (
\hyperref[example
]{example
}), external hyperlinks with embedded URIs
350 (
\href{http://www.python.org
}{Python web site
}),
\href{http://www.python.org/
}{anonymous hyperlink
351 references
}\DUfootnotemark{id38
}{id29
}{5} (
\href{http://docutils.sourceforge.net/
}{a second reference
}\DUfootnotemark{id40
}{id39
}{8}), footnote references (manually
352 numbered
\DUfootnotemark{id1
}{id8
}{1}, anonymous auto-numbered
\DUfootnotemark{id2
}{id12
}{3}, labeled auto-numbered
\DUfootnotemark{id3
}{label
}{2}, or symbolic
\DUfootnotemark{id4
}{id13
}{*
}), citation references (
\hyperlink{cit2002
}{[CIT2002
]}),
353 substitution references (
\includegraphics{../../../docs/user/rst/images/biohazard.png
}), and
%
354 \phantomsection\label{inline-hyperlink-targets
}inline hyperlink targets
355 (see
\hyperref[targets
]{Targets
} below for a reference back to here). Character-level
356 inline markup is also possible (although exceedingly ugly!) in
\emph{re
}\texttt{Structured
}\emph{Text
}. Problems are indicated by
%
357 \raisebox{1em
}{\hypertarget{id28
}{}}\hyperlink{id27
}{\textbf{\color{red
}|problematic|
}} text
358 (generated by processing errors; this one is intentional). Here is a
359 reference to the
\hyperref[doctitle
]{doctitle
} and the
\hyperref[subtitle
]{subtitle
}.
361 The default role for interpreted text is
\DUroletitlereference{Title Reference
}. Here are
362 some explicit interpreted text roles: a PEP reference (
\href{http://www.python.org/dev/peps/pep-
0287}{PEP
287}); an
363 RFC reference (
\href{http://tools.ietf.org/html/rfc2822.html
}{RFC
2822}); an abbreviation (
\DUrole{abbreviation
}{abb.
}), an acronym
364 (
\DUrole{acronym
}{reST
}), code (
\texttt{\DUrole{code
}{print
\textquotedbl{}hello world
\textquotedbl{}}}); a
\textsubscript{subscript
};
365 a
\textsuperscript{superscript
} and explicit roles for
\DUroletitlereference{Docutils
}’
366 \emph{standard
} \textbf{inline
} \texttt{markup
}.
368 % DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
370 Let’s test wrapping and whitespace significance in inline literals:
371 \texttt{This is an example of -
{}-inline-literal -
{}-text, -
{}-including some-
{}-
372 strangely-
{}-hyphenated-words. ~Adjust-the-width-of-your-browser-window
373 to see how the text is wrapped. ~-
{}- -
{}-
{}-
{}- -
{}-
{}-
{}-
{}-
{}-
{}-
{}- ~Now note ~ ~the
374 spacing ~ ~between the ~ ~words of ~ ~this sentence ~ ~(words
375 should ~ ~be grouped ~ ~in pairs).
}
377 If the
\texttt{-
{}-pep-references
} option was supplied, there should be a
378 live link to PEP
258 here.
381 \subsection{2.2 Bullet Lists
%
382 \label{bullet-lists
}%
389 \item Nested bullet list.
396 Paragraph
2 of item
2.
399 \item Nested bullet list.
411 \item This nested list should be compacted by the HTML writer.
413 \phantomsection\label{target
}
414 % Even if this item contains a target and a comment.
419 \subsection{2.3 Enumerated Lists
%
420 \label{enumerated-lists
}%
424 \item Arabic numerals.
427 \renewcommand{\labelenumii}{\alph{enumii
})
}
431 \renewcommand{\labelenumiii}{(
\roman{enumiii
})
}
437 \begin{list
}{\Roman{enumv
})
}{\usecounter{enumv
}}
444 \item Lists that don’t start at
1:
447 \renewcommand{\labelenumii}{\arabic{enumii
}.
}
448 \setcounter{enumii
}{2}
455 \renewcommand{\labelenumii}{\Alph{enumii
}.
}
456 \setcounter{enumii
}{2}
463 \renewcommand{\labelenumii}{\roman{enumii
}.
}
464 \setcounter{enumii
}{2}
472 \subsection{2.4 Definition Lists
%
473 \label{definition-lists
}%
477 \item[{Term
}] \leavevmode
480 \item[{Term
}] \leavevmode (
\textbf{classifier
})
481 Definition paragraph
1.
483 Definition paragraph
2.
485 \item[{Term
}] \leavevmode
488 \item[{Term
}] \leavevmode (
\textbf{classifier one
})(
\textbf{classifier two
})
494 \subsection{2.5 Field Lists
%
500 Field lists map field names to field bodies, like database
501 records. They are often part of an extension syntax. They are
502 an unambiguous variant of RFC
2822 fields.
504 \item[{how arg1 arg2:
}]
505 The field marker is a colon, the field name, and a colon.
507 The field body may contain one or more body elements, indented
508 relative to the field marker.
511 \DUrole{credits
}{This paragraph has the
\DUroletitlereference{credits
} class set. (This is actually not
512 about credits but just for ensuring that the class attribute
513 doesn’t get stripped away.)
}
517 \subsection{2.6 Option Lists
%
518 \label{option-lists
}%
521 For listing command-line options:
524 \item[-a
] command-line option “a”
526 \item[-b file
] options can have arguments
527 and long descriptions
529 \item[-
{}-long
] options can be long also
531 \item[-
{}-input=file
] long options can also have
534 \item[-
{}-very-long-option
] The description can also start on the next line.
536 The description may contain multiple body elements,
537 regardless of where it starts.
539 \item[-x, -y, -z
] Multiple options are an “option group”.
541 \item[-v, -
{}-verbose
] Commonly-seen: short \& long options.
543 \item[-
1 file, -
{}-one=file, -
{}-two file
] Multiple options with arguments.
545 \item[/V
] DOS/VMS-style options too
548 There must be at least two spaces between the option and the
552 \subsection{2.7 Literal Blocks
%
553 \label{literal-blocks
}%
556 Literal blocks are indicated with a double-colon (“::”) at the end of
557 the preceding paragraph (over there
\texttt{-
{}->
}). They can be indented:
562 text = 'is left as-is'
563 spaces_and_linebreaks = 'are preserved'
564 markup_processing = None
568 Or they can be quoted without indentation:
574 > Why didn't I think of that?
579 \subsection{2.8 Line Blocks
%
583 This section tests line blocks. Line blocks are body elements which
584 consist of lines and other line blocks. Nested line blocks cause
587 \begin{DUlineblock
}{0em
}
588 \item[] This is a line block. It ends with a blank line.
590 \begin{DUlineblock
}{\DUlineblockindent}
591 \item[] New lines begin with a vertical bar (“|”).
592 \item[] Line breaks and initial indent are significant, and preserved.
594 \begin{DUlineblock
}{\DUlineblockindent}
595 \item[] Continuation lines are also possible. A long line that is intended
596 to wrap should begin with a space in place of the vertical bar.
598 \item[] The left edge of a continuation line need not be aligned with
599 the left edge of the text above it.
603 \begin{DUlineblock
}{0em
}
604 \item[] This is a second line block.
606 \item[] Blank lines are permitted internally, but they must begin with a “|”.
609 Another line block, surrounded by paragraphs:
611 \begin{DUlineblock
}{0em
}
612 \item[] And it’s no good waiting by the window
613 \item[] It’s no good waiting for the sun
614 \item[] Please believe me, the things you dream of
615 \item[] They don’t fall in the lap of no-one
618 Take it away, Eric the Orchestra Leader!
621 \begin{DUlineblock
}{0em
}
622 \item[] A one, two, a one two three four
624 \item[] Half a bee, philosophically,
626 \begin{DUlineblock
}{\DUlineblockindent}
627 \item[] must,
\emph{ipso facto
}, half not be.
629 \item[] But half the bee has got to be,
631 \begin{DUlineblock
}{\DUlineblockindent}
632 \item[] \emph{vis a vis
} its entity. D’you see?
635 \item[] But can a bee be said to be
637 \begin{DUlineblock
}{\DUlineblockindent}
638 \item[] or not to be an entire bee,
640 \begin{DUlineblock
}{\DUlineblockindent}
641 \item[] when half the bee is not a bee,
643 \begin{DUlineblock
}{\DUlineblockindent}
644 \item[] due to some ancient injury?
653 A line block, like the following poem by Christian Morgenstern, can
654 also be centre-aligned:
656 \begin{selectlanguage
}{ngerman}
657 \begin{DUlineblock
}{0em
}
659 \item[] \textbf{Die Trichter
}
661 \item[] Zwei Trichter wandeln durch die Nacht.
662 \item[] Durch ihres Rumpfs verengten Schacht
663 \item[] fließt weißes Mondlicht
664 \item[] still und heiter
674 \subsection{2.9 Block Quotes
%
675 \label{block-quotes
}%
678 Block quotes consist of indented body elements:
681 My theory by A. Elk. Brackets Miss, brackets. This theory goes
682 as follows and begins now. All brontosauruses are thin at one
683 end, much much thicker in the middle and then thin again at the
684 far end. That is my theory, it is mine, and belongs to me and I
685 own it, and what it is too.
688 \raggedleft —Anne Elk (Miss)
691 The language of a quote (like any other object) can be specified by
696 \begin{selectlanguage
}{french
}
698 ReStructuredText est un langage de balisage léger utilisé
699 notamment dans la documentation du langage Python.
704 \subsection{2.10 Doctest Blocks
%
705 \label{doctest-blocks
}%
710 >>> print 'Python-specific usage examples; begun with ">>>"'
711 Python-specific usage examples; begun with ">>>"
712 >>> print '(cut and pasted from interactive Python sessions)'
713 (cut and pasted from interactive Python sessions)
718 \subsection{2.11 Footnotes
%
722 \DUfootnotetext{id8
}{id1
}{1}{%
723 A footnote contains body elements, consistently indented by at
726 This is the footnote’s second paragraph.
729 \DUfootnotetext{label
}{id3
}{2}{\phantomsection\label{label
}%
730 Footnotes may be numbered, either manually (as in
\DUfootnotemark{id9
}{id8
}{1}) or
731 automatically using a “\#”-prefixed label. This footnote has a
732 label so it can be referred to from multiple places, both as a
733 footnote reference (
\DUfootnotemark{id10
}{label
}{2}) and as a
\hyperref[label
]{hyperlink reference
}.
736 \DUfootnotetext{id12
}{id2
}{3}{%
737 This footnote is numbered automatically and anonymously using a
740 This is the second paragraph.
742 And this is the third paragraph.
745 \DUfootnotetext{id13
}{id4
}{*
}{%
746 Footnotes may also use symbols, specified with a “*” label.
747 Here’s a reference to the next footnote:
\DUfootnotemark{id14
}{id15
}{†
}.
750 \DUfootnotetext{id15
}{id14
}{†
}{%
751 This footnote shows the next symbol in the sequence.
754 \DUfootnotetext{id16
}{id16
}{4}{%
755 Here’s an unreferenced footnote, with a reference to a
756 nonexistent footnote:
%
757 \raisebox{1em
}{\hypertarget{id17
}{}}\hyperlink{id45
}{\textbf{\color{red
}{[}5{]}\_}}.
761 \subsection{2.12 Citations
%
764 \begin{figure
}[b
]\raisebox{1em
}{\hypertarget{cit2002
}{}}[CIT2002
]
765 Citations are text-labeled footnotes. They may be
766 rendered separately and differently from footnotes.
769 Here’s a reference to the above,
\hyperlink{cit2002
}{[CIT2002
]}, and a
%
770 \raisebox{1em
}{\hypertarget{id19
}{}}\hyperlink{id46
}{\textbf{\color{red
}{[}nonexistent
{]}\_}}
774 \subsection{2.13 Targets
%
776 \label{another-target
}%
779 \phantomsection\label{example
}
780 This paragraph is pointed to by the explicit “example” target. A
781 reference can be found under
\hyperref[inline-markup
]{Inline Markup
}, above.
\hyperref[inline-hyperlink-targets
]{Inline
782 hyperlink targets
} are also possible.
784 Section headers are implicit targets, referred to by name. See
785 \hyperref[targets
]{Targets
}, which is a subsection of
\hyperref[body-elements
]{Body Elements
}.
787 Explicit external targets are interpolated into references such as
788 “
\href{http://www.python.org/
}{Python
}\DUfootnotemark{id31
}{id29
}{5}”.
790 Targets may be indirect and anonymous. Thus
\hyperref[targets
]{this phrase
} may also
791 refer to the
\hyperref[targets
]{Targets
} section.
794 \raisebox{1em
}{\hypertarget{id48
}{}}\hyperlink{id47
}{\textbf{\color{red
}`hyperlink reference without a target`
\_}}, which generates an
798 \subsubsection{2.13.1 Duplicate Target Names
%
799 \label{duplicate-target-names
}%
802 Duplicate names in section headers or other implicit targets will
803 generate “info” (level-
1) system messages. Duplicate names in
804 explicit targets will generate “warning” (level-
2) system messages.
807 \subsubsection{2.13.2 Duplicate Target Names
%
811 Since there are two “Duplicate Target Names” section headers, we
812 cannot uniquely refer to either of them by name. If we try to (like
814 \raisebox{1em
}{\hypertarget{id50
}{}}\hyperlink{id49
}{\textbf{\color{red
}`Duplicate Target Names`
\_}}), an error is generated.
817 \subsection{2.14 Directives
%
821 \phantomsection\label{contents
}
822 These are just a sample of the many reStructuredText Directives. For
824 \url{http://docutils.sourceforge.net/docs/ref/rst/directives.html
}.
827 \subsubsection{2.14.1 Document Parts
%
828 \label{document-parts
}%
831 An example of the “contents” directive can be seen above this section
832 (a local, untitled table of
\hyperref[contents
]{contents
}) and at the beginning of the
833 document (a
document-wide
\hyperref[table-of-contents
]{table of contents
}).
836 \subsubsection{2.14.2 Images and Figures
%
837 \label{images-and-figures
}%
840 An image directive (also clickable – a hyperlink reference):
842 \hyperref[directives
]{\includegraphics{../../../docs/user/rst/images/title.png
}}
844 Image with multiple IDs:
846 \includegraphics{../../../docs/user/rst/images/title.png
}
847 \phantomsection\label{image-target-
3}\label{image-target-
2}\label{image-target-
1}
851 \noindent\makebox[\linewidth][c
]{\includegraphics{../../../docs/user/rst/images/biohazard.png
}}
853 A left-aligned image:
855 \noindent{\includegraphics{../../../docs/user/rst/images/biohazard.png
}\hfill}
857 This paragraph might flow around the image.
858 The specific behavior depends upon the style sheet and
859 the browser or rendering software used.
861 A right-aligned image:
863 \noindent{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png
}}
865 This paragraph might flow around the image.
866 The specific behavior depends upon the style sheet and
867 the browser or rendering software used.
869 For inline images see
\hyperref[substitution-definitions
]{Substitution Definitions
}.
875 \includegraphics[width=
2em
]{../../../docs/user/rst/images/biohazard.png
}
877 An image
2 em wide and
15 pixel high:
879 \includegraphics[height=
15px,width=
2em
]{../../../docs/user/rst/images/biohazard.png
}
881 An image occupying
50\% of the line width:
883 \includegraphics[width=
0.500\linewidth]{../../../docs/user/rst/images/title.png
}
887 \includegraphics[height=
2cm
]{../../../docs/user/rst/images/biohazard.png
}
889 A
\emph{figure
} is an image with a caption and/or a legend. With page-based output
890 media, figures might float to a different position if this helps the page
893 \begin{DUclass
}{figclass1
}
894 \begin{DUclass
}{figclass2
}
896 \noindent\makebox[\linewidth][c
]{\includegraphics[width=
258bp
]{../../../docs/user/rst/images/title.png
}}
897 \caption{Plaintext markup syntax and parser system.
}
899 \setlength{\DUtablewidth}{\linewidth}
900 \begin{longtable*
}[c
]{|p
{0.156\DUtablewidth}|p
{0.563\DUtablewidth}|
}
905 Revised, revisited, based on ‘re’ module.
911 Structure-enhanced text, structuredtext.
917 Well it is, isn’t it?
922 This paragraph is also part of the legend.
928 A left-aligned figure:
930 \begin{DUclass
}{figclass1
}
931 \begin{DUclass
}{figclass2
}
932 \begin{figure
} % align = "left"
933 \noindent\makebox[\linewidth][c
]{\includegraphics[width=
40px
]{../../../docs/user/rst/images/biohazard.png
}}
934 \caption{This is the caption.
}
938 The legend may consist of several paragraphs.
944 This paragraph might flow around the figure.
946 The specific behavior depends upon the style sheet and the browser or
947 rendering software used.
952 \noindent\makebox[\linewidth][c
]{\includegraphics[width=
40px
]{../../../docs/user/rst/images/biohazard.png
}}
953 \caption{This is the caption.
}
957 The legend may consist of several paragraphs.
961 This paragraph might flow around the figure.
963 The specific behavior depends upon the style sheet and the browser or
964 rendering software used.
966 A right-aligned figure:
968 \begin{figure
} % align = "right"
969 \noindent\makebox[\linewidth][c
]{\includegraphics[width=
40px
]{../../../docs/user/rst/images/biohazard.png
}}
970 \caption{This is the caption.
}
974 The legend may consist of several paragraphs.
978 This paragraph might flow around the figure. The specific behavior depends
979 upon the style sheet and the browser or rendering software used.
981 Tables may be given titles and additional arguments with the
\emph{table
}
984 \setlength{\DUtablewidth}{\linewidth}
985 \begin{longtable
}[l
]{|p
{0.075\DUtablewidth}|p
{0.075\DUtablewidth}|
}
986 \caption{left-aligned table
}\\
995 \caption[]{left-aligned table (... continued)
}\\
1004 \multicolumn{2}{c
}{\hfill ... continued on next page
} \\
1021 \setlength{\DUtablewidth}{\linewidth}
1022 \begin{longtable
}[c
]{|p
{0.075\DUtablewidth}|p
{0.075\DUtablewidth}|
}
1023 \caption{center-aligned table
}\\
1032 \caption[]{center-aligned table (... continued)
}\\
1041 \multicolumn{2}{c
}{\hfill ... continued on next page
} \\
1058 \setlength{\DUtablewidth}{\linewidth}
1059 \begin{longtable
}[r
]{|p
{0.075\DUtablewidth}|p
{0.075\DUtablewidth}|
}
1060 \caption{right-aligned table
}\\
1069 \caption[]{right-aligned table (... continued)
}\\
1078 \multicolumn{2}{c
}{\hfill ... continued on next page
} \\
1095 With the “widths” argument “auto” (or “class” value “colwidths-auto”),
1096 column widths are determined by the backend (if supported by the
1099 \begin{longtable*
}[c
]{|l|l|l|
}
1101 \textbf{A
} &
\textbf{B
} &
\textbf{A or B
} \\
1105 \textbf{A
} &
\textbf{B
} &
\textbf{A or B
} \\
1108 \multicolumn{3}{c
}{\hfill ... continued on next page
} \\
1111 False & False & False \\
1113 True & False & True \\
1115 False & True & True \\
1117 True & True & True \\
1120 \label{target2
}\label{target1
}
1123 \subsubsection{2.14.3 Admonitions
%
1124 \label{admonitions
}%
1127 \DUadmonition[attention
]{
1128 \DUtitle[attention
]{Attention!
}
1130 Directives at large.
1133 \DUadmonition[caution
]{
1134 \DUtitle[caution
]{Caution!
}
1136 Don’t take any wooden nickels.
1139 \DUadmonition[danger
]{
1140 \DUtitle[danger
]{!DANGER!
}
1142 Mad scientist at work!
1145 \DUadmonition[error
]{
1146 \DUtitle[error
]{Error
}
1151 \DUadmonition[hint
]{
1152 \DUtitle[hint
]{Hint
}
1154 It’s bigger than a bread box.
1157 \DUadmonition[important
]{
1158 \DUtitle[important
]{Important
}
1161 \item Wash behind your ears.
1163 \item Clean up your room.
1165 \item Call your mother.
1167 \item Back up your data.
1171 \DUadmonition[note
]{
1172 \DUtitle[note
]{Note
}
1180 15\% if the service is good.
1183 \DUadmonition[warning
]{
1184 \DUtitle[warning
]{Warning
}
1186 Strong prose may provoke extreme mental exertion.
1187 Reader discretion is strongly advised.
1190 \DUadmonition[admonition-and-by-the-way
]{
1191 \DUtitle[admonition-and-by-the-way
]{And, by the way…
}
1193 You can make up your own admonition too.
1197 \subsubsection{2.14.4 Topics, Sidebars, and Rubrics
%
1198 \label{topics-sidebars-and-rubrics
}%
1201 \emph{Sidebars
} are like miniature, parallel documents.
1204 \DUtitle[title
]{Sidebar Title
}
1206 \DUsubtitle[sidebar
]{Optional Subtitle
}
1208 This is a sidebar. It is for text outside the flow of the main
1211 \DUrubric{This is a rubric inside a sidebar
}
1213 Sidebars often appear beside the main text with a border and a different
1214 background or font
color.
1217 A
\emph{topic
} is like a block quote with a title, or a self-contained section
1218 with no subsections.
1220 \begin{DUclass
}{topic
}
1222 \DUtitle[topic
]{Topic Title
}
1228 A
\emph{rubric
} is like an informal heading that doesn’t correspond to the
1229 document’s structure. It is typically highlighted in red (hence the name).
1231 \DUrubric{This is a rubric
}
1233 Topics and rubrics can be used at places where a
\hyperref[section-title
]{section title
} is not
1234 allowed (e.g. inside a directive).
1237 \subsubsection{2.14.5 Target Footnotes
%
1238 \label{target-footnotes
}%
1241 \DUfootnotetext{id29
}{id30
}{5}{%
1242 \url{http://www.python.org/
}
1245 \DUfootnotetext{id33
}{id34
}{6}{%
1246 \url{http://pygments.org/
}
1249 \DUfootnotetext{id35
}{id36
}{7}{%
1250 \url{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf
}
1253 \DUfootnotetext{id39
}{id40
}{8}{%
1254 \url{http://docutils.sourceforge.net/
}
1257 \DUfootnotetext{id41
}{id42
}{9}{%
1262 \subsubsection{2.14.6 Replacement Text
%
1263 \label{replacement-text
}%
1266 I recommend you try
\href{http://www.python.org/
}{Python,
\emph{the
} best language around
}\DUfootnotemark{id32
}{id29
}{5}.
1269 \subsubsection{2.14.7 Compound Paragraph
%
1270 \label{compound-paragraph
}%
1273 The
\emph{compound
} directive is used to create a “compound paragraph”, which
1274 is a single logical paragraph containing multiple physical body
1275 elements. For example:
1277 \begin{DUclass
}{compound
}
1278 The ‘rm’ command is very dangerous. If you are logged
1279 in as root and enter
1286 you will erase the entire contents of your file system.
1289 Test the handling and display of compound paragraphs:
1291 \begin{DUclass
}{compound
}
1292 \begin{DUclass
}{some-class
}
1293 Compound
2, paragraph
1,
1295 compound
2, paragraph
2,
1301 compound
2, paragraph
3.
1305 \begin{DUclass
}{compound
}
1306 Compound
3, only consisting of one paragraph.
1309 \begin{DUclass
}{compound
}
1313 This one starts with a literal block.
1316 Compound
4, paragraph following the literal block.
1319 Now something
\emph{really
} perverted – a nested compound block. This is
1320 just to test that it works at all; the results don’t have to be
1323 \begin{DUclass
}{compound
}
1324 Compound
5, block
1 (a paragraph).
1326 \begin{DUclass
}{compound
}
1327 Compound
6 is block
2 in compound
5.
1329 Compound
6, another paragraph.
1332 Compound
5, block
3 (a paragraph).
1335 \begin{DUclass
}{compound
}
1336 Compound
7, tests the inclusion of various block-level
1337 elements in one logical paragraph. First a table,
1339 \setlength{\DUtablewidth}{\linewidth}
1340 \begin{longtable*
}[c
]{|p
{0.249\DUtablewidth}|p
{0.249\DUtablewidth}|p
{0.249\DUtablewidth}|
}
1362 followed by a paragraph. This physical paragraph is
1363 actually a continuation of the paragraph before the table. It is followed
1369 \item an enumerated list,
1372 \begin{DUoptionlist
}
1373 \item[-
{}-an
] option list,
1382 \item[{a definition
}] \leavevmode
1386 a paragraph, an image:
1387 \includegraphics{../../../docs/user/rst/images/biohazard.png
}
1389 \begin{DUlineblock
}{0em
}
1393 a paragraph followed by a comment,
1397 \DUadmonition[note
]{
1398 \DUtitle[note
]{Note
}
1402 and the final paragraph of the compound
7.
1406 \subsubsection{2.14.8 Parsed Literal Blocks
%
1407 \label{parsed-literal-blocks
}%
1411 {\ttfamily \raggedright \noindent
1412 This~is~a~parsed~literal~block.\\
1413 ~~~~This~line~is~indented.~~The~next~line~is~blank.\\
1415 Inline~markup~is~supported,~e.g.~
\emph{emphasis
},~
\textbf{strong
},~
\texttt{literal\\
1416 text
},~
\textsubscript{sub-
}~and~
\textsuperscript{super
}scripts,\\
1417 inline~formulas:~$A =
2 \pi r^
2$,\\
1418 footnotes
\DUfootnotemark{id22
}{id8
}{1},~
%
1419 \phantomsection\label{hyperlink-targets
}hyperlink~targets,~and~
\href{http://www.python.org/
}{references
}.
1424 \subsubsection{2.14.9 Code
%
1428 Blocks of source code can be set with the
\DUroletitlereference{code
} directive. If the code
1429 language is specified, the content is parsed and tagged by the
\href{http://pygments.org/
}{Pygments
}\DUfootnotemark{id34
}{id33
}{6}
1430 syntax highlighter and can be formatted with a style sheet. (Code parsing
1431 is turned off using the
\texttt{syntax-highlight
} config setting in the test
1432 conversions in order to get identical results with/without installed
1433 Pygments highlighter.)
1435 \begin{DUclass
}{code
}
1436 \begin{DUclass
}{python
}
1439 print 'This is Python code.'
1445 The
\texttt{:number-lines:
} option (with optional start value) generates line
1448 \begin{DUclass
}{code
}
1449 \begin{DUclass
}{python
}
1451 {\ttfamily \raggedright \noindent
1452 \DUrole{ln
}{~
8~
}\#~print~integers~from~
0~to~
9:\\
1453 \DUrole{ln
}{~
9~
}for~i~in~range(
10):\\
1454 \DUrole{ln
}{10~
}~~~~print~i
1460 For inline code snippets, there is the
\DUroletitlereference{code
} role, which can be used
1461 directly (the code will not be parsed/tagged, as the language is not known)
1462 or as base for special code roles, e.g. the LaTeX code in the next
1465 Docutils uses LaTeX syntax for math directives and roles:
1466 \texttt{\DUrole{code
}{\DUrole{tex
}{\textbackslash{}alpha = f(x)
}}} prints $
\alpha = f(x)$.
1468 The
\texttt{:code:
} option of the
\DUroletitlereference{include
} directive sets the included content
1469 as a code block, here the rst file
\texttt{header
\_footer.txt
} with line numbers:
1471 \begin{DUclass
}{code
}
1472 \begin{DUclass
}{rst
}
1474 {\ttfamily \raggedright \noindent
1475 \DUrole{ln
}{1~
}..~header::~Document~header\\
1476 \DUrole{ln
}{2~
}..~footer::~Document~footer
1483 \subsection{2.15 Substitution Definitions
%
1484 \label{substitution-definitions
}%
1487 An inline image (
\includegraphics{../../../docs/user/rst/images/biohazard.png
}) example:
1489 (Substitution definitions are not visible in the HTML source.)
1492 \subsection{2.16 Comments
%
1498 % Comments begin with two dots and a space. Anything may
1499 % follow, except for the syntax of footnotes, hyperlink
1500 % targets, directives, or substitution definitions.
1502 % Double-dashes -- "--" -- must be escaped somehow in HTML output.
1504 % Comments may contain non-ASCII characters: ä ö ü æ ø å
1506 (View the HTML source to see the comment.)
1509 \subsection{2.17 Raw text
%
1513 This does not necessarily look nice, because there may be missing white space.
1515 It’s just there to freeze the behavior.
1521 \DUrole{myclass
}{Another test with myclass set.
}
1523 This is the
\DUrole{myrawroleclass
}{fourth test
} with myrawroleclass set.
1525 Fifth test in LaTeX.\
\Line two.
1528 \subsection{2.18 Container
%
1532 \begin{DUclass
}{custom
}
1539 % currently not implemented in LaTeX:
1540 % .. include:: data/header_footer.txt
1543 \subsection{2.19 Colspanning tables
%
1544 \label{colspanning-tables
}%
1547 This table has a cell spanning two columns:
1549 \setlength{\DUtablewidth}{\linewidth}
1550 \begin{longtable*
}[c
]{|p
{0.075\DUtablewidth}|p
{0.075\DUtablewidth}|p
{0.086\DUtablewidth}|
}
1552 \multicolumn{2}{|p
{0.15\DUtablewidth}|
}{\textbf{%
1568 \multicolumn{2}{|p
{0.15\DUtablewidth}|
}{\textbf{%
1583 \multicolumn{3}{c
}{\hfill ... continued on next page
} \\
1621 \subsection{2.20 Rowspanning tables
%
1622 \label{rowspanning-tables
}%
1625 Here’s a table with cells spanning several rows:
1627 \setlength{\DUtablewidth}{\linewidth}
1628 \begin{longtable*
}[c
]{|p
{0.296\DUtablewidth}|p
{0.156\DUtablewidth}|p
{0.226\DUtablewidth}|
}
1631 Header row, column
1
1632 (header rows optional)
1642 Header row, column
1
1643 (header rows optional)
1651 \multicolumn{3}{c
}{\hfill ... continued on next page
} \\
1655 body row
1, column
1
1664 &
\multirow{2}{0.16\DUtablewidth}{%
1667 } &
\multirow{2}{0.23\DUtablewidth}{%
1680 \subsection{2.21 Custom Roles
%
1681 \label{custom-roles
}%
1685 \item A role based on an existing role.
1687 \texttt{\DUrole{custom
}{one
}} \texttt{\DUrole{custom
}{two
}} \texttt{\DUrole{custom
}{three
}}
1691 \DUrole{customnew
}{one two three
}
1693 \item A role with class attribute.
1695 \DUrole{special
}{interpreted text
}
1697 \item A language-switching role:
1699 Let’s count in German
\foreignlanguage{ngerman}{eins zwei drei
}.
1701 \item A role with multiple class attributes, styled with raw directives:
1703 \newcommand{\DUrolegreen}[1]{\textcolor{green
}{#1}}
1704 \newcommand{\DUrolesc}[1]{\textsc{#1}}
1706 The following works in most browsers but does not validate
1707 (
\texttt{<style>
} is only allowed in the
document head):
1713 <style type="text/css"><!-
{}-
1714 .green \
{color: green;\
}
1715 .sc \
{font-variant: small-caps;\
}
1720 \DUrole{green
}{\DUrole{sc
}{\foreignlanguage{british
}{British colourful text in small-caps
}}}.
1724 \subsection{2.22 Mathematics
%
1725 \label{mathematics
}%
1728 Docutils supports inline math with the prefix or postfix
\texttt{:math:
}
1729 role specificator, $n! +
\sin(x_n^
2)$ and $A_
\text{c
} =
1730 \frac{\pi}{4} d^
2$, as well as displayed math via the
1731 \DUroletitlereference{math
} directive:
1734 f(
\epsilon) =
\frac{1}{1 +
\exp\left(
\frac{\varepsilon}{k_
\text{B
}T
}\right)
}
1736 Content may start on the first line of the directive, e.g.
1739 N =
\frac{\text{number of apples
}}{7}
1741 Equations can be labeled with a reference name using the
\texttt{:name:
} option.
1742 See
\hyperref[eq-m
]{eq:M
} and
\hyperref[eq-schrodinger
]{eq:schrödinger
} below.
1744 The determinant of the matrix
1747 \mathbf{M
} =
\left(
\begin{matrix
}a&b\
\c&d
\end{matrix
}\right)
1751 is $|
\mathbf{M
}| = ad - bc$.
1753 More than one display math block can be put in one math directive.
1754 For example, the following sum and integral with limits:
1757 \int_0^
1 x^n dx =
\frac{1}{n +
1}
1760 \sum_{n=
1}^m n =
\frac{m(m+
1)
}{2}
1762 LaTeX-supported Unicode math symbols can be used in math roles and
1765 The Schrödinger equation
1768 i
\hbar \frac{\partial }{\partial t
}\Psi =
\hat{H
}\Psi ,
1770 \label{eq-schrodinger
}
1772 with the
\emph{wave function
} $
\Psi $, describes how the quantum state of a
1773 physical system changes in time.
1776 \item[{Math-Accents:
}] \leavevmode
1777 \setlength{\DUtablewidth}{\linewidth}
1778 \begin{longtable*
}[c
]{p
{0.315\DUtablewidth}p
{0.315\DUtablewidth}p
{0.315\DUtablewidth}}
1780 $
\acute{a
}$
\texttt{\textbackslash{}acute\
{a\
}}
1782 $
\dot{t
}$
\texttt{\textbackslash{}dot\
{t\
}}
1784 $
\hat{\gamma}$
\texttt{\textbackslash{}hat\
{\textbackslash{}gamma\
}}
1787 $
\grave{a
}$
\texttt{\textbackslash{}grave\
{a\
}}
1789 $
\ddot{t
}$
\texttt{\textbackslash{}ddot\
{t\
}}
1791 $
\tilde{\alpha}$
\texttt{\textbackslash{}tilde\
{\textbackslash{}alpha\
}}
1794 $
\breve{x
}$
\texttt{\textbackslash{}breve\
{x\
}}
1796 $
\dddot{t
}$
\texttt{\textbackslash{}dddot\
{t\
}}
1798 $
\vec{\imath}$
\texttt{\textbackslash{}vec\
{\textbackslash{}imath\
}}
1801 $
\check{a
}$
\texttt{\textbackslash{}check\
{a\
}}
1803 $
\bar{a
}$
\texttt{\textbackslash{}bar\
{a\
}}
1805 $
\vec{R
}$
\texttt{\textbackslash{}vec\
{R\
}}
1814 Modulation Transfer Function:
1817 \text{MTF
} =
\left|
\frac{\mathcal{F
}\
{s(x)\
}}
1818 {\mathcal{F
}\
{ s(x)\
} |_
{\omega _
{x
}=
0}}\right|
1819 =
\mathrm{abs
}\left(
\frac
1820 {\int _
{-
\infty }^
{\infty }s(x)
\mathrm{e
}^
{\mathrm{i
}\omega _
{x
}x
}\mathrm{d
}{x
}}
1821 {\int _
{-
\infty }^
{\infty }s(x)
\mathrm{d
}{x
}}
1824 Math split over two lines: If a double backslash is detected outside a
1825 \texttt{\textbackslash{}begin\
{...\
} \textbackslash{}end\
{...\
}} pair, the math code is wrapped in an
\href{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf
}{AMSmath
}\DUfootnotemark{id36
}{id35
}{7}
1826 \texttt{align
} environment:
1829 s_
{\mathrm{out
}}(x) & = s_
{\mathrm{in
}}(x') * s_
\delta (x-x') \\
1830 & =
\int s_
{\mathrm{in
}}(x')s_
\delta (x-x')
\mathrm{d
}x'
1832 Cases (“manually”, with
\texttt{matrix
} environment):
1835 \mathrm{sgn
}(x) =
\left\
{\begin{matrix
}
1840 Cases with the
\href{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf
}{AMSmath
}\DUfootnotemark{id37
}{id35
}{7} \texttt{cases
} environment (not (yet) supported by
1841 HTML writers with
\texttt{-
{}-math-output=MathML
}):
1844 \mathrm{sgn
}(x) =
\begin{cases
}
1850 \section{3 Tests for the LaTeX writer
%
1851 \label{tests-for-the-latex-writer
}%
1854 Test syntax elements which may cause trouble for the LaTeX writer but might
1855 not need to be tested with other writers (e.g. the HTML writer).
1858 \subsection{3.1 Custom Roles in LaTeX
%
1859 \label{custom-roles-in-latex
}%
1863 \item Role names and class arguments are converted to conform to the
1864 regular expression
\texttt{{[}a-z
{]}{[}-a-z0-
9{]}*
} (letters are downcased,
1865 accents and similar decoration is stripped, non-conforming
1866 characters are replaced by a hyphen).
1868 Class arguments may contain numbers and hyphens, which need special
1869 treatment in LaTeX command names.
1871 \DUrole{large
}{\DUrole{custom4
}{\DUrole{small-caps
}{\DUrole{custom-role
}{\DUrole{custom-role
}{Text with role “custom4”
}}}}} (but without styling by
\texttt{DUrole*
}
1874 \item With LaTeX, roles can be styled within the
document using the
\DUroletitlereference{raw
}
1877 \newcommand{\DUrolelarge}[1]{{\large #1}}
1879 \@namedef
{DUrolesmall-caps
}{\textsc}
1880 \@namedef
{DUrolecustom4
}{\textbf}
1883 \DUrole{large
}{\DUrole{custom4
}{\DUrole{small-caps
}{\DUrole{custom-role
}{\DUrole{custom-role
}{inline text
}}}}} in large, bold, small-caps.
1885 \item Custom roles can be based on standard roles:
1887 This is a
\emph{\DUrole{custom-emphasis
}{customized emphasis text role
}}
1889 This is a
\texttt{\DUrole{custom-literal
}{customized literal text role
}}
1891 This is a
\textbf{\DUrole{custom-strong
}{customized strong text role
}}
1893 This is a
\textsubscript{\DUrole{custom-subscript
}{customized subscript text role
}}
1895 This is a
\textsuperscript{\DUrole{custom-superscript
}{customized superscript text role
}}
1897 This is a
\DUroletitlereference{\DUrole{custom-title-reference
}{customized title-reference text role
}}
1901 \subsection{3.2 class handling
%
1902 \label{class-handling
}%
1905 This section tests class handling for block level elements by the LaTeX
1906 writer. See the input file
\texttt{classes
\_latex.txt
} for the raw LaTeX code used
1907 to style the examples.
1909 An “epigraph” directive is exported as “quote” wrapped in a “DUclass”
1910 environment. Here, it is styled by a “DUCLASSepigraph” environment
1911 redefining the “quote” environment as “minipage”:
1913 \newcommand*
{\DUCLASSepigraph}{%
1914 \renewenvironment{quote
}{\vspace{1em
}
1915 \footnotesize\hfill{}%
1916 \begin{minipage
}{0.4\columnwidth}}%
1917 {\end{minipage
}\vskip\baselineskip}}
1919 \begin{DUclass
}{epigraph
}
1921 Do not play this piece fast. It is never right to play
\emph{Ragtime
} fast.
1924 \raggedleft —Scott Joplin
1928 Raw latex is also used to style the following lists: “DUCLASSenumerateitems”
1929 redefines “itemize” as “enumerate”, “DUCLASSrules” draws horizontal lines
1932 \newcommand*
{\DUCLASSenumerateitems}{%
1933 \renewenvironment{itemize
}{\begin{enumerate
}}%
1937 \newenvironment{DUCLASSrules
}%
1938 {\noindent\rule[0.5ex
]{1\columnwidth}{1pt
}}%
1939 {\noindent\rule[0.5ex
]{1\columnwidth}{1pt
}}
1941 An “enumerated” bullet list:
1943 \begin{DUclass
}{enumerateitems
}
1953 A list with lines above and below:
1955 \begin{DUclass
}{rules
}
1963 A normal bullet list is kept unchanged by the above redefinitions:
1973 A container wraps several elements in a common “class wrapper”. Here, we use
1974 it to set
2 paragraphs and a list in small caps:
1976 \newcommand*
{\DUCLASSscshape}{\scshape}
1978 \begin{DUclass
}{scshape
}
1987 \item still bullet list
1991 A right-aligned line-block. Alignment handling is built into the latex
1992 writer for image, table, and line block elements.
1994 \begin{DUlineblock
}{0em
}
1996 \item[] Max Mustermann
1998 \item[] D
01234 Testdorf
1999 \item[] Tel.:
0123/
456789
2003 \subsection{3.3 More Tables
%
2004 \label{more-tables
}%
2007 A table with multi-paragraph multicolumn cells:
2009 \setlength{\DUtablewidth}{\linewidth}
2010 \begin{longtable*
}[c
]{|p
{0.133\DUtablewidth}|p
{0.179\DUtablewidth}|p
{0.179\DUtablewidth}|p
{0.110\DUtablewidth}|p
{0.121\DUtablewidth}|p
{0.145\DUtablewidth}|
}
2016 &
\multicolumn{3}{p
{0.41\DUtablewidth}|
}{%
2019 With a second paragraph
2024 \multicolumn{2}{|p
{0.31\DUtablewidth}|
}{%
2027 With a second paragraph
2040 &
\multicolumn{2}{p
{0.36\DUtablewidth}|
}{%
2041 multicolumn
3 (one line,
2042 but very very very very
2058 &
\multicolumn{3}{p
{0.38\DUtablewidth}|
}{%
2064 Tables with multi-paragraph multirow cells currently fail due to a LaTeX
2065 limitation (see
\url{https://sourceforge.net/p/docutils/bugs/
225/
}).
2067 A table with multirow header and column-widths set by LaTeX:
2069 \begin{longtable*
}[c
]{|l|l|
}
2071 \multirow{2}{*
}{\textbf{XXX
}} &
\textbf{Variable Summary
} \\
2073 &
\textbf{Description
} \\
2077 \multirow{2}{*
}{\textbf{XXX
}} &
\textbf{Variable Summary
} \\
2079 &
\textbf{Description
} \\
2082 \multicolumn{2}{c
}{\hfill ... continued on next page
} \\
2085 \multicolumn{2}{|l|
}{multicollumn cell
} \\
2089 In a table with column-widths set by LaTeX, each cell has just one line.
2090 Paragraphs are merged (a warning is given).
2092 \begin{longtable*
}[c
]{|l|l|
}
2094 11 & first paragraph
2102 % This file is used by the standalone_rst_latex test.
2105 \subsection{3.4 Option lists
%
2109 The LaTeX-
2e description environment is used for definition lists.
2110 The definition is continued on the same line as the term, this should
2111 not happen if a option-list is at the top of the definition.
2113 If the option list is not at the first element in the definition, it
2114 is contained in a quote
2117 \begin{DUoptionlist
}
2118 \item[-
{}-help
] show help
2125 \item[{In a definition list:
}] \leavevmode
2126 \begin{DUoptionlist
}
2127 \item[-
{}-help
] show help
2135 \subsection{3.5 Monospaced non-alphanumeric characters
%
2136 \label{monospaced-non-alphanumeric-characters
}%
2139 These are all ASCII characters except a-zA-Z0-
9 and space:
2141 \texttt{!!!
\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'
{}'
{}'((()))***+++,
{},
{},-
{}-
{}-...///:::
}
2143 \texttt{;;;<
{}<
{}<===>
{}>
{}>???@@@
{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_`
{}`
{}`\
{\
{\
{|||\
}\
}\
}\textasciitilde{}\textasciitilde{}\textasciitilde{}}
2145 \texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
}
2147 The two lines of non-alphanumeric characters should both have the same
2148 width as the third line.
2151 \subsection{3.6 Non-ASCII characters
%
2152 \label{non-ascii-characters
}%
2155 Punctuation and footnote symbols
2157 \setlength{\DUtablewidth}{\linewidth}
2158 \begin{longtable*
}[c
]{|p
{0.028\DUtablewidth}|p
{0.424\DUtablewidth}|
}
2175 single turned comma quotation mark
2181 single comma quotation mark
2187 low single comma quotation mark
2193 double turned comma quotation mark
2199 double comma quotation mark
2205 low double comma quotation mark
2259 left-right double arrow
2264 The
\DUroletitlereference{Latin-
1 extended
} Unicode block
2266 \setlength{\DUtablewidth}{\linewidth}
2267 \begin{longtable*
}[c
]{|p
{0.051\DUtablewidth}|p
{0.028\DUtablewidth}|p
{0.028\DUtablewidth}|p
{0.028\DUtablewidth}|p
{0.028\DUtablewidth}|p
{0.028\DUtablewidth}|p
{0.028\DUtablewidth}|p
{0.028\DUtablewidth}|p
{0.028\DUtablewidth}|p
{0.028\DUtablewidth}|p
{0.028\DUtablewidth}|
}
2524 \item The following line should not be wrapped, because it uses
2525 no-break spaces (
\textbackslash{}u00a0):
2527 X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X
2529 \item Line wrapping with/without breakpoints marked by soft hyphens
2530 (
\textbackslash{}u00ad):
2532 pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch
2534 pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch
2538 \subsection{3.7 Encoding special chars
%
2539 \label{encoding-special-chars
}%
2542 The LaTeX Info pages lists under “
2.18 Special Characters”
2545 The following characters play a special role in LaTeX and are called
2546 “special printing characters”, or simply “special characters”.
2549 \# \$ \% \&
\textasciitilde{} \_ \textasciicircum{} \textbackslash{} \
{ \
}
2553 The special chars verbatim:
2557 # $
% & ~ _ ^ \textbackslash{} \{ \}
2561 However also
\emph{square brackets
} {[}{]} need special care.
2564 Commands with optional arguments (e.g.
\texttt{\textbackslash{}item
}) check
2565 if the token right after the macro name is an opening bracket.
2566 In that case the contents between that bracket and the following
2567 closing bracket on the same grouping level are taken as the
2568 optional argument. What makes this unintuitive is the fact that
2569 the square brackets aren’t grouping characters themselves, so in
2570 your last example item
{[}{[}…
{]}{]} the optional argument consists of
2571 {[}… (without the closing bracket).
2574 Compare the items in the following lists:
2579 \item {[}bracketed
{]} item
2583 \item[{simple
}] \leavevmode
2586 \item[{{[}bracketed
{]}}] \leavevmode
2591 The OT1 font-encoding has different characters for the less-than,
2592 greater-than and bar, < | >, except for typewriter font
\DUroletitlereference{cmtt
}:
2601 \subsection{3.8 Hyperlinks and -targets
%
2602 \label{hyperlinks-and-targets
}%
2605 In LaTeX, we must set an explicit anchor (
\texttt{\textbackslash{}phantomsection
}) for a
2607 \phantomsection\label{hypertarget-in-plain-text
}hypertarget in plain text or in a figure but not in a longtable or
2610 \setlength{\DUtablewidth}{\linewidth}
2611 \begin{longtable
}[c
]{|p
{0.075\DUtablewidth}|p
{0.075\DUtablewidth}|p
{0.075\DUtablewidth}|
}
2612 \caption{Table with
%
2613 \label{hypertarget-in-table-title
}hypertarget in table title.
}\\
2627 \phantomsection\label{figure-label
}
2628 \noindent\makebox[\linewidth][c
]{\includegraphics{../../../docs/user/rst/images/biohazard.png
}}
2629 \caption{Figure with
%
2630 \label{hypertarget-in-figure-caption
}hypertarget in figure caption.
}
2633 \phantomsection\label{hypertarget-in-figure-legend
}hypertarget in figure legend.
2637 \includegraphics{../../../docs/user/rst/images/biohazard.png
}
2638 \phantomsection\label{image-label
}
2640 See
\hyperref[hypertarget-in-plain-text
]{hypertarget in plain text
},
2641 \hyperref[table-label
]{table label
},
\hyperref[hypertarget-in-table-title
]{hypertarget in table title
},
2642 \hyperref[figure-label
]{figure label
},
\hyperref[hypertarget-in-figure-caption
]{hypertarget in figure caption
},
2643 \hyperref[hypertarget-in-figure-legend
]{hypertarget in figure legend
}, and
2644 \hyperref[image-label
]{image label
}.
2647 \subsection{3.9 External references
%
2648 \label{external-references
}%
2651 Long URLs should be wrapped in the PDF.
2652 This can be achieved with the url command which is used by the LaTeX writer
2653 whenever the content (name) of a reference node equals the link URL.
2656 \item[{Example:
}] \leavevmode
2657 a long URL that should wrap in the output
2658 \url{http://docutils.sourceforge.net/docs/user/latex.html\#id79
}
2662 If the argument contains any “\%”, “\#”, or “
\textasciicircum{}\textasciicircum{}”, or ends with
\texttt{\textbackslash{}}, it can’t
2663 be used in the argument to another command. The argument must not contain
2666 The characters
\textasciicircum{}, \
{, \
}, and
\texttt{\textbackslash{}} are invalid in a “http:” or “ftp:” URL
2667 and not recognized as part of it:
2669 \begin{DUlineblock
}{0em
}
2670 \item[] \url{http://www.example.org
}/strange
\textasciicircum{}\textasciicircum{}name
2671 \item[] \url{http://www.example.org
}\textbackslash{}using
\textbackslash{}DOS
\textbackslash{}paths
\textbackslash{}
2672 \item[] \url{http://www.example.org/XML
}/strange\
{n\
}ame
2675 They can, however be used in paths and/or filenames.
2677 Handling by the LaTeX writer:
2680 \item \texttt{\#
},
\texttt{\textbackslash{}} and
\texttt{\%
} are escaped:
2682 \begin{DUlineblock
}{0em
}
2683 \item[] \href{http://www.w3.org/XML/Schema\#dev
}{URL with \#
}
2684 \url{http://www.w3.org/XML/Schema\#dev
}
2685 \item[] \href{http://www.w3.org/XML/Schema\%dev
}{URL with \%
}
2686 \url{http://example.org/Schema\%dev
}
2687 \item[] \href{A:DOS\
\path\\
}{file with DOS path
}\DUfootnotemark{id42
}{id41
}{9} \url{A:DOS\
\path\\
}\DUfootnotemark{id43
}{id41
}{9}
2690 \DUadmonition[note
]{
2691 \DUtitle[note
]{Note
}
2693 These URLs are typeset inside a LaTeX command without error.
2695 \begin{DUlineblock
}{0em
}
2696 \item[] \url{http://www.w3.org/XML/Schema\#dev
}
2697 \item[] \url{http://example.org/Schema\%dev
}
2698 \item[] \url{A:DOS\
\path\\
}\DUfootnotemark{id44
}{id41
}{9}
2704 \item \textasciicircum{}\textasciicircum{} LaTeX’s special syntax for characters results in “strange” replacements
2705 (both with href and url). A warning is given.
2707 \href{../strange^^name
}{file with
\textasciicircum{}\textasciicircum{}}:
2708 \url{../strange^^name
}
2710 \item Unbalanced braces, \
{ or \
}, will fail (both with href and url):
2714 `file with \
{ <../strange\
{name>`__
2715 `<../strange\
{name>`__
2719 while balanced braces are suported:
2721 \begin{DUlineblock
}{0em
}
2722 \item[] \url{../strange
{n
}ame
}
2723 \item[] \url{../st
{r
}ange
{n
}ame
}
2724 \item[] \url{../
{st
{r
}ange
{n
}ame
}}
2729 \subsection{3.10 Section titles with
\hyperref[inline-markup
]{inline markup
}%
2730 \label{section-titles-with-inline-markup
}%
2734 \subsubsection{3.10.1 \emph{emphasized
}, H
\textsubscript{2}O and $x^
2$
%
2735 \label{emphasized-h2o-and-x-
2}%
2739 \subsubsection{3.10.2 Substitutions work
%
2740 \label{substitutions-fail
}%
2744 \subsection{3.11 Deeply nested sections
%
2745 \label{deeply-nested-sections
}%
2751 \subsubsection{3.11.1 Level
3%
2758 \paragraph{3.11.1.1 level
4%
2765 \subparagraph{3.11.1.1.1 level
5%
2769 (depending on the
document class)
2772 \DUtitle[sectionVI
]{3.11.1.1.1.1 level
6%
2776 an unsupported level.
2778 % unusual combinations (currently separately tested)
2779 % .. include:: data/latex_cornercases.txt
2781 % Preface for System Messages:
2784 \section{4 Error Handling
%
2785 \label{error-handling
}%
2788 Any errors caught during processing will generate system messages.
2790 There should be five messages in the following, auto-generated
2791 section, “Docutils System Messages”:
2793 % section should be added by Docutils automatically
2796 \section[Docutils System Messages
]{\color{red
}Docutils System Messages
%
2799 \DUadmonition[system-message
]{
2800 \DUtitle[system-message
]{system-message
}
2801 \raisebox{1em
}{\hypertarget{id27
}{}}
2803 {\color{red
}ERROR/
3} in
\texttt{functional/input/data/standard.txt
}, line~
104
2806 Undefined substitution referenced:
\textquotedbl{}problematic
\textquotedbl{}.
2809 \DUadmonition[system-message
]{
2810 \DUtitle[system-message
]{system-message
}
2811 \raisebox{1em
}{\hypertarget{id45
}{}}
2813 {\color{red
}ERROR/
3} in
\texttt{functional/input/data/standard.txt
}, line~
391
2816 Unknown target name:
\textquotedbl{}5\textquotedbl{}.
2819 \DUadmonition[system-message
]{
2820 \DUtitle[system-message
]{system-message
}
2821 \raisebox{1em
}{\hypertarget{id46
}{}}
2823 {\color{red
}ERROR/
3} in
\texttt{functional/input/data/standard.txt
}, line~
400
2826 Unknown target name:
\textquotedbl{}nonexistent
\textquotedbl{}.
2829 \DUadmonition[system-message
]{
2830 \DUtitle[system-message
]{system-message
}
2831 \raisebox{1em
}{\hypertarget{id47
}{}}
2833 {\color{red
}ERROR/
3} in
\texttt{functional/input/data/standard.txt
}, line~
427
2836 Unknown target name:
\textquotedbl{}hyperlink reference without a target
\textquotedbl{}.
2839 \DUadmonition[system-message
]{
2840 \DUtitle[system-message
]{system-message
}
2841 \raisebox{1em
}{\hypertarget{id49
}{}}
2843 {\color{red
}ERROR/
3} in
\texttt{functional/input/data/standard.txt
}, line~
440
2846 Duplicate target name, cannot be used as a unique reference:
\textquotedbl{}duplicate target names
\textquotedbl{}.