"code" option of the "include" directive, tests
[docutils.git] / test / functional / expected / standalone_rst_xetex.tex
blobc3d35cb97ab188b706342cce4ea3bd0cf6beba0a
1 \documentclass[a4paper]{article}
2 % generated by Docutils <http://docutils.sourceforge.net/>
3 % rubber: set program xelatex
4 \usepackage[no-sscript]{xltxtra} % loads fixltx2e, metalogo, xunicode, fontspec
5 \defaultfontfeatures{Scale=MatchLowercase}
6 \usepackage{ifthen}
7 \usepackage{amsmath}
8 \usepackage{polyglossia}
9 \setdefaultlanguage{english}
10 \setotherlanguages{german,british,french}
11 \usepackage{color}
12 \usepackage{float} % float configuration
13 \floatplacement{figure}{H} % place figures here definitely
14 \usepackage{graphicx}
15 \usepackage{multirow}
16 \usepackage{longtable,ltcaption,array}
17 \setlength{\extrarowheight}{2pt}
18 \newlength{\DUtablewidth} % internal use in tables
19 \usepackage{tabularx}
21 %%% Custom LaTeX preamble
22 % Linux Libertine (free, wide coverage, not only for Linux)
23 \setmainfont{Linux Libertine O}
24 \setsansfont{Linux Biolinum O}
25 \setmonofont[HyphenChar=None]{DejaVu Sans Mono}
27 %%% User specified packages and stylesheets
29 %%% Fallback definitions for Docutils-specific commands
31 % providelength (provide a length variable and set default, if it is new)
32 \providecommand*{\DUprovidelength}[2]{
33 \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
36 % abstract title
37 \providecommand*{\DUtitleabstract}[1]{\centerline{\textbf{#1}}}
39 % admonition (specially marked topic)
40 \providecommand{\DUadmonition}[2][class-arg]{%
41 % try \DUadmonition#1{#2}:
42 \ifcsname DUadmonition#1\endcsname%
43 \csname DUadmonition#1\endcsname{#2}%
44 \else
45 \begin{center}
46 \fbox{\parbox{0.9\textwidth}{#2}}
47 \end{center}
48 \fi
51 \makeatletter
52 \@namedef{DUrolealign-center}{\centering}
53 \makeatother
56 % dedication topic
57 \providecommand{\DUtopicdedication}[1]{\begin{center}#1\end{center}}
59 % docinfo (width of docinfo table)
60 \DUprovidelength{\DUdocinfowidth}{0.9\textwidth}
62 % error admonition title
63 \providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}}
65 % fieldlist environment
66 \ifthenelse{\isundefined{\DUfieldlist}}{
67 \newenvironment{DUfieldlist}%
68 {\quote\description}
69 {\enddescription\endquote}
70 }{}
71 % numeric or symbol footnotes with hyperlinks
72 \providecommand*{\DUfootnotemark}[3]{%
73 \raisebox{1em}{\hypertarget{#1}{}}%
74 \hyperlink{#2}{\textsuperscript{#3}}%
76 \providecommand{\DUfootnotetext}[4]{%
77 \begingroup%
78 \renewcommand{\thefootnote}{%
79 \protect\raisebox{1em}{\protect\hypertarget{#1}{}}%
80 \protect\hyperlink{#2}{#3}}%
81 \footnotetext{#4}%
82 \endgroup%
85 % inline markup (custom roles)
86 % \DUrole{#1}{#2} tries \DUrole#1{#2}
87 \providecommand*{\DUrole}[2]{%
88 \ifcsname DUrole#1\endcsname%
89 \csname DUrole#1\endcsname{#2}%
90 \else% backwards compatibility: try \docutilsrole#1{#2}
91 \ifcsname docutilsrole#1\endcsname%
92 \csname docutilsrole#1\endcsname{#2}%
93 \else%
94 #2%
95 \fi%
96 \fi%
99 % legend environment
100 \ifthenelse{\isundefined{\DUlegend}}{
101 \newenvironment{DUlegend}{\small}{}
104 % lineblock environment
105 \DUprovidelength{\DUlineblockindent}{2.5em}
106 \ifthenelse{\isundefined{\DUlineblock}}{
107 \newenvironment{DUlineblock}[1]{%
108 \list{}{\setlength{\partopsep}{\parskip}
109 \addtolength{\partopsep}{\baselineskip}
110 \setlength{\topsep}{0pt}
111 \setlength{\itemsep}{0.15\baselineskip}
112 \setlength{\parsep}{0pt}
113 \setlength{\leftmargin}{#1}}
114 \raggedright
116 {\endlist}
119 % optionlist environment
120 \providecommand*{\DUoptionlistlabel}[1]{\bf #1 \hfill}
121 \DUprovidelength{\DUoptionlistindent}{3cm}
122 \ifthenelse{\isundefined{\DUoptionlist}}{
123 \newenvironment{DUoptionlist}{%
124 \list{}{\setlength{\labelwidth}{\DUoptionlistindent}
125 \setlength{\rightmargin}{1cm}
126 \setlength{\leftmargin}{\rightmargin}
127 \addtolength{\leftmargin}{\labelwidth}
128 \addtolength{\leftmargin}{\labelsep}
129 \renewcommand{\makelabel}{\DUoptionlistlabel}}
131 {\endlist}
134 \DUprovidelength{\pdfpxdimen}{1bp}
137 % rubric (informal heading)
138 \providecommand*{\DUrubric}[2][class-arg]{%
139 \subsubsection*{\centering\textit{\textmd{#2}}}}
141 % sidebar (text outside the main text flow)
142 \providecommand{\DUsidebar}[2][class-arg]{%
143 \begin{center}
144 \colorbox[gray]{0.80}{\parbox{0.9\textwidth}{#2}}
145 \end{center}
148 % subtitle (for topic/sidebar)
149 \providecommand*{\DUsubtitle}[2][class-arg]{\par\emph{#2}\smallskip}
151 % title for topics, admonitions and sidebar
152 \providecommand*{\DUtitle}[2][class-arg]{%
153 % call \DUtitle#1{#2} if it exists:
154 \ifcsname DUtitle#1\endcsname%
155 \csname DUtitle#1\endcsname{#2}%
156 \else
157 \smallskip\noindent\textbf{#2}\smallskip%
161 % titlereference role
162 \providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
164 % topic (quote with heading)
165 \providecommand{\DUtopic}[2][class-arg]{%
166 \ifcsname DUtopic#1\endcsname%
167 \csname DUtopic#1\endcsname{#2}%
168 \else
169 \begin{quote}#2\end{quote}
173 % transition (break, fancybreak, anonymous section)
174 \providecommand*{\DUtransition}[1][class-arg]{%
175 \hspace*{\fill}\hrulefill\hspace*{\fill}
176 \vskip 0.5\baselineskip
179 % hyperlinks:
180 \ifthenelse{\isundefined{\hypersetup}}{
181 \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
182 \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
184 \hypersetup{
185 pdftitle={reStructuredText Test Document},
186 pdfauthor={David Goodger;Me;Myself;I}
189 %%% Title Data
190 \title{\phantomsection%
191 reStructuredText Test Document%
192 \label{restructuredtext-test-document}%
193 \label{doctitle}%
194 \\ % subtitle%
195 \large{Examples of Syntax Constructs}%
196 \label{examples-of-syntax-constructs}%
197 \label{subtitle}}
198 \author{}
199 \date{}
201 %%% Body
202 \begin{document}
203 \maketitle
205 % Docinfo
206 \begin{center}
207 \begin{tabularx}{\DUdocinfowidth}{lX}
208 \textbf{Author}: &
209 David Goodger \\
210 \textbf{Address}: &
211 {\raggedright
212 123 Example Street\\
213 Example, EX Canada\\
214 A1B 2C3 } \\
215 \textbf{Contact}: &
216 \href{mailto:goodger@python.org}{goodger@python.org} \\
217 \textbf{Author}: &
218 Me \\
219 \textbf{Author}: &
220 Myself \\
221 \textbf{Author}: &
222 I \\
223 \textbf{Organization}: &
224 humankind \\
225 \textbf{Date}: &
226 Now, or yesterday. Or maybe even \emph{before} yesterday. \\
227 \textbf{Status}: &
228 This is a "work in progress" \\
229 \textbf{Revision}: &
230 is managed by a version control system. \\
231 \textbf{Version}: &
232 1 \\
233 \textbf{Copyright}: &
234 This document has been placed in the public domain. You
235 may do with it as you wish. You may copy, modify,
236 redistribute, reattribute, sell, buy, rent, lease,
237 destroy, or improve it, quote it at length, excerpt,
238 incorporate, collate, fold, staple, or mutilate it, or do
239 anything else to it that your or anyone else's heart
240 desires. \\
241 \textbf{field name}: &
242 This is a "generic bibliographic field".
244 \textbf{field name "2"}: &
245 Generic bibliographic fields may contain multiple body elements.
247 Like this.
249 \end{tabularx}
250 \end{center}
252 \DUtopic[dedication]{
253 \DUtitle[dedication]{Dedication}
255 For Docutils users \& co-developers.
258 \DUtopic[abstract]{
259 \DUtitle[abstract]{Abstract}
261 This is a test document, containing at least one example of each
262 reStructuredText construct.
265 % This is a comment. Note how any initial comments are moved by
266 % transforms to after the document title, subtitle, and docinfo.
268 % Above is the document title, and below is the subtitle.
269 % They are transformed from section titles after parsing.
271 % bibliographic fields (which also require a transform):
273 \pagebreak[4] % start ToC on new page
275 \phantomsection\label{table-of-contents}
276 \pdfbookmark[1]{Table of Contents}{table-of-contents}
277 \renewcommand{\contentsname}{Table of Contents}
278 \tableofcontents
282 %___________________________________________________________________________
284 \section*{\phantomsection%
285 1   Structural Elements%
286 \addcontentsline{toc}{section}{1   Structural Elements}%
287 \label{structural-elements}%
291 %___________________________________________________________________________
293 \subsection*{\phantomsection%
294 1.1   Section Title%
295 \addcontentsline{toc}{subsection}{1.1   Section Title}%
296 \label{section-title}%
298 \subsubsection*{Section Subtitle}
300 Lone subsections are converted to a section subtitle by a transform
301 activated with the \texttt{--section-subtitles} command line option or the
302 \texttt{sectsubtitle-xform} configuration value.
305 %___________________________________________________________________________
307 \subsection*{\phantomsection%
308 1.2   Empty Section%
309 \addcontentsline{toc}{subsection}{1.2   Empty Section}%
310 \label{empty-section}%
314 %___________________________________________________________________________
316 \subsection*{\phantomsection%
317 1.3   Transitions%
318 \addcontentsline{toc}{subsection}{1.3   Transitions}%
319 \label{transitions}%
322 Here's a transition:
325 %___________________________________________________________________________
326 \DUtransition
329 It divides the section. Transitions may also occur between sections:
332 %___________________________________________________________________________
333 \DUtransition
337 %___________________________________________________________________________
339 \section*{\phantomsection%
340 2   Body Elements%
341 \addcontentsline{toc}{section}{2   Body Elements}%
342 \label{body-elements}%
346 %___________________________________________________________________________
348 \subsection*{\phantomsection%
349 2.1   Paragraphs%
350 \addcontentsline{toc}{subsection}{2.1   Paragraphs}%
351 \label{paragraphs}%
354 A paragraph.
357 %___________________________________________________________________________
359 \subsubsection*{\phantomsection%
360 2.1.1   Inline Markup%
361 \addcontentsline{toc}{subsubsection}{2.1.1   Inline Markup}%
362 \label{inline-markup}%
365 Paragraphs contain text and may contain inline markup: \emph{emphasis},
366 \textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks
367 (\url{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\DUfootnotemark{id30}{id29}{5}), internal
368 cross-references (\hyperref[example]{example}), external hyperlinks with embedded URIs
369 (\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink
370 references}\DUfootnotemark{id37}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id39}{id38}{8}), footnote references (manually
371 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]}),
372 substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and %
373 \phantomsection\label{inline-hyperlink-targets}inline hyperlink targets
374 (see \hyperref[targets]{Targets} below for a reference back to here). Character-level
375 inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by %
376 \raisebox{1em}{\hypertarget{id28}{}}\hyperlink{id27}{\textbf{\color{red}|problematic|}} text
377 (generated by processing errors; this one is intentional). Here is a
378 reference to the \hyperref[doctitle]{doctitle} and the \hyperref[subtitle]{subtitle}.
380 The default role for interpreted text is \DUroletitlereference{Title Reference}. Here are
381 some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/dev/peps/pep-0287}{PEP 287}); an
382 RFC reference (\href{http://www.faqs.org/rfcs/rfc2822.html}{RFC 2822}); an abbreviation (\DUrole{abbreviation}{abb.}), an acronym
383 (\DUrole{acronym}{reST}), code (\texttt{\DUrole{code}{print "hello world"}}); a \textsubscript{subscript};
384 a \textsuperscript{superscript} and explicit roles for \DUroletitlereference{Docutils}'
385 \emph{standard} \textbf{inline} \texttt{markup}.
387 % DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
389 Let's test wrapping and whitespace significance in inline literals:
390 \texttt{This is an example of --inline-literal --text, --including some--
391 strangely--hyphenated-words. ~Adjust-the-width-of-your-browser-window
392 to see how the text is wrapped. ~-- ---- -------- ~Now note ~ ~the
393 spacing ~ ~between the ~ ~words of ~ ~this sentence ~ ~(words
394 should ~ ~be grouped ~ ~in pairs).}
396 If the \texttt{--pep-references} option was supplied, there should be a
397 live link to PEP 258 here.
400 %___________________________________________________________________________
402 \subsection*{\phantomsection%
403 2.2   Bullet Lists%
404 \addcontentsline{toc}{subsection}{2.2   Bullet Lists}%
405 \label{bullet-lists}%
408 \begin{itemize}
410 \item A bullet list
412 \begin{itemize}
414 \item Nested bullet list.
416 \item Nested item 2.
418 \end{itemize}
420 \item Item 2.
422 Paragraph 2 of item 2.
424 \begin{itemize}
426 \item Nested bullet list.
428 \item Nested item 2.
430 \begin{itemize}
432 \item Third level.
434 \item Item 2.
436 \end{itemize}
438 \item Nested item 3.
440 \item This nested list should be compacted by the HTML writer.
442 \phantomsection\label{target}
443 % Even if this item contains a target and a comment.
445 \end{itemize}
447 \end{itemize}
450 %___________________________________________________________________________
452 \subsection*{\phantomsection%
453 2.3   Enumerated Lists%
454 \addcontentsline{toc}{subsection}{2.3   Enumerated Lists}%
455 \label{enumerated-lists}%
457 \newcounter{listcnt0}
458 \begin{list}{\arabic{listcnt0}.}
460 \usecounter{listcnt0}
461 \setlength{\rightmargin}{\leftmargin}
464 \item Arabic numerals.
465 \newcounter{listcnt1}
466 \begin{list}{\alph{listcnt1})}
468 \usecounter{listcnt1}
469 \setlength{\rightmargin}{\leftmargin}
472 \item lower alpha)
473 \newcounter{listcnt2}
474 \begin{list}{(\roman{listcnt2})}
476 \usecounter{listcnt2}
477 \setlength{\rightmargin}{\leftmargin}
480 \item (lower roman)
481 \newcounter{listcnt3}
482 \begin{list}{\Alph{listcnt3}.}
484 \usecounter{listcnt3}
485 \setlength{\rightmargin}{\leftmargin}
488 \item upper alpha.
489 \newcounter{listcnt4}
490 \begin{list}{\Roman{listcnt4})}
492 \usecounter{listcnt4}
493 \setlength{\rightmargin}{\leftmargin}
496 \item upper roman)
497 \end{list}
498 \end{list}
499 \end{list}
500 \end{list}
502 \item Lists that don't start at 1:
503 \setcounter{listcnt1}{0}
504 \begin{list}{\arabic{listcnt1}.}
506 \usecounter{listcnt1}
507 \addtocounter{listcnt1}{2}
508 \setlength{\rightmargin}{\leftmargin}
511 \item Three
513 \item Four
514 \end{list}
515 \setcounter{listcnt1}{0}
516 \begin{list}{\Alph{listcnt1}.}
518 \usecounter{listcnt1}
519 \addtocounter{listcnt1}{2}
520 \setlength{\rightmargin}{\leftmargin}
523 \item C
525 \item D
526 \end{list}
527 \setcounter{listcnt1}{0}
528 \begin{list}{\roman{listcnt1}.}
530 \usecounter{listcnt1}
531 \addtocounter{listcnt1}{2}
532 \setlength{\rightmargin}{\leftmargin}
535 \item iii
537 \item iv
538 \end{list}
539 \end{list}
542 %___________________________________________________________________________
544 \subsection*{\phantomsection%
545 2.4   Definition Lists%
546 \addcontentsline{toc}{subsection}{2.4   Definition Lists}%
547 \label{definition-lists}%
550 \begin{description}
551 \item[{Term}] \leavevmode
552 Definition
554 \item[{Term}] \leavevmode (\textbf{classifier})
556 Definition paragraph 1.
558 Definition paragraph 2.
560 \item[{Term}] \leavevmode
561 Definition
563 \item[{Term}] \leavevmode (\textbf{classifier one})
564 (\textbf{classifier two})
566 Definition
568 \end{description}
571 %___________________________________________________________________________
573 \subsection*{\phantomsection%
574 2.5   Field Lists%
575 \addcontentsline{toc}{subsection}{2.5   Field Lists}%
576 \label{field-lists}%
579 \begin{DUfieldlist}
580 \item[{what:}]
581 Field lists map field names to field bodies, like database
582 records. They are often part of an extension syntax. They are
583 an unambiguous variant of RFC 2822 fields.
585 \item[{how arg1 arg2:}]
586 The field marker is a colon, the field name, and a colon.
588 The field body may contain one or more body elements, indented
589 relative to the field marker.
591 \item[{credits:}]
592 \DUrole{credits}{This paragraph has the \DUroletitlereference{credits} class set. (This is actually not
593 about credits but just for ensuring that the class attribute
594 doesn't get stripped away.)}
596 \end{DUfieldlist}
599 %___________________________________________________________________________
601 \subsection*{\phantomsection%
602 2.6   Option Lists%
603 \addcontentsline{toc}{subsection}{2.6   Option Lists}%
604 \label{option-lists}%
607 For listing command-line options:
609 \begin{DUoptionlist}
611 \item[-a] command-line option "a"
613 \item[-b file] options can have arguments
614 and long descriptions
616 \item[--long] options can be long also
618 \item[--input=file] long options can also have
619 arguments
621 \item[--very-long-option] The description can also start on the next line.
623 The description may contain multiple body elements,
624 regardless of where it starts.
626 \item[-x, -y, -z] Multiple options are an "option group".
628 \item[-v, --verbose] Commonly-seen: short \& long options.
630 \item[-1 file, --one=file, --two file] Multiple options with arguments.
632 \item[/V] DOS/VMS-style options too
634 \end{DUoptionlist}
636 There must be at least two spaces between the option and the
637 description.
640 %___________________________________________________________________________
642 \subsection*{\phantomsection%
643 2.7   Literal Blocks%
644 \addcontentsline{toc}{subsection}{2.7   Literal Blocks}%
645 \label{literal-blocks}%
648 Literal blocks are indicated with a double-colon ("::") at the end of
649 the preceding paragraph (over there \texttt{-->}). They can be indented:
651 \begin{quote}{\ttfamily \raggedright \noindent
652 if~literal\_block:\\
653 ~~~~text~=~'is~left~as-is'\\
654 ~~~~spaces\_and\_linebreaks~=~'are~preserved'\\
655 ~~~~markup\_processing~=~None
657 \end{quote}
659 Or they can be quoted without indentation:
661 \begin{quote}{\ttfamily \raggedright \noindent
662 >>~Great~idea!\\
664 >~Why~didn't~I~think~of~that?
666 \end{quote}
669 %___________________________________________________________________________
671 \subsection*{\phantomsection%
672 2.8   Line Blocks%
673 \addcontentsline{toc}{subsection}{2.8   Line Blocks}%
674 \label{line-blocks}%
677 This section tests line blocks. Line blocks are body elements which
678 consist of lines and other line blocks. Nested line blocks cause
679 indentation.
681 \begin{DUlineblock}{0em}
682 \item[] This is a line block. It ends with a blank line.
683 \item[]
684 \begin{DUlineblock}{\DUlineblockindent}
685 \item[] New lines begin with a vertical bar ("|").
686 \item[] Line breaks and initial indent are significant, and preserved.
687 \item[]
688 \begin{DUlineblock}{\DUlineblockindent}
689 \item[] Continuation lines are also possible. A long line that is intended
690 to wrap should begin with a space in place of the vertical bar.
691 \end{DUlineblock}
692 \item[] The left edge of a continuation line need not be aligned with
693 the left edge of the text above it.
694 \end{DUlineblock}
695 \end{DUlineblock}
697 \begin{DUlineblock}{0em}
698 \item[] This is a second line block.
699 \item[]
700 \item[] Blank lines are permitted internally, but they must begin with a "|".
701 \end{DUlineblock}
703 Another line block, surrounded by paragraphs:
705 \begin{DUlineblock}{0em}
706 \item[] And it's no good waiting by the window
707 \item[] It's no good waiting for the sun
708 \item[] Please believe me, the things you dream of
709 \item[] They don't fall in the lap of no-one
710 \end{DUlineblock}
712 Take it away, Eric the Orchestra Leader!
714 \begin{quote}
716 \begin{DUlineblock}{0em}
717 \item[] A one, two, a one two three four
718 \item[]
719 \item[] Half a bee, philosophically,
720 \item[]
721 \begin{DUlineblock}{\DUlineblockindent}
722 \item[] must, \emph{ipso facto}, half not be.
723 \end{DUlineblock}
724 \item[] But half the bee has got to be,
725 \item[]
726 \begin{DUlineblock}{\DUlineblockindent}
727 \item[] \emph{vis a vis} its entity. D'you see?
728 \item[]
729 \end{DUlineblock}
730 \item[] But can a bee be said to be
731 \item[]
732 \begin{DUlineblock}{\DUlineblockindent}
733 \item[] or not to be an entire bee,
734 \item[]
735 \begin{DUlineblock}{\DUlineblockindent}
736 \item[] when half the bee is not a bee,
737 \item[]
738 \begin{DUlineblock}{\DUlineblockindent}
739 \item[] due to some ancient injury?
740 \item[]
741 \end{DUlineblock}
742 \end{DUlineblock}
743 \end{DUlineblock}
744 \item[] Singing...
745 \end{DUlineblock}
747 \end{quote}
749 A line block, like the following poem by Christian Morgenstern, can
750 also be centre-aligned:
752 \begin{DUlineblock}{0em}
753 \otherlanguage{german}{\DUrole{align-center}{
754 \item[] \textbf{Die Trichter}
755 \item[]
756 \item[] Zwei Trichter wandeln durch die Nacht.
757 \item[] Durch ihres Rumpfs verengten Schacht
758 \item[] fließt weißes Mondlicht
759 \item[] still und heiter
760 \item[] auf   ihren
761 \item[] Waldweg
762 \item[] u. s.
763 \item[] w.
764 \item[]
766 \end{DUlineblock}
769 %___________________________________________________________________________
771 \subsection*{\phantomsection%
772 2.9   Block Quotes%
773 \addcontentsline{toc}{subsection}{2.9   Block Quotes}%
774 \label{block-quotes}%
777 Block quotes consist of indented body elements:
779 \begin{quote}
781 My theory by A. Elk. Brackets Miss, brackets. This theory goes
782 as follows and begins now. All brontosauruses are thin at one
783 end, much much thicker in the middle and then thin again at the
784 far end. That is my theory, it is mine, and belongs to me and I
785 own it, and what it is too.
786 \nopagebreak
788 \raggedleft —Anne Elk (Miss)
790 \end{quote}
792 The language of a quote (like any other object) can be specified by
793 a class attribute:
797 \begin{quote}
798 \otherlanguage{french}{
799 ReStructuredText est un langage de balisage léger utilisé
800 notamment dans la documentation du langage Python.
802 \end{quote}
805 %___________________________________________________________________________
807 \subsection*{\phantomsection%
808 2.10   Doctest Blocks%
809 \addcontentsline{toc}{subsection}{2.10   Doctest Blocks}%
810 \label{doctest-blocks}%
813 \begin{quote}{\ttfamily \raggedright \noindent
814 >>>~print~'Python-specific~usage~examples;~begun~with~">>>"'\\
815 Python-specific~usage~examples;~begun~with~">>>"\\
816 >>>~print~'(cut~and~pasted~from~interactive~Python~sessions)'\\
817 (cut~and~pasted~from~interactive~Python~sessions)
819 \end{quote}
822 %___________________________________________________________________________
824 \subsection*{\phantomsection%
825 2.11   Footnotes%
826 \addcontentsline{toc}{subsection}{2.11   Footnotes}%
827 \label{footnotes}%
830 \DUfootnotetext{id8}{id1}{1}{%
831 A footnote contains body elements, consistently indented by at
832 least 3 spaces.
834 This is the footnote's second paragraph.
837 \DUfootnotetext{label}{id3}{2}{\phantomsection\label{label}%
838 Footnotes may be numbered, either manually (as in\DUfootnotemark{id9}{id8}{1}) or
839 automatically using a "\#"-prefixed label. This footnote has a
840 label so it can be referred to from multiple places, both as a
841 footnote reference (\DUfootnotemark{id10}{label}{2}) and as a \hyperref[label]{hyperlink reference}.
844 \DUfootnotetext{id12}{id2}{3}{%
845 This footnote is numbered automatically and anonymously using a
846 label of "\#" only.
848 This is the second paragraph.
850 And this is the third paragraph.
853 \DUfootnotetext{id13}{id4}{*}{%
854 Footnotes may also use symbols, specified with a "*" label.
855 Here's a reference to the next footnote:\DUfootnotemark{id14}{id15}{}.
858 \DUfootnotetext{id15}{id14}{}{%
859 This footnote shows the next symbol in the sequence.
862 \DUfootnotetext{id16}{id16}{4}{%
863 Here's an unreferenced footnote, with a reference to a
864 nonexistent footnote:%
865 \raisebox{1em}{\hypertarget{id45}{}}%
866 \raisebox{1em}{\hypertarget{id17}{}}\hyperlink{id44}{\textbf{\color{red}{[}5{]}\_}}.
870 %___________________________________________________________________________
872 \subsection*{\phantomsection%
873 2.12   Citations%
874 \addcontentsline{toc}{subsection}{2.12   Citations}%
875 \label{citations}%
877 \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
878 Citations are text-labeled footnotes. They may be
879 rendered separately and differently from footnotes.
880 \end{figure}
882 Here's a reference to the above, \hyperlink{cit2002}{[CIT2002]}, and a %
883 \raisebox{1em}{\hypertarget{id47}{}}%
884 \raisebox{1em}{\hypertarget{id19}{}}\hyperlink{id46}{\textbf{\color{red}{[}nonexistent{]}\_}}
885 citation.
888 %___________________________________________________________________________
890 \subsection*{\phantomsection%
891 2.13   Targets%
892 \addcontentsline{toc}{subsection}{2.13   Targets}%
893 \label{targets}%
894 \label{another-target}%
897 \phantomsection\label{example}
898 This paragraph is pointed to by the explicit "example" target. A
899 reference can be found under \hyperref[inline-markup]{Inline Markup}, above. \hyperref[inline-hyperlink-targets]{Inline
900 hyperlink targets} are also possible.
902 Section headers are implicit targets, referred to by name. See
903 \hyperref[targets]{Targets}, which is a subsection of \hyperref[body-elements]{Body Elements}.
905 Explicit external targets are interpolated into references such as
906 "\href{http://www.python.org/}{Python}\DUfootnotemark{id31}{id29}{5}".
908 Targets may be indirect and anonymous. Thus \hyperref[targets]{this phrase} may also
909 refer to the \hyperref[targets]{Targets} section.
911 Here's a %
912 \raisebox{1em}{\hypertarget{id49}{}}\hyperlink{id48}{\textbf{\color{red}`hyperlink reference without a target`\_}}, which generates an
913 error.
916 %___________________________________________________________________________
918 \subsubsection*{\phantomsection%
919 2.13.1   Duplicate Target Names%
920 \addcontentsline{toc}{subsubsection}{2.13.1   Duplicate Target Names}%
921 \label{duplicate-target-names}%
924 Duplicate names in section headers or other implicit targets will
925 generate "info" (level-1) system messages. Duplicate names in
926 explicit targets will generate "warning" (level-2) system messages.
929 %___________________________________________________________________________
931 \subsubsection*{\phantomsection%
932 2.13.2   Duplicate Target Names%
933 \addcontentsline{toc}{subsubsection}{2.13.2   Duplicate Target Names}%
934 \label{id21}%
937 Since there are two "Duplicate Target Names" section headers, we
938 cannot uniquely refer to either of them by name. If we try to (like
939 this: %
940 \raisebox{1em}{\hypertarget{id51}{}}\hyperlink{id50}{\textbf{\color{red}`Duplicate Target Names`\_}}), an error is generated.
943 %___________________________________________________________________________
945 \subsection*{\phantomsection%
946 2.14   Directives%
947 \addcontentsline{toc}{subsection}{2.14   Directives}%
948 \label{directives}%
951 \phantomsection\label{contents}
952 These are just a sample of the many reStructuredText Directives. For
953 others, please see
954 \url{http://docutils.sourceforge.net/docs/ref/rst/directives.html}.
957 %___________________________________________________________________________
959 \subsubsection*{\phantomsection%
960 2.14.1   Document Parts%
961 \addcontentsline{toc}{subsubsection}{2.14.1   Document Parts}%
962 \label{document-parts}%
965 An example of the "contents" directive can be seen above this section
966 (a local, untitled table of \hyperref[contents]{contents}) and at the beginning of the
967 document (a document-wide \hyperref[table-of-contents]{table of contents}).
970 %___________________________________________________________________________
972 \subsubsection*{\phantomsection%
973 2.14.2   Images and Figures%
974 \addcontentsline{toc}{subsubsection}{2.14.2   Images and Figures}%
975 \label{images-and-figures}%
978 An image directive (also clickable -- a hyperlink reference):
980 \hyperref[directives]{\includegraphics{../../../docs/user/rst/images/title.png}}
982 Image with multiple IDs:
984 \includegraphics{../../../docs/user/rst/images/title.png}
985 \phantomsection\label{image-target-3}\label{image-target-2}\label{image-target-1}
987 A centered image:
989 \noindent\makebox[\textwidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
991 A left-aligned image:
993 \noindent{\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill}
995 This paragraph might flow around the image.
996 The specific behavior depends upon the style sheet and
997 the browser or rendering software used.
999 A right-aligned image:
1001 \noindent{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}}
1003 This paragraph might flow around the image.
1004 The specific behavior depends upon the style sheet and
1005 the browser or rendering software used.
1007 For inline images see \hyperref[substitution-definitions]{Substitution Definitions}.
1009 Image size:
1011 An image 2 em wide:
1013 \includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png}
1015 An image 2 em wide and 15 pixel high:
1017 \includegraphics[height=15\pdfpxdimen,width=2em]{../../../docs/user/rst/images/biohazard.png}
1019 An image occupying 50\% of the line width:
1021 \includegraphics[width=0.500\linewidth]{../../../docs/user/rst/images/title.png}
1023 An image 2 cm high:
1025 \includegraphics[height=2cm]{../../../docs/user/rst/images/biohazard.png}
1027 A \emph{figure} is an image with a caption and/or a legend. With page-based output
1028 media, figures might float to a different position if this helps the page
1029 layout.
1030 \begin{figure}
1031 \noindent\makebox[\textwidth][c]{\includegraphics[width=258bp]{../../../docs/user/rst/images/title.png}}
1032 \caption{Plaintext markup syntax and parser system.}
1033 \begin{DUlegend}
1034 \setlength{\DUtablewidth}{\linewidth}
1035 \begin{longtable*}[c]{|p{0.156\DUtablewidth}|p{0.563\DUtablewidth}|}
1036 \hline
1040 Revised, revisited, based on 're' module.
1042 \hline
1044 Structured
1046 Structure-enhanced text, structuredtext.
1048 \hline
1050 Text
1052 Well it is, isn't it?
1054 \hline
1055 \end{longtable*}
1057 This paragraph is also part of the legend.
1058 \end{DUlegend}
1059 \end{figure}
1061 A left-aligned figure:
1062 \begin{figure}
1063 \noindent\makebox[\textwidth][c]{\includegraphics[width=40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png}}
1064 \caption{This is the caption.}
1065 \begin{DUlegend}
1066 This is the legend.
1068 The legend may consist of several paragraphs.
1069 \end{DUlegend}
1070 \end{figure}
1072 This paragraph might flow around the figure.
1074 The specific behavior depends upon the style sheet and the browser or
1075 rendering software used.
1077 A centered figure:
1078 \begin{figure}
1079 \noindent\makebox[\textwidth][c]{\includegraphics[width=40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png}}
1080 \caption{This is the caption.}
1081 \begin{DUlegend}
1082 This is the legend.
1084 The legend may consist of several paragraphs.
1085 \end{DUlegend}
1086 \end{figure}
1088 This paragraph might flow around the figure.
1090 The specific behavior depends upon the style sheet and the browser or
1091 rendering software used.
1093 A right-aligned figure:
1094 \begin{figure}
1095 \noindent\makebox[\textwidth][c]{\includegraphics[width=40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png}}
1096 \caption{This is the caption.}
1097 \begin{DUlegend}
1098 This is the legend.
1100 The legend may consist of several paragraphs.
1101 \end{DUlegend}
1102 \end{figure}
1104 This paragraph might flow around the figure. The specific behavior depends
1105 upon the style sheet and the browser or rendering software used.
1108 %___________________________________________________________________________
1110 \subsubsection*{\phantomsection%
1111 2.14.3   Admonitions%
1112 \addcontentsline{toc}{subsubsection}{2.14.3   Admonitions}%
1113 \label{admonitions}%
1116 \DUadmonition[attention]{
1117 \DUtitle[attention]{Attention!}
1119 Directives at large.
1122 \DUadmonition[caution]{
1123 \DUtitle[caution]{Caution!}
1125 Don't take any wooden nickels.
1128 \DUadmonition[danger]{
1129 \DUtitle[danger]{!DANGER!}
1131 Mad scientist at work!
1134 \DUadmonition[error]{
1135 \DUtitle[error]{Error}
1137 Does not compute.
1140 \DUadmonition[hint]{
1141 \DUtitle[hint]{Hint}
1143 It's bigger than a bread box.
1146 \DUadmonition[important]{
1147 \DUtitle[important]{Important}
1149 \begin{itemize}
1151 \item Wash behind your ears.
1153 \item Clean up your room.
1155 \item Call your mother.
1157 \item Back up your data.
1159 \end{itemize}
1162 \DUadmonition[note]{
1163 \DUtitle[note]{Note}
1165 This is a note.
1168 \DUadmonition[tip]{
1169 \DUtitle[tip]{Tip}
1171 15\% if the service is good.
1174 \DUadmonition[warning]{
1175 \DUtitle[warning]{Warning}
1177 Strong prose may provoke extreme mental exertion.
1178 Reader discretion is strongly advised.
1181 \DUadmonition[admonition-and-by-the-way]{
1182 \DUtitle[admonition-and-by-the-way]{And, by the way...}
1184 You can make up your own admonition too.
1188 %___________________________________________________________________________
1190 \subsubsection*{\phantomsection%
1191 2.14.4   Topics, Sidebars, and Rubrics%
1192 \addcontentsline{toc}{subsubsection}{2.14.4   Topics, Sidebars, and Rubrics}%
1193 \label{topics-sidebars-and-rubrics}%
1196 \emph{Sidebars} are like miniature, parallel documents.
1198 \DUsidebar{
1199 \DUtitle[title]{Sidebar Title}
1201 \DUsubtitle[sidebar]{Optional Subtitle}
1203 This is a sidebar. It is for text outside the flow of the main
1204 text.
1206 \DUrubric{This is a rubric inside a sidebar}
1208 Sidebars often appear beside the main text with a border and a different
1209 background or font color.
1212 A \emph{topic} is like a block quote with a title, or a self-contained section
1213 with no subsections.
1215 \DUtopic[]{
1216 \DUtitle[title]{Topic Title}
1218 This is a topic.
1221 A \emph{rubric} is like an informal heading that doesn't correspond to the
1222 document's structure. It is typically highlighted in red (hence the name).
1224 \DUrubric{This is a rubric}
1226 Topics and rubrics can be used at places where a \hyperref[section-title]{section title} is not
1227 allowed (e.g. inside a directive).
1230 %___________________________________________________________________________
1232 \subsubsection*{\phantomsection%
1233 2.14.5   Target Footnotes%
1234 \addcontentsline{toc}{subsubsection}{2.14.5   Target Footnotes}%
1235 \label{target-footnotes}%
1238 \DUfootnotetext{id29}{id30}{5}{%
1239 \url{http://www.python.org/}
1242 \DUfootnotetext{id33}{id34}{6}{%
1243 \url{http://pygments.org/}
1246 \DUfootnotetext{id35}{id36}{7}{%
1247 \url{http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=polyglossia}
1250 \DUfootnotetext{id38}{id39}{8}{%
1251 \url{http://docutils.sourceforge.net/}
1254 \DUfootnotetext{id40}{id41}{9}{%
1255 \url{A:DOS\\path\\}
1259 %___________________________________________________________________________
1261 \subsubsection*{\phantomsection%
1262 2.14.6   Replacement Text%
1263 \addcontentsline{toc}{subsubsection}{2.14.6   Replacement Text}%
1264 \label{replacement-text}%
1267 I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\DUfootnotemark{id32}{id29}{5}.
1270 %___________________________________________________________________________
1272 \subsubsection*{\phantomsection%
1273 2.14.7   Compound Paragraph%
1274 \addcontentsline{toc}{subsubsection}{2.14.7   Compound Paragraph}%
1275 \label{compound-paragraph}%
1278 Compound 1, paragraph 1.
1280 Compound 1, paragraph 2.
1282 \begin{itemize}
1284 \item Compound 1, list item one.
1286 \item Compound 1, list item two.
1288 \end{itemize}
1290 Another compound statement:
1292 Compound 2, a literal block:
1294 \begin{quote}{\ttfamily \raggedright \noindent
1295 Compound~2,~literal.
1297 \end{quote}
1298 Compound 2, this is a test.
1300 Compound 3, only consisting of one paragraph.
1302 \begin{quote}{\ttfamily \raggedright \noindent
1303 Compound~4.\\
1304 This~one~starts~with~a~literal~block.
1306 \end{quote}
1307 Compound 4, a paragraph.
1309 Now something \emph{really} perverted -- a nested compound block. This is
1310 just to test that it works at all; the results don't have to be
1311 meaningful.
1313 Compound 5, block 1 (a paragraph).
1315 Compound 6, block 2 in compound 5.
1317 Compound 6, another paragraph.
1319 Compound 5, block 3 (a paragraph).
1321 Compound 7, with a table inside:
1323 \setlength{\DUtablewidth}{\linewidth}
1324 \begin{longtable*}[c]{|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|}
1325 \hline
1327 Left cell, first
1328 paragraph.
1330 Left cell, second
1331 paragraph.
1333 Middle cell,
1334 consisting of
1335 exactly one
1336 paragraph.
1338 Right cell.
1340 Paragraph 2.
1342 Paragraph 3.
1344 \hline
1345 \end{longtable*}
1346 Compound 7, a paragraph after the table.
1348 Compound 7, another paragraph.
1351 %___________________________________________________________________________
1353 \subsubsection*{\phantomsection%
1354 2.14.8   Parsed Literal Blocks%
1355 \addcontentsline{toc}{subsubsection}{2.14.8   Parsed Literal Blocks}%
1356 \label{parsed-literal-blocks}%
1359 \begin{quote}{\ttfamily \raggedright \noindent
1360 This~is~a~parsed~literal~block.\\
1361 ~~~~This~line~is~indented.~~The~next~line~is~blank.\\
1363 Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\
1364 text},~footnotes\DUfootnotemark{id22}{id8}{1},~%
1365 \phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
1367 \end{quote}
1370 %___________________________________________________________________________
1372 \subsubsection*{\phantomsection%
1373 2.14.9   Code%
1374 \addcontentsline{toc}{subsubsection}{2.14.9   Code}%
1375 \label{code}%
1378 Blocks of source code can be set with the \DUroletitlereference{code} directive. If the code
1379 language is specified, the content is parsed and tagged by the \href{http://pygments.org/}{Pygments}\DUfootnotemark{id34}{id33}{6}
1380 syntax highlighter and can be formatted with a style sheet. (Code parsing
1381 is turned off using the \texttt{syntax-highlight} config setting in the test
1382 conversions in order to get identical results with/without installed
1383 Pygments highlighter.)
1385 \begin{quote}{\ttfamily \raggedright \noindent
1386 print~'This~is~Python~code.'
1388 \end{quote}
1390 The \texttt{:number-lines:} option (with optional start value) generates line
1391 numbers:
1393 \begin{quote}{\ttfamily \raggedright \noindent
1394 \DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
1395 ~\DUrole{ln}{~9~}for~i~in~range(10):\\
1396 ~\DUrole{ln}{10~}~~~~print~i
1398 \end{quote}
1400 For inline code snippets, there is the \DUroletitlereference{code} role, which can be used
1401 directly (the code will not be parsed/tagged, as the language is not
1402 known) or as base for special code roles, e.g.,
1406 \begin{quote}
1408 Docutils uses LaTeX syntax for math directives and roles:
1409 \texttt{\DUrole{code}{\DUrole{latex}{\DUrole{tex}{\textbackslash{}alpha = f(x)}}}} prints $\alpha = f(x)$.
1411 \end{quote}
1413 The \texttt{:code:} option of the \DUroletitlereference{include} directive sets the included content
1414 as a code block, here the rst file \texttt{header\_footer.txt} with line numbers:
1416 \begin{quote}{\ttfamily \raggedright \noindent
1417 \DUrole{ln}{1~}..~header::~Document~header\\
1418 ~\DUrole{ln}{2~}..~footer::~Document~footer
1420 \end{quote}
1423 %___________________________________________________________________________
1425 \subsection*{\phantomsection%
1426 2.15   Substitution Definitions%
1427 \addcontentsline{toc}{subsection}{2.15   Substitution Definitions}%
1428 \label{substitution-definitions}%
1431 An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example:
1433 (Substitution definitions are not visible in the HTML source.)
1436 %___________________________________________________________________________
1438 \subsection*{\phantomsection%
1439 2.16   Comments%
1440 \addcontentsline{toc}{subsection}{2.16   Comments}%
1441 \label{comments}%
1444 Here's one:
1446 % Comments begin with two dots and a space. Anything may
1447 % follow, except for the syntax of footnotes, hyperlink
1448 % targets, directives, or substitution definitions.
1450 % Double-dashes -- "--" -- must be escaped somehow in HTML output.
1452 % Comments may contain non-ASCII characters: ä ö ü æ ø å
1454 (View the HTML source to see the comment.)
1457 %___________________________________________________________________________
1459 \subsection*{\phantomsection%
1460 2.17   Raw text%
1461 \addcontentsline{toc}{subsection}{2.17   Raw text}%
1462 \label{raw-text}%
1465 This does not necessarily look nice, because there may be missing white space.
1467 It's just there to freeze the behavior.
1469 A test.
1471 Second test.
1473 \DUrole{myclass}{Another test with myclass set.}
1475 This is the \DUrole{myrawroleclass}{fourth test} with myrawroleclass set.
1477 Fifth test in LaTeX.\\Line two.
1480 %___________________________________________________________________________
1482 \subsection*{\phantomsection%
1483 2.18   Container%
1484 \addcontentsline{toc}{subsection}{2.18   Container}%
1485 \label{container}%
1488 paragraph 1
1490 paragraph 2
1492 % currently not implemented in LaTeX:
1493 % .. include:: data/header_footer.txt
1496 %___________________________________________________________________________
1498 \subsection*{\phantomsection%
1499 2.19   Colspanning tables%
1500 \addcontentsline{toc}{subsection}{2.19   Colspanning tables}%
1501 \label{colspanning-tables}%
1504 This table has a cell spanning two columns:
1506 \setlength{\DUtablewidth}{\linewidth}
1507 \begin{longtable*}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|}
1508 \hline
1509 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1510 Inputs
1511 }} & \textbf{%
1512 Output
1513 } \\
1514 \hline
1515 \textbf{%
1517 } & \textbf{%
1519 } & \textbf{%
1520 A or B
1521 } \\
1522 \hline
1523 \endfirsthead
1524 \hline
1525 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1526 Inputs
1527 }} & \textbf{%
1528 Output
1529 } \\
1530 \hline
1531 \textbf{%
1533 } & \textbf{%
1535 } & \textbf{%
1536 A or B
1537 } \\
1538 \hline
1539 \endhead
1540 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1541 \endfoot
1542 \endlastfoot
1544 False
1546 False
1548 False
1550 \hline
1552 True
1554 False
1556 True
1558 \hline
1560 False
1562 True
1564 True
1566 \hline
1568 True
1570 True
1572 True
1574 \hline
1575 \end{longtable*}
1578 %___________________________________________________________________________
1580 \subsection*{\phantomsection%
1581 2.20   Rowspanning tables%
1582 \addcontentsline{toc}{subsection}{2.20   Rowspanning tables}%
1583 \label{rowspanning-tables}%
1586 Here's a table with cells spanning several rows:
1588 \setlength{\DUtablewidth}{\linewidth}
1589 \begin{longtable*}[c]{|p{0.296\DUtablewidth}|p{0.156\DUtablewidth}|p{0.226\DUtablewidth}|}
1590 \hline
1591 \textbf{%
1592 Header row, column 1
1593 (header rows optional)
1594 } & \textbf{%
1595 Header 2
1596 } & \textbf{%
1597 Header 3
1598 } \\
1599 \hline
1600 \endfirsthead
1601 \hline
1602 \textbf{%
1603 Header row, column 1
1604 (header rows optional)
1605 } & \textbf{%
1606 Header 2
1607 } & \textbf{%
1608 Header 3
1609 } \\
1610 \hline
1611 \endhead
1612 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1613 \endfoot
1614 \endlastfoot
1616 body row 1, column 1
1618 column 2
1620 column 3
1622 \hline
1624 body row 2
1625 & \multirow{2}{0.16\DUtablewidth}{%
1626 Cells may
1627 span rows.
1628 } & \multirow{2}{0.23\DUtablewidth}{%
1629 Another
1630 rowspanning
1631 cell.
1632 } \\
1633 \cline{1-1}
1635 body row 3
1636 & \\
1637 \hline
1638 \end{longtable*}
1641 %___________________________________________________________________________
1643 \subsection*{\phantomsection%
1644 2.21   Custom Roles%
1645 \addcontentsline{toc}{subsection}{2.21   Custom Roles}%
1646 \label{custom-roles}%
1649 \begin{itemize}
1651 \item A role based on an existing role.
1653 \texttt{\DUrole{custom}{one}} \texttt{\DUrole{custom}{two}} \texttt{\DUrole{custom}{three}}
1655 \item A new role.
1657 \DUrole{customnew}{one two three}
1659 \item A role with class attribute.
1661 \DUrole{special}{interpreted text}
1663 \item A language-switching role:
1665 Let's count in German \otherlanguage{german}{eins zwei drei}.
1667 \item A role with multiple class attributes, styled with raw directives:
1669 \newcommand{\DUrolegreen}[1]{\textcolor{green}{#1}}
1670 \newcommand{\DUrolesc}[1]{\textsc{#1}}
1672 The following works in most browsers but does not validate
1673 (\texttt{<style>} is only allowed in the document head):
1675 \begin{quote}{\ttfamily \raggedright \noindent
1676 ..~raw::~html\\
1678 ~~<style~type="text/css"><!--\\
1679 ~~~.green~\{color:~green;\}\\
1680 ~~~.sc~\{font-variant:~small-caps;\}\\
1681 ~~~--></style>
1683 \end{quote}
1685 \otherlanguage{british}{\DUrole{green}{\DUrole{sc}{British colourful text in small-caps}}}.
1687 \end{itemize}
1690 %___________________________________________________________________________
1692 \section*{\phantomsection%
1693 3   Tests for the LaTeX writer%
1694 \addcontentsline{toc}{section}{3   Tests for the LaTeX writer}%
1695 \label{tests-for-the-latex-writer}%
1698 Test syntax elements which may cause trouble for the LaTeX writer but might
1699 not need to be tested with other writers (e.g. the HTML writer).
1702 %___________________________________________________________________________
1704 \subsection*{\phantomsection%
1705 3.1   Custom Roles in LaTeX%
1706 \addcontentsline{toc}{subsection}{3.1   Custom Roles in LaTeX}%
1707 \label{custom-roles-in-latex}%
1710 \begin{itemize}
1712 \item Role names and class arguments are converted to conform to the
1713 regular expression \texttt{{[}a-z{]}{[}-a-z0-9{]}*} (letters are downcased,
1714 accents and similar decoration is stripped, non-conforming
1715 characters are replaced by a hyphen).
1717 Class arguments may contain numbers and hyphens, which need special
1718 treatment in LaTeX command names.
1720 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}}
1722 \item With LaTeX, roles can be styled within the document using the \DUroletitlereference{raw}
1723 directive.
1725 \newcommand{\DUrolelarge}[1]{{\large #1}}
1726 \makeatletter
1727 \@namedef{DUrolesmall-caps}{\textsc}
1728 \@namedef{DUrolecustom4}{\textbf}
1729 \makeatother
1731 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}} in large, bold, small-caps.
1733 \item Custom roles can be based on standard roles:
1735 This is a \emph{\DUrole{custom-emphasis}{customized emphasis text role}}
1737 This is a \texttt{\DUrole{custom-literal}{customized literal text role}}
1739 This is a \textbf{\DUrole{custom-strong}{customized strong text role}}
1741 This is a \textsubscript{\DUrole{custom-subscript}{customized subscript text role}}
1743 This is a \textsuperscript{\DUrole{custom-superscript}{customized superscript text role}}
1745 This is a \DUroletitlereference{\DUrole{custom-title-reference}{customized title-reference text role}}
1747 \end{itemize}
1749 % This file is used by the standalone_rst_latex test.
1752 %___________________________________________________________________________
1754 \subsection*{\phantomsection%
1755 3.2   Option lists%
1756 \addcontentsline{toc}{subsection}{3.2   Option lists}%
1757 \label{id23}%
1760 The LaTeX-2e description environment is used for definition lists.
1761 The definition is continued on the same line as the term, this should
1762 not happen if a option-list is at the top of the definition.
1764 If the option list is not at the first element in the definition, it
1765 is contained in a quote
1767 \begin{quote}
1769 \begin{DUoptionlist}
1771 \item[--help] show help
1773 \item[-v] verbose
1775 \end{DUoptionlist}
1777 \end{quote}
1779 \begin{description}
1780 \item[{In a definition list:}] \leavevmode %
1781 \begin{DUoptionlist}
1783 \item[--help] show help
1785 \item[-v] verbose
1787 \end{DUoptionlist}
1789 \end{description}
1792 %___________________________________________________________________________
1794 \subsection*{\phantomsection%
1795 3.3   Monospaced non-alphanumeric characters%
1796 \addcontentsline{toc}{subsection}{3.3   Monospaced non-alphanumeric characters}%
1797 \label{monospaced-non-alphanumeric-characters}%
1800 These are all ASCII characters except a-zA-Z0-9 and space:
1802 \texttt{!!!"""\#\#\#\$\$\$\%\%\%\&\&\&'''((()))***+++,,,---...///:::}
1804 \texttt{;;;<<<===>>>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_```\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}}
1806 \texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
1808 The two lines of non-alphanumeric characters should both have the same
1809 width as the third line.
1812 %___________________________________________________________________________
1814 \subsection*{\phantomsection%
1815 3.4   Non-ASCII characters%
1816 \addcontentsline{toc}{subsection}{3.4   Non-ASCII characters}%
1817 \label{non-ascii-characters}%
1820 Punctuation and footnote symbols
1822 \setlength{\DUtablewidth}{\linewidth}
1823 \begin{longtable*}[c]{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|}
1824 \hline
1828 en-dash
1830 \hline
1834 em-dash
1836 \hline
1840 single turned comma quotation mark
1842 \hline
1846 single comma quotation mark
1848 \hline
1852 low single comma quotation mark
1854 \hline
1858 double turned comma quotation mark
1860 \hline
1864 double comma quotation mark
1866 \hline
1870 low double comma quotation mark
1872 \hline
1876 dagger
1878 \hline
1882 double dagger
1884 \hline
1888 black diamond suit
1890 \hline
1894 black heart suit
1896 \hline
1900 black spade suit
1902 \hline
1906 black club suit
1908 \hline
1912 ellipsis
1914 \hline
1918 trade mark sign
1920 \hline
1924 left-right double arrow
1926 \hline
1927 \end{longtable*}
1929 The \DUroletitlereference{Latin-1 extended} Unicode block
1931 \setlength{\DUtablewidth}{\linewidth}
1932 \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}|}
1933 \hline
1957 \hline
1960 & &
1966 & &
1977 \hline
2001 \hline
2025 \hline
2049 \hline
2073 \hline
2097 \hline
2121 \hline
2145 \hline
2169 \hline
2184 & & & & \\
2185 \hline
2186 \end{longtable*}
2188 \begin{itemize}
2190 \item The following line should not be wrapped, because it uses
2191 no-break spaces (\textbackslash{}u00a0):
2193 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
2195 \item Line wrapping with/without breakpoints marked by soft hyphens
2196 (\textbackslash{}u00ad):
2198 pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch
2200 pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch
2202 \item The currency sign (\textbackslash{}u00a4) is not supported by all fonts
2203 (some have an Euro sign at its place). You might see an error
2204 like:
2206 \begin{quote}{\ttfamily \raggedright \noindent
2207 !~Package~textcomp~Error:~Symbol~\textbackslash{}textcurrency~not~provided~by\\
2208 (textcomp)~~~~~~~~~~~~~~~~font~family~ptm~in~TS1~encoding.\\
2209 (textcomp)~~~~~~~~~~~~~~~~Default~family~used~instead.
2211 \end{quote}
2213 (which in case of font family ptm is a false positive). Add either
2215 \begin{DUfieldlist}
2216 \item[{warn:}]
2217 turn the error in a warning, use the default symbol (bitmap), or
2219 \item[{force,almostfull:}]
2220 use the symbol provided by the font at the users
2221 risk,
2223 \end{DUfieldlist}
2225 to the document options or use a different font package.
2227 \end{itemize}
2230 %___________________________________________________________________________
2232 \subsection*{\phantomsection%
2233 3.5   Encoding special chars%
2234 \addcontentsline{toc}{subsection}{3.5   Encoding special chars}%
2235 \label{encoding-special-chars}%
2238 The LaTeX Info pages lists under "2.18 Special Characters"
2240 \begin{quote}
2242 The following characters play a special role in LaTeX and are called
2243 "special printing characters", or simply "special characters".
2245 \begin{quote}
2247 \# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \}
2249 \end{quote}
2251 \end{quote}
2253 The special chars verbatim:
2255 \begin{quote}{\ttfamily \raggedright \noindent
2256 \#~\$~\%~\&~\textasciitilde{}~\_~\textasciicircum{}~\textbackslash{}~\{~\}
2258 \end{quote}
2260 However also \emph{square brackets} {[}{]} need special care.
2262 \begin{quote}
2264 item and all the other commands with optional arguments check
2265 if the token right after the macro name is an opening bracket.
2266 In that case the contents between that bracket and the following
2267 closing bracket on the same grouping level are taken as the
2268 optional argument. What makes this unintuitive is the fact that
2269 the square brackets aren't grouping characters themselves, so in
2270 your last example item{[}{[}...{]}{]} the optional argument consists of
2271 {[}... (without the closing bracket).
2273 \end{quote}
2275 Compare the items in the following lists:
2277 \begin{itemize}
2279 \item simple item
2281 \item {[}bracketed{]} item
2283 \end{itemize}
2285 \begin{description}
2286 \item[{simple}] \leavevmode
2287 description term
2289 \item[{{[}bracketed{]}}] \leavevmode
2290 description term
2292 \end{description}
2294 The OT1 font-encoding has different characters for the less-than,
2295 greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}:
2297 \begin{quote}{\ttfamily \raggedright \noindent
2298 <~|~>
2300 \end{quote}
2303 %___________________________________________________________________________
2305 \subsection*{\phantomsection%
2306 3.6   Hyperlinks and -targets%
2307 \addcontentsline{toc}{subsection}{3.6   Hyperlinks and -targets}%
2308 \label{hyperlinks-and-targets}%
2311 In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a
2313 \phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or
2314 caption:
2316 \setlength{\DUtablewidth}{\linewidth}
2317 \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
2318 \caption{Table with %
2319 \label{hypertarget-in-table-title}hypertarget in table title.}\\
2320 \hline
2322 False
2324 True
2326 None
2328 \hline
2329 \end{longtable}
2330 \label{table-label}
2331 \begin{figure}
2332 \phantomsection\label{figure-label}
2333 \noindent\makebox[\textwidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
2334 \caption{Figure with %
2335 \label{hypertarget-in-figure-caption}hypertarget in figure caption.}
2336 \begin{DUlegend}
2337 Legend with %
2338 \phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend.
2339 \end{DUlegend}
2340 \end{figure}
2342 \includegraphics{../../../docs/user/rst/images/biohazard.png}
2343 \phantomsection\label{image-label}
2345 See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text},
2346 \hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title},
2347 \hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption},
2348 \hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and
2349 \hyperref[image-label]{image label}.
2352 %___________________________________________________________________________
2354 \subsection*{\phantomsection%
2355 3.7   External references%
2356 \addcontentsline{toc}{subsection}{3.7   External references}%
2357 \label{external-references}%
2360 Long URLs should be wrapped in the PDF.
2361 This can be achieved with the url command which is used by the LaTeX writer
2362 wheneve the content (name) of a reference node equals the link URL.
2364 \begin{description}
2365 \item[{Example:}] \leavevmode
2366 a long URL that should wrap in the output
2367 \url{http://docutils.sourceforge.net/docs/user/latex.html\#id79}
2369 \end{description}
2371 If the argument contains any "\%", "\#", or "\textasciicircum{}\textasciicircum{}", or ends with \texttt{\textbackslash{}}, it can't
2372 be used in the argument to another command. The argument must not contain
2373 unbalanced braces.
2375 The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a "http:" or "ftp:" URL
2376 and not recognized as part of it:
2378 \begin{DUlineblock}{0em}
2379 \item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name
2380 \item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{}
2381 \item[] \url{http://www.example.org/XML}/strange\{n\}ame
2382 \end{DUlineblock}
2384 They can, however be used in paths and/or filenames.
2386 Handling by the LaTeX writer:
2388 \begin{itemize}
2390 \item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped:
2392 \begin{DUlineblock}{0em}
2393 \item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#}
2394 \url{http://www.w3.org/XML/Schema\#dev}
2395 \item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%}
2396 \url{http://example.org/Schema\%dev}
2397 \item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{id41}{id40}{9} \url{A:DOS\\path\\}\DUfootnotemark{id42}{id40}{9}
2398 \end{DUlineblock}
2400 \DUadmonition[note]{
2401 \DUtitle[note]{Note}
2403 These URLs are typeset inside a LaTeX command without error.
2405 \begin{DUlineblock}{0em}
2406 \item[] \url{http://www.w3.org/XML/Schema\#dev}
2407 \item[] \url{http://example.org/Schema\%dev}
2408 \item[] \url{A:DOS\\path\\}\DUfootnotemark{id43}{id40}{9}
2409 \end{DUlineblock}
2412 \end{itemize}
2414 \begin{itemize}
2416 \item \textasciicircum{}\textasciicircum{} LaTeX's special syntax for characters results in "strange" replacements
2417 (both with href and url). A warning is given.
2419 \href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}:
2420 \url{../strange^^name}
2422 \item Unbalanced braces, \{ or \}, will fail (both with href and url):
2424 \begin{quote}{\ttfamily \raggedright \noindent
2425 `file~with~\{~<../strange\{name>`\_\_\\
2426 `<../strange\{name>`\_\_
2428 \end{quote}
2430 while balanced braces are suported:
2432 \begin{DUlineblock}{0em}
2433 \item[] \url{../strange{n}ame}
2434 \item[] \url{../st{r}ange{n}ame}
2435 \item[] \url{../{st{r}ange{n}ame}}
2436 \end{DUlineblock}
2438 \end{itemize}
2441 %___________________________________________________________________________
2443 \section*{\phantomsection%
2444 4   Tests for the XeTeX writer%
2445 \addcontentsline{toc}{section}{4   Tests for the XeTeX writer}%
2446 \label{tests-for-the-xetex-writer}%
2449 With XeTeX, you can typeset text in any language/script supported by
2450 Unicode and the selected font, e.g. Azərbaycanca, Bân-lâm-gú, Башҡорт
2451 Беларуская, Български, Català, Чӑвашла, Česky, Ελληνικά, Español,
2452 Français, Føroyskt, Хальмг, Íslenska, עברית , Қазақша, Kurdî,
2453 Latviešu, Lietuvių, Македонски, Монгол, Nāhuatl, Português, Română,
2454 Русский, Slovenščina, Српски, Türkçe, Українська, Tiếng Việt, Volapük,
2455 Võro, ייִדיש , Žemaitėška.
2456 Currently, there is extended support for 28 languages in the
2457 \href{http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=polyglossia}{polyglossia}\DUfootnotemark{id36}{id35}{7} package.
2459 % System Messages:
2462 %___________________________________________________________________________
2464 \section*{\phantomsection%
2465 5   Error Handling%
2466 \addcontentsline{toc}{section}{5   Error Handling}%
2467 \label{error-handling}%
2470 Any errors caught during processing will generate system messages.
2472 There should be five messages in the following, auto-generated
2473 section, "Docutils System Messages":
2475 % section should be added by Docutils automatically
2478 %___________________________________________________________________________
2480 \section*{\phantomsection%
2481 \color{red}Docutils System Messages%
2482 \addcontentsline{toc}{section}{Docutils System Messages}%
2485 \DUadmonition[system-message]{
2486 \DUtitle[system-message]{system-message}
2487 \raisebox{1em}{\hypertarget{id27}{}}
2489 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~104
2491 \hyperlink{id28}{
2492 Undefined substitution referenced: "problematic".
2495 \DUadmonition[system-message]{
2496 \DUtitle[system-message]{system-message}
2497 \raisebox{1em}{\hypertarget{id44}{}}
2499 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~391
2501 \hyperlink{id45}{
2502 Unknown target name: "5".
2505 \DUadmonition[system-message]{
2506 \DUtitle[system-message]{system-message}
2507 \raisebox{1em}{\hypertarget{id46}{}}
2509 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~400
2511 \hyperlink{id47}{
2512 Unknown target name: "nonexistent".
2515 \DUadmonition[system-message]{
2516 \DUtitle[system-message]{system-message}
2517 \raisebox{1em}{\hypertarget{id48}{}}
2519 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~427
2521 \hyperlink{id49}{
2522 Unknown target name: "hyperlink reference without a target".
2525 \DUadmonition[system-message]{
2526 \DUtitle[system-message]{system-message}
2527 \raisebox{1em}{\hypertarget{id50}{}}
2529 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~440
2531 \hyperlink{id51}{
2532 Duplicate target name, cannot be used as a unique reference: "duplicate target names".
2535 \end{document}