latex writer: fix fallback definition of \DUroles macro.
[docutils.git] / docutils / test / functional / expected / standalone_rst_xetex.tex
blob18e148bd928ee9f70e70970fe65cc73f7c36b768
1 \documentclass[a4paper]{article}
2 % generated by Docutils <http://docutils.sourceforge.net/>
3 % rubber: set program xelatex
4 \usepackage{fontspec}
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}}%
10 \fi
11 \usepackage{ifthen}
12 \usepackage{alltt}
13 \usepackage{amsmath}
14 \usepackage{polyglossia}
15 \setdefaultlanguage{english}
16 \setotherlanguages{english,french,german}
17 \usepackage{color}
18 \usepackage{float} % float configuration
19 \floatplacement{figure}{H} % place figures here definitely
20 \usepackage{graphicx}
21 \usepackage{multirow}
22 \setcounter{secnumdepth}{0}
23 \usepackage{longtable,ltcaption,array}
24 \setlength{\extrarowheight}{2pt}
25 \newlength{\DUtablewidth} % internal use in tables
26 \usepackage{tabularx}
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}%
46 \fi
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}}{}
53 % abstract title
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}%
61 \else
62 \begin{center}
63 \fbox{\parbox{0.9\linewidth}{#2}}
64 \end{center}
65 \fi
68 % dedication topic
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}}
78 \newcounter{enumv}
80 % error admonition title
81 \providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}}
83 % fieldlist environment
84 \ifthenelse{\isundefined{\DUfieldlist}}{
85 \newenvironment{DUfieldlist}%
86 {\quote\description}
87 {\enddescription\endquote}
88 }{}
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]{%
95 \begingroup%
96 \renewcommand{\thefootnote}{%
97 \protect\raisebox{1em}{\protect\hypertarget{#1}{}}%
98 \protect\hyperlink{#2}{#3}}%
99 \footnotetext{#4}%
100 \endgroup%
103 % inline markup (custom roles)
104 % \DUrole{#1}{#2} tries \DUrole#1{#2}
105 \providecommand*{\DUrole}[2]{%
106 \ifcsname DUrole#1\endcsname%
107 \csname DUrole#1\endcsname{#2}%
108 \else
109 % backwards compatibility: try \docutilsrole#1{#2}
110 \ifcsname docutilsrole#1\endcsname%
111 \csname docutilsrole#1\endcsname{#2}%
112 \else%
114 \fi%
115 \fi%
118 % legend environment
119 \ifthenelse{\isundefined{\DUlegend}}{
120 \newenvironment{DUlegend}{\small}{}
123 % lineblock environment
124 \DUprovidelength{\DUlineblockindent}{2.5em}
125 \ifthenelse{\isundefined{\DUlineblock}}{
126 \newenvironment{DUlineblock}[1]{%
127 \list{}{\setlength{\partopsep}{\parskip}
128 \addtolength{\partopsep}{\baselineskip}
129 \setlength{\topsep}{0pt}
130 \setlength{\itemsep}{0.15\baselineskip}
131 \setlength{\parsep}{0pt}
132 \setlength{\leftmargin}{#1}}
133 \raggedright
135 {\endlist}
138 % optionlist environment
139 \providecommand*{\DUoptionlistlabel}[1]{\bf #1 \hfill}
140 \DUprovidelength{\DUoptionlistindent}{3cm}
141 \ifthenelse{\isundefined{\DUoptionlist}}{
142 \newenvironment{DUoptionlist}{%
143 \list{}{\setlength{\labelwidth}{\DUoptionlistindent}
144 \setlength{\rightmargin}{1cm}
145 \setlength{\leftmargin}{\rightmargin}
146 \addtolength{\leftmargin}{\labelwidth}
147 \addtolength{\leftmargin}{\labelsep}
148 \renewcommand{\makelabel}{\DUoptionlistlabel}}
150 {\endlist}
153 \DUprovidelength{\pdfpxdimen}{1bp}
156 % rubric (informal heading)
157 \providecommand*{\DUrubric}[1]{%
158 \subsubsection*{\centering\textit{\textmd{#1}}}}
160 % sidebar (text outside the main text flow)
161 \providecommand{\DUsidebar}[1]{%
162 \begin{center}
163 \colorbox[gray]{0.80}{\parbox{0.9\linewidth}{#1}}
164 \end{center}
167 % subtitle (for topic/sidebar)
168 \providecommand*{\DUsubtitle}[1]{\par\emph{#1}\smallskip}
170 % text mode subscript
171 \ifx\textsubscript\undefined
172 \usepackage{fixltx2e} % since 2015 loaded by default
175 % title for topics, admonitions, unsupported section levels, and sidebar
176 \providecommand*{\DUtitle}[2][class-arg]{%
177 % call \DUtitle#1{#2} if it exists:
178 \ifcsname DUtitle#1\endcsname%
179 \csname DUtitle#1\endcsname{#2}%
180 \else
181 \smallskip\noindent\textbf{#2}\smallskip%
185 % titlereference role
186 \providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
188 % transition (break, fancybreak, anonymous section)
189 \providecommand*{\DUtransition}{%
190 \hspace*{\fill}\hrulefill\hspace*{\fill}
191 \vskip 0.5\baselineskip
193 % hyperlinks:
194 \ifthenelse{\isundefined{\hypersetup}}{
195 \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
196 \usepackage{bookmark}
197 \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
199 \hypersetup{
200 pdftitle={reStructuredText Test Document},
201 pdfauthor={David Goodger;Me;Myself;I}
204 \title{reStructuredText Test Document%
205 \label{restructuredtext-test-document}%
206 \label{doctitle}%
207 \\ % subtitle%
208 \DUdocumentsubtitle{Examples of Syntax Constructs}%
209 \label{examples-of-syntax-constructs}%
210 \label{subtitle}}
211 \author{}
212 \date{}
214 %%% Body
215 \begin{document}
216 \maketitle
218 % Docinfo
219 \begin{center}
220 \begin{tabularx}{\DUdocinfowidth}{lX}
221 \textbf{Author}: &
222 David Goodger \\
223 \textbf{Address}: &
224 {\raggedright
225 123 Example Street\\
226 Example, EX Canada\\
227 A1B 2C3 } \\
228 \textbf{Contact}: &
229 \href{mailto:goodger@python.org}{goodger@python.org} \\
230 \textbf{Author}: &
231 Me \\
232 \textbf{Author}: &
233 Myself \\
234 \textbf{Author}: &
235 I \\
236 \textbf{Organization}: &
237 humankind \\
238 \textbf{Date}: &
239 Now, or yesterday. Or maybe even \emph{before} yesterday. \\
240 \textbf{Status}: &
241 This is a “work in progress” \\
242 \textbf{Revision}: &
243 is managed by a version control system. \\
244 \textbf{Version}: &
245 1 \\
246 \textbf{Copyright}: &
247 This document has been placed in the public domain. You
248 may do with it as you wish. You may copy, modify,
249 redistribute, reattribute, sell, buy, rent, lease,
250 destroy, or improve it, quote it at length, excerpt,
251 incorporate, collate, fold, staple, or mutilate it, or do
252 anything else to it that your or anyone else’s heart
253 desires. \\
254 \textbf{field name}: &
255 This is a “generic bibliographic field”.
257 \textbf{field name “2}: &
258 Generic bibliographic fields may contain multiple body elements.
260 Like this.
262 \end{tabularx}
263 \end{center}
265 \begin{DUclass}{dedication}
266 \begin{quote}
267 \DUtitle[dedication]{Dedication}
269 For Docutils users \& co-developers.
270 \end{quote}
271 \end{DUclass}
273 \begin{DUclass}{abstract}
274 \begin{quote}
275 \DUtitle[abstract]{Abstract}
277 This is a test document, containing at least one example of each
278 reStructuredText construct.
279 \end{quote}
280 \end{DUclass}
282 % This is a comment. Note how any initial comments are moved by
283 % transforms to after the document title, subtitle, and docinfo.
285 % Above is the document title, and below is the subtitle.
286 % They are transformed from section titles after parsing.
288 % bibliographic fields (which also require a transform):
290 \pagebreak[4] % start ToC on new page
292 \phantomsection\label{table-of-contents}
293 \pdfbookmark[1]{Table of Contents}{table-of-contents}
294 \renewcommand{\contentsname}{Table of Contents}
295 \tableofcontents
298 \section{1   Structural Elements%
299 \label{structural-elements}%
303 \subsection{1.1   Section Title%
304 \label{section-title}%
306 \subsubsection*{Section Subtitle}
308 Lone subsections are converted to a section subtitle by a transform
309 activated with the \texttt{--section-subtitles} command line option or the
310 \texttt{sectsubtitle-xform} configuration value.
313 \subsection{1.2   Empty Section%
314 \label{empty-section}%
318 \subsection{1.3   Transitions%
319 \label{transitions}%
322 Here’s a transition:
324 %___________________________________________________________________________
325 \DUtransition
327 It divides the section. Transitions may also occur between sections:
329 %___________________________________________________________________________
330 \DUtransition
333 \section{2   Body Elements%
334 \label{body-elements}%
338 \subsection{2.1   Paragraphs%
339 \label{paragraphs}%
342 A paragraph.
345 \subsubsection{2.1.1   Inline Markup%
346 \label{inline-markup}%
349 Paragraphs contain text and may contain inline markup: \emph{emphasis},
350 \textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks
351 (\url{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\DUfootnotemark{id30}{id29}{5}), internal
352 cross-references (\hyperref[example]{example}), external hyperlinks with embedded URIs
353 (\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink
354 references}\DUfootnotemark{id40}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id42}{id41}{9}), footnote references (manually
355 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]}),
356 substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png} \&
357 a \emph{trimmed heart} \texttt{(U+2665):}♥), and %
358 \phantomsection\label{inline-hyperlink-targets}inline hyperlink targets
359 (see \hyperref[targets]{Targets} below for a reference back to here). Character-level
360 inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by %
361 \raisebox{1em}{\hypertarget{id28}{}}\hyperlink{id27}{\textbf{\color{red}|problematic|}} text
362 (generated by processing errors; this one is intentional). Here is a
363 reference to the \hyperref[doctitle]{doctitle} and the \hyperref[subtitle]{subtitle}.
365 The default role for interpreted text is \DUroletitlereference{Title Reference}. Here are
366 some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/dev/peps/pep-0287}{PEP 287}); an
367 RFC reference (\href{http://tools.ietf.org/html/rfc2822.html}{RFC 2822}); an abbreviation (\DUrole{abbreviation}{abb.}), an acronym
368 (\DUrole{acronym}{reST}), code (\texttt{\DUrole{code}{print \textquotedbl{}hello world\textquotedbl{}}}); a \textsubscript{subscript};
369 a \textsuperscript{superscript} and explicit roles for \DUroletitlereference{Docutils}
370 \emph{standard} \textbf{inline} \texttt{markup}.
372 % DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
374 Let’s test wrapping and whitespace significance in inline literals:
375 \texttt{This is an example of --inline-literal --text, --including some--
376 strangely--hyphenated-words. ~Adjust-the-width-of-your-browser-window
377 to see how the text is wrapped. ~-- ---- -------- ~Now note ~ ~the
378 spacing ~ ~between the ~ ~words of ~ ~this sentence ~ ~(words
379 should ~ ~be grouped ~ ~in pairs).}
381 If the \texttt{--pep-references} option was supplied, there should be a
382 live link to PEP 258 here.
385 \subsection{2.2   Bullet Lists%
386 \label{bullet-lists}%
389 \begin{itemize}
390 \item A bullet list
392 \begin{itemize}
393 \item Nested bullet list.
395 \item Nested item 2.
396 \end{itemize}
398 \item Item 2.
400 Paragraph 2 of item 2.
402 \begin{itemize}
403 \item Nested bullet list.
405 \item Nested item 2.
407 \begin{itemize}
408 \item Third level.
410 \item Item 2.
411 \end{itemize}
413 \item Nested item 3.
415 \item This nested list should be compacted by the HTML writer.
417 \phantomsection\label{target}
418 % Even if this item contains a target and a comment.
419 \end{itemize}
420 \end{itemize}
423 \subsection{2.3   Enumerated Lists%
424 \label{enumerated-lists}%
427 \begin{enumerate}
428 \item Arabic numerals.
430 \begin{enumerate}
431 \renewcommand{\labelenumii}{\alph{enumii})}
432 \item lower alpha)
434 \begin{enumerate}
435 \renewcommand{\labelenumiii}{(\roman{enumiii})}
436 \item (lower roman)
438 \begin{enumerate}
439 \item upper alpha.
441 \begin{list}{\Roman{enumv})}{\usecounter{enumv}}
442 \item upper roman)
443 \end{list}
444 \end{enumerate}
445 \end{enumerate}
446 \end{enumerate}
448 \item Lists that don’t start at 1:
450 \begin{enumerate}
451 \renewcommand{\labelenumii}{\arabic{enumii}.}
452 \setcounter{enumii}{2}
453 \item Three
455 \item Four
456 \end{enumerate}
458 \begin{enumerate}
459 \renewcommand{\labelenumii}{\Alph{enumii}.}
460 \setcounter{enumii}{2}
461 \item C
463 \item D
464 \end{enumerate}
466 \begin{enumerate}
467 \renewcommand{\labelenumii}{\roman{enumii}.}
468 \setcounter{enumii}{2}
469 \item iii
471 \item iv
472 \end{enumerate}
473 \end{enumerate}
476 \subsection{2.4   Definition Lists%
477 \label{definition-lists}%
480 \begin{description}
481 \item[{Term}] \leavevmode
482 Definition
484 \item[{Term}] \leavevmode (\textbf{classifier})
485 Definition paragraph 1.
487 Definition paragraph 2.
489 \item[{Term}] \leavevmode
490 Definition
492 \item[{Term}] \leavevmode (\textbf{classifier one})(\textbf{classifier two})
493 Definition
495 \end{description}
498 \subsection{2.5   Field Lists%
499 \label{field-lists}%
502 \begin{DUfieldlist}
503 \item[{what:}]
504 Field lists map field names to field bodies, like database
505 records. They are often part of an extension syntax. They are
506 an unambiguous variant of RFC 2822 fields.
508 \item[{how arg1 arg2:}]
509 The field marker is a colon, the field name, and a colon.
511 The field body may contain one or more body elements, indented
512 relative to the field marker.
514 \item[{credits:}]
515 \DUrole{credits}{This paragraph has the \DUroletitlereference{credits} class set. (This is actually not
516 about credits but just for ensuring that the class attribute
517 doesn’t get stripped away.)}
518 \end{DUfieldlist}
521 \subsection{2.6   Option Lists%
522 \label{option-lists}%
525 For listing command-line options:
527 \begin{DUoptionlist}
528 \item[-a] command-line option “a”
530 \item[-b file] options can have arguments
531 and long descriptions
533 \item[--long] options can be long also
535 \item[--input=file] long options can also have
536 arguments
538 \item[--very-long-option] The description can also start on the next line.
540 The description may contain multiple body elements,
541 regardless of where it starts.
543 \item[-x, -y, -z] Multiple options are an “option group”.
545 \item[-v, --verbose] Commonly-seen: short \& long options.
547 \item[-1 file, --one=file, --two file] Multiple options with arguments.
549 \item[/V] DOS/VMS-style options too
550 \end{DUoptionlist}
552 There must be at least two spaces between the option and the
553 description.
556 \subsection{2.7   Literal Blocks%
557 \label{literal-blocks}%
560 Literal blocks are indicated with a double-colon (“::”) at the end of
561 the preceding paragraph (over there \texttt{-->}). They can be indented:
563 \begin{quote}
564 \begin{alltt}
565 if literal_block:
566 text = 'is left as-is'
567 spaces_and_linebreaks = 'are preserved'
568 markup_processing = None
569 \end{alltt}
570 \end{quote}
572 Or they can be quoted without indentation:
574 \begin{quote}
575 \begin{alltt}
576 >> Great idea!
578 > Why didn't I think of that?
579 \end{alltt}
580 \end{quote}
583 \subsection{2.8   Line Blocks%
584 \label{line-blocks}%
587 This section tests line blocks. Line blocks are body elements which
588 consist of lines and other line blocks. Nested line blocks cause
589 indentation.
591 \begin{DUlineblock}{0em}
592 \item[] This is a line block. It ends with a blank line.
593 \item[]
594 \begin{DUlineblock}{\DUlineblockindent}
595 \item[] New lines begin with a vertical bar (“|”).
596 \item[] Line breaks and initial indent are significant, and preserved.
597 \item[]
598 \begin{DUlineblock}{\DUlineblockindent}
599 \item[] Continuation lines are also possible. A long line that is intended
600 to wrap should begin with a space in place of the vertical bar.
601 \end{DUlineblock}
602 \item[] The left edge of a continuation line need not be aligned with
603 the left edge of the text above it.
604 \end{DUlineblock}
605 \end{DUlineblock}
607 \begin{DUlineblock}{0em}
608 \item[] This is a second line block.
609 \item[]
610 \item[] Blank lines are permitted internally, but they must begin with a “|”.
611 \end{DUlineblock}
613 Another line block, surrounded by paragraphs:
615 \begin{DUlineblock}{0em}
616 \item[] And it’s no good waiting by the window
617 \item[] It’s no good waiting for the sun
618 \item[] Please believe me, the things you dream of
619 \item[] They don’t fall in the lap of no-one
620 \end{DUlineblock}
622 Take it away, Eric the Orchestra Leader!
624 \begin{quote}
625 \begin{DUlineblock}{0em}
626 \item[] A one, two, a one two three four
627 \item[]
628 \item[] Half a bee, philosophically,
629 \item[]
630 \begin{DUlineblock}{\DUlineblockindent}
631 \item[] must, \emph{ipso facto}, half not be.
632 \end{DUlineblock}
633 \item[] But half the bee has got to be,
634 \item[]
635 \begin{DUlineblock}{\DUlineblockindent}
636 \item[] \emph{vis a vis} its entity. D’you see?
637 \item[]
638 \end{DUlineblock}
639 \item[] But can a bee be said to be
640 \item[]
641 \begin{DUlineblock}{\DUlineblockindent}
642 \item[] or not to be an entire bee,
643 \item[]
644 \begin{DUlineblock}{\DUlineblockindent}
645 \item[] when half the bee is not a bee,
646 \item[]
647 \begin{DUlineblock}{\DUlineblockindent}
648 \item[] due to some ancient injury?
649 \item[]
650 \end{DUlineblock}
651 \end{DUlineblock}
652 \end{DUlineblock}
653 \item[] Singing…
654 \end{DUlineblock}
655 \end{quote}
657 A line block, like the following poem by Christian Morgenstern, can
658 also be centre-aligned:
660 \begin{selectlanguage}{german}
661 \begin{DUlineblock}{0em}
662 \centering
663 \item[] \textbf{Die Trichter}
664 \item[]
665 \item[] Zwei Trichter wandeln durch die Nacht.
666 \item[] Durch ihres Rumpfs verengten Schacht
667 \item[] fließt weißes Mondlicht
668 \item[] still und heiter
669 \item[] auf   ihren
670 \item[] Waldweg
671 \item[] u. s.
672 \item[] w.
673 \item[]
674 \end{DUlineblock}
675 \end{selectlanguage}
678 \subsection{2.9   Block Quotes%
679 \label{block-quotes}%
682 Block quotes consist of indented body elements:
684 \begin{quote}
685 My theory by A. Elk. Brackets Miss, brackets. This theory goes
686 as follows and begins now. All brontosauruses are thin at one
687 end, much much thicker in the middle and then thin again at the
688 far end. That is my theory, it is mine, and belongs to me and I
689 own it, and what it is too.
690 \nopagebreak
692 \raggedleft —Anne Elk (Miss)
693 \end{quote}
695 The language of a quote (like any other object) can be specified by
696 a class attribute:
700 \begin{selectlanguage}{french}
701 \begin{quote}
702 ReStructuredText est un langage de balisage léger utilisé
703 notamment dans la documentation du langage Python.
704 \end{quote}
705 \end{selectlanguage}
708 \subsection{2.10   Doctest Blocks%
709 \label{doctest-blocks}%
712 \begin{quote}
713 \begin{alltt}
714 >>> print 'Python-specific usage examples; begun with ">>>"'
715 Python-specific usage examples; begun with ">>>"
716 >>> print '(cut and pasted from interactive Python sessions)'
717 (cut and pasted from interactive Python sessions)
718 \end{alltt}
719 \end{quote}
722 \subsection{2.11   Footnotes%
723 \label{footnotes}%
726 \DUfootnotetext{id8}{id1}{1}{%
727 A footnote contains body elements, consistently indented by at
728 least 3 spaces.
730 This is the footnote’s second paragraph.
733 \DUfootnotetext{label}{id3}{2}{\phantomsection\label{label}%
734 Footnotes may be numbered, either manually (as in\DUfootnotemark{id9}{id8}{1}) or
735 automatically using a “\#”-prefixed label. This footnote has a
736 label so it can be referred to from multiple places, both as a
737 footnote reference (\DUfootnotemark{id10}{label}{2}) and as a \hyperref[label]{hyperlink reference}.
740 \DUfootnotetext{id12}{id2}{3}{%
741 This footnote is numbered automatically and anonymously using a
742 label of “\#” only.
744 This is the second paragraph.
746 And this is the third paragraph.
749 \DUfootnotetext{id13}{id4}{*}{%
750 Footnotes may also use symbols, specified with a “*” label.
751 Here’s a reference to the next footnote:\DUfootnotemark{id14}{id15}{}.
754 \DUfootnotetext{id15}{id14}{}{%
755 This footnote shows the next symbol in the sequence.
758 \DUfootnotetext{id16}{id16}{4}{%
759 Here’s an unreferenced footnote, with a reference to a
760 nonexistent footnote:%
761 \raisebox{1em}{\hypertarget{id17}{}}\hyperlink{id47}{\textbf{\color{red}{[}5{]}\_}}.
765 \subsection{2.12   Citations%
766 \label{citations}%
768 \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
769 Citations are text-labeled footnotes. They may be
770 rendered separately and differently from footnotes.
771 \end{figure}
773 Here’s a reference to the above, \hyperlink{cit2002}{[CIT2002]}, and a %
774 \raisebox{1em}{\hypertarget{id19}{}}\hyperlink{id48}{\textbf{\color{red}{[}nonexistent{]}\_}}
775 citation.
778 \subsection{2.13   Targets%
779 \label{targets}%
780 \label{another-target}%
783 \phantomsection\label{example}
784 This paragraph is pointed to by the explicit “example” target. A
785 reference can be found under \hyperref[inline-markup]{Inline Markup}, above. \hyperref[inline-hyperlink-targets]{Inline
786 hyperlink targets} are also possible.
788 Section headers are implicit targets, referred to by name. See
789 \hyperref[targets]{Targets}, which is a subsection of \hyperref[body-elements]{Body Elements}.
791 Explicit external targets are interpolated into references such as
792 \href{http://www.python.org/}{Python}\DUfootnotemark{id31}{id29}{5}”.
794 Targets may be indirect and anonymous. Thus \hyperref[targets]{this phrase} may also
795 refer to the \hyperref[targets]{Targets} section.
797 Here’s a %
798 \raisebox{1em}{\hypertarget{id50}{}}\hyperlink{id49}{\textbf{\color{red}`hyperlink reference without a target`\_}}, which generates an
799 error.
802 \subsubsection{2.13.1   Duplicate Target Names%
803 \label{duplicate-target-names}%
806 Duplicate names in section headers or other implicit targets will
807 generate “info” (level-1) system messages. Duplicate names in
808 explicit targets will generate “warning” (level-2) system messages.
811 \subsubsection{2.13.2   Duplicate Target Names%
812 \label{id21}%
815 Since there are two “Duplicate Target Names” section headers, we
816 cannot uniquely refer to either of them by name. If we try to (like
817 this: %
818 \raisebox{1em}{\hypertarget{id52}{}}\hyperlink{id51}{\textbf{\color{red}`Duplicate Target Names`\_}}), an error is generated.
821 \subsection{2.14   Directives%
822 \label{directives}%
825 \phantomsection\label{contents}
826 These are just a sample of the many reStructuredText Directives. For
827 others, please see
828 \url{http://docutils.sourceforge.net/docs/ref/rst/directives.html}.
831 \subsubsection{2.14.1   Document Parts%
832 \label{document-parts}%
835 An example of the “contents” directive can be seen above this section
836 (a local, untitled table of \hyperref[contents]{contents}) and at the beginning of the
837 document (a document-wide \hyperref[table-of-contents]{table of contents}).
840 \subsubsection{2.14.2   Images and Figures%
841 \label{images-and-figures}%
844 An image directive (also clickable – a hyperlink reference):
846 \hyperref[directives]{\includegraphics{../../../docs/user/rst/images/title.png}}
848 Image with multiple IDs:
850 \includegraphics{../../../docs/user/rst/images/title.png}
851 \phantomsection\label{image-target-3}\label{image-target-2}\label{image-target-1}
853 A centered image:
855 \noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
857 A left-aligned image:
859 \noindent{\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill}
861 This paragraph might flow around the image.
862 The specific behavior depends upon the style sheet and
863 the browser or rendering software used.
865 A right-aligned image:
867 \noindent{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}}
869 This paragraph might flow around the image.
870 The specific behavior depends upon the style sheet and
871 the browser or rendering software used.
873 For inline images see \hyperref[substitution-definitions]{Substitution Definitions}.
875 Image size:
877 An image 2 em wide:
879 \includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png}
881 An image 2 em wide and 15 pixel high:
883 \includegraphics[height=15\pdfpxdimen,width=2em]{../../../docs/user/rst/images/biohazard.png}
885 An image occupying 50\% of the line width:
887 \includegraphics[width=0.500\linewidth]{../../../docs/user/rst/images/title.png}
889 An image 2 cm high:
891 \includegraphics[height=2cm]{../../../docs/user/rst/images/biohazard.png}
893 A \emph{figure} is an image with a caption and/or a legend. With page-based output
894 media, figures might float to a different position if this helps the page
895 layout.
897 \begin{DUclass}{figclass1}
898 \begin{DUclass}{figclass2}
899 \begin{figure}
900 \noindent\makebox[\linewidth][c]{\includegraphics[width=258bp]{../../../docs/user/rst/images/title.png}}
901 \caption{Plaintext markup syntax and parser system.}
902 \begin{DUlegend}
903 \setlength{\DUtablewidth}{\linewidth}
904 \begin{longtable*}[c]{|p{0.156\DUtablewidth}|p{0.563\DUtablewidth}|}
905 \hline
909 Revised, revisited, based on ‘re’ module.
911 \hline
913 Structured
915 Structure-enhanced text, structuredtext.
917 \hline
919 Text
921 Well it is, isn’t it?
923 \hline
924 \end{longtable*}
926 This paragraph is also part of the legend.
927 \end{DUlegend}
928 \end{figure}
929 \end{DUclass}
930 \end{DUclass}
932 A left-aligned figure:
934 \begin{DUclass}{figclass1}
935 \begin{DUclass}{figclass2}
936 \begin{figure} % align = "left"
937 \noindent\makebox[\linewidth][c]{\includegraphics[width=40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png}}
938 \caption{This is the caption.}
939 \begin{DUlegend}
940 This is the legend.
942 The legend may consist of several paragraphs.
943 \end{DUlegend}
944 \end{figure}
945 \end{DUclass}
946 \end{DUclass}
948 This paragraph might flow around the figure.
950 The specific behavior depends upon the style sheet and the browser or
951 rendering software used.
953 A centered figure:
955 \begin{figure}
956 \noindent\makebox[\linewidth][c]{\includegraphics[width=40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png}}
957 \caption{This is the caption.}
958 \begin{DUlegend}
959 This is the legend.
961 The legend may consist of several paragraphs.
962 \end{DUlegend}
963 \end{figure}
965 This paragraph might flow around the figure.
967 The specific behavior depends upon the style sheet and the browser or
968 rendering software used.
970 A right-aligned figure:
972 \begin{figure} % align = "right"
973 \noindent\makebox[\linewidth][c]{\includegraphics[width=40\pdfpxdimen]{../../../docs/user/rst/images/biohazard.png}}
974 \caption{This is the caption.}
975 \begin{DUlegend}
976 This is the legend.
978 The legend may consist of several paragraphs.
979 \end{DUlegend}
980 \end{figure}
982 This paragraph might flow around the figure. The specific behavior depends
983 upon the style sheet and the browser or rendering software used.
985 Tables may be given titles and additional arguments with the \emph{table}
986 directive:
988 \setlength{\DUtablewidth}{\linewidth}
989 \begin{longtable}[l]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
990 \caption{left-aligned table}\\
991 \hline
992 \textbf{%
994 } & \textbf{%
995 not A
996 } \\
997 \hline
998 \endfirsthead
999 \caption[]{left-aligned table (... continued)}\\
1000 \hline
1001 \textbf{%
1003 } & \textbf{%
1004 not A
1005 } \\
1006 \hline
1007 \endhead
1008 \multicolumn{2}{c}{\hfill ... continued on next page} \\
1009 \endfoot
1010 \endlastfoot
1012 False
1014 True
1016 \hline
1018 True
1020 False
1022 \hline
1023 \end{longtable}
1025 \setlength{\DUtablewidth}{\linewidth}
1026 \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
1027 \caption{center-aligned table}\\
1028 \hline
1029 \textbf{%
1031 } & \textbf{%
1032 not A
1033 } \\
1034 \hline
1035 \endfirsthead
1036 \caption[]{center-aligned table (... continued)}\\
1037 \hline
1038 \textbf{%
1040 } & \textbf{%
1041 not A
1042 } \\
1043 \hline
1044 \endhead
1045 \multicolumn{2}{c}{\hfill ... continued on next page} \\
1046 \endfoot
1047 \endlastfoot
1049 False
1051 True
1053 \hline
1055 True
1057 False
1059 \hline
1060 \end{longtable}
1062 \setlength{\DUtablewidth}{\linewidth}
1063 \begin{longtable}[r]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
1064 \caption{right-aligned table}\\
1065 \hline
1066 \textbf{%
1068 } & \textbf{%
1069 not A
1070 } \\
1071 \hline
1072 \endfirsthead
1073 \caption[]{right-aligned table (... continued)}\\
1074 \hline
1075 \textbf{%
1077 } & \textbf{%
1078 not A
1079 } \\
1080 \hline
1081 \endhead
1082 \multicolumn{2}{c}{\hfill ... continued on next page} \\
1083 \endfoot
1084 \endlastfoot
1086 False
1088 True
1090 \hline
1092 True
1094 False
1096 \hline
1097 \end{longtable}
1099 With the “widths” argument “auto” (or “class” value “colwidths-auto”),
1100 column widths are determined by the backend (if supported by the
1101 writer/backend).
1103 \begin{longtable*}[c]{|l|l|l|}
1104 \hline
1105 \textbf{A} & \textbf{B} & \textbf{A or B} \\
1106 \hline
1107 \endfirsthead
1108 \hline
1109 \textbf{A} & \textbf{B} & \textbf{A or B} \\
1110 \hline
1111 \endhead
1112 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1113 \endfoot
1114 \endlastfoot
1115 False & False & False \\
1116 \hline
1117 True & False & True \\
1118 \hline
1119 False & True & True \\
1120 \hline
1121 True & True & True \\
1122 \hline
1123 \end{longtable*}
1124 \label{target2}\label{target1}
1127 \subsubsection{2.14.3   Admonitions%
1128 \label{admonitions}%
1131 \DUadmonition[attention]{
1132 \DUtitle[attention]{Attention!}
1134 Directives at large.
1137 \DUadmonition[caution]{
1138 \DUtitle[caution]{Caution!}
1140 Don’t take any wooden nickels.
1143 \DUadmonition[danger]{
1144 \DUtitle[danger]{!DANGER!}
1146 Mad scientist at work!
1149 \DUadmonition[error]{
1150 \DUtitle[error]{Error}
1152 Does not compute.
1155 \DUadmonition[hint]{
1156 \DUtitle[hint]{Hint}
1158 It’s bigger than a bread box.
1161 \DUadmonition[important]{
1162 \DUtitle[important]{Important}
1164 \begin{itemize}
1165 \item Wash behind your ears.
1167 \item Clean up your room.
1169 \item Call your mother.
1171 \item Back up your data.
1172 \end{itemize}
1175 \DUadmonition[note]{
1176 \DUtitle[note]{Note}
1178 This is a note.
1181 \DUadmonition[tip]{
1182 \DUtitle[tip]{Tip}
1184 15\% if the service is good.
1187 \DUadmonition[warning]{
1188 \DUtitle[warning]{Warning}
1190 Strong prose may provoke extreme mental exertion.
1191 Reader discretion is strongly advised.
1194 \DUadmonition[admonition-and-by-the-way]{
1195 \DUtitle[admonition-and-by-the-way]{And, by the way…}
1197 You can make up your own admonition too.
1201 \subsubsection{2.14.4   Topics, Sidebars, and Rubrics%
1202 \label{topics-sidebars-and-rubrics}%
1205 \emph{Sidebars} are like miniature, parallel documents.
1207 \DUsidebar{
1208 \DUtitle[title]{Sidebar Title}
1210 \DUsubtitle[sidebar]{Optional Subtitle}
1212 This is a sidebar. It is for text outside the flow of the main
1213 text.
1215 \DUrubric{This is a rubric inside a sidebar}
1217 Sidebars often appear beside the main text with a border and a different
1218 background or font color.
1221 A \emph{topic} is like a block quote with a title, or a self-contained section
1222 with no subsections.
1224 \begin{DUclass}{topic}
1225 \begin{quote}
1226 \DUtitle[topic]{Topic Title}
1228 This is a topic.
1229 \end{quote}
1230 \end{DUclass}
1232 A \emph{rubric} is like an informal heading that doesn’t correspond to the
1233 document’s structure. It is typically highlighted in red (hence the name).
1235 \DUrubric{This is a rubric}
1237 Topics and rubrics can be used at places where a \hyperref[section-title]{section title} is not
1238 allowed (e.g. inside a directive).
1241 \subsubsection{2.14.5   Target Footnotes%
1242 \label{target-footnotes}%
1245 \DUfootnotetext{id29}{id30}{5}{%
1246 \url{http://www.python.org/}
1249 \DUfootnotetext{id33}{id34}{6}{%
1250 \url{http://pygments.org/}
1253 \DUfootnotetext{id35}{id36}{7}{%
1254 \url{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}
1257 \DUfootnotetext{id38}{id39}{8}{%
1258 \url{http://ctan.org/pkg/polyglossia}
1261 \DUfootnotetext{id41}{id42}{9}{%
1262 \url{http://docutils.sourceforge.net/}
1265 \DUfootnotetext{id43}{id44}{10}{%
1266 \url{A:DOS\\path\\}
1270 \subsubsection{2.14.6   Replacement Text%
1271 \label{replacement-text}%
1274 I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\DUfootnotemark{id32}{id29}{5}.
1277 \subsubsection{2.14.7   Compound Paragraph%
1278 \label{compound-paragraph}%
1281 The \emph{compound} directive is used to create a “compound paragraph”, which
1282 is a single logical paragraph containing multiple physical body
1283 elements. For example:
1285 \begin{DUclass}{compound}
1286 The ‘rm’ command is very dangerous. If you are logged
1287 in as root and enter
1288 \begin{quote}
1289 \begin{alltt}
1290 cd /
1291 rm -rf *
1292 \end{alltt}
1293 \end{quote}
1294 you will erase the entire contents of your file system.
1295 \end{DUclass}
1297 Test the handling and display of compound paragraphs:
1299 \begin{DUclass}{compound}
1300 \begin{DUclass}{some-class}
1301 Compound 2, paragraph 1,
1303 compound 2, paragraph 2,
1304 \begin{itemize}
1305 \item list item 1,
1307 \item list item 2,
1308 \end{itemize}
1309 compound 2, paragraph 3.
1310 \end{DUclass}
1311 \end{DUclass}
1313 \begin{DUclass}{compound}
1314 Compound 3, only consisting of one paragraph.
1315 \end{DUclass}
1317 \begin{DUclass}{compound}
1318 \begin{quote}
1319 \begin{alltt}
1320 Compound 4.
1321 This one starts with a literal block.
1322 \end{alltt}
1323 \end{quote}
1324 Compound 4, paragraph following the literal block.
1325 \end{DUclass}
1327 Now something \emph{really} perverted – a nested compound block. This is
1328 just to test that it works at all; the results don’t have to be
1329 meaningful.
1331 \begin{DUclass}{compound}
1332 Compound 5, block 1 (a paragraph).
1334 \begin{DUclass}{compound}
1335 Compound 6 is block 2 in compound 5.
1337 Compound 6, another paragraph.
1338 \end{DUclass}
1340 Compound 5, block 3 (a paragraph).
1341 \end{DUclass}
1343 \begin{DUclass}{compound}
1344 Compound 7, tests the inclusion of various block-level
1345 elements in one logical paragraph. First a table,
1347 \setlength{\DUtablewidth}{\linewidth}
1348 \begin{longtable*}[c]{|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|}
1349 \hline
1351 Left cell, first
1352 paragraph.
1354 Left cell, second
1355 paragraph.
1357 Middle cell,
1358 consisting of
1359 exactly one
1360 paragraph.
1362 Right cell.
1364 Paragraph 2.
1366 Paragraph 3.
1368 \hline
1369 \end{longtable*}
1370 followed by a paragraph. This physical paragraph is
1371 actually a continuation of the paragraph before the table. It is followed
1373 \begin{quote}
1374 a quote and
1375 \end{quote}
1376 \begin{enumerate}
1377 \item an enumerated list,
1378 \end{enumerate}
1379 a paragraph,
1380 \begin{DUoptionlist}
1381 \item[--an] option list,
1382 \end{DUoptionlist}
1383 a paragraph,
1384 \begin{DUfieldlist}
1385 \item[{a field:}]
1386 list,
1387 \end{DUfieldlist}
1388 a paragraph,
1389 \begin{description}
1390 \item[{a definition}] \leavevmode
1391 list,
1393 \end{description}
1394 a paragraph, an image:
1395 \includegraphics{../../../docs/user/rst/images/biohazard.png}
1396 a paragraph,
1397 \begin{DUlineblock}{0em}
1398 \item[] a line
1399 \item[] block,
1400 \end{DUlineblock}
1401 a paragraph followed by a comment,
1402 % this is a comment
1403 a paragraph, a
1405 \DUadmonition[note]{
1406 \DUtitle[note]{Note}
1408 with content
1410 and the final paragraph of the compound 7.
1411 \end{DUclass}
1414 \subsubsection{2.14.8   Parsed Literal Blocks%
1415 \label{parsed-literal-blocks}%
1418 \begin{quote}
1419 \ttfamily\raggedright
1420 This~is~a~parsed~literal~block.\\
1421 ~~~~This~line~is~indented.~~The~next~line~is~blank.\\
1423 Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\
1424 text},~\textsubscript{sub-}~and~\textsuperscript{super}scripts,\\
1425 inline~formulas:~$A = 2 \pi r^2$,\\
1426 footnotes\DUfootnotemark{id22}{id8}{1},~%
1427 \phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
1428 \end{quote}
1431 \subsubsection{2.14.9   Code%
1432 \label{code}%
1435 Blocks of source code can be set with the \DUroletitlereference{code} directive. If the code
1436 language is specified, the content is parsed and tagged by the \href{http://pygments.org/}{Pygments}\DUfootnotemark{id34}{id33}{6}
1437 syntax highlighter and can be formatted with a style sheet. (Code parsing
1438 is turned off using the \texttt{syntax-highlight} config setting in the test
1439 conversions in order to get identical results with/without installed
1440 Pygments highlighter.)
1442 \begin{DUclass}{code}
1443 \begin{DUclass}{python}
1444 \begin{quote}
1445 \begin{alltt}
1446 print 'This is Python code.'
1447 \end{alltt}
1448 \end{quote}
1449 \end{DUclass}
1450 \end{DUclass}
1452 The \texttt{:number-lines:} option (with optional start value) generates line
1453 numbers:
1455 \begin{DUclass}{code}
1456 \begin{DUclass}{python}
1457 \begin{quote}
1458 \ttfamily\raggedright
1459 \DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
1460 \DUrole{ln}{~9~}for~i~in~range(10):\\
1461 \DUrole{ln}{10~}~~~~print~i
1462 \end{quote}
1463 \end{DUclass}
1464 \end{DUclass}
1466 For inline code snippets, there is the \DUroletitlereference{code} role, which can be used
1467 directly (the code will not be parsed/tagged, as the language is not known)
1468 or as base for special code roles, e.g. the LaTeX code in the next
1469 paragraph.
1471 Docutils uses LaTeX syntax for math directives and roles:
1472 \texttt{\DUrole{code}{\DUrole{tex}{\textbackslash{}alpha = f(x)}}} prints $\alpha = f(x)$.
1474 The \texttt{:code:} option of the \DUroletitlereference{include} directive sets the included content
1475 as a code block, here the rst file \texttt{header\_footer.txt} with line numbers:
1477 \begin{DUclass}{code}
1478 \begin{DUclass}{rst}
1479 \begin{quote}
1480 \ttfamily\raggedright
1481 \DUrole{ln}{1~}..~header::~Document~header\\
1482 \DUrole{ln}{2~}..~footer::~Document~footer
1483 \end{quote}
1484 \end{DUclass}
1485 \end{DUclass}
1488 \subsection{2.15   Substitution Definitions%
1489 \label{substitution-definitions}%
1492 An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example:
1494 A Unicode example:
1496 (Substitution definitions are not visible in the HTML source.)
1499 \subsection{2.16   Comments%
1500 \label{comments}%
1503 Here’s one:
1505 % Comments begin with two dots and a space. Anything may
1506 % follow, except for the syntax of footnotes, hyperlink
1507 % targets, directives, or substitution definitions.
1509 % Double-dashes -- "--" -- must be escaped somehow in HTML output.
1511 % Comments may contain non-ASCII characters: ä ö ü æ ø å
1513 (View the HTML source to see the comment.)
1516 \subsection{2.17   Raw text%
1517 \label{raw-text}%
1520 This does not necessarily look nice, because there may be missing white space.
1522 It’s just there to freeze the behavior.
1524 A test.
1526 Second test.
1528 \DUrole{myclass}{Another test with myclass set.}
1530 This is the \DUrole{myrawroleclass}{fourth test} with myrawroleclass set.
1532 Fifth test in LaTeX.\\Line two.
1535 \subsection{2.18   Container%
1536 \label{container}%
1539 \begin{DUclass}{custom}
1541 paragraph 1
1543 paragraph 2
1544 \end{DUclass}
1546 % currently not implemented in LaTeX:
1547 % .. include:: data/header_footer.txt
1550 \subsection{2.19   Colspanning tables%
1551 \label{colspanning-tables}%
1554 This table has a cell spanning two columns:
1556 \setlength{\DUtablewidth}{\linewidth}
1557 \begin{longtable*}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|}
1558 \hline
1559 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1560 Inputs
1561 }} & \textbf{%
1562 Output
1563 } \\
1564 \hline
1565 \textbf{%
1567 } & \textbf{%
1569 } & \textbf{%
1570 A or B
1571 } \\
1572 \hline
1573 \endfirsthead
1574 \hline
1575 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1576 Inputs
1577 }} & \textbf{%
1578 Output
1579 } \\
1580 \hline
1581 \textbf{%
1583 } & \textbf{%
1585 } & \textbf{%
1586 A or B
1587 } \\
1588 \hline
1589 \endhead
1590 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1591 \endfoot
1592 \endlastfoot
1594 False
1596 False
1598 False
1600 \hline
1602 True
1604 False
1606 True
1608 \hline
1610 False
1612 True
1614 True
1616 \hline
1618 True
1620 True
1622 True
1624 \hline
1625 \end{longtable*}
1628 \subsection{2.20   Rowspanning tables%
1629 \label{rowspanning-tables}%
1632 Here’s a table with cells spanning several rows:
1634 \setlength{\DUtablewidth}{\linewidth}
1635 \begin{longtable*}[c]{|p{0.296\DUtablewidth}|p{0.156\DUtablewidth}|p{0.226\DUtablewidth}|}
1636 \hline
1637 \textbf{%
1638 Header row, column 1
1639 (header rows optional)
1640 } & \textbf{%
1641 Header 2
1642 } & \textbf{%
1643 Header 3
1644 } \\
1645 \hline
1646 \endfirsthead
1647 \hline
1648 \textbf{%
1649 Header row, column 1
1650 (header rows optional)
1651 } & \textbf{%
1652 Header 2
1653 } & \textbf{%
1654 Header 3
1655 } \\
1656 \hline
1657 \endhead
1658 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1659 \endfoot
1660 \endlastfoot
1662 body row 1, column 1
1664 column 2
1666 column 3
1668 \hline
1670 body row 2
1671 & \multirow{2}{0.16\DUtablewidth}{%
1672 Cells may
1673 span rows.
1674 } & \multirow{2}{0.23\DUtablewidth}{%
1675 Another
1676 rowspanning
1677 cell.
1678 } \\
1679 \cline{1-1}
1681 body row 3
1682 & & \\
1683 \hline
1684 \end{longtable*}
1687 \subsection{2.21   List Tables%
1688 \label{list-tables}%
1691 Here’s a list table exercising all features:
1693 \setlength{\DUtablewidth}{40em}
1694 \begin{longtable}[c]{|p{0.133\DUtablewidth}|p{0.249\DUtablewidth}|p{0.365\DUtablewidth}|}
1695 \caption{list table with integral header}\\
1696 \hline
1697 \textbf{%
1698 Treat
1699 } & \textbf{%
1700 Quantity
1701 } & \textbf{%
1702 Description
1703 } \\
1704 \hline
1705 \endfirsthead
1706 \caption[]{list table with integral header (... continued)}\\
1707 \hline
1708 \textbf{%
1709 Treat
1710 } & \textbf{%
1711 Quantity
1712 } & \textbf{%
1713 Description
1714 } \\
1715 \hline
1716 \endhead
1717 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1718 \endfoot
1719 \endlastfoot
1720 \textbf{%
1721 Albatross
1722 } &
1723 2.99
1725 On a stick!
1727 \hline
1728 \textbf{%
1729 Crunchy Frog
1730 } &
1731 1.49
1733 If we took the bones out, it wouldn’t be
1734 crunchy, now would it?
1736 \hline
1737 \textbf{%
1738 Gannet Ripple
1739 } &
1740 1.99
1742 On a stick!
1744 \hline
1745 \end{longtable}
1747 \begin{longtable}[c]{|l|l|}
1748 \caption{center aligned list table}\\
1749 \hline
1750 Albatross & 2.99 \\
1751 \hline
1752 Crunchy Frog & 1.49 \\
1753 \hline
1754 Gannet Ripple & 1.99 \\
1755 \hline
1756 \end{longtable}
1759 \subsection{2.22   Custom Roles%
1760 \label{custom-roles}%
1763 \begin{itemize}
1764 \item A role based on an existing role.
1766 \texttt{\DUrole{custom}{one}} \texttt{\DUrole{custom}{two}} \texttt{\DUrole{custom}{three}}
1768 \item A new role.
1770 \DUrole{customnew}{one two three}
1772 \item A role with class attribute.
1774 \DUrole{special}{interpreted text}
1776 \item A language-switching role:
1778 Let’s count in German \foreignlanguage{german}{eins zwei drei}.
1780 \item A role with multiple class attributes, styled with raw directives:
1782 \newcommand{\DUrolegreen}[1]{\textcolor{green}{#1}}
1783 \newcommand{\DUrolesc}[1]{\textsc{#1}}
1785 The following works in most browsers but does not validate
1786 (\texttt{<style>} is only allowed in the document head):
1788 \begin{quote}
1789 \begin{alltt}
1790 .. raw:: html
1792 <style type="text/css"><!--
1793 .green \{color: green;\}
1794 .sc \{font-variant: small-caps;\}
1795 --></style>
1796 \end{alltt}
1797 \end{quote}
1799 \DUrole{green}{\DUrole{sc}{\foreignlanguage{english}{British colourful text in small-caps}}}.
1800 \end{itemize}
1803 \subsection{2.23   Mathematics%
1804 \label{mathematics}%
1807 Docutils supports inline math with the prefix or postfix \texttt{:math:}
1808 role specificator, $n! + \sin(x_n^2)$ and $A_\text{c} =
1809 \frac{\pi}{4} d^2$, as well as displayed math via the
1810 \DUroletitlereference{math} directive:
1812 \begin{equation*}
1813 f(\epsilon) = \frac{1}{1 + \exp\left(\frac{\varepsilon}{k_\text{B}T}\right)}
1814 \end{equation*}
1815 Content may start on the first line of the directive, e.g.
1817 \begin{equation*}
1818 N = \frac{\text{number of apples}}{7}
1819 \end{equation*}
1820 Equations can be labeled with a reference name using the \texttt{:name:} option.
1821 See \hyperref[eq-m]{eq:M} and \hyperref[eq-schrodinger]{eq:schrödinger} below.
1823 The determinant of the matrix
1825 \begin{equation*}
1826 \mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)
1827 \phantomsection
1828 \label{eq-m}
1829 \end{equation*}
1830 is $|\mathbf{M}| = ad - bc$.
1832 More than one display math block can be put in one math directive.
1833 For example, the following sum and integral with limits:
1835 \begin{equation*}
1836 \int_0^1 x^n dx = \frac{1}{n + 1}
1837 \end{equation*}%
1838 \begin{equation*}
1839 \sum_{n=1}^m n = \frac{m(m+1)}{2}
1840 \end{equation*}
1841 LaTeX-supported Unicode math symbols can be used in math roles and
1842 directives:
1844 The Schrödinger equation
1846 \begin{equation*}
1847 i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi ,
1848 \phantomsection
1849 \label{eq-schrodinger}
1850 \end{equation*}
1851 with the \emph{wave function} $\Psi $, describes how the quantum state of a
1852 physical system changes in time.
1854 \begin{description}
1855 \item[{Math-Accents:}] \leavevmode
1856 \setlength{\DUtablewidth}{\linewidth}
1857 \begin{longtable*}[c]{p{0.315\DUtablewidth}p{0.315\DUtablewidth}p{0.315\DUtablewidth}}
1859 $\acute{a}$ \texttt{\textbackslash{}acute\{a\}}
1861 $\dot{t}$ \texttt{\textbackslash{}dot\{t\}}
1863 $\hat{\gamma}$ \texttt{\textbackslash{}hat\{\textbackslash{}gamma\}}
1866 $\grave{a}$ \texttt{\textbackslash{}grave\{a\}}
1868 $\ddot{t}$ \texttt{\textbackslash{}ddot\{t\}}
1870 $\tilde{\alpha}$ \texttt{\textbackslash{}tilde\{\textbackslash{}alpha\}}
1873 $\breve{x}$ \texttt{\textbackslash{}breve\{x\}}
1875 $\dddot{t}$ \texttt{\textbackslash{}dddot\{t\}}
1877 $\vec{\imath}$ \texttt{\textbackslash{}vec\{\textbackslash{}imath\}}
1880 $\check{a}$ \texttt{\textbackslash{}check\{a\}}
1882 $\bar{a}$ \texttt{\textbackslash{}bar\{a\}}
1884 $\vec{R}$ \texttt{\textbackslash{}vec\{R\}}
1886 \end{longtable*}
1888 \end{description}
1890 % \widetilde{xxx}
1891 % \widehat{xxx}
1893 Modulation Transfer Function:
1895 \begin{equation*}
1896 \text{MTF} = \left|\frac{\mathcal{F}\{s(x)\}}
1897 {\mathcal{F}\{ s(x)\} |_{\omega _{x}=0}}\right|
1898 = \mathrm{abs}\left(\frac
1899 {\int _{-\infty }^{\infty }s(x) \mathrm{e}^{\mathrm{i}\omega _{x}x}\mathrm{d}{x}}
1900 {\int _{-\infty }^{\infty }s(x)\mathrm{d}{x}}
1901 \right).
1902 \end{equation*}
1903 Math split over two lines: If a double backslash is detected outside a
1904 \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}
1905 \texttt{align} environment:
1907 \begin{align*}
1908 s_{\mathrm{out}}(x) & = s_{\mathrm{in}}(x') * s_\delta (x-x') \\
1909 & = \int s_{\mathrm{in}}(x')s_\delta (x-x')\mathrm{d}x'
1910 \end{align*}
1911 Cases (“manually”, with \texttt{matrix} environment):
1913 \begin{equation*}
1914 \mathrm{sgn}(x) = \left\{\begin{matrix}
1915 -1 & x<0\\
1916 1 & x>0
1917 \end{matrix}\right.
1918 \end{equation*}
1919 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
1920 HTML writers with \texttt{--math-output=MathML}):
1922 \begin{equation*}
1923 \mathrm{sgn}(x) = \begin{cases}
1924 -1 & x<0\\
1925 1 & x>0
1926 \end{cases}
1927 \end{equation*}
1929 \section{3   Tests for the LaTeX writer%
1930 \label{tests-for-the-latex-writer}%
1933 Test syntax elements which may cause trouble for the LaTeX writer but might
1934 not need to be tested with other writers (e.g. the HTML writer).
1937 \subsection{3.1   Custom Roles in LaTeX%
1938 \label{custom-roles-in-latex}%
1941 \begin{itemize}
1942 \item Role names and class arguments are converted to conform to the
1943 regular expression \texttt{{[}a-z{]}{[}-a-z0-9{]}*} (letters are downcased,
1944 accents and similar decoration is stripped, non-conforming
1945 characters are replaced by a hyphen).
1947 Class arguments may contain numbers and hyphens, which need special
1948 treatment in LaTeX command names.
1950 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Text with role “custom4”}}}}} (but without styling by \texttt{DUrole*}
1951 macros).
1953 \item With LaTeX, roles can be styled within the document using the \DUroletitlereference{raw}
1954 directive.
1956 \newcommand{\DUrolelarge}[1]{{\large #1}}
1957 \makeatletter
1958 \@namedef{DUrolesmall-caps}{\textsc}
1959 \@namedef{DUrolecustom4}{\textbf}
1960 \makeatother
1962 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{inline text}}}}} in large, bold, small-caps.
1964 \item Custom roles can be based on standard roles:
1966 This is a \emph{\DUrole{custom-emphasis}{customized emphasis text role}}
1968 This is a \texttt{\DUrole{custom-literal}{customized literal text role}}
1970 This is a \textbf{\DUrole{custom-strong}{customized strong text role}}
1972 This is a \textsubscript{\DUrole{custom-subscript}{customized subscript text role}}
1974 This is a \textsuperscript{\DUrole{custom-superscript}{customized superscript text role}}
1976 This is a \DUroletitlereference{\DUrole{custom-title-reference}{customized title-reference text role}}
1977 \end{itemize}
1980 \subsection{3.2   class handling%
1981 \label{class-handling}%
1984 This section tests class handling for block level elements by the LaTeX
1985 writer. See the input file \texttt{classes\_latex.txt} for the raw LaTeX code used
1986 to style the examples.
1988 An “epigraph” directive is exported as “quote” wrapped in a “DUclass”
1989 environment. Here, it is styled by a “DUCLASSepigraph” environment
1990 redefining the “quote” environment as “minipage”:
1992 \newcommand*{\DUCLASSepigraph}{%
1993 \renewenvironment{quote}{\vspace{1em}
1994 \footnotesize\hfill{}%
1995 \begin{minipage}{0.4\columnwidth}}%
1996 {\end{minipage}\vskip\baselineskip}}
1998 \begin{DUclass}{epigraph}
1999 \begin{quote}
2000 Do not play this piece fast. It is never right to play \emph{Ragtime} fast.
2001 \nopagebreak
2003 \raggedleft —Scott Joplin
2004 \end{quote}
2005 \end{DUclass}
2007 Raw latex is also used to style the following lists: “DUCLASSenumerateitems”
2008 redefines “itemize” as “enumerate”, “DUCLASSrules” draws horizontal lines
2009 above and below.
2011 \newcommand*{\DUCLASSenumerateitems}{%
2012 \renewenvironment{itemize}{\begin{enumerate}}%
2013 {\end{enumerate}}%
2016 \newenvironment{DUCLASSrules}%
2017 {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}%
2018 {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}
2020 An “enumerated” bullet list:
2022 \begin{DUclass}{enumerateitems}
2023 \begin{itemize}
2024 \item item
2026 \item next item
2028 \item third item
2029 \end{itemize}
2030 \end{DUclass}
2032 A list with lines above and below:
2034 \begin{DUclass}{rules}
2035 \begin{itemize}
2036 \item item
2038 \item next item
2039 \end{itemize}
2040 \end{DUclass}
2042 A normal bullet list is kept unchanged by the above redefinitions:
2044 \begin{itemize}
2045 \item item
2047 \item next item
2049 \item third item
2050 \end{itemize}
2052 A container wraps several elements in a common “class wrapper”. Here, we use
2053 it to set 2 paragraphs and a list in small caps:
2055 \newcommand*{\DUCLASSscshape}{\scshape}
2057 \begin{DUclass}{scshape}
2059 paragraph 1
2061 paragraph 2
2063 \begin{itemize}
2064 \item bullet list
2066 \item still bullet list
2067 \end{itemize}
2068 \end{DUclass}
2070 A right-aligned line-block. Alignment handling is built into the latex
2071 writer for image, table, and line block elements.
2073 \begin{DUlineblock}{0em}
2074 \raggedleft
2075 \item[] Max Mustermann
2076 \item[] Waldstr. 22
2077 \item[] D 01234 Testdorf
2078 \item[] Tel.: 0123/456789
2079 \end{DUlineblock}
2082 \subsection{3.3   More Tables%
2083 \label{more-tables}%
2086 A table with multi-paragraph multicolumn cells:
2088 \setlength{\DUtablewidth}{\linewidth}
2089 \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}|}
2090 \hline
2092 test
2094 \textbf{bold hd}
2095 & \multicolumn{3}{p{0.41\DUtablewidth}|}{%
2096 multicolumn 1
2098 With a second paragraph
2099 } &
2100 \emph{emph hd}
2102 \hline
2103 \multicolumn{2}{|p{0.31\DUtablewidth}|}{%
2104 multicolumn 2
2106 With a second paragraph
2107 } &
2108 cell
2110 cell
2112 cell
2114 cell
2116 \hline
2118 cell
2119 & \multicolumn{2}{p{0.36\DUtablewidth}|}{%
2120 multicolumn 3 (one line,
2121 but very very very very
2122 very looooong)
2123 } &
2124 cell
2126 cell
2128 cell
2130 \hline
2132 cell
2134 cell
2136 cell
2137 & \multicolumn{3}{p{0.38\DUtablewidth}|}{%
2138 Short multicolumn 4
2139 } \\
2140 \hline
2141 \end{longtable*}
2143 Tables with multi-paragraph multirow cells currently fail due to a LaTeX
2144 limitation (see \url{https://sourceforge.net/p/docutils/bugs/225/}).
2146 A table with multirow header and column-widths set by LaTeX:
2148 \begin{longtable*}[c]{|l|l|}
2149 \hline
2150 \multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\
2151 \cline{2-2}
2152 & \textbf{Description} \\
2153 \hline
2154 \endfirsthead
2155 \hline
2156 \multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\
2157 \cline{2-2}
2158 & \textbf{Description} \\
2159 \hline
2160 \endhead
2161 \multicolumn{2}{c}{\hfill ... continued on next page} \\
2162 \endfoot
2163 \endlastfoot
2164 \multicolumn{2}{|l|}{multicollumn cell} \\
2165 \hline
2166 \end{longtable*}
2168 In a table with column-widths set by LaTeX, each cell has just one line.
2169 Paragraphs are merged (a warning is given).
2171 \begin{longtable*}[c]{|l|l|}
2172 \hline
2173 11 & first paragraph
2174 second paragraph
2175 third paragraph \\
2176 \hline
2177 21 & 22 \\
2178 \hline
2179 \end{longtable*}
2181 % This file is used by the standalone_rst_latex test.
2184 \subsection{3.4   Option lists%
2185 \label{id23}%
2188 The LaTeX-2e description environment is used for definition lists.
2189 The definition is continued on the same line as the term, this should
2190 not happen if a option-list is at the top of the definition.
2192 If the option list is not at the first element in the definition, it
2193 is contained in a quote
2195 \begin{quote}
2196 \begin{DUoptionlist}
2197 \item[--help] show help
2199 \item[-v] verbose
2200 \end{DUoptionlist}
2201 \end{quote}
2203 \begin{description}
2204 \item[{In a definition list:}] \leavevmode
2205 \begin{DUoptionlist}
2206 \item[--help] show help
2208 \item[-v] verbose
2209 \end{DUoptionlist}
2211 \end{description}
2214 \subsection{3.5   Monospaced non-alphanumeric characters%
2215 \label{monospaced-non-alphanumeric-characters}%
2218 These are all ASCII characters except a-zA-Z0-9 and space:
2220 \texttt{!!!\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'''((()))***+++,,,---...///:::}
2222 \texttt{;;;<<<===>>>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_```\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}}
2224 \texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
2226 The two lines of non-alphanumeric characters should both have the same
2227 width as the third line.
2230 \subsection{3.6   Non-ASCII characters%
2231 \label{non-ascii-characters}%
2234 Punctuation and footnote symbols
2236 \setlength{\DUtablewidth}{\linewidth}
2237 \begin{longtable*}[c]{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|}
2238 \hline
2242 en-dash
2244 \hline
2248 em-dash
2250 \hline
2254 single turned comma quotation mark
2256 \hline
2260 single comma quotation mark
2262 \hline
2266 low single comma quotation mark
2268 \hline
2272 double turned comma quotation mark
2274 \hline
2278 double comma quotation mark
2280 \hline
2284 low double comma quotation mark
2286 \hline
2290 dagger
2292 \hline
2296 double dagger
2298 \hline
2302 black diamond suit
2304 \hline
2308 black heart suit
2310 \hline
2314 black spade suit
2316 \hline
2320 black club suit
2322 \hline
2326 ellipsis
2328 \hline
2332 trade mark sign
2334 \hline
2338 left-right double arrow
2340 \hline
2341 \end{longtable*}
2343 The \DUroletitlereference{Latin-1 extended} Unicode block
2345 \setlength{\DUtablewidth}{\linewidth}
2346 \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}|}
2347 \hline
2371 \hline
2374 & &
2380 & &
2391 \hline
2415 \hline
2439 \hline
2463 \hline
2487 \hline
2511 \hline
2535 \hline
2559 \hline
2583 \hline
2598 & & & & \\
2599 \hline
2600 \end{longtable*}
2602 \begin{itemize}
2603 \item The following line should not be wrapped, because it uses
2604 no-break spaces (\textbackslash{}u00a0):
2606 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
2608 \item Line wrapping with/without breakpoints marked by soft hyphens
2609 (\textbackslash{}u00ad):
2611 pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch
2613 pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch
2614 \end{itemize}
2617 \subsection{3.7   Encoding special chars%
2618 \label{encoding-special-chars}%
2621 The LaTeX Info pages lists under “2.18 Special Characters”
2623 \begin{quote}
2624 The following characters play a special role in LaTeX and are called
2625 “special printing characters”, or simply “special characters”.
2627 \begin{quote}
2628 \# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \}
2629 \end{quote}
2630 \end{quote}
2632 The special chars verbatim:
2634 \begin{quote}
2635 \begin{alltt}
2636 # $ % & ~ _ ^ \textbackslash{} \{ \}
2637 \end{alltt}
2638 \end{quote}
2640 However also \emph{square brackets} {[}{]} need special care.
2642 \begin{quote}
2643 Commands with optional arguments (e.g. \texttt{\textbackslash{}item}) check
2644 if the token right after the macro name is an opening bracket.
2645 In that case the contents between that bracket and the following
2646 closing bracket on the same grouping level are taken as the
2647 optional argument. What makes this unintuitive is the fact that
2648 the square brackets aren’t grouping characters themselves, so in
2649 your last example \texttt{\textbackslash{}item{[}{[}...{]}{]}} the optional argument consists of
2650 {[}… (without the closing bracket).
2651 \end{quote}
2653 Compare the items in the following lists:
2655 \begin{itemize}
2656 \item simple item
2658 \item {[}bracketed{]} item
2659 \end{itemize}
2661 \begin{description}
2662 \item[{simple}] \leavevmode
2663 description term
2665 \item[{{[}bracketed{]}}] \leavevmode
2666 description term
2668 \end{description}
2670 The OT1 font-encoding has different characters for the less-than,
2671 greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}:
2673 \begin{quote}
2674 \begin{alltt}
2675 < | >
2676 \end{alltt}
2677 \end{quote}
2680 \subsection{3.8   Hyperlinks and -targets%
2681 \label{hyperlinks-and-targets}%
2684 In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a
2686 \phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or
2687 caption:
2689 \setlength{\DUtablewidth}{\linewidth}
2690 \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
2691 \caption{Table with %
2692 \label{hypertarget-in-table-title}hypertarget in table title.}\\
2693 \hline
2695 False
2697 True
2699 None
2701 \hline
2702 \end{longtable}
2703 \label{table-label}
2705 \begin{figure}
2706 \phantomsection\label{figure-label}
2707 \noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
2708 \caption{Figure with %
2709 \label{hypertarget-in-figure-caption}hypertarget in figure caption.}
2710 \begin{DUlegend}
2711 Legend with %
2712 \phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend.
2713 \end{DUlegend}
2714 \end{figure}
2716 \includegraphics{../../../docs/user/rst/images/biohazard.png}
2717 \phantomsection\label{image-label}
2719 See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text},
2720 \hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title},
2721 \hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption},
2722 \hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and
2723 \hyperref[image-label]{image label}.
2726 \subsection{3.9   External references%
2727 \label{external-references}%
2730 Long URLs should be wrapped in the PDF. This can be achieved with the
2731 \texttt{\textbackslash{}url} command which is used by the LaTeX writer whenever the content
2732 (name) of a reference node equals the link URL.
2734 \begin{description}
2735 \item[{Example:}] \leavevmode
2736 a long URL that should wrap in the output
2737 \url{http://docutils.sourceforge.net/docs/user/latex.html\#id79}
2739 \end{description}
2741 If the argument contains any “\%”, “\#”, or “\textasciicircum{}\textasciicircum{}”, or ends with \texttt{\textbackslash{}}, it can’t
2742 be used in the argument to another command. The argument must not contain
2743 unbalanced braces.
2745 The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a “http:” or “ftp:” URL
2746 and not recognized as part of it:
2748 \begin{DUlineblock}{0em}
2749 \item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name
2750 \item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{}
2751 \item[] \url{http://www.example.org/XML}/strange\{n\}ame
2752 \end{DUlineblock}
2754 They can, however be used in paths and/or filenames.
2756 Handling by the LaTeX writer:
2758 \begin{itemize}
2759 \item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped:
2761 \begin{DUlineblock}{0em}
2762 \item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#}
2763 \url{http://www.w3.org/XML/Schema\#dev}
2764 \item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%}
2765 \url{http://example.org/Schema\%dev}
2766 \item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{id44}{id43}{10} \url{A:DOS\\path\\}\DUfootnotemark{id45}{id43}{10}
2767 \end{DUlineblock}
2769 \DUadmonition[note]{
2770 \DUtitle[note]{Note}
2772 These URLs are typeset inside a LaTeX command without error.
2774 \begin{DUlineblock}{0em}
2775 \item[] \url{http://www.w3.org/XML/Schema\#dev}
2776 \item[] \url{http://example.org/Schema\%dev}
2777 \item[] \url{A:DOS\\path\\}\DUfootnotemark{id46}{id43}{10}
2778 \end{DUlineblock}
2780 \end{itemize}
2782 \begin{itemize}
2783 \item \texttt{\textasciicircum{}\textasciicircum{}} LaTeX’s special syntax for characters results in “strange” replacements
2784 (both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}). A warning is given.
2786 \href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}:
2787 \url{../strange^^name}
2789 \item Unbalanced braces, \{ or \}, will fail (both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}):
2791 \begin{quote}
2792 \begin{alltt}
2793 `file with \{ <../strange\{name>`__
2794 `<../strange\{name>`__
2795 \end{alltt}
2796 \end{quote}
2798 while balanced braces are suported:
2800 \begin{DUlineblock}{0em}
2801 \item[] \url{../strange{n}ame}
2802 \item[] \url{../st{r}ange{n}ame}
2803 \item[] \url{../{st{r}ange{n}ame}}
2804 \end{DUlineblock}
2805 \end{itemize}
2808 \subsection{3.10   Section titles with \hyperref[inline-markup]{inline markup}%
2809 \label{section-titles-with-inline-markup}%
2813 \subsubsection{3.10.1   \emph{emphasized}, H\textsubscript{2}O and $x^2$%
2814 \label{emphasized-h2o-and-x-2}%
2818 \subsubsection{3.10.2   Substitutions work%
2819 \label{substitutions-fail}%
2823 \subsection{3.11   Deeply nested sections%
2824 \label{deeply-nested-sections}%
2827 In LaTeX and HTML,
2830 \subsubsection{3.11.1   Level 3%
2831 \label{level-3}%
2834 nested sections
2837 \paragraph{3.11.1.1   level 4%
2838 \label{level-4}%
2841 reach at some level
2844 \subparagraph{3.11.1.1.1   level 5%
2845 \label{level-5}%
2848 (depending on the document class)
2851 \DUtitle[sectionVI]{3.11.1.1.1.1   level 6%
2852 \label{level-6}%
2855 an unsupported level.
2858 \section{4   Tests for the XeTeX writer%
2859 \label{tests-for-the-xetex-writer}%
2862 With XeTeX, you can typeset text in any language/script supported by
2863 Unicode and the selected font, e.g. Azərbaycanca, Bân-lâm-gú, Башҡорт
2864 Беларуская, Български, Català, Чӑвашла, Česky, Ελληνικά, Español,
2865 Français, Føroyskt, Хальмг, Íslenska, עברית , Қазақша, Kurdî,
2866 Latviešu, Lietuvių, Македонски, Монгол, Nāhuatl, Português, Română,
2867 Русский, Slovenščina, Српски, Türkçe, Українська, Tiếng Việt, Volapük,
2868 Võro, ייִדיש , Žemaitėška.
2869 Currently, there is extended support for 28 languages in the
2870 \href{http://ctan.org/pkg/polyglossia}{polyglossia}\DUfootnotemark{id39}{id38}{8} package.
2872 % System Messages:
2875 \section{5   Error Handling%
2876 \label{error-handling}%
2879 Any errors caught during processing will generate system messages.
2881 There should be five messages in the following, auto-generated
2882 section, “Docutils System Messages”:
2884 % section should be added by Docutils automatically
2887 \section[Docutils System Messages]{\color{red}Docutils System Messages%
2890 \DUadmonition[system-message]{
2891 \DUtitle[system-message]{system-message}
2892 \raisebox{1em}{\hypertarget{id27}{}}
2894 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~104
2896 \hyperlink{id28}{
2897 Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}.
2900 \DUadmonition[system-message]{
2901 \DUtitle[system-message]{system-message}
2902 \raisebox{1em}{\hypertarget{id47}{}}
2904 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~392
2906 \hyperlink{id17}{
2907 Unknown target name: \textquotedbl{}5\textquotedbl{}.
2910 \DUadmonition[system-message]{
2911 \DUtitle[system-message]{system-message}
2912 \raisebox{1em}{\hypertarget{id48}{}}
2914 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~401
2916 \hyperlink{id19}{
2917 Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
2920 \DUadmonition[system-message]{
2921 \DUtitle[system-message]{system-message}
2922 \raisebox{1em}{\hypertarget{id49}{}}
2924 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~428
2926 \hyperlink{id50}{
2927 Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}.
2930 \DUadmonition[system-message]{
2931 \DUtitle[system-message]{system-message}
2932 \raisebox{1em}{\hypertarget{id51}{}}
2934 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~441
2936 \hyperlink{id52}{
2937 Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}.
2940 \end{document}