latex writer: fix fallback definition of \DUroles macro.
[docutils.git] / docutils / test / functional / expected / standalone_rst_latex.tex
blobab1402f9ce6133e2beba5190725b6ba9fabe2946
1 \documentclass[a4paper]{article}
2 % generated by Docutils <http://docutils.sourceforge.net/>
3 \usepackage{cmap} % fix search and cut-and-paste in Acrobat
4 \usepackage{ifthen}
5 \usepackage[T1]{fontenc}
6 \usepackage[utf8]{inputenc}
7 \DeclareUnicodeCharacter{21D4}{\ensuremath{\Leftrightarrow}}
8 \DeclareUnicodeCharacter{2660}{\ensuremath{\spadesuit}}
9 \DeclareUnicodeCharacter{2663}{\ensuremath{\clubsuit}}
10 \usepackage{alltt}
11 \usepackage{amsmath}
12 \usepackage[british,french,ngerman,english]{babel}
13 % Prevent side-effects if French hyphenation patterns are not loaded:
14 \frenchbsetup{StandardLayout}
15 \AtBeginDocument{\selectlanguage{english}\noextrasfrench}
16 \usepackage{color}
17 \usepackage{float} % float configuration
18 \floatplacement{figure}{H} % place figures here definitely
19 \usepackage{graphicx}
20 \usepackage{multirow}
21 \usepackage{pifont}
22 \setcounter{secnumdepth}{0}
23 \usepackage{longtable,ltcaption,array}
24 \setlength{\extrarowheight}{2pt}
25 \newlength{\DUtablewidth} % internal use in tables
26 \usepackage{tabularx}
27 \usepackage{textcomp} % text symbol macros
29 %%% Custom LaTeX preamble
30 % PDF Standard Fonts
31 \usepackage{mathptmx} % Times
32 \usepackage[scaled=.90]{helvet}
33 \usepackage{courier}
35 %%% User specified packages and stylesheets
37 %%% Fallback definitions for Docutils-specific commands
39 % class handling for environments (block-level elements)
40 % \begin{DUclass}{spam} tries \DUCLASSspam and
41 % \end{DUclass}{spam} tries \endDUCLASSspam
42 \ifx\DUclass\undefined % poor man's "provideenvironment"
43 \newenvironment{DUclass}[1]%
44 {\def\DocutilsClassFunctionName{DUCLASS#1}% arg cannot be used in end-part of environment.
45 \csname \DocutilsClassFunctionName \endcsname}%
46 {\csname end\DocutilsClassFunctionName \endcsname}%
47 \fi
49 % providelength (provide a length variable and set default, if it is new)
50 \providecommand*{\DUprovidelength}[2]{
51 \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
54 % abstract title
55 \providecommand*{\DUtitleabstract}[1]{\centerline{\textbf{#1}}}
57 % admonition (specially marked topic)
58 \providecommand{\DUadmonition}[2][class-arg]{%
59 % try \DUadmonition#1{#2}:
60 \ifcsname DUadmonition#1\endcsname%
61 \csname DUadmonition#1\endcsname{#2}%
62 \else
63 \begin{center}
64 \fbox{\parbox{0.9\linewidth}{#2}}
65 \end{center}
66 \fi
69 % dedication topic
70 \providecommand*{\DUCLASSdedication}{%
71 \renewenvironment{quote}{\begin{center}}{\end{center}}%
74 % docinfo (width of docinfo table)
75 \DUprovidelength{\DUdocinfowidth}{0.9\linewidth}
77 % subtitle (in document title)
78 \providecommand*{\DUdocumentsubtitle}[1]{{\large #1}}
79 \newcounter{enumv}
81 % error admonition title
82 \providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}}
84 % fieldlist environment
85 \ifthenelse{\isundefined{\DUfieldlist}}{
86 \newenvironment{DUfieldlist}%
87 {\quote\description}
88 {\enddescription\endquote}
89 }{}
90 % numeric or symbol footnotes with hyperlinks
91 \providecommand*{\DUfootnotemark}[3]{%
92 \raisebox{1em}{\hypertarget{#1}{}}%
93 \hyperlink{#2}{\textsuperscript{#3}}%
95 \providecommand{\DUfootnotetext}[4]{%
96 \begingroup%
97 \renewcommand{\thefootnote}{%
98 \protect\raisebox{1em}{\protect\hypertarget{#1}{}}%
99 \protect\hyperlink{#2}{#3}}%
100 \footnotetext{#4}%
101 \endgroup%
104 % inline markup (custom roles)
105 % \DUrole{#1}{#2} tries \DUrole#1{#2}
106 \providecommand*{\DUrole}[2]{%
107 \ifcsname DUrole#1\endcsname%
108 \csname DUrole#1\endcsname{#2}%
109 \else
110 % backwards compatibility: try \docutilsrole#1{#2}
111 \ifcsname docutilsrole#1\endcsname%
112 \csname docutilsrole#1\endcsname{#2}%
113 \else%
115 \fi%
116 \fi%
119 % legend environment
120 \ifthenelse{\isundefined{\DUlegend}}{
121 \newenvironment{DUlegend}{\small}{}
124 % lineblock environment
125 \DUprovidelength{\DUlineblockindent}{2.5em}
126 \ifthenelse{\isundefined{\DUlineblock}}{
127 \newenvironment{DUlineblock}[1]{%
128 \list{}{\setlength{\partopsep}{\parskip}
129 \addtolength{\partopsep}{\baselineskip}
130 \setlength{\topsep}{0pt}
131 \setlength{\itemsep}{0.15\baselineskip}
132 \setlength{\parsep}{0pt}
133 \setlength{\leftmargin}{#1}}
134 \raggedright
136 {\endlist}
139 % optionlist environment
140 \providecommand*{\DUoptionlistlabel}[1]{\bf #1 \hfill}
141 \DUprovidelength{\DUoptionlistindent}{3cm}
142 \ifthenelse{\isundefined{\DUoptionlist}}{
143 \newenvironment{DUoptionlist}{%
144 \list{}{\setlength{\labelwidth}{\DUoptionlistindent}
145 \setlength{\rightmargin}{1cm}
146 \setlength{\leftmargin}{\rightmargin}
147 \addtolength{\leftmargin}{\labelwidth}
148 \addtolength{\leftmargin}{\labelsep}
149 \renewcommand{\makelabel}{\DUoptionlistlabel}}
151 {\endlist}
154 % rubric (informal heading)
155 \providecommand*{\DUrubric}[1]{%
156 \subsubsection*{\centering\textit{\textmd{#1}}}}
158 % sidebar (text outside the main text flow)
159 \providecommand{\DUsidebar}[1]{%
160 \begin{center}
161 \colorbox[gray]{0.80}{\parbox{0.9\linewidth}{#1}}
162 \end{center}
165 % subtitle (for topic/sidebar)
166 \providecommand*{\DUsubtitle}[1]{\par\emph{#1}\smallskip}
168 % text mode subscript
169 \ifx\textsubscript\undefined
170 \usepackage{fixltx2e} % since 2015 loaded by default
173 % title for topics, admonitions, unsupported section levels, and sidebar
174 \providecommand*{\DUtitle}[2][class-arg]{%
175 % call \DUtitle#1{#2} if it exists:
176 \ifcsname DUtitle#1\endcsname%
177 \csname DUtitle#1\endcsname{#2}%
178 \else
179 \smallskip\noindent\textbf{#2}\smallskip%
183 % titlereference role
184 \providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
186 % transition (break, fancybreak, anonymous section)
187 \providecommand*{\DUtransition}{%
188 \hspace*{\fill}\hrulefill\hspace*{\fill}
189 \vskip 0.5\baselineskip
192 % hyperlinks:
193 \ifthenelse{\isundefined{\hypersetup}}{
194 \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
195 \usepackage{bookmark}
196 \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
198 \hypersetup{
199 pdftitle={reStructuredText Test Document},
200 pdfauthor={David Goodger;Me;Myself;I}
203 %%% Body
204 \begin{document}
205 \title{reStructuredText Test Document%
206 \label{restructuredtext-test-document}%
207 \label{doctitle}%
208 \\ % subtitle%
209 \DUdocumentsubtitle{Examples of Syntax Constructs}%
210 \label{examples-of-syntax-constructs}%
211 \label{subtitle}}
212 \author{}
213 \date{}
214 \maketitle
216 % Docinfo
217 \begin{center}
218 \begin{tabularx}{\DUdocinfowidth}{lX}
219 \textbf{Author}: &
220 David Goodger \\
221 \textbf{Address}: &
222 {\raggedright
223 123 Example Street\\
224 Example, EX Canada\\
225 A1B 2C3 } \\
226 \textbf{Contact}: &
227 \href{mailto:goodger@python.org}{goodger@python.org} \\
228 \textbf{Author}: &
229 Me \\
230 \textbf{Author}: &
231 Myself \\
232 \textbf{Author}: &
233 I \\
234 \textbf{Organization}: &
235 humankind \\
236 \textbf{Date}: &
237 Now, or yesterday. Or maybe even \emph{before} yesterday. \\
238 \textbf{Status}: &
239 This is a “work in progress” \\
240 \textbf{Revision}: &
241 is managed by a version control system. \\
242 \textbf{Version}: &
243 1 \\
244 \textbf{Copyright}: &
245 This document has been placed in the public domain. You
246 may do with it as you wish. You may copy, modify,
247 redistribute, reattribute, sell, buy, rent, lease,
248 destroy, or improve it, quote it at length, excerpt,
249 incorporate, collate, fold, staple, or mutilate it, or do
250 anything else to it that your or anyone else’s heart
251 desires. \\
252 \textbf{field name}: &
253 This is a “generic bibliographic field”.
255 \textbf{field name “2}: &
256 Generic bibliographic fields may contain multiple body elements.
258 Like this.
260 \end{tabularx}
261 \end{center}
263 \begin{DUclass}{dedication}
264 \begin{quote}
265 \DUtitle[dedication]{Dedication}
267 For Docutils users \& co-developers.
268 \end{quote}
269 \end{DUclass}
271 \begin{DUclass}{abstract}
272 \begin{quote}
273 \DUtitle[abstract]{Abstract}
275 This is a test document, containing at least one example of each
276 reStructuredText construct.
277 \end{quote}
278 \end{DUclass}
280 % This is a comment. Note how any initial comments are moved by
281 % transforms to after the document title, subtitle, and docinfo.
283 % Above is the document title, and below is the subtitle.
284 % They are transformed from section titles after parsing.
286 % bibliographic fields (which also require a transform):
288 \pagebreak[4] % start ToC on new page
290 \phantomsection\label{table-of-contents}
291 \pdfbookmark[1]{Table of Contents}{table-of-contents}
292 \renewcommand{\contentsname}{Table of Contents}
293 \tableofcontents
296 \section{1   Structural Elements%
297 \label{structural-elements}%
301 \subsection{1.1   Section Title%
302 \label{section-title}%
304 \subsubsection*{Section Subtitle}
306 Lone subsections are converted to a section subtitle by a transform
307 activated with the \texttt{-{}-section-subtitles} command line option or the
308 \texttt{sectsubtitle-xform} configuration value.
311 \subsection{1.2   Empty Section%
312 \label{empty-section}%
316 \subsection{1.3   Transitions%
317 \label{transitions}%
320 Here’s a transition:
322 %___________________________________________________________________________
323 \DUtransition
325 It divides the section. Transitions may also occur between sections:
327 %___________________________________________________________________________
328 \DUtransition
331 \section{2   Body Elements%
332 \label{body-elements}%
336 \subsection{2.1   Paragraphs%
337 \label{paragraphs}%
340 A paragraph.
343 \subsubsection{2.1.1   Inline Markup%
344 \label{inline-markup}%
347 Paragraphs contain text and may contain inline markup: \emph{emphasis},
348 \textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks
349 (\url{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\DUfootnotemark{id30}{id29}{5}), internal
350 cross-references (\hyperref[example]{example}), external hyperlinks with embedded URIs
351 (\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink
352 references}\DUfootnotemark{id38}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id40}{id39}{8}), footnote references (manually
353 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]}),
354 substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png} \&
355 a \emph{trimmed heart} \texttt{(U+2665):}\ding{170}), and %
356 \phantomsection\label{inline-hyperlink-targets}inline hyperlink targets
357 (see \hyperref[targets]{Targets} below for a reference back to here). Character-level
358 inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by %
359 \raisebox{1em}{\hypertarget{id28}{}}\hyperlink{id27}{\textbf{\color{red}|problematic|}} text
360 (generated by processing errors; this one is intentional). Here is a
361 reference to the \hyperref[doctitle]{doctitle} and the \hyperref[subtitle]{subtitle}.
363 The default role for interpreted text is \DUroletitlereference{Title Reference}. Here are
364 some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/dev/peps/pep-0287}{PEP 287}); an
365 RFC reference (\href{http://tools.ietf.org/html/rfc2822.html}{RFC 2822}); an abbreviation (\DUrole{abbreviation}{abb.}), an acronym
366 (\DUrole{acronym}{reST}), code (\texttt{\DUrole{code}{print \textquotedbl{}hello world\textquotedbl{}}}); a \textsubscript{subscript};
367 a \textsuperscript{superscript} and explicit roles for \DUroletitlereference{Docutils}
368 \emph{standard} \textbf{inline} \texttt{markup}.
370 % DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
372 Let’s test wrapping and whitespace significance in inline literals:
373 \texttt{This is an example of -{}-inline-literal -{}-text, -{}-including some-{}-
374 strangely-{}-hyphenated-words. ~Adjust-the-width-of-your-browser-window
375 to see how the text is wrapped. ~-{}- -{}-{}-{}- -{}-{}-{}-{}-{}-{}-{}- ~Now note ~ ~the
376 spacing ~ ~between the ~ ~words of ~ ~this sentence ~ ~(words
377 should ~ ~be grouped ~ ~in pairs).}
379 If the \texttt{-{}-pep-references} option was supplied, there should be a
380 live link to PEP 258 here.
383 \subsection{2.2   Bullet Lists%
384 \label{bullet-lists}%
387 \begin{itemize}
388 \item A bullet list
390 \begin{itemize}
391 \item Nested bullet list.
393 \item Nested item 2.
394 \end{itemize}
396 \item Item 2.
398 Paragraph 2 of item 2.
400 \begin{itemize}
401 \item Nested bullet list.
403 \item Nested item 2.
405 \begin{itemize}
406 \item Third level.
408 \item Item 2.
409 \end{itemize}
411 \item Nested item 3.
413 \item This nested list should be compacted by the HTML writer.
415 \phantomsection\label{target}
416 % Even if this item contains a target and a comment.
417 \end{itemize}
418 \end{itemize}
421 \subsection{2.3   Enumerated Lists%
422 \label{enumerated-lists}%
425 \begin{enumerate}
426 \item Arabic numerals.
428 \begin{enumerate}
429 \renewcommand{\labelenumii}{\alph{enumii})}
430 \item lower alpha)
432 \begin{enumerate}
433 \renewcommand{\labelenumiii}{(\roman{enumiii})}
434 \item (lower roman)
436 \begin{enumerate}
437 \item upper alpha.
439 \begin{list}{\Roman{enumv})}{\usecounter{enumv}}
440 \item upper roman)
441 \end{list}
442 \end{enumerate}
443 \end{enumerate}
444 \end{enumerate}
446 \item Lists that don’t start at 1:
448 \begin{enumerate}
449 \renewcommand{\labelenumii}{\arabic{enumii}.}
450 \setcounter{enumii}{2}
451 \item Three
453 \item Four
454 \end{enumerate}
456 \begin{enumerate}
457 \renewcommand{\labelenumii}{\Alph{enumii}.}
458 \setcounter{enumii}{2}
459 \item C
461 \item D
462 \end{enumerate}
464 \begin{enumerate}
465 \renewcommand{\labelenumii}{\roman{enumii}.}
466 \setcounter{enumii}{2}
467 \item iii
469 \item iv
470 \end{enumerate}
471 \end{enumerate}
474 \subsection{2.4   Definition Lists%
475 \label{definition-lists}%
478 \begin{description}
479 \item[{Term}] \leavevmode
480 Definition
482 \item[{Term}] \leavevmode (\textbf{classifier})
483 Definition paragraph 1.
485 Definition paragraph 2.
487 \item[{Term}] \leavevmode
488 Definition
490 \item[{Term}] \leavevmode (\textbf{classifier one})(\textbf{classifier two})
491 Definition
493 \end{description}
496 \subsection{2.5   Field Lists%
497 \label{field-lists}%
500 \begin{DUfieldlist}
501 \item[{what:}]
502 Field lists map field names to field bodies, like database
503 records. They are often part of an extension syntax. They are
504 an unambiguous variant of RFC 2822 fields.
506 \item[{how arg1 arg2:}]
507 The field marker is a colon, the field name, and a colon.
509 The field body may contain one or more body elements, indented
510 relative to the field marker.
512 \item[{credits:}]
513 \DUrole{credits}{This paragraph has the \DUroletitlereference{credits} class set. (This is actually not
514 about credits but just for ensuring that the class attribute
515 doesn’t get stripped away.)}
516 \end{DUfieldlist}
519 \subsection{2.6   Option Lists%
520 \label{option-lists}%
523 For listing command-line options:
525 \begin{DUoptionlist}
526 \item[-a] command-line option “a”
528 \item[-b file] options can have arguments
529 and long descriptions
531 \item[-{}-long] options can be long also
533 \item[-{}-input=file] long options can also have
534 arguments
536 \item[-{}-very-long-option] The description can also start on the next line.
538 The description may contain multiple body elements,
539 regardless of where it starts.
541 \item[-x, -y, -z] Multiple options are an “option group”.
543 \item[-v, -{}-verbose] Commonly-seen: short \& long options.
545 \item[-1 file, -{}-one=file, -{}-two file] Multiple options with arguments.
547 \item[/V] DOS/VMS-style options too
548 \end{DUoptionlist}
550 There must be at least two spaces between the option and the
551 description.
554 \subsection{2.7   Literal Blocks%
555 \label{literal-blocks}%
558 Literal blocks are indicated with a double-colon (“::”) at the end of
559 the preceding paragraph (over there \texttt{-{}->}). They can be indented:
561 \begin{quote}
562 \begin{alltt}
563 if literal_block:
564 text = 'is left as-is'
565 spaces_and_linebreaks = 'are preserved'
566 markup_processing = None
567 \end{alltt}
568 \end{quote}
570 Or they can be quoted without indentation:
572 \begin{quote}
573 \begin{alltt}
574 >> Great idea!
576 > Why didn't I think of that?
577 \end{alltt}
578 \end{quote}
581 \subsection{2.8   Line Blocks%
582 \label{line-blocks}%
585 This section tests line blocks. Line blocks are body elements which
586 consist of lines and other line blocks. Nested line blocks cause
587 indentation.
589 \begin{DUlineblock}{0em}
590 \item[] This is a line block. It ends with a blank line.
591 \item[]
592 \begin{DUlineblock}{\DUlineblockindent}
593 \item[] New lines begin with a vertical bar (“|”).
594 \item[] Line breaks and initial indent are significant, and preserved.
595 \item[]
596 \begin{DUlineblock}{\DUlineblockindent}
597 \item[] Continuation lines are also possible. A long line that is intended
598 to wrap should begin with a space in place of the vertical bar.
599 \end{DUlineblock}
600 \item[] The left edge of a continuation line need not be aligned with
601 the left edge of the text above it.
602 \end{DUlineblock}
603 \end{DUlineblock}
605 \begin{DUlineblock}{0em}
606 \item[] This is a second line block.
607 \item[]
608 \item[] Blank lines are permitted internally, but they must begin with a “|”.
609 \end{DUlineblock}
611 Another line block, surrounded by paragraphs:
613 \begin{DUlineblock}{0em}
614 \item[] And it’s no good waiting by the window
615 \item[] It’s no good waiting for the sun
616 \item[] Please believe me, the things you dream of
617 \item[] They don’t fall in the lap of no-one
618 \end{DUlineblock}
620 Take it away, Eric the Orchestra Leader!
622 \begin{quote}
623 \begin{DUlineblock}{0em}
624 \item[] A one, two, a one two three four
625 \item[]
626 \item[] Half a bee, philosophically,
627 \item[]
628 \begin{DUlineblock}{\DUlineblockindent}
629 \item[] must, \emph{ipso facto}, half not be.
630 \end{DUlineblock}
631 \item[] But half the bee has got to be,
632 \item[]
633 \begin{DUlineblock}{\DUlineblockindent}
634 \item[] \emph{vis a vis} its entity. D’you see?
635 \item[]
636 \end{DUlineblock}
637 \item[] But can a bee be said to be
638 \item[]
639 \begin{DUlineblock}{\DUlineblockindent}
640 \item[] or not to be an entire bee,
641 \item[]
642 \begin{DUlineblock}{\DUlineblockindent}
643 \item[] when half the bee is not a bee,
644 \item[]
645 \begin{DUlineblock}{\DUlineblockindent}
646 \item[] due to some ancient injury?
647 \item[]
648 \end{DUlineblock}
649 \end{DUlineblock}
650 \end{DUlineblock}
651 \item[] Singing…
652 \end{DUlineblock}
653 \end{quote}
655 A line block, like the following poem by Christian Morgenstern, can
656 also be centre-aligned:
658 \begin{selectlanguage}{ngerman}
659 \begin{DUlineblock}{0em}
660 \centering
661 \item[] \textbf{Die Trichter}
662 \item[]
663 \item[] Zwei Trichter wandeln durch die Nacht.
664 \item[] Durch ihres Rumpfs verengten Schacht
665 \item[] fließt weißes Mondlicht
666 \item[] still und heiter
667 \item[] auf   ihren
668 \item[] Waldweg
669 \item[] u. s.
670 \item[] w.
671 \item[]
672 \end{DUlineblock}
673 \end{selectlanguage}
676 \subsection{2.9   Block Quotes%
677 \label{block-quotes}%
680 Block quotes consist of indented body elements:
682 \begin{quote}
683 My theory by A. Elk. Brackets Miss, brackets. This theory goes
684 as follows and begins now. All brontosauruses are thin at one
685 end, much much thicker in the middle and then thin again at the
686 far end. That is my theory, it is mine, and belongs to me and I
687 own it, and what it is too.
688 \nopagebreak
690 \raggedleft —Anne Elk (Miss)
691 \end{quote}
693 The language of a quote (like any other object) can be specified by
694 a class attribute:
698 \begin{selectlanguage}{french}
699 \begin{quote}
700 ReStructuredText est un langage de balisage léger utilisé
701 notamment dans la documentation du langage Python.
702 \end{quote}
703 \end{selectlanguage}
706 \subsection{2.10   Doctest Blocks%
707 \label{doctest-blocks}%
710 \begin{quote}
711 \begin{alltt}
712 >>> print 'Python-specific usage examples; begun with ">>>"'
713 Python-specific usage examples; begun with ">>>"
714 >>> print '(cut and pasted from interactive Python sessions)'
715 (cut and pasted from interactive Python sessions)
716 \end{alltt}
717 \end{quote}
720 \subsection{2.11   Footnotes%
721 \label{footnotes}%
724 \DUfootnotetext{id8}{id1}{1}{%
725 A footnote contains body elements, consistently indented by at
726 least 3 spaces.
728 This is the footnote’s second paragraph.
731 \DUfootnotetext{label}{id3}{2}{\phantomsection\label{label}%
732 Footnotes may be numbered, either manually (as in\DUfootnotemark{id9}{id8}{1}) or
733 automatically using a “\#”-prefixed label. This footnote has a
734 label so it can be referred to from multiple places, both as a
735 footnote reference (\DUfootnotemark{id10}{label}{2}) and as a \hyperref[label]{hyperlink reference}.
738 \DUfootnotetext{id12}{id2}{3}{%
739 This footnote is numbered automatically and anonymously using a
740 label of “\#” only.
742 This is the second paragraph.
744 And this is the third paragraph.
747 \DUfootnotetext{id13}{id4}{*}{%
748 Footnotes may also use symbols, specified with a “*” label.
749 Here’s a reference to the next footnote:\DUfootnotemark{id14}{id15}{}.
752 \DUfootnotetext{id15}{id14}{}{%
753 This footnote shows the next symbol in the sequence.
756 \DUfootnotetext{id16}{id16}{4}{%
757 Here’s an unreferenced footnote, with a reference to a
758 nonexistent footnote:%
759 \raisebox{1em}{\hypertarget{id17}{}}\hyperlink{id45}{\textbf{\color{red}{[}5{]}\_}}.
763 \subsection{2.12   Citations%
764 \label{citations}%
766 \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
767 Citations are text-labeled footnotes. They may be
768 rendered separately and differently from footnotes.
769 \end{figure}
771 Here’s a reference to the above, \hyperlink{cit2002}{[CIT2002]}, and a %
772 \raisebox{1em}{\hypertarget{id19}{}}\hyperlink{id46}{\textbf{\color{red}{[}nonexistent{]}\_}}
773 citation.
776 \subsection{2.13   Targets%
777 \label{targets}%
778 \label{another-target}%
781 \phantomsection\label{example}
782 This paragraph is pointed to by the explicit “example” target. A
783 reference can be found under \hyperref[inline-markup]{Inline Markup}, above. \hyperref[inline-hyperlink-targets]{Inline
784 hyperlink targets} are also possible.
786 Section headers are implicit targets, referred to by name. See
787 \hyperref[targets]{Targets}, which is a subsection of \hyperref[body-elements]{Body Elements}.
789 Explicit external targets are interpolated into references such as
790 \href{http://www.python.org/}{Python}\DUfootnotemark{id31}{id29}{5}”.
792 Targets may be indirect and anonymous. Thus \hyperref[targets]{this phrase} may also
793 refer to the \hyperref[targets]{Targets} section.
795 Here’s a %
796 \raisebox{1em}{\hypertarget{id48}{}}\hyperlink{id47}{\textbf{\color{red}`hyperlink reference without a target`\_}}, which generates an
797 error.
800 \subsubsection{2.13.1   Duplicate Target Names%
801 \label{duplicate-target-names}%
804 Duplicate names in section headers or other implicit targets will
805 generate “info” (level-1) system messages. Duplicate names in
806 explicit targets will generate “warning” (level-2) system messages.
809 \subsubsection{2.13.2   Duplicate Target Names%
810 \label{id21}%
813 Since there are two “Duplicate Target Names” section headers, we
814 cannot uniquely refer to either of them by name. If we try to (like
815 this: %
816 \raisebox{1em}{\hypertarget{id50}{}}\hyperlink{id49}{\textbf{\color{red}`Duplicate Target Names`\_}}), an error is generated.
819 \subsection{2.14   Directives%
820 \label{directives}%
823 \phantomsection\label{contents}
824 These are just a sample of the many reStructuredText Directives. For
825 others, please see
826 \url{http://docutils.sourceforge.net/docs/ref/rst/directives.html}.
829 \subsubsection{2.14.1   Document Parts%
830 \label{document-parts}%
833 An example of the “contents” directive can be seen above this section
834 (a local, untitled table of \hyperref[contents]{contents}) and at the beginning of the
835 document (a document-wide \hyperref[table-of-contents]{table of contents}).
838 \subsubsection{2.14.2   Images and Figures%
839 \label{images-and-figures}%
842 An image directive (also clickable – a hyperlink reference):
844 \hyperref[directives]{\includegraphics{../../../docs/user/rst/images/title.png}}
846 Image with multiple IDs:
848 \includegraphics{../../../docs/user/rst/images/title.png}
849 \phantomsection\label{image-target-3}\label{image-target-2}\label{image-target-1}
851 A centered image:
853 \noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
855 A left-aligned image:
857 \noindent{\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill}
859 This paragraph might flow around the image.
860 The specific behavior depends upon the style sheet and
861 the browser or rendering software used.
863 A right-aligned image:
865 \noindent{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}}
867 This paragraph might flow around the image.
868 The specific behavior depends upon the style sheet and
869 the browser or rendering software used.
871 For inline images see \hyperref[substitution-definitions]{Substitution Definitions}.
873 Image size:
875 An image 2 em wide:
877 \includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png}
879 An image 2 em wide and 15 pixel high:
881 \includegraphics[height=15px,width=2em]{../../../docs/user/rst/images/biohazard.png}
883 An image occupying 50\% of the line width:
885 \includegraphics[width=0.500\linewidth]{../../../docs/user/rst/images/title.png}
887 An image 2 cm high:
889 \includegraphics[height=2cm]{../../../docs/user/rst/images/biohazard.png}
891 A \emph{figure} is an image with a caption and/or a legend. With page-based output
892 media, figures might float to a different position if this helps the page
893 layout.
895 \begin{DUclass}{figclass1}
896 \begin{DUclass}{figclass2}
897 \begin{figure}
898 \noindent\makebox[\linewidth][c]{\includegraphics[width=258bp]{../../../docs/user/rst/images/title.png}}
899 \caption{Plaintext markup syntax and parser system.}
900 \begin{DUlegend}
901 \setlength{\DUtablewidth}{\linewidth}
902 \begin{longtable*}[c]{|p{0.156\DUtablewidth}|p{0.563\DUtablewidth}|}
903 \hline
907 Revised, revisited, based on ‘re’ module.
909 \hline
911 Structured
913 Structure-enhanced text, structuredtext.
915 \hline
917 Text
919 Well it is, isn’t it?
921 \hline
922 \end{longtable*}
924 This paragraph is also part of the legend.
925 \end{DUlegend}
926 \end{figure}
927 \end{DUclass}
928 \end{DUclass}
930 A left-aligned figure:
932 \begin{DUclass}{figclass1}
933 \begin{DUclass}{figclass2}
934 \begin{figure} % align = "left"
935 \noindent\makebox[\linewidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
936 \caption{This is the caption.}
937 \begin{DUlegend}
938 This is the legend.
940 The legend may consist of several paragraphs.
941 \end{DUlegend}
942 \end{figure}
943 \end{DUclass}
944 \end{DUclass}
946 This paragraph might flow around the figure.
948 The specific behavior depends upon the style sheet and the browser or
949 rendering software used.
951 A centered figure:
953 \begin{figure}
954 \noindent\makebox[\linewidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
955 \caption{This is the caption.}
956 \begin{DUlegend}
957 This is the legend.
959 The legend may consist of several paragraphs.
960 \end{DUlegend}
961 \end{figure}
963 This paragraph might flow around the figure.
965 The specific behavior depends upon the style sheet and the browser or
966 rendering software used.
968 A right-aligned figure:
970 \begin{figure} % align = "right"
971 \noindent\makebox[\linewidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
972 \caption{This is the caption.}
973 \begin{DUlegend}
974 This is the legend.
976 The legend may consist of several paragraphs.
977 \end{DUlegend}
978 \end{figure}
980 This paragraph might flow around the figure. The specific behavior depends
981 upon the style sheet and the browser or rendering software used.
983 Tables may be given titles and additional arguments with the \emph{table}
984 directive:
986 \setlength{\DUtablewidth}{\linewidth}
987 \begin{longtable}[l]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
988 \caption{left-aligned table}\\
989 \hline
990 \textbf{%
992 } & \textbf{%
993 not A
994 } \\
995 \hline
996 \endfirsthead
997 \caption[]{left-aligned table (... continued)}\\
998 \hline
999 \textbf{%
1001 } & \textbf{%
1002 not A
1003 } \\
1004 \hline
1005 \endhead
1006 \multicolumn{2}{c}{\hfill ... continued on next page} \\
1007 \endfoot
1008 \endlastfoot
1010 False
1012 True
1014 \hline
1016 True
1018 False
1020 \hline
1021 \end{longtable}
1023 \setlength{\DUtablewidth}{\linewidth}
1024 \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
1025 \caption{center-aligned table}\\
1026 \hline
1027 \textbf{%
1029 } & \textbf{%
1030 not A
1031 } \\
1032 \hline
1033 \endfirsthead
1034 \caption[]{center-aligned table (... continued)}\\
1035 \hline
1036 \textbf{%
1038 } & \textbf{%
1039 not A
1040 } \\
1041 \hline
1042 \endhead
1043 \multicolumn{2}{c}{\hfill ... continued on next page} \\
1044 \endfoot
1045 \endlastfoot
1047 False
1049 True
1051 \hline
1053 True
1055 False
1057 \hline
1058 \end{longtable}
1060 \setlength{\DUtablewidth}{\linewidth}
1061 \begin{longtable}[r]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
1062 \caption{right-aligned table}\\
1063 \hline
1064 \textbf{%
1066 } & \textbf{%
1067 not A
1068 } \\
1069 \hline
1070 \endfirsthead
1071 \caption[]{right-aligned table (... continued)}\\
1072 \hline
1073 \textbf{%
1075 } & \textbf{%
1076 not A
1077 } \\
1078 \hline
1079 \endhead
1080 \multicolumn{2}{c}{\hfill ... continued on next page} \\
1081 \endfoot
1082 \endlastfoot
1084 False
1086 True
1088 \hline
1090 True
1092 False
1094 \hline
1095 \end{longtable}
1097 With the “widths” argument “auto” (or “class” value “colwidths-auto”),
1098 column widths are determined by the backend (if supported by the
1099 writer/backend).
1101 \begin{longtable*}[c]{|l|l|l|}
1102 \hline
1103 \textbf{A} & \textbf{B} & \textbf{A or B} \\
1104 \hline
1105 \endfirsthead
1106 \hline
1107 \textbf{A} & \textbf{B} & \textbf{A or B} \\
1108 \hline
1109 \endhead
1110 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1111 \endfoot
1112 \endlastfoot
1113 False & False & False \\
1114 \hline
1115 True & False & True \\
1116 \hline
1117 False & True & True \\
1118 \hline
1119 True & True & True \\
1120 \hline
1121 \end{longtable*}
1122 \label{target2}\label{target1}
1125 \subsubsection{2.14.3   Admonitions%
1126 \label{admonitions}%
1129 \DUadmonition[attention]{
1130 \DUtitle[attention]{Attention!}
1132 Directives at large.
1135 \DUadmonition[caution]{
1136 \DUtitle[caution]{Caution!}
1138 Don’t take any wooden nickels.
1141 \DUadmonition[danger]{
1142 \DUtitle[danger]{!DANGER!}
1144 Mad scientist at work!
1147 \DUadmonition[error]{
1148 \DUtitle[error]{Error}
1150 Does not compute.
1153 \DUadmonition[hint]{
1154 \DUtitle[hint]{Hint}
1156 It’s bigger than a bread box.
1159 \DUadmonition[important]{
1160 \DUtitle[important]{Important}
1162 \begin{itemize}
1163 \item Wash behind your ears.
1165 \item Clean up your room.
1167 \item Call your mother.
1169 \item Back up your data.
1170 \end{itemize}
1173 \DUadmonition[note]{
1174 \DUtitle[note]{Note}
1176 This is a note.
1179 \DUadmonition[tip]{
1180 \DUtitle[tip]{Tip}
1182 15\% if the service is good.
1185 \DUadmonition[warning]{
1186 \DUtitle[warning]{Warning}
1188 Strong prose may provoke extreme mental exertion.
1189 Reader discretion is strongly advised.
1192 \DUadmonition[admonition-and-by-the-way]{
1193 \DUtitle[admonition-and-by-the-way]{And, by the way…}
1195 You can make up your own admonition too.
1199 \subsubsection{2.14.4   Topics, Sidebars, and Rubrics%
1200 \label{topics-sidebars-and-rubrics}%
1203 \emph{Sidebars} are like miniature, parallel documents.
1205 \DUsidebar{
1206 \DUtitle[title]{Sidebar Title}
1208 \DUsubtitle[sidebar]{Optional Subtitle}
1210 This is a sidebar. It is for text outside the flow of the main
1211 text.
1213 \DUrubric{This is a rubric inside a sidebar}
1215 Sidebars often appear beside the main text with a border and a different
1216 background or font color.
1219 A \emph{topic} is like a block quote with a title, or a self-contained section
1220 with no subsections.
1222 \begin{DUclass}{topic}
1223 \begin{quote}
1224 \DUtitle[topic]{Topic Title}
1226 This is a topic.
1227 \end{quote}
1228 \end{DUclass}
1230 A \emph{rubric} is like an informal heading that doesn’t correspond to the
1231 document’s structure. It is typically highlighted in red (hence the name).
1233 \DUrubric{This is a rubric}
1235 Topics and rubrics can be used at places where a \hyperref[section-title]{section title} is not
1236 allowed (e.g. inside a directive).
1239 \subsubsection{2.14.5   Target Footnotes%
1240 \label{target-footnotes}%
1243 \DUfootnotetext{id29}{id30}{5}{%
1244 \url{http://www.python.org/}
1247 \DUfootnotetext{id33}{id34}{6}{%
1248 \url{http://pygments.org/}
1251 \DUfootnotetext{id35}{id36}{7}{%
1252 \url{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}
1255 \DUfootnotetext{id39}{id40}{8}{%
1256 \url{http://docutils.sourceforge.net/}
1259 \DUfootnotetext{id41}{id42}{9}{%
1260 \url{A:DOS\\path\\}
1264 \subsubsection{2.14.6   Replacement Text%
1265 \label{replacement-text}%
1268 I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\DUfootnotemark{id32}{id29}{5}.
1271 \subsubsection{2.14.7   Compound Paragraph%
1272 \label{compound-paragraph}%
1275 The \emph{compound} directive is used to create a “compound paragraph”, which
1276 is a single logical paragraph containing multiple physical body
1277 elements. For example:
1279 \begin{DUclass}{compound}
1280 The ‘rm’ command is very dangerous. If you are logged
1281 in as root and enter
1282 \begin{quote}
1283 \begin{alltt}
1284 cd /
1285 rm -rf *
1286 \end{alltt}
1287 \end{quote}
1288 you will erase the entire contents of your file system.
1289 \end{DUclass}
1291 Test the handling and display of compound paragraphs:
1293 \begin{DUclass}{compound}
1294 \begin{DUclass}{some-class}
1295 Compound 2, paragraph 1,
1297 compound 2, paragraph 2,
1298 \begin{itemize}
1299 \item list item 1,
1301 \item list item 2,
1302 \end{itemize}
1303 compound 2, paragraph 3.
1304 \end{DUclass}
1305 \end{DUclass}
1307 \begin{DUclass}{compound}
1308 Compound 3, only consisting of one paragraph.
1309 \end{DUclass}
1311 \begin{DUclass}{compound}
1312 \begin{quote}
1313 \begin{alltt}
1314 Compound 4.
1315 This one starts with a literal block.
1316 \end{alltt}
1317 \end{quote}
1318 Compound 4, paragraph following the literal block.
1319 \end{DUclass}
1321 Now something \emph{really} perverted – a nested compound block. This is
1322 just to test that it works at all; the results don’t have to be
1323 meaningful.
1325 \begin{DUclass}{compound}
1326 Compound 5, block 1 (a paragraph).
1328 \begin{DUclass}{compound}
1329 Compound 6 is block 2 in compound 5.
1331 Compound 6, another paragraph.
1332 \end{DUclass}
1334 Compound 5, block 3 (a paragraph).
1335 \end{DUclass}
1337 \begin{DUclass}{compound}
1338 Compound 7, tests the inclusion of various block-level
1339 elements in one logical paragraph. First a table,
1341 \setlength{\DUtablewidth}{\linewidth}
1342 \begin{longtable*}[c]{|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|}
1343 \hline
1345 Left cell, first
1346 paragraph.
1348 Left cell, second
1349 paragraph.
1351 Middle cell,
1352 consisting of
1353 exactly one
1354 paragraph.
1356 Right cell.
1358 Paragraph 2.
1360 Paragraph 3.
1362 \hline
1363 \end{longtable*}
1364 followed by a paragraph. This physical paragraph is
1365 actually a continuation of the paragraph before the table. It is followed
1367 \begin{quote}
1368 a quote and
1369 \end{quote}
1370 \begin{enumerate}
1371 \item an enumerated list,
1372 \end{enumerate}
1373 a paragraph,
1374 \begin{DUoptionlist}
1375 \item[-{}-an] option list,
1376 \end{DUoptionlist}
1377 a paragraph,
1378 \begin{DUfieldlist}
1379 \item[{a field:}]
1380 list,
1381 \end{DUfieldlist}
1382 a paragraph,
1383 \begin{description}
1384 \item[{a definition}] \leavevmode
1385 list,
1387 \end{description}
1388 a paragraph, an image:
1389 \includegraphics{../../../docs/user/rst/images/biohazard.png}
1390 a paragraph,
1391 \begin{DUlineblock}{0em}
1392 \item[] a line
1393 \item[] block,
1394 \end{DUlineblock}
1395 a paragraph followed by a comment,
1396 % this is a comment
1397 a paragraph, a
1399 \DUadmonition[note]{
1400 \DUtitle[note]{Note}
1402 with content
1404 and the final paragraph of the compound 7.
1405 \end{DUclass}
1408 \subsubsection{2.14.8   Parsed Literal Blocks%
1409 \label{parsed-literal-blocks}%
1412 \begin{quote}
1413 \ttfamily\raggedright
1414 This~is~a~parsed~literal~block.\\
1415 ~~~~This~line~is~indented.~~The~next~line~is~blank.\\
1417 Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\
1418 text},~\textsubscript{sub-}~and~\textsuperscript{super}scripts,\\
1419 inline~formulas:~$A = 2 \pi r^2$,\\
1420 footnotes\DUfootnotemark{id22}{id8}{1},~%
1421 \phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
1422 \end{quote}
1425 \subsubsection{2.14.9   Code%
1426 \label{code}%
1429 Blocks of source code can be set with the \DUroletitlereference{code} directive. If the code
1430 language is specified, the content is parsed and tagged by the \href{http://pygments.org/}{Pygments}\DUfootnotemark{id34}{id33}{6}
1431 syntax highlighter and can be formatted with a style sheet. (Code parsing
1432 is turned off using the \texttt{syntax-highlight} config setting in the test
1433 conversions in order to get identical results with/without installed
1434 Pygments highlighter.)
1436 \begin{DUclass}{code}
1437 \begin{DUclass}{python}
1438 \begin{quote}
1439 \begin{alltt}
1440 print 'This is Python code.'
1441 \end{alltt}
1442 \end{quote}
1443 \end{DUclass}
1444 \end{DUclass}
1446 The \texttt{:number-lines:} option (with optional start value) generates line
1447 numbers:
1449 \begin{DUclass}{code}
1450 \begin{DUclass}{python}
1451 \begin{quote}
1452 \ttfamily\raggedright
1453 \DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
1454 \DUrole{ln}{~9~}for~i~in~range(10):\\
1455 \DUrole{ln}{10~}~~~~print~i
1456 \end{quote}
1457 \end{DUclass}
1458 \end{DUclass}
1460 For inline code snippets, there is the \DUroletitlereference{code} role, which can be used
1461 directly (the code will not be parsed/tagged, as the language is not known)
1462 or as base for special code roles, e.g. the LaTeX code in the next
1463 paragraph.
1465 Docutils uses LaTeX syntax for math directives and roles:
1466 \texttt{\DUrole{code}{\DUrole{tex}{\textbackslash{}alpha = f(x)}}} prints $\alpha = f(x)$.
1468 The \texttt{:code:} option of the \DUroletitlereference{include} directive sets the included content
1469 as a code block, here the rst file \texttt{header\_footer.txt} with line numbers:
1471 \begin{DUclass}{code}
1472 \begin{DUclass}{rst}
1473 \begin{quote}
1474 \ttfamily\raggedright
1475 \DUrole{ln}{1~}..~header::~Document~header\\
1476 \DUrole{ln}{2~}..~footer::~Document~footer
1477 \end{quote}
1478 \end{DUclass}
1479 \end{DUclass}
1482 \subsection{2.15   Substitution Definitions%
1483 \label{substitution-definitions}%
1486 An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example:
1488 A Unicode example:
1490 (Substitution definitions are not visible in the HTML source.)
1493 \subsection{2.16   Comments%
1494 \label{comments}%
1497 Here’s one:
1499 % Comments begin with two dots and a space. Anything may
1500 % follow, except for the syntax of footnotes, hyperlink
1501 % targets, directives, or substitution definitions.
1503 % Double-dashes -- "--" -- must be escaped somehow in HTML output.
1505 % Comments may contain non-ASCII characters: ä ö ü æ ø å
1507 (View the HTML source to see the comment.)
1510 \subsection{2.17   Raw text%
1511 \label{raw-text}%
1514 This does not necessarily look nice, because there may be missing white space.
1516 It’s just there to freeze the behavior.
1518 A test.
1520 Second test.
1522 \DUrole{myclass}{Another test with myclass set.}
1524 This is the \DUrole{myrawroleclass}{fourth test} with myrawroleclass set.
1526 Fifth test in LaTeX.\\Line two.
1529 \subsection{2.18   Container%
1530 \label{container}%
1533 \begin{DUclass}{custom}
1535 paragraph 1
1537 paragraph 2
1538 \end{DUclass}
1540 % currently not implemented in LaTeX:
1541 % .. include:: data/header_footer.txt
1544 \subsection{2.19   Colspanning tables%
1545 \label{colspanning-tables}%
1548 This table has a cell spanning two columns:
1550 \setlength{\DUtablewidth}{\linewidth}
1551 \begin{longtable*}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|}
1552 \hline
1553 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1554 Inputs
1555 }} & \textbf{%
1556 Output
1557 } \\
1558 \hline
1559 \textbf{%
1561 } & \textbf{%
1563 } & \textbf{%
1564 A or B
1565 } \\
1566 \hline
1567 \endfirsthead
1568 \hline
1569 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1570 Inputs
1571 }} & \textbf{%
1572 Output
1573 } \\
1574 \hline
1575 \textbf{%
1577 } & \textbf{%
1579 } & \textbf{%
1580 A or B
1581 } \\
1582 \hline
1583 \endhead
1584 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1585 \endfoot
1586 \endlastfoot
1588 False
1590 False
1592 False
1594 \hline
1596 True
1598 False
1600 True
1602 \hline
1604 False
1606 True
1608 True
1610 \hline
1612 True
1614 True
1616 True
1618 \hline
1619 \end{longtable*}
1622 \subsection{2.20   Rowspanning tables%
1623 \label{rowspanning-tables}%
1626 Here’s a table with cells spanning several rows:
1628 \setlength{\DUtablewidth}{\linewidth}
1629 \begin{longtable*}[c]{|p{0.296\DUtablewidth}|p{0.156\DUtablewidth}|p{0.226\DUtablewidth}|}
1630 \hline
1631 \textbf{%
1632 Header row, column 1
1633 (header rows optional)
1634 } & \textbf{%
1635 Header 2
1636 } & \textbf{%
1637 Header 3
1638 } \\
1639 \hline
1640 \endfirsthead
1641 \hline
1642 \textbf{%
1643 Header row, column 1
1644 (header rows optional)
1645 } & \textbf{%
1646 Header 2
1647 } & \textbf{%
1648 Header 3
1649 } \\
1650 \hline
1651 \endhead
1652 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1653 \endfoot
1654 \endlastfoot
1656 body row 1, column 1
1658 column 2
1660 column 3
1662 \hline
1664 body row 2
1665 & \multirow{2}{0.16\DUtablewidth}{%
1666 Cells may
1667 span rows.
1668 } & \multirow{2}{0.23\DUtablewidth}{%
1669 Another
1670 rowspanning
1671 cell.
1672 } \\
1673 \cline{1-1}
1675 body row 3
1676 & & \\
1677 \hline
1678 \end{longtable*}
1681 \subsection{2.21   List Tables%
1682 \label{list-tables}%
1685 Here’s a list table exercising all features:
1687 \setlength{\DUtablewidth}{40em}
1688 \begin{longtable}[c]{|p{0.133\DUtablewidth}|p{0.249\DUtablewidth}|p{0.365\DUtablewidth}|}
1689 \caption{list table with integral header}\\
1690 \hline
1691 \textbf{%
1692 Treat
1693 } & \textbf{%
1694 Quantity
1695 } & \textbf{%
1696 Description
1697 } \\
1698 \hline
1699 \endfirsthead
1700 \caption[]{list table with integral header (... continued)}\\
1701 \hline
1702 \textbf{%
1703 Treat
1704 } & \textbf{%
1705 Quantity
1706 } & \textbf{%
1707 Description
1708 } \\
1709 \hline
1710 \endhead
1711 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1712 \endfoot
1713 \endlastfoot
1714 \textbf{%
1715 Albatross
1716 } &
1717 2.99
1719 On a stick!
1721 \hline
1722 \textbf{%
1723 Crunchy Frog
1724 } &
1725 1.49
1727 If we took the bones out, it wouldn’t be
1728 crunchy, now would it?
1730 \hline
1731 \textbf{%
1732 Gannet Ripple
1733 } &
1734 1.99
1736 On a stick!
1738 \hline
1739 \end{longtable}
1741 \begin{longtable}[c]{|l|l|}
1742 \caption{center aligned list table}\\
1743 \hline
1744 Albatross & 2.99 \\
1745 \hline
1746 Crunchy Frog & 1.49 \\
1747 \hline
1748 Gannet Ripple & 1.99 \\
1749 \hline
1750 \end{longtable}
1753 \subsection{2.22   Custom Roles%
1754 \label{custom-roles}%
1757 \begin{itemize}
1758 \item A role based on an existing role.
1760 \texttt{\DUrole{custom}{one}} \texttt{\DUrole{custom}{two}} \texttt{\DUrole{custom}{three}}
1762 \item A new role.
1764 \DUrole{customnew}{one two three}
1766 \item A role with class attribute.
1768 \DUrole{special}{interpreted text}
1770 \item A language-switching role:
1772 Let’s count in German \foreignlanguage{ngerman}{eins zwei drei}.
1774 \item A role with multiple class attributes, styled with raw directives:
1776 \newcommand{\DUrolegreen}[1]{\textcolor{green}{#1}}
1777 \newcommand{\DUrolesc}[1]{\textsc{#1}}
1779 The following works in most browsers but does not validate
1780 (\texttt{<style>} is only allowed in the document head):
1782 \begin{quote}
1783 \begin{alltt}
1784 .. raw:: html
1786 <style type="text/css"><!-{}-
1787 .green \{color: green;\}
1788 .sc \{font-variant: small-caps;\}
1789 -{}-></style>
1790 \end{alltt}
1791 \end{quote}
1793 \DUrole{green}{\DUrole{sc}{\foreignlanguage{british}{British colourful text in small-caps}}}.
1794 \end{itemize}
1797 \subsection{2.23   Mathematics%
1798 \label{mathematics}%
1801 Docutils supports inline math with the prefix or postfix \texttt{:math:}
1802 role specificator, $n! + \sin(x_n^2)$ and $A_\text{c} =
1803 \frac{\pi}{4} d^2$, as well as displayed math via the
1804 \DUroletitlereference{math} directive:
1806 \begin{equation*}
1807 f(\epsilon) = \frac{1}{1 + \exp\left(\frac{\varepsilon}{k_\text{B}T}\right)}
1808 \end{equation*}
1809 Content may start on the first line of the directive, e.g.
1811 \begin{equation*}
1812 N = \frac{\text{number of apples}}{7}
1813 \end{equation*}
1814 Equations can be labeled with a reference name using the \texttt{:name:} option.
1815 See \hyperref[eq-m]{eq:M} and \hyperref[eq-schrodinger]{eq:schrödinger} below.
1817 The determinant of the matrix
1819 \begin{equation*}
1820 \mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)
1821 \phantomsection
1822 \label{eq-m}
1823 \end{equation*}
1824 is $|\mathbf{M}| = ad - bc$.
1826 More than one display math block can be put in one math directive.
1827 For example, the following sum and integral with limits:
1829 \begin{equation*}
1830 \int_0^1 x^n dx = \frac{1}{n + 1}
1831 \end{equation*}%
1832 \begin{equation*}
1833 \sum_{n=1}^m n = \frac{m(m+1)}{2}
1834 \end{equation*}
1835 LaTeX-supported Unicode math symbols can be used in math roles and
1836 directives:
1838 The Schrödinger equation
1840 \begin{equation*}
1841 i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi ,
1842 \phantomsection
1843 \label{eq-schrodinger}
1844 \end{equation*}
1845 with the \emph{wave function} $\Psi $, describes how the quantum state of a
1846 physical system changes in time.
1848 \begin{description}
1849 \item[{Math-Accents:}] \leavevmode
1850 \setlength{\DUtablewidth}{\linewidth}
1851 \begin{longtable*}[c]{p{0.315\DUtablewidth}p{0.315\DUtablewidth}p{0.315\DUtablewidth}}
1853 $\acute{a}$ \texttt{\textbackslash{}acute\{a\}}
1855 $\dot{t}$ \texttt{\textbackslash{}dot\{t\}}
1857 $\hat{\gamma}$ \texttt{\textbackslash{}hat\{\textbackslash{}gamma\}}
1860 $\grave{a}$ \texttt{\textbackslash{}grave\{a\}}
1862 $\ddot{t}$ \texttt{\textbackslash{}ddot\{t\}}
1864 $\tilde{\alpha}$ \texttt{\textbackslash{}tilde\{\textbackslash{}alpha\}}
1867 $\breve{x}$ \texttt{\textbackslash{}breve\{x\}}
1869 $\dddot{t}$ \texttt{\textbackslash{}dddot\{t\}}
1871 $\vec{\imath}$ \texttt{\textbackslash{}vec\{\textbackslash{}imath\}}
1874 $\check{a}$ \texttt{\textbackslash{}check\{a\}}
1876 $\bar{a}$ \texttt{\textbackslash{}bar\{a\}}
1878 $\vec{R}$ \texttt{\textbackslash{}vec\{R\}}
1880 \end{longtable*}
1882 \end{description}
1884 % \widetilde{xxx}
1885 % \widehat{xxx}
1887 Modulation Transfer Function:
1889 \begin{equation*}
1890 \text{MTF} = \left|\frac{\mathcal{F}\{s(x)\}}
1891 {\mathcal{F}\{ s(x)\} |_{\omega _{x}=0}}\right|
1892 = \mathrm{abs}\left(\frac
1893 {\int _{-\infty }^{\infty }s(x) \mathrm{e}^{\mathrm{i}\omega _{x}x}\mathrm{d}{x}}
1894 {\int _{-\infty }^{\infty }s(x)\mathrm{d}{x}}
1895 \right).
1896 \end{equation*}
1897 Math split over two lines: If a double backslash is detected outside a
1898 \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}
1899 \texttt{align} environment:
1901 \begin{align*}
1902 s_{\mathrm{out}}(x) & = s_{\mathrm{in}}(x') * s_\delta (x-x') \\
1903 & = \int s_{\mathrm{in}}(x')s_\delta (x-x')\mathrm{d}x'
1904 \end{align*}
1905 Cases (“manually”, with \texttt{matrix} environment):
1907 \begin{equation*}
1908 \mathrm{sgn}(x) = \left\{\begin{matrix}
1909 -1 & x<0\\
1910 1 & x>0
1911 \end{matrix}\right.
1912 \end{equation*}
1913 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
1914 HTML writers with \texttt{-{}-math-output=MathML}):
1916 \begin{equation*}
1917 \mathrm{sgn}(x) = \begin{cases}
1918 -1 & x<0\\
1919 1 & x>0
1920 \end{cases}
1921 \end{equation*}
1923 \section{3   Tests for the LaTeX writer%
1924 \label{tests-for-the-latex-writer}%
1927 Test syntax elements which may cause trouble for the LaTeX writer but might
1928 not need to be tested with other writers (e.g. the HTML writer).
1931 \subsection{3.1   Custom Roles in LaTeX%
1932 \label{custom-roles-in-latex}%
1935 \begin{itemize}
1936 \item Role names and class arguments are converted to conform to the
1937 regular expression \texttt{{[}a-z{]}{[}-a-z0-9{]}*} (letters are downcased,
1938 accents and similar decoration is stripped, non-conforming
1939 characters are replaced by a hyphen).
1941 Class arguments may contain numbers and hyphens, which need special
1942 treatment in LaTeX command names.
1944 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Text with role “custom4”}}}}} (but without styling by \texttt{DUrole*}
1945 macros).
1947 \item With LaTeX, roles can be styled within the document using the \DUroletitlereference{raw}
1948 directive.
1950 \newcommand{\DUrolelarge}[1]{{\large #1}}
1951 \makeatletter
1952 \@namedef{DUrolesmall-caps}{\textsc}
1953 \@namedef{DUrolecustom4}{\textbf}
1954 \makeatother
1956 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{inline text}}}}} in large, bold, small-caps.
1958 \item Custom roles can be based on standard roles:
1960 This is a \emph{\DUrole{custom-emphasis}{customized emphasis text role}}
1962 This is a \texttt{\DUrole{custom-literal}{customized literal text role}}
1964 This is a \textbf{\DUrole{custom-strong}{customized strong text role}}
1966 This is a \textsubscript{\DUrole{custom-subscript}{customized subscript text role}}
1968 This is a \textsuperscript{\DUrole{custom-superscript}{customized superscript text role}}
1970 This is a \DUroletitlereference{\DUrole{custom-title-reference}{customized title-reference text role}}
1971 \end{itemize}
1974 \subsection{3.2   class handling%
1975 \label{class-handling}%
1978 This section tests class handling for block level elements by the LaTeX
1979 writer. See the input file \texttt{classes\_latex.txt} for the raw LaTeX code used
1980 to style the examples.
1982 An “epigraph” directive is exported as “quote” wrapped in a “DUclass”
1983 environment. Here, it is styled by a “DUCLASSepigraph” environment
1984 redefining the “quote” environment as “minipage”:
1986 \newcommand*{\DUCLASSepigraph}{%
1987 \renewenvironment{quote}{\vspace{1em}
1988 \footnotesize\hfill{}%
1989 \begin{minipage}{0.4\columnwidth}}%
1990 {\end{minipage}\vskip\baselineskip}}
1992 \begin{DUclass}{epigraph}
1993 \begin{quote}
1994 Do not play this piece fast. It is never right to play \emph{Ragtime} fast.
1995 \nopagebreak
1997 \raggedleft —Scott Joplin
1998 \end{quote}
1999 \end{DUclass}
2001 Raw latex is also used to style the following lists: “DUCLASSenumerateitems”
2002 redefines “itemize” as “enumerate”, “DUCLASSrules” draws horizontal lines
2003 above and below.
2005 \newcommand*{\DUCLASSenumerateitems}{%
2006 \renewenvironment{itemize}{\begin{enumerate}}%
2007 {\end{enumerate}}%
2010 \newenvironment{DUCLASSrules}%
2011 {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}%
2012 {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}
2014 An “enumerated” bullet list:
2016 \begin{DUclass}{enumerateitems}
2017 \begin{itemize}
2018 \item item
2020 \item next item
2022 \item third item
2023 \end{itemize}
2024 \end{DUclass}
2026 A list with lines above and below:
2028 \begin{DUclass}{rules}
2029 \begin{itemize}
2030 \item item
2032 \item next item
2033 \end{itemize}
2034 \end{DUclass}
2036 A normal bullet list is kept unchanged by the above redefinitions:
2038 \begin{itemize}
2039 \item item
2041 \item next item
2043 \item third item
2044 \end{itemize}
2046 A container wraps several elements in a common “class wrapper”. Here, we use
2047 it to set 2 paragraphs and a list in small caps:
2049 \newcommand*{\DUCLASSscshape}{\scshape}
2051 \begin{DUclass}{scshape}
2053 paragraph 1
2055 paragraph 2
2057 \begin{itemize}
2058 \item bullet list
2060 \item still bullet list
2061 \end{itemize}
2062 \end{DUclass}
2064 A right-aligned line-block. Alignment handling is built into the latex
2065 writer for image, table, and line block elements.
2067 \begin{DUlineblock}{0em}
2068 \raggedleft
2069 \item[] Max Mustermann
2070 \item[] Waldstr. 22
2071 \item[] D 01234 Testdorf
2072 \item[] Tel.: 0123/456789
2073 \end{DUlineblock}
2076 \subsection{3.3   More Tables%
2077 \label{more-tables}%
2080 A table with multi-paragraph multicolumn cells:
2082 \setlength{\DUtablewidth}{\linewidth}
2083 \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}|}
2084 \hline
2086 test
2088 \textbf{bold hd}
2089 & \multicolumn{3}{p{0.41\DUtablewidth}|}{%
2090 multicolumn 1
2092 With a second paragraph
2093 } &
2094 \emph{emph hd}
2096 \hline
2097 \multicolumn{2}{|p{0.31\DUtablewidth}|}{%
2098 multicolumn 2
2100 With a second paragraph
2101 } &
2102 cell
2104 cell
2106 cell
2108 cell
2110 \hline
2112 cell
2113 & \multicolumn{2}{p{0.36\DUtablewidth}|}{%
2114 multicolumn 3 (one line,
2115 but very very very very
2116 very looooong)
2117 } &
2118 cell
2120 cell
2122 cell
2124 \hline
2126 cell
2128 cell
2130 cell
2131 & \multicolumn{3}{p{0.38\DUtablewidth}|}{%
2132 Short multicolumn 4
2133 } \\
2134 \hline
2135 \end{longtable*}
2137 Tables with multi-paragraph multirow cells currently fail due to a LaTeX
2138 limitation (see \url{https://sourceforge.net/p/docutils/bugs/225/}).
2140 A table with multirow header and column-widths set by LaTeX:
2142 \begin{longtable*}[c]{|l|l|}
2143 \hline
2144 \multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\
2145 \cline{2-2}
2146 & \textbf{Description} \\
2147 \hline
2148 \endfirsthead
2149 \hline
2150 \multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\
2151 \cline{2-2}
2152 & \textbf{Description} \\
2153 \hline
2154 \endhead
2155 \multicolumn{2}{c}{\hfill ... continued on next page} \\
2156 \endfoot
2157 \endlastfoot
2158 \multicolumn{2}{|l|}{multicollumn cell} \\
2159 \hline
2160 \end{longtable*}
2162 In a table with column-widths set by LaTeX, each cell has just one line.
2163 Paragraphs are merged (a warning is given).
2165 \begin{longtable*}[c]{|l|l|}
2166 \hline
2167 11 & first paragraph
2168 second paragraph
2169 third paragraph \\
2170 \hline
2171 21 & 22 \\
2172 \hline
2173 \end{longtable*}
2175 % This file is used by the standalone_rst_latex test.
2178 \subsection{3.4   Option lists%
2179 \label{id23}%
2182 The LaTeX-2e description environment is used for definition lists.
2183 The definition is continued on the same line as the term, this should
2184 not happen if a option-list is at the top of the definition.
2186 If the option list is not at the first element in the definition, it
2187 is contained in a quote
2189 \begin{quote}
2190 \begin{DUoptionlist}
2191 \item[-{}-help] show help
2193 \item[-v] verbose
2194 \end{DUoptionlist}
2195 \end{quote}
2197 \begin{description}
2198 \item[{In a definition list:}] \leavevmode
2199 \begin{DUoptionlist}
2200 \item[-{}-help] show help
2202 \item[-v] verbose
2203 \end{DUoptionlist}
2205 \end{description}
2208 \subsection{3.5   Monospaced non-alphanumeric characters%
2209 \label{monospaced-non-alphanumeric-characters}%
2212 These are all ASCII characters except a-zA-Z0-9 and space:
2214 \texttt{!!!\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'{}'{}'((()))***+++,{},{},-{}-{}-...///:::}
2216 \texttt{;;;<{}<{}<===>{}>{}>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_`{}`{}`\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}}
2218 \texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
2220 The two lines of non-alphanumeric characters should both have the same
2221 width as the third line.
2224 \subsection{3.6   Non-ASCII characters%
2225 \label{non-ascii-characters}%
2228 Punctuation and footnote symbols
2230 \setlength{\DUtablewidth}{\linewidth}
2231 \begin{longtable*}[c]{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|}
2232 \hline
2236 en-dash
2238 \hline
2242 em-dash
2244 \hline
2248 single turned comma quotation mark
2250 \hline
2254 single comma quotation mark
2256 \hline
2260 low single comma quotation mark
2262 \hline
2266 double turned comma quotation mark
2268 \hline
2272 double comma quotation mark
2274 \hline
2278 low double comma quotation mark
2280 \hline
2284 dagger
2286 \hline
2290 double dagger
2292 \hline
2294 \ding{169}
2296 black diamond suit
2298 \hline
2300 \ding{170}
2302 black heart suit
2304 \hline
2308 black spade suit
2310 \hline
2314 black club suit
2316 \hline
2320 ellipsis
2322 \hline
2326 trade mark sign
2328 \hline
2332 left-right double arrow
2334 \hline
2335 \end{longtable*}
2337 The \DUroletitlereference{Latin-1 extended} Unicode block
2339 \setlength{\DUtablewidth}{\linewidth}
2340 \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}|}
2341 \hline
2365 \hline
2368 & &
2374 & &
2385 \hline
2409 \hline
2433 \hline
2457 \hline
2481 \hline
2505 \hline
2529 \hline
2553 \hline
2577 \hline
2592 & & & & \\
2593 \hline
2594 \end{longtable*}
2596 \begin{itemize}
2597 \item The following line should not be wrapped, because it uses
2598 no-break spaces (\textbackslash{}u00a0):
2600 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
2602 \item Line wrapping with/without breakpoints marked by soft hyphens
2603 (\textbackslash{}u00ad):
2605 pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch
2607 pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch
2608 \end{itemize}
2611 \subsection{3.7   Encoding special chars%
2612 \label{encoding-special-chars}%
2615 The LaTeX Info pages lists under “2.18 Special Characters”
2617 \begin{quote}
2618 The following characters play a special role in LaTeX and are called
2619 “special printing characters”, or simply “special characters”.
2621 \begin{quote}
2622 \# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \}
2623 \end{quote}
2624 \end{quote}
2626 The special chars verbatim:
2628 \begin{quote}
2629 \begin{alltt}
2630 # $ % & ~ _ ^ \textbackslash{} \{ \}
2631 \end{alltt}
2632 \end{quote}
2634 However also \emph{square brackets} {[}{]} need special care.
2636 \begin{quote}
2637 Commands with optional arguments (e.g. \texttt{\textbackslash{}item}) check
2638 if the token right after the macro name is an opening bracket.
2639 In that case the contents between that bracket and the following
2640 closing bracket on the same grouping level are taken as the
2641 optional argument. What makes this unintuitive is the fact that
2642 the square brackets aren’t grouping characters themselves, so in
2643 your last example \texttt{\textbackslash{}item{[}{[}...{]}{]}} the optional argument consists of
2644 {[}… (without the closing bracket).
2645 \end{quote}
2647 Compare the items in the following lists:
2649 \begin{itemize}
2650 \item simple item
2652 \item {[}bracketed{]} item
2653 \end{itemize}
2655 \begin{description}
2656 \item[{simple}] \leavevmode
2657 description term
2659 \item[{{[}bracketed{]}}] \leavevmode
2660 description term
2662 \end{description}
2664 The OT1 font-encoding has different characters for the less-than,
2665 greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}:
2667 \begin{quote}
2668 \begin{alltt}
2669 < | >
2670 \end{alltt}
2671 \end{quote}
2674 \subsection{3.8   Hyperlinks and -targets%
2675 \label{hyperlinks-and-targets}%
2678 In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a
2680 \phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or
2681 caption:
2683 \setlength{\DUtablewidth}{\linewidth}
2684 \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
2685 \caption{Table with %
2686 \label{hypertarget-in-table-title}hypertarget in table title.}\\
2687 \hline
2689 False
2691 True
2693 None
2695 \hline
2696 \end{longtable}
2697 \label{table-label}
2699 \begin{figure}
2700 \phantomsection\label{figure-label}
2701 \noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
2702 \caption{Figure with %
2703 \label{hypertarget-in-figure-caption}hypertarget in figure caption.}
2704 \begin{DUlegend}
2705 Legend with %
2706 \phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend.
2707 \end{DUlegend}
2708 \end{figure}
2710 \includegraphics{../../../docs/user/rst/images/biohazard.png}
2711 \phantomsection\label{image-label}
2713 See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text},
2714 \hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title},
2715 \hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption},
2716 \hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and
2717 \hyperref[image-label]{image label}.
2720 \subsection{3.9   External references%
2721 \label{external-references}%
2724 Long URLs should be wrapped in the PDF. This can be achieved with the
2725 \texttt{\textbackslash{}url} command which is used by the LaTeX writer whenever the content
2726 (name) of a reference node equals the link URL.
2728 \begin{description}
2729 \item[{Example:}] \leavevmode
2730 a long URL that should wrap in the output
2731 \url{http://docutils.sourceforge.net/docs/user/latex.html\#id79}
2733 \end{description}
2735 If the argument contains any “\%”, “\#”, or “\textasciicircum{}\textasciicircum{}”, or ends with \texttt{\textbackslash{}}, it can’t
2736 be used in the argument to another command. The argument must not contain
2737 unbalanced braces.
2739 The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a “http:” or “ftp:” URL
2740 and not recognized as part of it:
2742 \begin{DUlineblock}{0em}
2743 \item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name
2744 \item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{}
2745 \item[] \url{http://www.example.org/XML}/strange\{n\}ame
2746 \end{DUlineblock}
2748 They can, however be used in paths and/or filenames.
2750 Handling by the LaTeX writer:
2752 \begin{itemize}
2753 \item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped:
2755 \begin{DUlineblock}{0em}
2756 \item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#}
2757 \url{http://www.w3.org/XML/Schema\#dev}
2758 \item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%}
2759 \url{http://example.org/Schema\%dev}
2760 \item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{id42}{id41}{9} \url{A:DOS\\path\\}\DUfootnotemark{id43}{id41}{9}
2761 \end{DUlineblock}
2763 \DUadmonition[note]{
2764 \DUtitle[note]{Note}
2766 These URLs are typeset inside a LaTeX command without error.
2768 \begin{DUlineblock}{0em}
2769 \item[] \url{http://www.w3.org/XML/Schema\#dev}
2770 \item[] \url{http://example.org/Schema\%dev}
2771 \item[] \url{A:DOS\\path\\}\DUfootnotemark{id44}{id41}{9}
2772 \end{DUlineblock}
2774 \end{itemize}
2776 \begin{itemize}
2777 \item \texttt{\textasciicircum{}\textasciicircum{}} LaTeX’s special syntax for characters results in “strange” replacements
2778 (both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}). A warning is given.
2780 \href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}:
2781 \url{../strange^^name}
2783 \item Unbalanced braces, \{ or \}, will fail (both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}):
2785 \begin{quote}
2786 \begin{alltt}
2787 `file with \{ <../strange\{name>`__
2788 `<../strange\{name>`__
2789 \end{alltt}
2790 \end{quote}
2792 while balanced braces are suported:
2794 \begin{DUlineblock}{0em}
2795 \item[] \url{../strange{n}ame}
2796 \item[] \url{../st{r}ange{n}ame}
2797 \item[] \url{../{st{r}ange{n}ame}}
2798 \end{DUlineblock}
2799 \end{itemize}
2802 \subsection{3.10   Section titles with \hyperref[inline-markup]{inline markup}%
2803 \label{section-titles-with-inline-markup}%
2807 \subsubsection{3.10.1   \emph{emphasized}, H\textsubscript{2}O and $x^2$%
2808 \label{emphasized-h2o-and-x-2}%
2812 \subsubsection{3.10.2   Substitutions work%
2813 \label{substitutions-fail}%
2817 \subsection{3.11   Deeply nested sections%
2818 \label{deeply-nested-sections}%
2821 In LaTeX and HTML,
2824 \subsubsection{3.11.1   Level 3%
2825 \label{level-3}%
2828 nested sections
2831 \paragraph{3.11.1.1   level 4%
2832 \label{level-4}%
2835 reach at some level
2838 \subparagraph{3.11.1.1.1   level 5%
2839 \label{level-5}%
2842 (depending on the document class)
2845 \DUtitle[sectionVI]{3.11.1.1.1.1   level 6%
2846 \label{level-6}%
2849 an unsupported level.
2851 % unusual combinations (currently separately tested)
2852 % .. include:: data/latex_cornercases.txt
2854 % Preface for System Messages:
2857 \section{4   Error Handling%
2858 \label{error-handling}%
2861 Any errors caught during processing will generate system messages.
2863 There should be five messages in the following, auto-generated
2864 section, “Docutils System Messages”:
2866 % section should be added by Docutils automatically
2869 \section[Docutils System Messages]{\color{red}Docutils System Messages%
2872 \DUadmonition[system-message]{
2873 \DUtitle[system-message]{system-message}
2874 \raisebox{1em}{\hypertarget{id27}{}}
2876 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~104
2878 \hyperlink{id28}{
2879 Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}.
2882 \DUadmonition[system-message]{
2883 \DUtitle[system-message]{system-message}
2884 \raisebox{1em}{\hypertarget{id45}{}}
2886 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~392
2888 \hyperlink{id17}{
2889 Unknown target name: \textquotedbl{}5\textquotedbl{}.
2892 \DUadmonition[system-message]{
2893 \DUtitle[system-message]{system-message}
2894 \raisebox{1em}{\hypertarget{id46}{}}
2896 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~401
2898 \hyperlink{id19}{
2899 Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
2902 \DUadmonition[system-message]{
2903 \DUtitle[system-message]{system-message}
2904 \raisebox{1em}{\hypertarget{id47}{}}
2906 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~428
2908 \hyperlink{id48}{
2909 Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}.
2912 \DUadmonition[system-message]{
2913 \DUtitle[system-message]{system-message}
2914 \raisebox{1em}{\hypertarget{id49}{}}
2916 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~441
2918 \hyperlink{id50}{
2919 Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}.
2922 \end{document}