1 \documentclass[a4paper]{article
}
2 % generated by Docutils <http://docutils.sourceforge.net/>
3 % rubber: set program xelatex
5 % \defaultfontfeatures{Scale=MatchLowercase}
6 % straight double quotes (defined T1 but missing in TU):
7 \ifdefined \UnicodeEncodingName
8 \DeclareTextCommand{\textquotedbl}{\UnicodeEncodingName}{%
9 {\addfontfeatures{RawFeature=-tlig,Mapping=
}\char34}}%
14 \usepackage{polyglossia
}
15 \setdefaultlanguage{english
}
16 \setotherlanguages{english,french,german
}
18 \usepackage{float
} % float configuration
19 \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
28 %%% Custom LaTeX preamble
29 % Linux Libertine (free, wide coverage, not only for Linux)
30 \setmainfont{Linux Libertine O
}
31 \setsansfont{Linux Biolinum O
}
32 \setmonofont[HyphenChar=None,Scale=MatchLowercase
]{DejaVu Sans Mono
}
34 %%% User specified packages and stylesheets
36 %%% Fallback definitions for Docutils-specific commands
38 % class handling for environments (block-level elements)
39 % \begin{DUclass}{spam} tries \DUCLASSspam and
40 % \end{DUclass}{spam} tries \endDUCLASSspam
41 \ifx\DUclass\undefined % poor man's "provideenvironment"
42 \newenvironment{DUclass
}[1]%
43 {\def\DocutilsClassFunctionName{DUCLASS
#1}% arg cannot be used in end-part of environment.
44 \csname \DocutilsClassFunctionName \endcsname}%
45 {\csname end
\DocutilsClassFunctionName \endcsname}%
48 % providelength (provide a length variable and set default, if it is new)
49 \providecommand*
{\DUprovidelength}[2]{
50 \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
54 \providecommand*
{\DUtitleabstract}[1]{\centerline{\textbf{#1}}}
56 % admonition (specially marked topic)
57 \providecommand{\DUadmonition}[2][class-arg
]{%
58 % try \DUadmonition#1{#2}:
59 \ifcsname DUadmonition
#1\endcsname%
60 \csname DUadmonition
#1\endcsname{#2}%
63 \fbox{\parbox{0.9\linewidth}{#2}}
69 \providecommand*
{\DUCLASSdedication}{%
70 \renewenvironment{quote
}{\begin{center
}}{\end{center
}}%
73 % docinfo (width of docinfo table)
74 \DUprovidelength{\DUdocinfowidth}{0.9\linewidth}
76 % subtitle (in document title)
77 \providecommand*
{\DUdocumentsubtitle}[1]{{\large #1}}
80 % error admonition title
81 \providecommand*
{\DUtitleerror}[1]{\DUtitle{\color{red
}#1}}
83 % fieldlist environment
84 \ifthenelse{\isundefined{\DUfieldlist}}{
85 \newenvironment{DUfieldlist
}%
87 {\enddescription\endquote}
89 % numeric or symbol footnotes with hyperlinks
90 \providecommand*
{\DUfootnotemark}[3]{%
91 \raisebox{1em
}{\hypertarget{#1}{}}%
92 \hyperlink{#2}{\textsuperscript{#3}}%
94 \providecommand{\DUfootnotetext}[4]{%
96 \renewcommand{\thefootnote}{%
97 \protect\raisebox{1em
}{\protect\hypertarget{#1}{}}%
98 \protect\hyperlink{#2}{#3}}%
103 % inline markup (custom roles)
104 % \DUrole{#1}{#2} tries \DUrole#1{#2}
105 \providecommand*
{\DUrole}[2]{%
106 % backwards compatibility: try \docutilsrole#1{#2}
107 \ifcsname docutilsrole
#1\endcsname%
108 \csname docutilsrole
#1\endcsname{#2}%
110 \csname DUrole
#1\endcsname{#2}%
115 \ifthenelse{\isundefined{\DUlegend}}{
116 \newenvironment{DUlegend
}{\small}{}
119 % lineblock environment
120 \DUprovidelength{\DUlineblockindent}{2.5em
}
121 \ifthenelse{\isundefined{\DUlineblock}}{
122 \newenvironment{DUlineblock
}[1]{%
123 \list{}{\setlength{\partopsep}{\parskip}
124 \addtolength{\partopsep}{\baselineskip}
125 \setlength{\topsep}{0pt
}
126 \setlength{\itemsep}{0.15\baselineskip}
127 \setlength{\parsep}{0pt
}
128 \setlength{\leftmargin}{#1}}
134 % optionlist environment
135 \providecommand*
{\DUoptionlistlabel}[1]{\bf #1 \hfill}
136 \DUprovidelength{\DUoptionlistindent}{3cm
}
137 \ifthenelse{\isundefined{\DUoptionlist}}{
138 \newenvironment{DUoptionlist
}{%
139 \list{}{\setlength{\labelwidth}{\DUoptionlistindent}
140 \setlength{\rightmargin}{1cm
}
141 \setlength{\leftmargin}{\rightmargin}
142 \addtolength{\leftmargin}{\labelwidth}
143 \addtolength{\leftmargin}{\labelsep}
144 \renewcommand{\makelabel}{\DUoptionlistlabel}}
149 \DUprovidelength{\pdfpxdimen}{1bp
}
152 % rubric (informal heading)
153 \providecommand*
{\DUrubric}[1]{%
154 \subsubsection*
{\centering\textit{\textmd{#1}}}}
156 % sidebar (text outside the main text flow)
157 \providecommand{\DUsidebar}[1]{%
159 \colorbox[gray
]{0.80}{\parbox{0.9\linewidth}{#1}}
163 % subtitle (for topic/sidebar)
164 \providecommand*
{\DUsubtitle}[1]{\par\emph{#1}\smallskip}
166 % text mode subscript
167 \ifx\textsubscript\undefined
168 \usepackage{fixltx2e
} % since 2015 loaded by default
171 % title for topics, admonitions, unsupported section levels, and sidebar
172 \providecommand*
{\DUtitle}[2][class-arg
]{%
173 % call \DUtitle#1{#2} if it exists:
174 \ifcsname DUtitle
#1\endcsname%
175 \csname DUtitle
#1\endcsname{#2}%
177 \smallskip\noindent\textbf{#2}\smallskip%
181 % titlereference role
182 \providecommand*
{\DUroletitlereference}[1]{\textsl{#1}}
184 % transition (break, fancybreak, anonymous section)
185 \providecommand*
{\DUtransition}{%
186 \hspace*
{\fill}\hrulefill\hspace*
{\fill}
187 \vskip 0.5\baselineskip
190 \ifthenelse{\isundefined{\hypersetup}}{
191 \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue
]{hyperref
}
192 \usepackage{bookmark
}
193 \urlstyle{same
} % normal text font (alternatives: tt, rm, sf)
196 pdftitle=
{reStructuredText Test Document
},
197 pdfauthor=
{David Goodger;Me;Myself;I
}
200 \title{reStructuredText Test Document
%
201 \label{restructuredtext-test-
document}%
204 \DUdocumentsubtitle{Examples of Syntax Constructs
}%
205 \label{examples-of-syntax-constructs
}%
216 \begin{tabularx
}{\DUdocinfowidth}{lX
}
225 \href{mailto:goodger@python.org
}{goodger@python.org
} \\
232 \textbf{Organization
}: &
235 Now, or yesterday. Or maybe even
\emph{before
} yesterday. \\
237 This is a “work in progress” \\
239 is managed by a version control system. \\
242 \textbf{Copyright
}: &
243 This
document has been placed in the public domain. You
244 may do with it as you wish. You may copy, modify,
245 redistribute, reattribute, sell, buy, rent, lease,
246 destroy, or improve it, quote it at length, excerpt,
247 incorporate, collate, fold, staple, or mutilate it, or do
248 anything else to it that your or anyone else’s heart
250 \textbf{field name
}: &
251 This is a “generic bibliographic field”.
253 \textbf{field name “
2”
}: &
254 Generic bibliographic fields may contain multiple body elements.
261 \begin{DUclass
}{dedication
}
263 \DUtitle[dedication
]{Dedication
}
265 For Docutils users \& co-developers.
269 \begin{DUclass
}{abstract
}
271 \DUtitle[abstract
]{Abstract
}
273 This is a test
document, containing at least one example of each
274 reStructuredText construct.
278 % This is a comment. Note how any initial comments are moved by
279 % transforms to after the document title, subtitle, and docinfo.
281 % Above is the document title, and below is the subtitle.
282 % They are transformed from section titles after parsing.
284 % bibliographic fields (which also require a transform):
286 \pagebreak[4] % start ToC on new page
288 \phantomsection\label{table-of-contents
}
289 \pdfbookmark[1]{Table of Contents
}{table-of-contents
}
290 \renewcommand{\contentsname}{Table of Contents
}
294 \section{1 Structural Elements
%
295 \label{structural-elements
}%
299 \subsection{1.1 Section Title
%
300 \label{section-title
}%
302 \subsubsection*
{Section Subtitle
}
304 Lone subsections are converted to a section subtitle by a transform
305 activated with the
\texttt{--section-subtitles
} command line option or the
306 \texttt{sectsubtitle-xform
} configuration value.
309 \subsection{1.2 Empty Section
%
310 \label{empty-section
}%
314 \subsection{1.3 Transitions
%
320 %___________________________________________________________________________
323 It divides the section. Transitions may also occur between sections:
325 %___________________________________________________________________________
329 \section{2 Body Elements
%
330 \label{body-elements
}%
334 \subsection{2.1 Paragraphs
%
341 \subsubsection{2.1.1 Inline Markup
%
342 \label{inline-markup
}%
345 Paragraphs contain text and may contain inline markup:
\emph{emphasis
},
346 \textbf{strong emphasis
},
\texttt{inline literals
}, standalone hyperlinks
347 (
\url{http://www.python.org
}), external hyperlinks (
\href{http://www.python.org/
}{Python
}\DUfootnotemark{id30
}{id29
}{5}), internal
348 cross-references (
\hyperref[example
]{example
}), external hyperlinks with embedded URIs
349 (
\href{http://www.python.org
}{Python web site
}),
\href{http://www.python.org/
}{anonymous hyperlink
350 references
}\DUfootnotemark{id40
}{id29
}{5} (
\href{http://docutils.sourceforge.net/
}{a second reference
}\DUfootnotemark{id42
}{id41
}{9}), footnote references (manually
351 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
]}),
352 substitution references (
\includegraphics{../../../docs/user/rst/images/biohazard.png
}), and
%
353 \phantomsection\label{inline-hyperlink-targets
}inline hyperlink targets
354 (see
\hyperref[targets
]{Targets
} below for a reference back to here). Character-level
355 inline markup is also possible (although exceedingly ugly!) in
\emph{re
}\texttt{Structured
}\emph{Text
}. Problems are indicated by
%
356 \raisebox{1em
}{\hypertarget{id28
}{}}\hyperlink{id27
}{\textbf{\color{red
}|problematic|
}} text
357 (generated by processing errors; this one is intentional). Here is a
358 reference to the
\hyperref[doctitle
]{doctitle
} and the
\hyperref[subtitle
]{subtitle
}.
360 The default role for interpreted text is
\DUroletitlereference{Title Reference
}. Here are
361 some explicit interpreted text roles: a PEP reference (
\href{http://www.python.org/dev/peps/pep-
0287}{PEP
287}); an
362 RFC reference (
\href{http://tools.ietf.org/html/rfc2822.html
}{RFC
2822}); an abbreviation (
\DUrole{abbreviation
}{abb.
}), an acronym
363 (
\DUrole{acronym
}{reST
}), code (
\texttt{\DUrole{code
}{print
\textquotedbl{}hello world
\textquotedbl{}}}); a
\textsubscript{subscript
};
364 a
\textsuperscript{superscript
} and explicit roles for
\DUroletitlereference{Docutils
}’
365 \emph{standard
} \textbf{inline
} \texttt{markup
}.
367 % DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
369 Let’s test wrapping and whitespace significance in inline literals:
370 \texttt{This is an example of --inline-literal --text, --including some--
371 strangely--hyphenated-words. ~Adjust-the-width-of-your-browser-window
372 to see how the text is wrapped. ~-- ---- -------- ~Now note ~ ~the
373 spacing ~ ~between the ~ ~words of ~ ~this sentence ~ ~(words
374 should ~ ~be grouped ~ ~in pairs).
}
376 If the
\texttt{--pep-references
} option was supplied, there should be a
377 live link to PEP
258 here.
380 \subsection{2.2 Bullet Lists
%
381 \label{bullet-lists
}%
388 \item Nested bullet list.
395 Paragraph
2 of item
2.
398 \item Nested bullet list.
410 \item This nested list should be compacted by the HTML writer.
412 \phantomsection\label{target
}
413 % Even if this item contains a target and a comment.
418 \subsection{2.3 Enumerated Lists
%
419 \label{enumerated-lists
}%
423 \item Arabic numerals.
426 \renewcommand{\labelenumii}{\alph{enumii
})
}
430 \renewcommand{\labelenumiii}{(
\roman{enumiii
})
}
436 \begin{list
}{\Roman{enumv
})
}{\usecounter{enumv
}}
443 \item Lists that don’t start at
1:
446 \renewcommand{\labelenumii}{\arabic{enumii
}.
}
447 \setcounter{enumii
}{2}
454 \renewcommand{\labelenumii}{\Alph{enumii
}.
}
455 \setcounter{enumii
}{2}
462 \renewcommand{\labelenumii}{\roman{enumii
}.
}
463 \setcounter{enumii
}{2}
471 \subsection{2.4 Definition Lists
%
472 \label{definition-lists
}%
476 \item[{Term
}] \leavevmode
479 \item[{Term
}] \leavevmode (
\textbf{classifier
})
480 Definition paragraph
1.
482 Definition paragraph
2.
484 \item[{Term
}] \leavevmode
487 \item[{Term
}] \leavevmode (
\textbf{classifier one
})(
\textbf{classifier two
})
493 \subsection{2.5 Field Lists
%
499 Field lists map field names to field bodies, like database
500 records. They are often part of an extension syntax. They are
501 an unambiguous variant of RFC
2822 fields.
503 \item[{how arg1 arg2:
}]
504 The field marker is a colon, the field name, and a colon.
506 The field body may contain one or more body elements, indented
507 relative to the field marker.
510 \DUrole{credits
}{This paragraph has the
\DUroletitlereference{credits
} class set. (This is actually not
511 about credits but just for ensuring that the class attribute
512 doesn’t get stripped away.)
}
516 \subsection{2.6 Option Lists
%
517 \label{option-lists
}%
520 For listing command-line options:
523 \item[-a
] command-line option “a”
525 \item[-b file
] options can have arguments
526 and long descriptions
528 \item[--long
] options can be long also
530 \item[--input=file
] long options can also have
533 \item[--very-long-option
] The description can also start on the next line.
535 The description may contain multiple body elements,
536 regardless of where it starts.
538 \item[-x, -y, -z
] Multiple options are an “option group”.
540 \item[-v, --verbose
] Commonly-seen: short \& long options.
542 \item[-
1 file, --one=file, --two file
] Multiple options with arguments.
544 \item[/V
] DOS/VMS-style options too
547 There must be at least two spaces between the option and the
551 \subsection{2.7 Literal Blocks
%
552 \label{literal-blocks
}%
555 Literal blocks are indicated with a double-colon (“::”) at the end of
556 the preceding paragraph (over there
\texttt{-->
}). They can be indented:
561 text = 'is left as-is'
562 spaces_and_linebreaks = 'are preserved'
563 markup_processing = None
567 Or they can be quoted without indentation:
573 > Why didn't I think of that?
578 \subsection{2.8 Line Blocks
%
582 This section tests line blocks. Line blocks are body elements which
583 consist of lines and other line blocks. Nested line blocks cause
586 \begin{DUlineblock
}{0em
}
587 \item[] This is a line block. It ends with a blank line.
589 \begin{DUlineblock
}{\DUlineblockindent}
590 \item[] New lines begin with a vertical bar (“|”).
591 \item[] Line breaks and initial indent are significant, and preserved.
593 \begin{DUlineblock
}{\DUlineblockindent}
594 \item[] Continuation lines are also possible. A long line that is intended
595 to wrap should begin with a space in place of the vertical bar.
597 \item[] The left edge of a continuation line need not be aligned with
598 the left edge of the text above it.
602 \begin{DUlineblock
}{0em
}
603 \item[] This is a second line block.
605 \item[] Blank lines are permitted internally, but they must begin with a “|”.
608 Another line block, surrounded by paragraphs:
610 \begin{DUlineblock
}{0em
}
611 \item[] And it’s no good waiting by the window
612 \item[] It’s no good waiting for the sun
613 \item[] Please believe me, the things you dream of
614 \item[] They don’t fall in the lap of no-one
617 Take it away, Eric the Orchestra Leader!
620 \begin{DUlineblock
}{0em
}
621 \item[] A one, two, a one two three four
623 \item[] Half a bee, philosophically,
625 \begin{DUlineblock
}{\DUlineblockindent}
626 \item[] must,
\emph{ipso facto
}, half not be.
628 \item[] But half the bee has got to be,
630 \begin{DUlineblock
}{\DUlineblockindent}
631 \item[] \emph{vis a vis
} its entity. D’you see?
634 \item[] But can a bee be said to be
636 \begin{DUlineblock
}{\DUlineblockindent}
637 \item[] or not to be an entire bee,
639 \begin{DUlineblock
}{\DUlineblockindent}
640 \item[] when half the bee is not a bee,
642 \begin{DUlineblock
}{\DUlineblockindent}
643 \item[] due to some ancient injury?
652 A line block, like the following poem by Christian Morgenstern, can
653 also be centre-aligned:
655 \begin{selectlanguage
}{german
}
656 \begin{DUlineblock
}{0em
}
658 \item[] \textbf{Die Trichter
}
660 \item[] Zwei Trichter wandeln durch die Nacht.
661 \item[] Durch ihres Rumpfs verengten Schacht
662 \item[] fließt weißes Mondlicht
663 \item[] still und heiter
673 \subsection{2.9 Block Quotes
%
674 \label{block-quotes
}%
677 Block quotes consist of indented body elements:
680 My theory by A. Elk. Brackets Miss, brackets. This theory goes
681 as follows and begins now. All brontosauruses are thin at one
682 end, much much thicker in the middle and then thin again at the
683 far end. That is my theory, it is mine, and belongs to me and I
684 own it, and what it is too.
687 \raggedleft —Anne Elk (Miss)
690 The language of a quote (like any other object) can be specified by
695 \begin{selectlanguage
}{french
}
697 ReStructuredText est un langage de balisage léger utilisé
698 notamment dans la documentation du langage Python.
703 \subsection{2.10 Doctest Blocks
%
704 \label{doctest-blocks
}%
709 >>> print 'Python-specific usage examples; begun with ">>>"'
710 Python-specific usage examples; begun with ">>>"
711 >>> print '(cut and pasted from interactive Python sessions)'
712 (cut and pasted from interactive Python sessions)
717 \subsection{2.11 Footnotes
%
721 \DUfootnotetext{id8
}{id1
}{1}{%
722 A footnote contains body elements, consistently indented by at
725 This is the footnote’s second paragraph.
728 \DUfootnotetext{label
}{id3
}{2}{\phantomsection\label{label
}%
729 Footnotes may be numbered, either manually (as in
\DUfootnotemark{id9
}{id8
}{1}) or
730 automatically using a “\#”-prefixed label. This footnote has a
731 label so it can be referred to from multiple places, both as a
732 footnote reference (
\DUfootnotemark{id10
}{label
}{2}) and as a
\hyperref[label
]{hyperlink reference
}.
735 \DUfootnotetext{id12
}{id2
}{3}{%
736 This footnote is numbered automatically and anonymously using a
739 This is the second paragraph.
741 And this is the third paragraph.
744 \DUfootnotetext{id13
}{id4
}{*
}{%
745 Footnotes may also use symbols, specified with a “*” label.
746 Here’s a reference to the next footnote:
\DUfootnotemark{id14
}{id15
}{†
}.
749 \DUfootnotetext{id15
}{id14
}{†
}{%
750 This footnote shows the next symbol in the sequence.
753 \DUfootnotetext{id16
}{id16
}{4}{%
754 Here’s an unreferenced footnote, with a reference to a
755 nonexistent footnote:
%
756 \raisebox{1em
}{\hypertarget{id17
}{}}\hyperlink{id47
}{\textbf{\color{red
}{[}5{]}\_}}.
760 \subsection{2.12 Citations
%
763 \begin{figure
}[b
]\raisebox{1em
}{\hypertarget{cit2002
}{}}[CIT2002
]
764 Citations are text-labeled footnotes. They may be
765 rendered separately and differently from footnotes.
768 Here’s a reference to the above,
\hyperlink{cit2002
}{[CIT2002
]}, and a
%
769 \raisebox{1em
}{\hypertarget{id19
}{}}\hyperlink{id48
}{\textbf{\color{red
}{[}nonexistent
{]}\_}}
773 \subsection{2.13 Targets
%
775 \label{another-target
}%
778 \phantomsection\label{example
}
779 This paragraph is pointed to by the explicit “example” target. A
780 reference can be found under
\hyperref[inline-markup
]{Inline Markup
}, above.
\hyperref[inline-hyperlink-targets
]{Inline
781 hyperlink targets
} are also possible.
783 Section headers are implicit targets, referred to by name. See
784 \hyperref[targets
]{Targets
}, which is a subsection of
\hyperref[body-elements
]{Body Elements
}.
786 Explicit external targets are interpolated into references such as
787 “
\href{http://www.python.org/
}{Python
}\DUfootnotemark{id31
}{id29
}{5}”.
789 Targets may be indirect and anonymous. Thus
\hyperref[targets
]{this phrase
} may also
790 refer to the
\hyperref[targets
]{Targets
} section.
793 \raisebox{1em
}{\hypertarget{id50
}{}}\hyperlink{id49
}{\textbf{\color{red
}`hyperlink reference without a target`
\_}}, which generates an
797 \subsubsection{2.13.1 Duplicate Target Names
%
798 \label{duplicate-target-names
}%
801 Duplicate names in section headers or other implicit targets will
802 generate “info” (level-
1) system messages. Duplicate names in
803 explicit targets will generate “warning” (level-
2) system messages.
806 \subsubsection{2.13.2 Duplicate Target Names
%
810 Since there are two “Duplicate Target Names” section headers, we
811 cannot uniquely refer to either of them by name. If we try to (like
813 \raisebox{1em
}{\hypertarget{id52
}{}}\hyperlink{id51
}{\textbf{\color{red
}`Duplicate Target Names`
\_}}), an error is generated.
816 \subsection{2.14 Directives
%
820 \phantomsection\label{contents
}
821 These are just a sample of the many reStructuredText Directives. For
823 \url{http://docutils.sourceforge.net/docs/ref/rst/directives.html
}.
826 \subsubsection{2.14.1 Document Parts
%
827 \label{document-parts
}%
830 An example of the “contents” directive can be seen above this section
831 (a local, untitled table of
\hyperref[contents
]{contents
}) and at the beginning of the
832 document (a
document-wide
\hyperref[table-of-contents
]{table of contents
}).
835 \subsubsection{2.14.2 Images and Figures
%
836 \label{images-and-figures
}%
839 An image directive (also clickable – a hyperlink reference):
841 \hyperref[directives
]{\includegraphics{../../../docs/user/rst/images/title.png
}}
843 Image with multiple IDs:
845 \includegraphics{../../../docs/user/rst/images/title.png
}
846 \phantomsection\label{image-target-
3}\label{image-target-
2}\label{image-target-
1}
850 \noindent\makebox[\linewidth][c
]{\includegraphics{../../../docs/user/rst/images/biohazard.png
}}
852 A left-aligned image:
854 \noindent{\includegraphics{../../../docs/user/rst/images/biohazard.png
}\hfill}
856 This paragraph might flow around the image.
857 The specific behavior depends upon the style sheet and
858 the browser or rendering software used.
860 A right-aligned image:
862 \noindent{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png
}}
864 This paragraph might flow around the image.
865 The specific behavior depends upon the style sheet and
866 the browser or rendering software used.
868 For inline images see
\hyperref[substitution-definitions
]{Substitution Definitions
}.
874 \includegraphics[width=
2em
]{../../../docs/user/rst/images/biohazard.png
}
876 An image
2 em wide and
15 pixel high:
878 \includegraphics[height=
15\pdfpxdimen,width=
2em
]{../../../docs/user/rst/images/biohazard.png
}
880 An image occupying
50\% of the line width:
882 \includegraphics[width=
0.500\linewidth]{../../../docs/user/rst/images/title.png
}
886 \includegraphics[height=
2cm
]{../../../docs/user/rst/images/biohazard.png
}
888 A
\emph{figure
} is an image with a caption and/or a legend. With page-based output
889 media, figures might float to a different position if this helps the page
892 \begin{DUclass
}{figclass1
}
893 \begin{DUclass
}{figclass2
}
895 \noindent\makebox[\linewidth][c
]{\includegraphics[width=
258bp
]{../../../docs/user/rst/images/title.png
}}
896 \caption{Plaintext markup syntax and parser system.
}
898 \setlength{\DUtablewidth}{\linewidth}
899 \begin{longtable*
}[c
]{|p
{0.156\DUtablewidth}|p
{0.563\DUtablewidth}|
}
904 Revised, revisited, based on ‘re’ module.
910 Structure-enhanced text, structuredtext.
916 Well it is, isn’t it?
921 This paragraph is also part of the legend.
927 A left-aligned figure:
929 \begin{DUclass
}{figclass1
}
930 \begin{DUclass
}{figclass2
}
931 \begin{figure
} % align = "left"
932 \noindent\makebox[\linewidth][c
]{\includegraphics[width=
40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png
}}
933 \caption{This is the caption.
}
937 The legend may consist of several paragraphs.
943 This paragraph might flow around the figure.
945 The specific behavior depends upon the style sheet and the browser or
946 rendering software used.
951 \noindent\makebox[\linewidth][c
]{\includegraphics[width=
40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png
}}
952 \caption{This is the caption.
}
956 The legend may consist of several paragraphs.
960 This paragraph might flow around the figure.
962 The specific behavior depends upon the style sheet and the browser or
963 rendering software used.
965 A right-aligned figure:
967 \begin{figure
} % align = "right"
968 \noindent\makebox[\linewidth][c
]{\includegraphics[width=
40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png
}}
969 \caption{This is the caption.
}
973 The legend may consist of several paragraphs.
977 This paragraph might flow around the figure. The specific behavior depends
978 upon the style sheet and the browser or rendering software used.
980 Tables may be given titles and additional arguments with the
\emph{table
}
983 \setlength{\DUtablewidth}{\linewidth}
984 \begin{longtable
}[l
]{|p
{0.075\DUtablewidth}|p
{0.075\DUtablewidth}|
}
985 \caption{left-aligned table
}\\
994 \caption[]{left-aligned table (... continued)
}\\
1003 \multicolumn{2}{c
}{\hfill ... continued on next page
} \\
1020 \setlength{\DUtablewidth}{\linewidth}
1021 \begin{longtable
}[c
]{|p
{0.075\DUtablewidth}|p
{0.075\DUtablewidth}|
}
1022 \caption{center-aligned table
}\\
1031 \caption[]{center-aligned table (... continued)
}\\
1040 \multicolumn{2}{c
}{\hfill ... continued on next page
} \\
1057 \setlength{\DUtablewidth}{\linewidth}
1058 \begin{longtable
}[r
]{|p
{0.075\DUtablewidth}|p
{0.075\DUtablewidth}|
}
1059 \caption{right-aligned table
}\\
1068 \caption[]{right-aligned table (... continued)
}\\
1077 \multicolumn{2}{c
}{\hfill ... continued on next page
} \\
1094 With the “widths” argument “auto” (or “class” value “colwidths-auto”),
1095 column widths are determined by the backend (if supported by the
1098 \begin{longtable*
}[c
]{|l|l|l|
}
1100 \textbf{A
} &
\textbf{B
} &
\textbf{A or B
} \\
1104 \textbf{A
} &
\textbf{B
} &
\textbf{A or B
} \\
1107 \multicolumn{3}{c
}{\hfill ... continued on next page
} \\
1110 False & False & False \\
1112 True & False & True \\
1114 False & True & True \\
1116 True & True & True \\
1119 \label{target2
}\label{target1
}
1122 \subsubsection{2.14.3 Admonitions
%
1123 \label{admonitions
}%
1126 \DUadmonition[attention
]{
1127 \DUtitle[attention
]{Attention!
}
1129 Directives at large.
1132 \DUadmonition[caution
]{
1133 \DUtitle[caution
]{Caution!
}
1135 Don’t take any wooden nickels.
1138 \DUadmonition[danger
]{
1139 \DUtitle[danger
]{!DANGER!
}
1141 Mad scientist at work!
1144 \DUadmonition[error
]{
1145 \DUtitle[error
]{Error
}
1150 \DUadmonition[hint
]{
1151 \DUtitle[hint
]{Hint
}
1153 It’s bigger than a bread box.
1156 \DUadmonition[important
]{
1157 \DUtitle[important
]{Important
}
1160 \item Wash behind your ears.
1162 \item Clean up your room.
1164 \item Call your mother.
1166 \item Back up your data.
1170 \DUadmonition[note
]{
1171 \DUtitle[note
]{Note
}
1179 15\% if the service is good.
1182 \DUadmonition[warning
]{
1183 \DUtitle[warning
]{Warning
}
1185 Strong prose may provoke extreme mental exertion.
1186 Reader discretion is strongly advised.
1189 \DUadmonition[admonition-and-by-the-way
]{
1190 \DUtitle[admonition-and-by-the-way
]{And, by the way…
}
1192 You can make up your own admonition too.
1196 \subsubsection{2.14.4 Topics, Sidebars, and Rubrics
%
1197 \label{topics-sidebars-and-rubrics
}%
1200 \emph{Sidebars
} are like miniature, parallel documents.
1203 \DUtitle[title
]{Sidebar Title
}
1205 \DUsubtitle[sidebar
]{Optional Subtitle
}
1207 This is a sidebar. It is for text outside the flow of the main
1210 \DUrubric{This is a rubric inside a sidebar
}
1212 Sidebars often appear beside the main text with a border and a different
1213 background or font
color.
1216 A
\emph{topic
} is like a block quote with a title, or a self-contained section
1217 with no subsections.
1219 \begin{DUclass
}{topic
}
1221 \DUtitle[topic
]{Topic Title
}
1227 A
\emph{rubric
} is like an informal heading that doesn’t correspond to the
1228 document’s structure. It is typically highlighted in red (hence the name).
1230 \DUrubric{This is a rubric
}
1232 Topics and rubrics can be used at places where a
\hyperref[section-title
]{section title
} is not
1233 allowed (e.g. inside a directive).
1236 \subsubsection{2.14.5 Target Footnotes
%
1237 \label{target-footnotes
}%
1240 \DUfootnotetext{id29
}{id30
}{5}{%
1241 \url{http://www.python.org/
}
1244 \DUfootnotetext{id33
}{id34
}{6}{%
1245 \url{http://pygments.org/
}
1248 \DUfootnotetext{id35
}{id36
}{7}{%
1249 \url{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf
}
1252 \DUfootnotetext{id38
}{id39
}{8}{%
1253 \url{http://ctan.org/pkg/polyglossia
}
1256 \DUfootnotetext{id41
}{id42
}{9}{%
1257 \url{http://docutils.sourceforge.net/
}
1260 \DUfootnotetext{id43
}{id44
}{10}{%
1265 \subsubsection{2.14.6 Replacement Text
%
1266 \label{replacement-text
}%
1269 I recommend you try
\href{http://www.python.org/
}{Python,
\emph{the
} best language around
}\DUfootnotemark{id32
}{id29
}{5}.
1272 \subsubsection{2.14.7 Compound Paragraph
%
1273 \label{compound-paragraph
}%
1276 The
\emph{compound
} directive is used to create a “compound paragraph”, which
1277 is a single logical paragraph containing multiple physical body
1278 elements. For example:
1280 \begin{DUclass
}{compound
}
1281 The ‘rm’ command is very dangerous. If you are logged
1282 in as root and enter
1289 you will erase the entire contents of your file system.
1292 Test the handling and display of compound paragraphs:
1294 \begin{DUclass
}{compound
}
1295 \begin{DUclass
}{some-class
}
1296 Compound
2, paragraph
1,
1298 compound
2, paragraph
2,
1304 compound
2, paragraph
3.
1308 \begin{DUclass
}{compound
}
1309 Compound
3, only consisting of one paragraph.
1312 \begin{DUclass
}{compound
}
1316 This one starts with a literal block.
1319 Compound
4, paragraph following the literal block.
1322 Now something
\emph{really
} perverted – a nested compound block. This is
1323 just to test that it works at all; the results don’t have to be
1326 \begin{DUclass
}{compound
}
1327 Compound
5, block
1 (a paragraph).
1329 \begin{DUclass
}{compound
}
1330 Compound
6 is block
2 in compound
5.
1332 Compound
6, another paragraph.
1335 Compound
5, block
3 (a paragraph).
1338 \begin{DUclass
}{compound
}
1339 Compound
7, tests the inclusion of various block-level
1340 elements in one logical paragraph. First a table,
1342 \setlength{\DUtablewidth}{\linewidth}
1343 \begin{longtable*
}[c
]{|p
{0.249\DUtablewidth}|p
{0.249\DUtablewidth}|p
{0.249\DUtablewidth}|
}
1365 followed by a paragraph. This physical paragraph is
1366 actually a continuation of the paragraph before the table. It is followed
1372 \item an enumerated list,
1375 \begin{DUoptionlist
}
1376 \item[--an
] option list,
1385 \item[{a definition
}] \leavevmode
1389 a paragraph, an image:
1390 \includegraphics{../../../docs/user/rst/images/biohazard.png
}
1392 \begin{DUlineblock
}{0em
}
1396 a paragraph followed by a comment,
1400 \DUadmonition[note
]{
1401 \DUtitle[note
]{Note
}
1405 and the final paragraph of the compound
7.
1409 \subsubsection{2.14.8 Parsed Literal Blocks
%
1410 \label{parsed-literal-blocks
}%
1414 \ttfamily\raggedright
1415 This~is~a~parsed~literal~block.\\
1416 ~~~~This~line~is~indented.~~The~next~line~is~blank.\\
1418 Inline~markup~is~supported,~e.g.~
\emph{emphasis
},~
\textbf{strong
},~
\texttt{literal\\
1419 text
},~
\textsubscript{sub-
}~and~
\textsuperscript{super
}scripts,\\
1420 inline~formulas:~$A =
2 \pi r^
2$,\\
1421 footnotes
\DUfootnotemark{id22
}{id8
}{1},~
%
1422 \phantomsection\label{hyperlink-targets
}hyperlink~targets,~and~
\href{http://www.python.org/
}{references
}.
1426 \subsubsection{2.14.9 Code
%
1430 Blocks of source code can be set with the
\DUroletitlereference{code
} directive. If the code
1431 language is specified, the content is parsed and tagged by the
\href{http://pygments.org/
}{Pygments
}\DUfootnotemark{id34
}{id33
}{6}
1432 syntax highlighter and can be formatted with a style sheet. (Code parsing
1433 is turned off using the
\texttt{syntax-highlight
} config setting in the test
1434 conversions in order to get identical results with/without installed
1435 Pygments highlighter.)
1437 \begin{DUclass
}{code
}
1438 \begin{DUclass
}{python
}
1441 print 'This is Python code.'
1447 The
\texttt{:number-lines:
} option (with optional start value) generates line
1450 \begin{DUclass
}{code
}
1451 \begin{DUclass
}{python
}
1453 \ttfamily\raggedright
1454 \DUrole{ln
}{~
8~
}\#~print~integers~from~
0~to~
9:\\
1455 \DUrole{ln
}{~
9~
}for~i~in~range(
10):\\
1456 \DUrole{ln
}{10~
}~~~~print~i
1461 For inline code snippets, there is the
\DUroletitlereference{code
} role, which can be used
1462 directly (the code will not be parsed/tagged, as the language is not known)
1463 or as base for special code roles, e.g. the LaTeX code in the next
1466 Docutils uses LaTeX syntax for math directives and roles:
1467 \texttt{\DUrole{code
}{\DUrole{tex
}{\textbackslash{}alpha = f(x)
}}} prints $
\alpha = f(x)$.
1469 The
\texttt{:code:
} option of the
\DUroletitlereference{include
} directive sets the included content
1470 as a code block, here the rst file
\texttt{header
\_footer.txt
} with line numbers:
1472 \begin{DUclass
}{code
}
1473 \begin{DUclass
}{rst
}
1475 \ttfamily\raggedright
1476 \DUrole{ln
}{1~
}..~header::~Document~header\\
1477 \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 List Tables
%
1681 \label{list-tables
}%
1684 Here’s a list table exercising all features:
1686 \setlength{\DUtablewidth}{40em
}
1687 \begin{longtable
}[c
]{|p
{0.133\DUtablewidth}|p
{0.249\DUtablewidth}|p
{0.365\DUtablewidth}|
}
1688 \caption{list table with integral header
}\\
1699 \caption[]{list table with integral header (... continued)
}\\
1710 \multicolumn{3}{c
}{\hfill ... continued on next page
} \\
1726 If we took the bones out, it wouldn’t be
1727 crunchy, now would it?
1740 \begin{longtable
}[c
]{|l|l|
}
1741 \caption{center aligned list table
}\\
1745 Crunchy Frog &
1.49 \\
1747 Gannet Ripple &
1.99 \\
1752 \subsection{2.22 Custom Roles
%
1753 \label{custom-roles
}%
1757 \item A role based on an existing role.
1759 \texttt{\DUrole{custom
}{one
}} \texttt{\DUrole{custom
}{two
}} \texttt{\DUrole{custom
}{three
}}
1763 \DUrole{customnew
}{one two three
}
1765 \item A role with class attribute.
1767 \DUrole{special
}{interpreted text
}
1769 \item A language-switching role:
1771 Let’s count in German
\foreignlanguage{german
}{eins zwei drei
}.
1773 \item A role with multiple class attributes, styled with raw directives:
1775 \newcommand{\DUrolegreen}[1]{\textcolor{green
}{#1}}
1776 \newcommand{\DUrolesc}[1]{\textsc{#1}}
1778 The following works in most browsers but does not validate
1779 (
\texttt{<style>
} is only allowed in the
document head):
1785 <style type="text/css"><!--
1786 .green \
{color: green;\
}
1787 .sc \
{font-variant: small-caps;\
}
1792 \DUrole{green
}{\DUrole{sc
}{\foreignlanguage{english
}{British colourful text in small-caps
}}}.
1796 \subsection{2.23 Mathematics
%
1797 \label{mathematics
}%
1800 Docutils supports inline math with the prefix or postfix
\texttt{:math:
}
1801 role specificator, $n! +
\sin(x_n^
2)$ and $A_
\text{c
} =
1802 \frac{\pi}{4} d^
2$, as well as displayed math via the
1803 \DUroletitlereference{math
} directive:
1806 f(
\epsilon) =
\frac{1}{1 +
\exp\left(
\frac{\varepsilon}{k_
\text{B
}T
}\right)
}
1808 Content may start on the first line of the directive, e.g.
1811 N =
\frac{\text{number of apples
}}{7}
1813 Equations can be labeled with a reference name using the
\texttt{:name:
} option.
1814 See
\hyperref[eq-m
]{eq:M
} and
\hyperref[eq-schrodinger
]{eq:schrödinger
} below.
1816 The determinant of the matrix
1819 \mathbf{M
} =
\left(
\begin{matrix
}a&b\
\c&d
\end{matrix
}\right)
1823 is $|
\mathbf{M
}| = ad - bc$.
1825 More than one display math block can be put in one math directive.
1826 For example, the following sum and integral with limits:
1829 \int_0^
1 x^n dx =
\frac{1}{n +
1}
1832 \sum_{n=
1}^m n =
\frac{m(m+
1)
}{2}
1834 LaTeX-supported Unicode math symbols can be used in math roles and
1837 The Schrödinger equation
1840 i
\hbar \frac{\partial }{\partial t
}\Psi =
\hat{H
}\Psi ,
1842 \label{eq-schrodinger
}
1844 with the
\emph{wave function
} $
\Psi $, describes how the quantum state of a
1845 physical system changes in time.
1848 \item[{Math-Accents:
}] \leavevmode
1849 \setlength{\DUtablewidth}{\linewidth}
1850 \begin{longtable*
}[c
]{p
{0.315\DUtablewidth}p
{0.315\DUtablewidth}p
{0.315\DUtablewidth}}
1852 $
\acute{a
}$
\texttt{\textbackslash{}acute\
{a\
}}
1854 $
\dot{t
}$
\texttt{\textbackslash{}dot\
{t\
}}
1856 $
\hat{\gamma}$
\texttt{\textbackslash{}hat\
{\textbackslash{}gamma\
}}
1859 $
\grave{a
}$
\texttt{\textbackslash{}grave\
{a\
}}
1861 $
\ddot{t
}$
\texttt{\textbackslash{}ddot\
{t\
}}
1863 $
\tilde{\alpha}$
\texttt{\textbackslash{}tilde\
{\textbackslash{}alpha\
}}
1866 $
\breve{x
}$
\texttt{\textbackslash{}breve\
{x\
}}
1868 $
\dddot{t
}$
\texttt{\textbackslash{}dddot\
{t\
}}
1870 $
\vec{\imath}$
\texttt{\textbackslash{}vec\
{\textbackslash{}imath\
}}
1873 $
\check{a
}$
\texttt{\textbackslash{}check\
{a\
}}
1875 $
\bar{a
}$
\texttt{\textbackslash{}bar\
{a\
}}
1877 $
\vec{R
}$
\texttt{\textbackslash{}vec\
{R\
}}
1886 Modulation Transfer Function:
1889 \text{MTF
} =
\left|
\frac{\mathcal{F
}\
{s(x)\
}}
1890 {\mathcal{F
}\
{ s(x)\
} |_
{\omega _
{x
}=
0}}\right|
1891 =
\mathrm{abs
}\left(
\frac
1892 {\int _
{-
\infty }^
{\infty }s(x)
\mathrm{e
}^
{\mathrm{i
}\omega _
{x
}x
}\mathrm{d
}{x
}}
1893 {\int _
{-
\infty }^
{\infty }s(x)
\mathrm{d
}{x
}}
1896 Math split over two lines: If a double backslash is detected outside a
1897 \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}
1898 \texttt{align
} environment:
1901 s_
{\mathrm{out
}}(x) & = s_
{\mathrm{in
}}(x') * s_
\delta (x-x') \\
1902 & =
\int s_
{\mathrm{in
}}(x')s_
\delta (x-x')
\mathrm{d
}x'
1904 Cases (“manually”, with
\texttt{matrix
} environment):
1907 \mathrm{sgn
}(x) =
\left\
{\begin{matrix
}
1912 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
1913 HTML writers with
\texttt{--math-output=MathML
}):
1916 \mathrm{sgn
}(x) =
\begin{cases
}
1922 \section{3 Tests for the LaTeX writer
%
1923 \label{tests-for-the-latex-writer
}%
1926 Test syntax elements which may cause trouble for the LaTeX writer but might
1927 not need to be tested with other writers (e.g. the HTML writer).
1930 \subsection{3.1 Custom Roles in LaTeX
%
1931 \label{custom-roles-in-latex
}%
1935 \item Role names and class arguments are converted to conform to the
1936 regular expression
\texttt{{[}a-z
{]}{[}-a-z0-
9{]}*
} (letters are downcased,
1937 accents and similar decoration is stripped, non-conforming
1938 characters are replaced by a hyphen).
1940 Class arguments may contain numbers and hyphens, which need special
1941 treatment in LaTeX command names.
1943 \DUrole{large
}{\DUrole{custom4
}{\DUrole{small-caps
}{\DUrole{custom-role
}{\DUrole{custom-role
}{Text with role “custom4”
}}}}} (but without styling by
\texttt{DUrole*
}
1946 \item With LaTeX, roles can be styled within the
document using the
\DUroletitlereference{raw
}
1949 \newcommand{\DUrolelarge}[1]{{\large #1}}
1951 \@namedef
{DUrolesmall-caps
}{\textsc}
1952 \@namedef
{DUrolecustom4
}{\textbf}
1955 \DUrole{large
}{\DUrole{custom4
}{\DUrole{small-caps
}{\DUrole{custom-role
}{\DUrole{custom-role
}{inline text
}}}}} in large, bold, small-caps.
1957 \item Custom roles can be based on standard roles:
1959 This is a
\emph{\DUrole{custom-emphasis
}{customized emphasis text role
}}
1961 This is a
\texttt{\DUrole{custom-literal
}{customized literal text role
}}
1963 This is a
\textbf{\DUrole{custom-strong
}{customized strong text role
}}
1965 This is a
\textsubscript{\DUrole{custom-subscript
}{customized subscript text role
}}
1967 This is a
\textsuperscript{\DUrole{custom-superscript
}{customized superscript text role
}}
1969 This is a
\DUroletitlereference{\DUrole{custom-title-reference
}{customized title-reference text role
}}
1973 \subsection{3.2 class handling
%
1974 \label{class-handling
}%
1977 This section tests class handling for block level elements by the LaTeX
1978 writer. See the input file
\texttt{classes
\_latex.txt
} for the raw LaTeX code used
1979 to style the examples.
1981 An “epigraph” directive is exported as “quote” wrapped in a “DUclass”
1982 environment. Here, it is styled by a “DUCLASSepigraph” environment
1983 redefining the “quote” environment as “minipage”:
1985 \newcommand*
{\DUCLASSepigraph}{%
1986 \renewenvironment{quote
}{\vspace{1em
}
1987 \footnotesize\hfill{}%
1988 \begin{minipage
}{0.4\columnwidth}}%
1989 {\end{minipage
}\vskip\baselineskip}}
1991 \begin{DUclass
}{epigraph
}
1993 Do not play this piece fast. It is never right to play
\emph{Ragtime
} fast.
1996 \raggedleft —Scott Joplin
2000 Raw latex is also used to style the following lists: “DUCLASSenumerateitems”
2001 redefines “itemize” as “enumerate”, “DUCLASSrules” draws horizontal lines
2004 \newcommand*
{\DUCLASSenumerateitems}{%
2005 \renewenvironment{itemize
}{\begin{enumerate
}}%
2009 \newenvironment{DUCLASSrules
}%
2010 {\noindent\rule[0.5ex
]{1\columnwidth}{1pt
}}%
2011 {\noindent\rule[0.5ex
]{1\columnwidth}{1pt
}}
2013 An “enumerated” bullet list:
2015 \begin{DUclass
}{enumerateitems
}
2025 A list with lines above and below:
2027 \begin{DUclass
}{rules
}
2035 A normal bullet list is kept unchanged by the above redefinitions:
2045 A container wraps several elements in a common “class wrapper”. Here, we use
2046 it to set
2 paragraphs and a list in small caps:
2048 \newcommand*
{\DUCLASSscshape}{\scshape}
2050 \begin{DUclass
}{scshape
}
2059 \item still bullet list
2063 A right-aligned line-block. Alignment handling is built into the latex
2064 writer for image, table, and line block elements.
2066 \begin{DUlineblock
}{0em
}
2068 \item[] Max Mustermann
2070 \item[] D
01234 Testdorf
2071 \item[] Tel.:
0123/
456789
2075 \subsection{3.3 More Tables
%
2076 \label{more-tables
}%
2079 A table with multi-paragraph multicolumn cells:
2081 \setlength{\DUtablewidth}{\linewidth}
2082 \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}|
}
2088 &
\multicolumn{3}{p
{0.41\DUtablewidth}|
}{%
2091 With a second paragraph
2096 \multicolumn{2}{|p
{0.31\DUtablewidth}|
}{%
2099 With a second paragraph
2112 &
\multicolumn{2}{p
{0.36\DUtablewidth}|
}{%
2113 multicolumn
3 (one line,
2114 but very very very very
2130 &
\multicolumn{3}{p
{0.38\DUtablewidth}|
}{%
2136 Tables with multi-paragraph multirow cells currently fail due to a LaTeX
2137 limitation (see
\url{https://sourceforge.net/p/docutils/bugs/
225/
}).
2139 A table with multirow header and column-widths set by LaTeX:
2141 \begin{longtable*
}[c
]{|l|l|
}
2143 \multirow{2}{*
}{\textbf{XXX
}} &
\textbf{Variable Summary
} \\
2145 &
\textbf{Description
} \\
2149 \multirow{2}{*
}{\textbf{XXX
}} &
\textbf{Variable Summary
} \\
2151 &
\textbf{Description
} \\
2154 \multicolumn{2}{c
}{\hfill ... continued on next page
} \\
2157 \multicolumn{2}{|l|
}{multicollumn cell
} \\
2161 In a table with column-widths set by LaTeX, each cell has just one line.
2162 Paragraphs are merged (a warning is given).
2164 \begin{longtable*
}[c
]{|l|l|
}
2166 11 & first paragraph
2174 % This file is used by the standalone_rst_latex test.
2177 \subsection{3.4 Option lists
%
2181 The LaTeX-
2e description environment is used for definition lists.
2182 The definition is continued on the same line as the term, this should
2183 not happen if a option-list is at the top of the definition.
2185 If the option list is not at the first element in the definition, it
2186 is contained in a quote
2189 \begin{DUoptionlist
}
2190 \item[--help
] show help
2197 \item[{In a definition list:
}] \leavevmode
2198 \begin{DUoptionlist
}
2199 \item[--help
] show help
2207 \subsection{3.5 Monospaced non-alphanumeric characters
%
2208 \label{monospaced-non-alphanumeric-characters
}%
2211 These are all ASCII characters except a-zA-Z0-
9 and space:
2213 \texttt{!!!
\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'''((()))***+++,,,---...///:::
}
2215 \texttt{;;;<<<===>>>???@@@
{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_```\
{\
{\
{|||\
}\
}\
}\textasciitilde{}\textasciitilde{}\textasciitilde{}}
2217 \texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
}
2219 The two lines of non-alphanumeric characters should both have the same
2220 width as the third line.
2223 \subsection{3.6 Non-ASCII characters
%
2224 \label{non-ascii-characters
}%
2227 Punctuation and footnote symbols
2229 \setlength{\DUtablewidth}{\linewidth}
2230 \begin{longtable*
}[c
]{|p
{0.028\DUtablewidth}|p
{0.424\DUtablewidth}|
}
2247 single turned comma quotation mark
2253 single comma quotation mark
2259 low single comma quotation mark
2265 double turned comma quotation mark
2271 double comma quotation mark
2277 low double comma quotation mark
2331 left-right double arrow
2336 The
\DUroletitlereference{Latin-
1 extended
} Unicode block
2338 \setlength{\DUtablewidth}{\linewidth}
2339 \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}|
}
2596 \item The following line should not be wrapped, because it uses
2597 no-break spaces (
\textbackslash{}u00a0):
2599 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
2601 \item Line wrapping with/without breakpoints marked by soft hyphens
2602 (
\textbackslash{}u00ad):
2604 pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch
2606 pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch
2610 \subsection{3.7 Encoding special chars
%
2611 \label{encoding-special-chars
}%
2614 The LaTeX Info pages lists under “
2.18 Special Characters”
2617 The following characters play a special role in LaTeX and are called
2618 “special printing characters”, or simply “special characters”.
2621 \# \$ \% \&
\textasciitilde{} \_ \textasciicircum{} \textbackslash{} \
{ \
}
2625 The special chars verbatim:
2629 # $
% & ~ _ ^ \textbackslash{} \{ \}
2633 However also
\emph{square brackets
} {[}{]} need special care.
2636 Commands with optional arguments (e.g.
\texttt{\textbackslash{}item
}) check
2637 if the token right after the macro name is an opening bracket.
2638 In that case the contents between that bracket and the following
2639 closing bracket on the same grouping level are taken as the
2640 optional argument. What makes this unintuitive is the fact that
2641 the square brackets aren’t grouping characters themselves, so in
2642 your last example item
{[}{[}…
{]}{]} the optional argument consists of
2643 {[}… (without the closing bracket).
2646 Compare the items in the following lists:
2651 \item {[}bracketed
{]} item
2655 \item[{simple
}] \leavevmode
2658 \item[{{[}bracketed
{]}}] \leavevmode
2663 The OT1 font-encoding has different characters for the less-than,
2664 greater-than and bar, < | >, except for typewriter font
\DUroletitlereference{cmtt
}:
2673 \subsection{3.8 Hyperlinks and -targets
%
2674 \label{hyperlinks-and-targets
}%
2677 In LaTeX, we must set an explicit anchor (
\texttt{\textbackslash{}phantomsection
}) for a
2679 \phantomsection\label{hypertarget-in-plain-text
}hypertarget in plain text or in a figure but not in a longtable or
2682 \setlength{\DUtablewidth}{\linewidth}
2683 \begin{longtable
}[c
]{|p
{0.075\DUtablewidth}|p
{0.075\DUtablewidth}|p
{0.075\DUtablewidth}|
}
2684 \caption{Table with
%
2685 \label{hypertarget-in-table-title
}hypertarget in table title.
}\\
2699 \phantomsection\label{figure-label
}
2700 \noindent\makebox[\linewidth][c
]{\includegraphics{../../../docs/user/rst/images/biohazard.png
}}
2701 \caption{Figure with
%
2702 \label{hypertarget-in-figure-caption
}hypertarget in figure caption.
}
2705 \phantomsection\label{hypertarget-in-figure-legend
}hypertarget in figure legend.
2709 \includegraphics{../../../docs/user/rst/images/biohazard.png
}
2710 \phantomsection\label{image-label
}
2712 See
\hyperref[hypertarget-in-plain-text
]{hypertarget in plain text
},
2713 \hyperref[table-label
]{table label
},
\hyperref[hypertarget-in-table-title
]{hypertarget in table title
},
2714 \hyperref[figure-label
]{figure label
},
\hyperref[hypertarget-in-figure-caption
]{hypertarget in figure caption
},
2715 \hyperref[hypertarget-in-figure-legend
]{hypertarget in figure legend
}, and
2716 \hyperref[image-label
]{image label
}.
2719 \subsection{3.9 External references
%
2720 \label{external-references
}%
2723 Long URLs should be wrapped in the PDF.
2724 This can be achieved with the url command which is used by the LaTeX writer
2725 whenever the content (name) of a reference node equals the link URL.
2728 \item[{Example:
}] \leavevmode
2729 a long URL that should wrap in the output
2730 \url{http://docutils.sourceforge.net/docs/user/latex.html\#id79
}
2734 If the argument contains any “\%”, “\#”, or “
\textasciicircum{}\textasciicircum{}”, or ends with
\texttt{\textbackslash{}}, it can’t
2735 be used in the argument to another command. The argument must not contain
2738 The characters
\textasciicircum{}, \
{, \
}, and
\texttt{\textbackslash{}} are invalid in a “http:” or “ftp:” URL
2739 and not recognized as part of it:
2741 \begin{DUlineblock
}{0em
}
2742 \item[] \url{http://www.example.org
}/strange
\textasciicircum{}\textasciicircum{}name
2743 \item[] \url{http://www.example.org
}\textbackslash{}using
\textbackslash{}DOS
\textbackslash{}paths
\textbackslash{}
2744 \item[] \url{http://www.example.org/XML
}/strange\
{n\
}ame
2747 They can, however be used in paths and/or filenames.
2749 Handling by the LaTeX writer:
2752 \item \texttt{\#
},
\texttt{\textbackslash{}} and
\texttt{\%
} are escaped:
2754 \begin{DUlineblock
}{0em
}
2755 \item[] \href{http://www.w3.org/XML/Schema\#dev
}{URL with \#
}
2756 \url{http://www.w3.org/XML/Schema\#dev
}
2757 \item[] \href{http://www.w3.org/XML/Schema\%dev
}{URL with \%
}
2758 \url{http://example.org/Schema\%dev
}
2759 \item[] \href{A:DOS\
\path\\
}{file with DOS path
}\DUfootnotemark{id44
}{id43
}{10} \url{A:DOS\
\path\\
}\DUfootnotemark{id45
}{id43
}{10}
2762 \DUadmonition[note
]{
2763 \DUtitle[note
]{Note
}
2765 These URLs are typeset inside a LaTeX command without error.
2767 \begin{DUlineblock
}{0em
}
2768 \item[] \url{http://www.w3.org/XML/Schema\#dev
}
2769 \item[] \url{http://example.org/Schema\%dev
}
2770 \item[] \url{A:DOS\
\path\\
}\DUfootnotemark{id46
}{id43
}{10}
2776 \item \textasciicircum{}\textasciicircum{} LaTeX’s special syntax for characters results in “strange” replacements
2777 (both with href and url). A warning is given.
2779 \href{../strange^^name
}{file with
\textasciicircum{}\textasciicircum{}}:
2780 \url{../strange^^name
}
2782 \item Unbalanced braces, \
{ or \
}, will fail (both with href and url):
2786 `file with \
{ <../strange\
{name>`__
2787 `<../strange\
{name>`__
2791 while balanced braces are suported:
2793 \begin{DUlineblock
}{0em
}
2794 \item[] \url{../strange
{n
}ame
}
2795 \item[] \url{../st
{r
}ange
{n
}ame
}
2796 \item[] \url{../
{st
{r
}ange
{n
}ame
}}
2801 \subsection{3.10 Section titles with
\hyperref[inline-markup
]{inline markup
}%
2802 \label{section-titles-with-inline-markup
}%
2806 \subsubsection{3.10.1 \emph{emphasized
}, H
\textsubscript{2}O and $x^
2$
%
2807 \label{emphasized-h2o-and-x-
2}%
2811 \subsubsection{3.10.2 Substitutions work
%
2812 \label{substitutions-fail
}%
2816 \subsection{3.11 Deeply nested sections
%
2817 \label{deeply-nested-sections
}%
2823 \subsubsection{3.11.1 Level
3%
2830 \paragraph{3.11.1.1 level
4%
2837 \subparagraph{3.11.1.1.1 level
5%
2841 (depending on the
document class)
2844 \DUtitle[sectionVI
]{3.11.1.1.1.1 level
6%
2848 an unsupported level.
2851 \section{4 Tests for the XeTeX writer
%
2852 \label{tests-for-the-xetex-writer
}%
2855 With XeTeX, you can typeset text in any language/script supported by
2856 Unicode and the selected font, e.g. Azərbaycanca, Bân-lâm-gú, Башҡорт
2857 Беларуская, Български, Català, Чӑвашла, Česky, Ελληνικά, Español,
2858 Français, Føroyskt, Хальмг, Íslenska, עברית , Қазақша, Kurdî,
2859 Latviešu, Lietuvių, Македонски, Монгол, Nāhuatl, Português, Română,
2860 Русский, Slovenščina, Српски, Türkçe, Українська, Tiếng Việt, Volapük,
2861 Võro, ייִדיש , Žemaitėška.
2862 Currently, there is extended support for
28 languages in the
2863 \href{http://ctan.org/pkg/polyglossia
}{polyglossia
}\DUfootnotemark{id39
}{id38
}{8} package.
2868 \section{5 Error Handling
%
2869 \label{error-handling
}%
2872 Any errors caught during processing will generate system messages.
2874 There should be five messages in the following, auto-generated
2875 section, “Docutils System Messages”:
2877 % section should be added by Docutils automatically
2880 \section[Docutils System Messages
]{\color{red
}Docutils System Messages
%
2883 \DUadmonition[system-message
]{
2884 \DUtitle[system-message
]{system-message
}
2885 \raisebox{1em
}{\hypertarget{id27
}{}}
2887 {\color{red
}ERROR/
3} in
\texttt{functional/input/data/standard.txt
}, line~
104
2890 Undefined substitution referenced:
\textquotedbl{}problematic
\textquotedbl{}.
2893 \DUadmonition[system-message
]{
2894 \DUtitle[system-message
]{system-message
}
2895 \raisebox{1em
}{\hypertarget{id47
}{}}
2897 {\color{red
}ERROR/
3} in
\texttt{functional/input/data/standard.txt
}, line~
391
2900 Unknown target name:
\textquotedbl{}5\textquotedbl{}.
2903 \DUadmonition[system-message
]{
2904 \DUtitle[system-message
]{system-message
}
2905 \raisebox{1em
}{\hypertarget{id48
}{}}
2907 {\color{red
}ERROR/
3} in
\texttt{functional/input/data/standard.txt
}, line~
400
2910 Unknown target name:
\textquotedbl{}nonexistent
\textquotedbl{}.
2913 \DUadmonition[system-message
]{
2914 \DUtitle[system-message
]{system-message
}
2915 \raisebox{1em
}{\hypertarget{id49
}{}}
2917 {\color{red
}ERROR/
3} in
\texttt{functional/input/data/standard.txt
}, line~
427
2920 Unknown target name:
\textquotedbl{}hyperlink reference without a target
\textquotedbl{}.
2923 \DUadmonition[system-message
]{
2924 \DUtitle[system-message
]{system-message
}
2925 \raisebox{1em
}{\hypertarget{id51
}{}}
2927 {\color{red
}ERROR/
3} in
\texttt{functional/input/data/standard.txt
}, line~
440
2930 Duplicate target name, cannot be used as a unique reference:
\textquotedbl{}duplicate target names
\textquotedbl{}.