Fix :width: option for the table directives.
[docutils.git] / docutils / test / functional / expected / standalone_rst_latex.tex
blobb35b5f04f40a154a60d469750c54f668881fe109
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 % backwards compatibility: try \docutilsrole#1{#2}
108 \ifcsname docutilsrole#1\endcsname%
109 \csname docutilsrole#1\endcsname{#2}%
110 \else
111 \csname DUrole#1\endcsname{#2}%
112 \fi%
115 % legend environment
116 \ifthenelse{\isundefined{\DUlegend}}{
117 \newenvironment{DUlegend}{\small}{}
120 % lineblock environment
121 \DUprovidelength{\DUlineblockindent}{2.5em}
122 \ifthenelse{\isundefined{\DUlineblock}}{
123 \newenvironment{DUlineblock}[1]{%
124 \list{}{\setlength{\partopsep}{\parskip}
125 \addtolength{\partopsep}{\baselineskip}
126 \setlength{\topsep}{0pt}
127 \setlength{\itemsep}{0.15\baselineskip}
128 \setlength{\parsep}{0pt}
129 \setlength{\leftmargin}{#1}}
130 \raggedright
132 {\endlist}
135 % optionlist environment
136 \providecommand*{\DUoptionlistlabel}[1]{\bf #1 \hfill}
137 \DUprovidelength{\DUoptionlistindent}{3cm}
138 \ifthenelse{\isundefined{\DUoptionlist}}{
139 \newenvironment{DUoptionlist}{%
140 \list{}{\setlength{\labelwidth}{\DUoptionlistindent}
141 \setlength{\rightmargin}{1cm}
142 \setlength{\leftmargin}{\rightmargin}
143 \addtolength{\leftmargin}{\labelwidth}
144 \addtolength{\leftmargin}{\labelsep}
145 \renewcommand{\makelabel}{\DUoptionlistlabel}}
147 {\endlist}
150 % rubric (informal heading)
151 \providecommand*{\DUrubric}[1]{%
152 \subsubsection*{\centering\textit{\textmd{#1}}}}
154 % sidebar (text outside the main text flow)
155 \providecommand{\DUsidebar}[1]{%
156 \begin{center}
157 \colorbox[gray]{0.80}{\parbox{0.9\linewidth}{#1}}
158 \end{center}
161 % subtitle (for topic/sidebar)
162 \providecommand*{\DUsubtitle}[1]{\par\emph{#1}\smallskip}
164 % text mode subscript
165 \ifx\textsubscript\undefined
166 \usepackage{fixltx2e} % since 2015 loaded by default
169 % title for topics, admonitions, unsupported section levels, and sidebar
170 \providecommand*{\DUtitle}[2][class-arg]{%
171 % call \DUtitle#1{#2} if it exists:
172 \ifcsname DUtitle#1\endcsname%
173 \csname DUtitle#1\endcsname{#2}%
174 \else
175 \smallskip\noindent\textbf{#2}\smallskip%
179 % titlereference role
180 \providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
182 % transition (break, fancybreak, anonymous section)
183 \providecommand*{\DUtransition}{%
184 \hspace*{\fill}\hrulefill\hspace*{\fill}
185 \vskip 0.5\baselineskip
188 % hyperlinks:
189 \ifthenelse{\isundefined{\hypersetup}}{
190 \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
191 \usepackage{bookmark}
192 \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
194 \hypersetup{
195 pdftitle={reStructuredText Test Document},
196 pdfauthor={David Goodger;Me;Myself;I}
199 %%% Body
200 \begin{document}
201 \title{reStructuredText Test Document%
202 \label{restructuredtext-test-document}%
203 \label{doctitle}%
204 \\ % subtitle%
205 \DUdocumentsubtitle{Examples of Syntax Constructs}%
206 \label{examples-of-syntax-constructs}%
207 \label{subtitle}}
208 \author{}
209 \date{}
210 \maketitle
212 % Docinfo
213 \begin{center}
214 \begin{tabularx}{\DUdocinfowidth}{lX}
215 \textbf{Author}: &
216 David Goodger \\
217 \textbf{Address}: &
218 {\raggedright
219 123 Example Street\\
220 Example, EX Canada\\
221 A1B 2C3 } \\
222 \textbf{Contact}: &
223 \href{mailto:goodger@python.org}{goodger@python.org} \\
224 \textbf{Author}: &
225 Me \\
226 \textbf{Author}: &
227 Myself \\
228 \textbf{Author}: &
229 I \\
230 \textbf{Organization}: &
231 humankind \\
232 \textbf{Date}: &
233 Now, or yesterday. Or maybe even \emph{before} yesterday. \\
234 \textbf{Status}: &
235 This is a “work in progress” \\
236 \textbf{Revision}: &
237 is managed by a version control system. \\
238 \textbf{Version}: &
239 1 \\
240 \textbf{Copyright}: &
241 This document has been placed in the public domain. You
242 may do with it as you wish. You may copy, modify,
243 redistribute, reattribute, sell, buy, rent, lease,
244 destroy, or improve it, quote it at length, excerpt,
245 incorporate, collate, fold, staple, or mutilate it, or do
246 anything else to it that your or anyone else’s heart
247 desires. \\
248 \textbf{field name}: &
249 This is a “generic bibliographic field”.
251 \textbf{field name “2}: &
252 Generic bibliographic fields may contain multiple body elements.
254 Like this.
256 \end{tabularx}
257 \end{center}
259 \begin{DUclass}{dedication}
260 \begin{quote}
261 \DUtitle[dedication]{Dedication}
263 For Docutils users \& co-developers.
264 \end{quote}
265 \end{DUclass}
267 \begin{DUclass}{abstract}
268 \begin{quote}
269 \DUtitle[abstract]{Abstract}
271 This is a test document, containing at least one example of each
272 reStructuredText construct.
273 \end{quote}
274 \end{DUclass}
276 % This is a comment. Note how any initial comments are moved by
277 % transforms to after the document title, subtitle, and docinfo.
279 % Above is the document title, and below is the subtitle.
280 % They are transformed from section titles after parsing.
282 % bibliographic fields (which also require a transform):
284 \pagebreak[4] % start ToC on new page
286 \phantomsection\label{table-of-contents}
287 \pdfbookmark[1]{Table of Contents}{table-of-contents}
288 \renewcommand{\contentsname}{Table of Contents}
289 \tableofcontents
292 \section{1   Structural Elements%
293 \label{structural-elements}%
297 \subsection{1.1   Section Title%
298 \label{section-title}%
300 \subsubsection*{Section Subtitle}
302 Lone subsections are converted to a section subtitle by a transform
303 activated with the \texttt{-{}-section-subtitles} command line option or the
304 \texttt{sectsubtitle-xform} configuration value.
307 \subsection{1.2   Empty Section%
308 \label{empty-section}%
312 \subsection{1.3   Transitions%
313 \label{transitions}%
316 Here’s a transition:
318 %___________________________________________________________________________
319 \DUtransition
321 It divides the section. Transitions may also occur between sections:
323 %___________________________________________________________________________
324 \DUtransition
327 \section{2   Body Elements%
328 \label{body-elements}%
332 \subsection{2.1   Paragraphs%
333 \label{paragraphs}%
336 A paragraph.
339 \subsubsection{2.1.1   Inline Markup%
340 \label{inline-markup}%
343 Paragraphs contain text and may contain inline markup: \emph{emphasis},
344 \textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks
345 (\url{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\DUfootnotemark{id30}{id29}{5}), internal
346 cross-references (\hyperref[example]{example}), external hyperlinks with embedded URIs
347 (\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink
348 references}\DUfootnotemark{id38}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id40}{id39}{8}), footnote references (manually
349 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]}),
350 substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and %
351 \phantomsection\label{inline-hyperlink-targets}inline hyperlink targets
352 (see \hyperref[targets]{Targets} below for a reference back to here). Character-level
353 inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by %
354 \raisebox{1em}{\hypertarget{id28}{}}\hyperlink{id27}{\textbf{\color{red}|problematic|}} text
355 (generated by processing errors; this one is intentional). Here is a
356 reference to the \hyperref[doctitle]{doctitle} and the \hyperref[subtitle]{subtitle}.
358 The default role for interpreted text is \DUroletitlereference{Title Reference}. Here are
359 some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/dev/peps/pep-0287}{PEP 287}); an
360 RFC reference (\href{http://tools.ietf.org/html/rfc2822.html}{RFC 2822}); an abbreviation (\DUrole{abbreviation}{abb.}), an acronym
361 (\DUrole{acronym}{reST}), code (\texttt{\DUrole{code}{print \textquotedbl{}hello world\textquotedbl{}}}); a \textsubscript{subscript};
362 a \textsuperscript{superscript} and explicit roles for \DUroletitlereference{Docutils}
363 \emph{standard} \textbf{inline} \texttt{markup}.
365 % DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
367 Let’s test wrapping and whitespace significance in inline literals:
368 \texttt{This is an example of -{}-inline-literal -{}-text, -{}-including some-{}-
369 strangely-{}-hyphenated-words. ~Adjust-the-width-of-your-browser-window
370 to see how the text is wrapped. ~-{}- -{}-{}-{}- -{}-{}-{}-{}-{}-{}-{}- ~Now note ~ ~the
371 spacing ~ ~between the ~ ~words of ~ ~this sentence ~ ~(words
372 should ~ ~be grouped ~ ~in pairs).}
374 If the \texttt{-{}-pep-references} option was supplied, there should be a
375 live link to PEP 258 here.
378 \subsection{2.2   Bullet Lists%
379 \label{bullet-lists}%
382 \begin{itemize}
383 \item A bullet list
385 \begin{itemize}
386 \item Nested bullet list.
388 \item Nested item 2.
389 \end{itemize}
391 \item Item 2.
393 Paragraph 2 of item 2.
395 \begin{itemize}
396 \item Nested bullet list.
398 \item Nested item 2.
400 \begin{itemize}
401 \item Third level.
403 \item Item 2.
404 \end{itemize}
406 \item Nested item 3.
408 \item This nested list should be compacted by the HTML writer.
410 \phantomsection\label{target}
411 % Even if this item contains a target and a comment.
412 \end{itemize}
413 \end{itemize}
416 \subsection{2.3   Enumerated Lists%
417 \label{enumerated-lists}%
420 \begin{enumerate}
421 \item Arabic numerals.
423 \begin{enumerate}
424 \renewcommand{\labelenumii}{\alph{enumii})}
425 \item lower alpha)
427 \begin{enumerate}
428 \renewcommand{\labelenumiii}{(\roman{enumiii})}
429 \item (lower roman)
431 \begin{enumerate}
432 \item upper alpha.
434 \begin{list}{\Roman{enumv})}{\usecounter{enumv}}
435 \item upper roman)
436 \end{list}
437 \end{enumerate}
438 \end{enumerate}
439 \end{enumerate}
441 \item Lists that don’t start at 1:
443 \begin{enumerate}
444 \renewcommand{\labelenumii}{\arabic{enumii}.}
445 \setcounter{enumii}{2}
446 \item Three
448 \item Four
449 \end{enumerate}
451 \begin{enumerate}
452 \renewcommand{\labelenumii}{\Alph{enumii}.}
453 \setcounter{enumii}{2}
454 \item C
456 \item D
457 \end{enumerate}
459 \begin{enumerate}
460 \renewcommand{\labelenumii}{\roman{enumii}.}
461 \setcounter{enumii}{2}
462 \item iii
464 \item iv
465 \end{enumerate}
466 \end{enumerate}
469 \subsection{2.4   Definition Lists%
470 \label{definition-lists}%
473 \begin{description}
474 \item[{Term}] \leavevmode
475 Definition
477 \item[{Term}] \leavevmode (\textbf{classifier})
478 Definition paragraph 1.
480 Definition paragraph 2.
482 \item[{Term}] \leavevmode
483 Definition
485 \item[{Term}] \leavevmode (\textbf{classifier one})(\textbf{classifier two})
486 Definition
488 \end{description}
491 \subsection{2.5   Field Lists%
492 \label{field-lists}%
495 \begin{DUfieldlist}
496 \item[{what:}]
497 Field lists map field names to field bodies, like database
498 records. They are often part of an extension syntax. They are
499 an unambiguous variant of RFC 2822 fields.
501 \item[{how arg1 arg2:}]
502 The field marker is a colon, the field name, and a colon.
504 The field body may contain one or more body elements, indented
505 relative to the field marker.
507 \item[{credits:}]
508 \DUrole{credits}{This paragraph has the \DUroletitlereference{credits} class set. (This is actually not
509 about credits but just for ensuring that the class attribute
510 doesn’t get stripped away.)}
511 \end{DUfieldlist}
514 \subsection{2.6   Option Lists%
515 \label{option-lists}%
518 For listing command-line options:
520 \begin{DUoptionlist}
521 \item[-a] command-line option “a”
523 \item[-b file] options can have arguments
524 and long descriptions
526 \item[-{}-long] options can be long also
528 \item[-{}-input=file] long options can also have
529 arguments
531 \item[-{}-very-long-option] The description can also start on the next line.
533 The description may contain multiple body elements,
534 regardless of where it starts.
536 \item[-x, -y, -z] Multiple options are an “option group”.
538 \item[-v, -{}-verbose] Commonly-seen: short \& long options.
540 \item[-1 file, -{}-one=file, -{}-two file] Multiple options with arguments.
542 \item[/V] DOS/VMS-style options too
543 \end{DUoptionlist}
545 There must be at least two spaces between the option and the
546 description.
549 \subsection{2.7   Literal Blocks%
550 \label{literal-blocks}%
553 Literal blocks are indicated with a double-colon (“::”) at the end of
554 the preceding paragraph (over there \texttt{-{}->}). They can be indented:
556 \begin{quote}
557 \begin{alltt}
558 if literal_block:
559 text = 'is left as-is'
560 spaces_and_linebreaks = 'are preserved'
561 markup_processing = None
562 \end{alltt}
563 \end{quote}
565 Or they can be quoted without indentation:
567 \begin{quote}
568 \begin{alltt}
569 >> Great idea!
571 > Why didn't I think of that?
572 \end{alltt}
573 \end{quote}
576 \subsection{2.8   Line Blocks%
577 \label{line-blocks}%
580 This section tests line blocks. Line blocks are body elements which
581 consist of lines and other line blocks. Nested line blocks cause
582 indentation.
584 \begin{DUlineblock}{0em}
585 \item[] This is a line block. It ends with a blank line.
586 \item[]
587 \begin{DUlineblock}{\DUlineblockindent}
588 \item[] New lines begin with a vertical bar (“|”).
589 \item[] Line breaks and initial indent are significant, and preserved.
590 \item[]
591 \begin{DUlineblock}{\DUlineblockindent}
592 \item[] Continuation lines are also possible. A long line that is intended
593 to wrap should begin with a space in place of the vertical bar.
594 \end{DUlineblock}
595 \item[] The left edge of a continuation line need not be aligned with
596 the left edge of the text above it.
597 \end{DUlineblock}
598 \end{DUlineblock}
600 \begin{DUlineblock}{0em}
601 \item[] This is a second line block.
602 \item[]
603 \item[] Blank lines are permitted internally, but they must begin with a “|”.
604 \end{DUlineblock}
606 Another line block, surrounded by paragraphs:
608 \begin{DUlineblock}{0em}
609 \item[] And it’s no good waiting by the window
610 \item[] It’s no good waiting for the sun
611 \item[] Please believe me, the things you dream of
612 \item[] They don’t fall in the lap of no-one
613 \end{DUlineblock}
615 Take it away, Eric the Orchestra Leader!
617 \begin{quote}
618 \begin{DUlineblock}{0em}
619 \item[] A one, two, a one two three four
620 \item[]
621 \item[] Half a bee, philosophically,
622 \item[]
623 \begin{DUlineblock}{\DUlineblockindent}
624 \item[] must, \emph{ipso facto}, half not be.
625 \end{DUlineblock}
626 \item[] But half the bee has got to be,
627 \item[]
628 \begin{DUlineblock}{\DUlineblockindent}
629 \item[] \emph{vis a vis} its entity. D’you see?
630 \item[]
631 \end{DUlineblock}
632 \item[] But can a bee be said to be
633 \item[]
634 \begin{DUlineblock}{\DUlineblockindent}
635 \item[] or not to be an entire bee,
636 \item[]
637 \begin{DUlineblock}{\DUlineblockindent}
638 \item[] when half the bee is not a bee,
639 \item[]
640 \begin{DUlineblock}{\DUlineblockindent}
641 \item[] due to some ancient injury?
642 \item[]
643 \end{DUlineblock}
644 \end{DUlineblock}
645 \end{DUlineblock}
646 \item[] Singing…
647 \end{DUlineblock}
648 \end{quote}
650 A line block, like the following poem by Christian Morgenstern, can
651 also be centre-aligned:
653 \begin{selectlanguage}{ngerman}
654 \begin{DUlineblock}{0em}
655 \centering
656 \item[] \textbf{Die Trichter}
657 \item[]
658 \item[] Zwei Trichter wandeln durch die Nacht.
659 \item[] Durch ihres Rumpfs verengten Schacht
660 \item[] fließt weißes Mondlicht
661 \item[] still und heiter
662 \item[] auf   ihren
663 \item[] Waldweg
664 \item[] u. s.
665 \item[] w.
666 \item[]
667 \end{DUlineblock}
668 \end{selectlanguage}
671 \subsection{2.9   Block Quotes%
672 \label{block-quotes}%
675 Block quotes consist of indented body elements:
677 \begin{quote}
678 My theory by A. Elk. Brackets Miss, brackets. This theory goes
679 as follows and begins now. All brontosauruses are thin at one
680 end, much much thicker in the middle and then thin again at the
681 far end. That is my theory, it is mine, and belongs to me and I
682 own it, and what it is too.
683 \nopagebreak
685 \raggedleft —Anne Elk (Miss)
686 \end{quote}
688 The language of a quote (like any other object) can be specified by
689 a class attribute:
693 \begin{selectlanguage}{french}
694 \begin{quote}
695 ReStructuredText est un langage de balisage léger utilisé
696 notamment dans la documentation du langage Python.
697 \end{quote}
698 \end{selectlanguage}
701 \subsection{2.10   Doctest Blocks%
702 \label{doctest-blocks}%
705 \begin{quote}
706 \begin{alltt}
707 >>> print 'Python-specific usage examples; begun with ">>>"'
708 Python-specific usage examples; begun with ">>>"
709 >>> print '(cut and pasted from interactive Python sessions)'
710 (cut and pasted from interactive Python sessions)
711 \end{alltt}
712 \end{quote}
715 \subsection{2.11   Footnotes%
716 \label{footnotes}%
719 \DUfootnotetext{id8}{id1}{1}{%
720 A footnote contains body elements, consistently indented by at
721 least 3 spaces.
723 This is the footnote’s second paragraph.
726 \DUfootnotetext{label}{id3}{2}{\phantomsection\label{label}%
727 Footnotes may be numbered, either manually (as in\DUfootnotemark{id9}{id8}{1}) or
728 automatically using a “\#”-prefixed label. This footnote has a
729 label so it can be referred to from multiple places, both as a
730 footnote reference (\DUfootnotemark{id10}{label}{2}) and as a \hyperref[label]{hyperlink reference}.
733 \DUfootnotetext{id12}{id2}{3}{%
734 This footnote is numbered automatically and anonymously using a
735 label of “\#” only.
737 This is the second paragraph.
739 And this is the third paragraph.
742 \DUfootnotetext{id13}{id4}{*}{%
743 Footnotes may also use symbols, specified with a “*” label.
744 Here’s a reference to the next footnote:\DUfootnotemark{id14}{id15}{}.
747 \DUfootnotetext{id15}{id14}{}{%
748 This footnote shows the next symbol in the sequence.
751 \DUfootnotetext{id16}{id16}{4}{%
752 Here’s an unreferenced footnote, with a reference to a
753 nonexistent footnote:%
754 \raisebox{1em}{\hypertarget{id17}{}}\hyperlink{id45}{\textbf{\color{red}{[}5{]}\_}}.
758 \subsection{2.12   Citations%
759 \label{citations}%
761 \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
762 Citations are text-labeled footnotes. They may be
763 rendered separately and differently from footnotes.
764 \end{figure}
766 Here’s a reference to the above, \hyperlink{cit2002}{[CIT2002]}, and a %
767 \raisebox{1em}{\hypertarget{id19}{}}\hyperlink{id46}{\textbf{\color{red}{[}nonexistent{]}\_}}
768 citation.
771 \subsection{2.13   Targets%
772 \label{targets}%
773 \label{another-target}%
776 \phantomsection\label{example}
777 This paragraph is pointed to by the explicit “example” target. A
778 reference can be found under \hyperref[inline-markup]{Inline Markup}, above. \hyperref[inline-hyperlink-targets]{Inline
779 hyperlink targets} are also possible.
781 Section headers are implicit targets, referred to by name. See
782 \hyperref[targets]{Targets}, which is a subsection of \hyperref[body-elements]{Body Elements}.
784 Explicit external targets are interpolated into references such as
785 \href{http://www.python.org/}{Python}\DUfootnotemark{id31}{id29}{5}”.
787 Targets may be indirect and anonymous. Thus \hyperref[targets]{this phrase} may also
788 refer to the \hyperref[targets]{Targets} section.
790 Here’s a %
791 \raisebox{1em}{\hypertarget{id48}{}}\hyperlink{id47}{\textbf{\color{red}`hyperlink reference without a target`\_}}, which generates an
792 error.
795 \subsubsection{2.13.1   Duplicate Target Names%
796 \label{duplicate-target-names}%
799 Duplicate names in section headers or other implicit targets will
800 generate “info” (level-1) system messages. Duplicate names in
801 explicit targets will generate “warning” (level-2) system messages.
804 \subsubsection{2.13.2   Duplicate Target Names%
805 \label{id21}%
808 Since there are two “Duplicate Target Names” section headers, we
809 cannot uniquely refer to either of them by name. If we try to (like
810 this: %
811 \raisebox{1em}{\hypertarget{id50}{}}\hyperlink{id49}{\textbf{\color{red}`Duplicate Target Names`\_}}), an error is generated.
814 \subsection{2.14   Directives%
815 \label{directives}%
818 \phantomsection\label{contents}
819 These are just a sample of the many reStructuredText Directives. For
820 others, please see
821 \url{http://docutils.sourceforge.net/docs/ref/rst/directives.html}.
824 \subsubsection{2.14.1   Document Parts%
825 \label{document-parts}%
828 An example of the “contents” directive can be seen above this section
829 (a local, untitled table of \hyperref[contents]{contents}) and at the beginning of the
830 document (a document-wide \hyperref[table-of-contents]{table of contents}).
833 \subsubsection{2.14.2   Images and Figures%
834 \label{images-and-figures}%
837 An image directive (also clickable – a hyperlink reference):
839 \hyperref[directives]{\includegraphics{../../../docs/user/rst/images/title.png}}
841 Image with multiple IDs:
843 \includegraphics{../../../docs/user/rst/images/title.png}
844 \phantomsection\label{image-target-3}\label{image-target-2}\label{image-target-1}
846 A centered image:
848 \noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
850 A left-aligned image:
852 \noindent{\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill}
854 This paragraph might flow around the image.
855 The specific behavior depends upon the style sheet and
856 the browser or rendering software used.
858 A right-aligned image:
860 \noindent{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}}
862 This paragraph might flow around the image.
863 The specific behavior depends upon the style sheet and
864 the browser or rendering software used.
866 For inline images see \hyperref[substitution-definitions]{Substitution Definitions}.
868 Image size:
870 An image 2 em wide:
872 \includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png}
874 An image 2 em wide and 15 pixel high:
876 \includegraphics[height=15px,width=2em]{../../../docs/user/rst/images/biohazard.png}
878 An image occupying 50\% of the line width:
880 \includegraphics[width=0.500\linewidth]{../../../docs/user/rst/images/title.png}
882 An image 2 cm high:
884 \includegraphics[height=2cm]{../../../docs/user/rst/images/biohazard.png}
886 A \emph{figure} is an image with a caption and/or a legend. With page-based output
887 media, figures might float to a different position if this helps the page
888 layout.
890 \begin{DUclass}{figclass1}
891 \begin{DUclass}{figclass2}
892 \begin{figure}
893 \noindent\makebox[\linewidth][c]{\includegraphics[width=258bp]{../../../docs/user/rst/images/title.png}}
894 \caption{Plaintext markup syntax and parser system.}
895 \begin{DUlegend}
896 \setlength{\DUtablewidth}{\linewidth}
897 \begin{longtable*}[c]{|p{0.156\DUtablewidth}|p{0.563\DUtablewidth}|}
898 \hline
902 Revised, revisited, based on ‘re’ module.
904 \hline
906 Structured
908 Structure-enhanced text, structuredtext.
910 \hline
912 Text
914 Well it is, isn’t it?
916 \hline
917 \end{longtable*}
919 This paragraph is also part of the legend.
920 \end{DUlegend}
921 \end{figure}
922 \end{DUclass}
923 \end{DUclass}
925 A left-aligned figure:
927 \begin{DUclass}{figclass1}
928 \begin{DUclass}{figclass2}
929 \begin{figure} % align = "left"
930 \noindent\makebox[\linewidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
931 \caption{This is the caption.}
932 \begin{DUlegend}
933 This is the legend.
935 The legend may consist of several paragraphs.
936 \end{DUlegend}
937 \end{figure}
938 \end{DUclass}
939 \end{DUclass}
941 This paragraph might flow around the figure.
943 The specific behavior depends upon the style sheet and the browser or
944 rendering software used.
946 A centered figure:
948 \begin{figure}
949 \noindent\makebox[\linewidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
950 \caption{This is the caption.}
951 \begin{DUlegend}
952 This is the legend.
954 The legend may consist of several paragraphs.
955 \end{DUlegend}
956 \end{figure}
958 This paragraph might flow around the figure.
960 The specific behavior depends upon the style sheet and the browser or
961 rendering software used.
963 A right-aligned figure:
965 \begin{figure} % align = "right"
966 \noindent\makebox[\linewidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
967 \caption{This is the caption.}
968 \begin{DUlegend}
969 This is the legend.
971 The legend may consist of several paragraphs.
972 \end{DUlegend}
973 \end{figure}
975 This paragraph might flow around the figure. The specific behavior depends
976 upon the style sheet and the browser or rendering software used.
978 Tables may be given titles and additional arguments with the \emph{table}
979 directive:
981 \setlength{\DUtablewidth}{\linewidth}
982 \begin{longtable}[l]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
983 \caption{left-aligned table}\\
984 \hline
985 \textbf{%
987 } & \textbf{%
988 not A
989 } \\
990 \hline
991 \endfirsthead
992 \caption[]{left-aligned table (... continued)}\\
993 \hline
994 \textbf{%
996 } & \textbf{%
997 not A
998 } \\
999 \hline
1000 \endhead
1001 \multicolumn{2}{c}{\hfill ... continued on next page} \\
1002 \endfoot
1003 \endlastfoot
1005 False
1007 True
1009 \hline
1011 True
1013 False
1015 \hline
1016 \end{longtable}
1018 \setlength{\DUtablewidth}{\linewidth}
1019 \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
1020 \caption{center-aligned table}\\
1021 \hline
1022 \textbf{%
1024 } & \textbf{%
1025 not A
1026 } \\
1027 \hline
1028 \endfirsthead
1029 \caption[]{center-aligned table (... continued)}\\
1030 \hline
1031 \textbf{%
1033 } & \textbf{%
1034 not A
1035 } \\
1036 \hline
1037 \endhead
1038 \multicolumn{2}{c}{\hfill ... continued on next page} \\
1039 \endfoot
1040 \endlastfoot
1042 False
1044 True
1046 \hline
1048 True
1050 False
1052 \hline
1053 \end{longtable}
1055 \setlength{\DUtablewidth}{\linewidth}
1056 \begin{longtable}[r]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
1057 \caption{right-aligned table}\\
1058 \hline
1059 \textbf{%
1061 } & \textbf{%
1062 not A
1063 } \\
1064 \hline
1065 \endfirsthead
1066 \caption[]{right-aligned table (... continued)}\\
1067 \hline
1068 \textbf{%
1070 } & \textbf{%
1071 not A
1072 } \\
1073 \hline
1074 \endhead
1075 \multicolumn{2}{c}{\hfill ... continued on next page} \\
1076 \endfoot
1077 \endlastfoot
1079 False
1081 True
1083 \hline
1085 True
1087 False
1089 \hline
1090 \end{longtable}
1092 With the “widths” argument “auto” (or “class” value “colwidths-auto”),
1093 column widths are determined by the backend (if supported by the
1094 writer/backend).
1096 \begin{longtable*}[c]{|l|l|l|}
1097 \hline
1098 \textbf{A} & \textbf{B} & \textbf{A or B} \\
1099 \hline
1100 \endfirsthead
1101 \hline
1102 \textbf{A} & \textbf{B} & \textbf{A or B} \\
1103 \hline
1104 \endhead
1105 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1106 \endfoot
1107 \endlastfoot
1108 False & False & False \\
1109 \hline
1110 True & False & True \\
1111 \hline
1112 False & True & True \\
1113 \hline
1114 True & True & True \\
1115 \hline
1116 \end{longtable*}
1117 \label{target2}\label{target1}
1120 \subsubsection{2.14.3   Admonitions%
1121 \label{admonitions}%
1124 \DUadmonition[attention]{
1125 \DUtitle[attention]{Attention!}
1127 Directives at large.
1130 \DUadmonition[caution]{
1131 \DUtitle[caution]{Caution!}
1133 Don’t take any wooden nickels.
1136 \DUadmonition[danger]{
1137 \DUtitle[danger]{!DANGER!}
1139 Mad scientist at work!
1142 \DUadmonition[error]{
1143 \DUtitle[error]{Error}
1145 Does not compute.
1148 \DUadmonition[hint]{
1149 \DUtitle[hint]{Hint}
1151 It’s bigger than a bread box.
1154 \DUadmonition[important]{
1155 \DUtitle[important]{Important}
1157 \begin{itemize}
1158 \item Wash behind your ears.
1160 \item Clean up your room.
1162 \item Call your mother.
1164 \item Back up your data.
1165 \end{itemize}
1168 \DUadmonition[note]{
1169 \DUtitle[note]{Note}
1171 This is a note.
1174 \DUadmonition[tip]{
1175 \DUtitle[tip]{Tip}
1177 15\% if the service is good.
1180 \DUadmonition[warning]{
1181 \DUtitle[warning]{Warning}
1183 Strong prose may provoke extreme mental exertion.
1184 Reader discretion is strongly advised.
1187 \DUadmonition[admonition-and-by-the-way]{
1188 \DUtitle[admonition-and-by-the-way]{And, by the way…}
1190 You can make up your own admonition too.
1194 \subsubsection{2.14.4   Topics, Sidebars, and Rubrics%
1195 \label{topics-sidebars-and-rubrics}%
1198 \emph{Sidebars} are like miniature, parallel documents.
1200 \DUsidebar{
1201 \DUtitle[title]{Sidebar Title}
1203 \DUsubtitle[sidebar]{Optional Subtitle}
1205 This is a sidebar. It is for text outside the flow of the main
1206 text.
1208 \DUrubric{This is a rubric inside a sidebar}
1210 Sidebars often appear beside the main text with a border and a different
1211 background or font color.
1214 A \emph{topic} is like a block quote with a title, or a self-contained section
1215 with no subsections.
1217 \begin{DUclass}{topic}
1218 \begin{quote}
1219 \DUtitle[topic]{Topic Title}
1221 This is a topic.
1222 \end{quote}
1223 \end{DUclass}
1225 A \emph{rubric} is like an informal heading that doesn’t correspond to the
1226 document’s structure. It is typically highlighted in red (hence the name).
1228 \DUrubric{This is a rubric}
1230 Topics and rubrics can be used at places where a \hyperref[section-title]{section title} is not
1231 allowed (e.g. inside a directive).
1234 \subsubsection{2.14.5   Target Footnotes%
1235 \label{target-footnotes}%
1238 \DUfootnotetext{id29}{id30}{5}{%
1239 \url{http://www.python.org/}
1242 \DUfootnotetext{id33}{id34}{6}{%
1243 \url{http://pygments.org/}
1246 \DUfootnotetext{id35}{id36}{7}{%
1247 \url{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}
1250 \DUfootnotetext{id39}{id40}{8}{%
1251 \url{http://docutils.sourceforge.net/}
1254 \DUfootnotetext{id41}{id42}{9}{%
1255 \url{A:DOS\\path\\}
1259 \subsubsection{2.14.6   Replacement Text%
1260 \label{replacement-text}%
1263 I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\DUfootnotemark{id32}{id29}{5}.
1266 \subsubsection{2.14.7   Compound Paragraph%
1267 \label{compound-paragraph}%
1270 The \emph{compound} directive is used to create a “compound paragraph”, which
1271 is a single logical paragraph containing multiple physical body
1272 elements. For example:
1274 \begin{DUclass}{compound}
1275 The ‘rm’ command is very dangerous. If you are logged
1276 in as root and enter
1277 \begin{quote}
1278 \begin{alltt}
1279 cd /
1280 rm -rf *
1281 \end{alltt}
1282 \end{quote}
1283 you will erase the entire contents of your file system.
1284 \end{DUclass}
1286 Test the handling and display of compound paragraphs:
1288 \begin{DUclass}{compound}
1289 \begin{DUclass}{some-class}
1290 Compound 2, paragraph 1,
1292 compound 2, paragraph 2,
1293 \begin{itemize}
1294 \item list item 1,
1296 \item list item 2,
1297 \end{itemize}
1298 compound 2, paragraph 3.
1299 \end{DUclass}
1300 \end{DUclass}
1302 \begin{DUclass}{compound}
1303 Compound 3, only consisting of one paragraph.
1304 \end{DUclass}
1306 \begin{DUclass}{compound}
1307 \begin{quote}
1308 \begin{alltt}
1309 Compound 4.
1310 This one starts with a literal block.
1311 \end{alltt}
1312 \end{quote}
1313 Compound 4, paragraph following the literal block.
1314 \end{DUclass}
1316 Now something \emph{really} perverted – a nested compound block. This is
1317 just to test that it works at all; the results don’t have to be
1318 meaningful.
1320 \begin{DUclass}{compound}
1321 Compound 5, block 1 (a paragraph).
1323 \begin{DUclass}{compound}
1324 Compound 6 is block 2 in compound 5.
1326 Compound 6, another paragraph.
1327 \end{DUclass}
1329 Compound 5, block 3 (a paragraph).
1330 \end{DUclass}
1332 \begin{DUclass}{compound}
1333 Compound 7, tests the inclusion of various block-level
1334 elements in one logical paragraph. First a table,
1336 \setlength{\DUtablewidth}{\linewidth}
1337 \begin{longtable*}[c]{|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|}
1338 \hline
1340 Left cell, first
1341 paragraph.
1343 Left cell, second
1344 paragraph.
1346 Middle cell,
1347 consisting of
1348 exactly one
1349 paragraph.
1351 Right cell.
1353 Paragraph 2.
1355 Paragraph 3.
1357 \hline
1358 \end{longtable*}
1359 followed by a paragraph. This physical paragraph is
1360 actually a continuation of the paragraph before the table. It is followed
1362 \begin{quote}
1363 a quote and
1364 \end{quote}
1365 \begin{enumerate}
1366 \item an enumerated list,
1367 \end{enumerate}
1368 a paragraph,
1369 \begin{DUoptionlist}
1370 \item[-{}-an] option list,
1371 \end{DUoptionlist}
1372 a paragraph,
1373 \begin{DUfieldlist}
1374 \item[{a field:}]
1375 list,
1376 \end{DUfieldlist}
1377 a paragraph,
1378 \begin{description}
1379 \item[{a definition}] \leavevmode
1380 list,
1382 \end{description}
1383 a paragraph, an image:
1384 \includegraphics{../../../docs/user/rst/images/biohazard.png}
1385 a paragraph,
1386 \begin{DUlineblock}{0em}
1387 \item[] a line
1388 \item[] block,
1389 \end{DUlineblock}
1390 a paragraph followed by a comment,
1391 % this is a comment
1392 a paragraph, a
1394 \DUadmonition[note]{
1395 \DUtitle[note]{Note}
1397 with content
1399 and the final paragraph of the compound 7.
1400 \end{DUclass}
1403 \subsubsection{2.14.8   Parsed Literal Blocks%
1404 \label{parsed-literal-blocks}%
1407 \begin{quote}
1408 \ttfamily\raggedright
1409 This~is~a~parsed~literal~block.\\
1410 ~~~~This~line~is~indented.~~The~next~line~is~blank.\\
1412 Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\
1413 text},~\textsubscript{sub-}~and~\textsuperscript{super}scripts,\\
1414 inline~formulas:~$A = 2 \pi r^2$,\\
1415 footnotes\DUfootnotemark{id22}{id8}{1},~%
1416 \phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
1417 \end{quote}
1420 \subsubsection{2.14.9   Code%
1421 \label{code}%
1424 Blocks of source code can be set with the \DUroletitlereference{code} directive. If the code
1425 language is specified, the content is parsed and tagged by the \href{http://pygments.org/}{Pygments}\DUfootnotemark{id34}{id33}{6}
1426 syntax highlighter and can be formatted with a style sheet. (Code parsing
1427 is turned off using the \texttt{syntax-highlight} config setting in the test
1428 conversions in order to get identical results with/without installed
1429 Pygments highlighter.)
1431 \begin{DUclass}{code}
1432 \begin{DUclass}{python}
1433 \begin{quote}
1434 \begin{alltt}
1435 print 'This is Python code.'
1436 \end{alltt}
1437 \end{quote}
1438 \end{DUclass}
1439 \end{DUclass}
1441 The \texttt{:number-lines:} option (with optional start value) generates line
1442 numbers:
1444 \begin{DUclass}{code}
1445 \begin{DUclass}{python}
1446 \begin{quote}
1447 \ttfamily\raggedright
1448 \DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
1449 \DUrole{ln}{~9~}for~i~in~range(10):\\
1450 \DUrole{ln}{10~}~~~~print~i
1451 \end{quote}
1452 \end{DUclass}
1453 \end{DUclass}
1455 For inline code snippets, there is the \DUroletitlereference{code} role, which can be used
1456 directly (the code will not be parsed/tagged, as the language is not known)
1457 or as base for special code roles, e.g. the LaTeX code in the next
1458 paragraph.
1460 Docutils uses LaTeX syntax for math directives and roles:
1461 \texttt{\DUrole{code}{\DUrole{tex}{\textbackslash{}alpha = f(x)}}} prints $\alpha = f(x)$.
1463 The \texttt{:code:} option of the \DUroletitlereference{include} directive sets the included content
1464 as a code block, here the rst file \texttt{header\_footer.txt} with line numbers:
1466 \begin{DUclass}{code}
1467 \begin{DUclass}{rst}
1468 \begin{quote}
1469 \ttfamily\raggedright
1470 \DUrole{ln}{1~}..~header::~Document~header\\
1471 \DUrole{ln}{2~}..~footer::~Document~footer
1472 \end{quote}
1473 \end{DUclass}
1474 \end{DUclass}
1477 \subsection{2.15   Substitution Definitions%
1478 \label{substitution-definitions}%
1481 An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example:
1483 (Substitution definitions are not visible in the HTML source.)
1486 \subsection{2.16   Comments%
1487 \label{comments}%
1490 Here’s one:
1492 % Comments begin with two dots and a space. Anything may
1493 % follow, except for the syntax of footnotes, hyperlink
1494 % targets, directives, or substitution definitions.
1496 % Double-dashes -- "--" -- must be escaped somehow in HTML output.
1498 % Comments may contain non-ASCII characters: ä ö ü æ ø å
1500 (View the HTML source to see the comment.)
1503 \subsection{2.17   Raw text%
1504 \label{raw-text}%
1507 This does not necessarily look nice, because there may be missing white space.
1509 It’s just there to freeze the behavior.
1511 A test.
1513 Second test.
1515 \DUrole{myclass}{Another test with myclass set.}
1517 This is the \DUrole{myrawroleclass}{fourth test} with myrawroleclass set.
1519 Fifth test in LaTeX.\\Line two.
1522 \subsection{2.18   Container%
1523 \label{container}%
1526 \begin{DUclass}{custom}
1528 paragraph 1
1530 paragraph 2
1531 \end{DUclass}
1533 % currently not implemented in LaTeX:
1534 % .. include:: data/header_footer.txt
1537 \subsection{2.19   Colspanning tables%
1538 \label{colspanning-tables}%
1541 This table has a cell spanning two columns:
1543 \setlength{\DUtablewidth}{\linewidth}
1544 \begin{longtable*}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|}
1545 \hline
1546 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1547 Inputs
1548 }} & \textbf{%
1549 Output
1550 } \\
1551 \hline
1552 \textbf{%
1554 } & \textbf{%
1556 } & \textbf{%
1557 A or B
1558 } \\
1559 \hline
1560 \endfirsthead
1561 \hline
1562 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1563 Inputs
1564 }} & \textbf{%
1565 Output
1566 } \\
1567 \hline
1568 \textbf{%
1570 } & \textbf{%
1572 } & \textbf{%
1573 A or B
1574 } \\
1575 \hline
1576 \endhead
1577 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1578 \endfoot
1579 \endlastfoot
1581 False
1583 False
1585 False
1587 \hline
1589 True
1591 False
1593 True
1595 \hline
1597 False
1599 True
1601 True
1603 \hline
1605 True
1607 True
1609 True
1611 \hline
1612 \end{longtable*}
1615 \subsection{2.20   Rowspanning tables%
1616 \label{rowspanning-tables}%
1619 Here’s a table with cells spanning several rows:
1621 \setlength{\DUtablewidth}{\linewidth}
1622 \begin{longtable*}[c]{|p{0.296\DUtablewidth}|p{0.156\DUtablewidth}|p{0.226\DUtablewidth}|}
1623 \hline
1624 \textbf{%
1625 Header row, column 1
1626 (header rows optional)
1627 } & \textbf{%
1628 Header 2
1629 } & \textbf{%
1630 Header 3
1631 } \\
1632 \hline
1633 \endfirsthead
1634 \hline
1635 \textbf{%
1636 Header row, column 1
1637 (header rows optional)
1638 } & \textbf{%
1639 Header 2
1640 } & \textbf{%
1641 Header 3
1642 } \\
1643 \hline
1644 \endhead
1645 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1646 \endfoot
1647 \endlastfoot
1649 body row 1, column 1
1651 column 2
1653 column 3
1655 \hline
1657 body row 2
1658 & \multirow{2}{0.16\DUtablewidth}{%
1659 Cells may
1660 span rows.
1661 } & \multirow{2}{0.23\DUtablewidth}{%
1662 Another
1663 rowspanning
1664 cell.
1665 } \\
1666 \cline{1-1}
1668 body row 3
1669 & & \\
1670 \hline
1671 \end{longtable*}
1674 \subsection{2.21   List Tables%
1675 \label{list-tables}%
1678 Here’s a list table exercising all features:
1680 \setlength{\DUtablewidth}{40em}
1681 \begin{longtable}[c]{|p{0.133\DUtablewidth}|p{0.249\DUtablewidth}|p{0.365\DUtablewidth}|}
1682 \caption{list table with integral header}\\
1683 \hline
1684 \textbf{%
1685 Treat
1686 } & \textbf{%
1687 Quantity
1688 } & \textbf{%
1689 Description
1690 } \\
1691 \hline
1692 \endfirsthead
1693 \caption[]{list table with integral header (... continued)}\\
1694 \hline
1695 \textbf{%
1696 Treat
1697 } & \textbf{%
1698 Quantity
1699 } & \textbf{%
1700 Description
1701 } \\
1702 \hline
1703 \endhead
1704 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1705 \endfoot
1706 \endlastfoot
1707 \textbf{%
1708 Albatross
1709 } &
1710 2.99
1712 On a stick!
1714 \hline
1715 \textbf{%
1716 Crunchy Frog
1717 } &
1718 1.49
1720 If we took the bones out, it wouldn’t be
1721 crunchy, now would it?
1723 \hline
1724 \textbf{%
1725 Gannet Ripple
1726 } &
1727 1.99
1729 On a stick!
1731 \hline
1732 \end{longtable}
1734 \begin{longtable}[c]{|l|l|}
1735 \caption{center aligned list table}\\
1736 \hline
1737 Albatross & 2.99 \\
1738 \hline
1739 Crunchy Frog & 1.49 \\
1740 \hline
1741 Gannet Ripple & 1.99 \\
1742 \hline
1743 \end{longtable}
1746 \subsection{2.22   Custom Roles%
1747 \label{custom-roles}%
1750 \begin{itemize}
1751 \item A role based on an existing role.
1753 \texttt{\DUrole{custom}{one}} \texttt{\DUrole{custom}{two}} \texttt{\DUrole{custom}{three}}
1755 \item A new role.
1757 \DUrole{customnew}{one two three}
1759 \item A role with class attribute.
1761 \DUrole{special}{interpreted text}
1763 \item A language-switching role:
1765 Let’s count in German \foreignlanguage{ngerman}{eins zwei drei}.
1767 \item A role with multiple class attributes, styled with raw directives:
1769 \newcommand{\DUrolegreen}[1]{\textcolor{green}{#1}}
1770 \newcommand{\DUrolesc}[1]{\textsc{#1}}
1772 The following works in most browsers but does not validate
1773 (\texttt{<style>} is only allowed in the document head):
1775 \begin{quote}
1776 \begin{alltt}
1777 .. raw:: html
1779 <style type="text/css"><!-{}-
1780 .green \{color: green;\}
1781 .sc \{font-variant: small-caps;\}
1782 -{}-></style>
1783 \end{alltt}
1784 \end{quote}
1786 \DUrole{green}{\DUrole{sc}{\foreignlanguage{british}{British colourful text in small-caps}}}.
1787 \end{itemize}
1790 \subsection{2.23   Mathematics%
1791 \label{mathematics}%
1794 Docutils supports inline math with the prefix or postfix \texttt{:math:}
1795 role specificator, $n! + \sin(x_n^2)$ and $A_\text{c} =
1796 \frac{\pi}{4} d^2$, as well as displayed math via the
1797 \DUroletitlereference{math} directive:
1799 \begin{equation*}
1800 f(\epsilon) = \frac{1}{1 + \exp\left(\frac{\varepsilon}{k_\text{B}T}\right)}
1801 \end{equation*}
1802 Content may start on the first line of the directive, e.g.
1804 \begin{equation*}
1805 N = \frac{\text{number of apples}}{7}
1806 \end{equation*}
1807 Equations can be labeled with a reference name using the \texttt{:name:} option.
1808 See \hyperref[eq-m]{eq:M} and \hyperref[eq-schrodinger]{eq:schrödinger} below.
1810 The determinant of the matrix
1812 \begin{equation*}
1813 \mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)
1814 \phantomsection
1815 \label{eq-m}
1816 \end{equation*}
1817 is $|\mathbf{M}| = ad - bc$.
1819 More than one display math block can be put in one math directive.
1820 For example, the following sum and integral with limits:
1822 \begin{equation*}
1823 \int_0^1 x^n dx = \frac{1}{n + 1}
1824 \end{equation*}%
1825 \begin{equation*}
1826 \sum_{n=1}^m n = \frac{m(m+1)}{2}
1827 \end{equation*}
1828 LaTeX-supported Unicode math symbols can be used in math roles and
1829 directives:
1831 The Schrödinger equation
1833 \begin{equation*}
1834 i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi ,
1835 \phantomsection
1836 \label{eq-schrodinger}
1837 \end{equation*}
1838 with the \emph{wave function} $\Psi $, describes how the quantum state of a
1839 physical system changes in time.
1841 \begin{description}
1842 \item[{Math-Accents:}] \leavevmode
1843 \setlength{\DUtablewidth}{\linewidth}
1844 \begin{longtable*}[c]{p{0.315\DUtablewidth}p{0.315\DUtablewidth}p{0.315\DUtablewidth}}
1846 $\acute{a}$ \texttt{\textbackslash{}acute\{a\}}
1848 $\dot{t}$ \texttt{\textbackslash{}dot\{t\}}
1850 $\hat{\gamma}$ \texttt{\textbackslash{}hat\{\textbackslash{}gamma\}}
1853 $\grave{a}$ \texttt{\textbackslash{}grave\{a\}}
1855 $\ddot{t}$ \texttt{\textbackslash{}ddot\{t\}}
1857 $\tilde{\alpha}$ \texttt{\textbackslash{}tilde\{\textbackslash{}alpha\}}
1860 $\breve{x}$ \texttt{\textbackslash{}breve\{x\}}
1862 $\dddot{t}$ \texttt{\textbackslash{}dddot\{t\}}
1864 $\vec{\imath}$ \texttt{\textbackslash{}vec\{\textbackslash{}imath\}}
1867 $\check{a}$ \texttt{\textbackslash{}check\{a\}}
1869 $\bar{a}$ \texttt{\textbackslash{}bar\{a\}}
1871 $\vec{R}$ \texttt{\textbackslash{}vec\{R\}}
1873 \end{longtable*}
1875 \end{description}
1877 % \widetilde{xxx}
1878 % \widehat{xxx}
1880 Modulation Transfer Function:
1882 \begin{equation*}
1883 \text{MTF} = \left|\frac{\mathcal{F}\{s(x)\}}
1884 {\mathcal{F}\{ s(x)\} |_{\omega _{x}=0}}\right|
1885 = \mathrm{abs}\left(\frac
1886 {\int _{-\infty }^{\infty }s(x) \mathrm{e}^{\mathrm{i}\omega _{x}x}\mathrm{d}{x}}
1887 {\int _{-\infty }^{\infty }s(x)\mathrm{d}{x}}
1888 \right).
1889 \end{equation*}
1890 Math split over two lines: If a double backslash is detected outside a
1891 \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}
1892 \texttt{align} environment:
1894 \begin{align*}
1895 s_{\mathrm{out}}(x) & = s_{\mathrm{in}}(x') * s_\delta (x-x') \\
1896 & = \int s_{\mathrm{in}}(x')s_\delta (x-x')\mathrm{d}x'
1897 \end{align*}
1898 Cases (“manually”, with \texttt{matrix} environment):
1900 \begin{equation*}
1901 \mathrm{sgn}(x) = \left\{\begin{matrix}
1902 -1 & x<0\\
1903 1 & x>0
1904 \end{matrix}\right.
1905 \end{equation*}
1906 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
1907 HTML writers with \texttt{-{}-math-output=MathML}):
1909 \begin{equation*}
1910 \mathrm{sgn}(x) = \begin{cases}
1911 -1 & x<0\\
1912 1 & x>0
1913 \end{cases}
1914 \end{equation*}
1916 \section{3   Tests for the LaTeX writer%
1917 \label{tests-for-the-latex-writer}%
1920 Test syntax elements which may cause trouble for the LaTeX writer but might
1921 not need to be tested with other writers (e.g. the HTML writer).
1924 \subsection{3.1   Custom Roles in LaTeX%
1925 \label{custom-roles-in-latex}%
1928 \begin{itemize}
1929 \item Role names and class arguments are converted to conform to the
1930 regular expression \texttt{{[}a-z{]}{[}-a-z0-9{]}*} (letters are downcased,
1931 accents and similar decoration is stripped, non-conforming
1932 characters are replaced by a hyphen).
1934 Class arguments may contain numbers and hyphens, which need special
1935 treatment in LaTeX command names.
1937 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Text with role “custom4”}}}}} (but without styling by \texttt{DUrole*}
1938 macros).
1940 \item With LaTeX, roles can be styled within the document using the \DUroletitlereference{raw}
1941 directive.
1943 \newcommand{\DUrolelarge}[1]{{\large #1}}
1944 \makeatletter
1945 \@namedef{DUrolesmall-caps}{\textsc}
1946 \@namedef{DUrolecustom4}{\textbf}
1947 \makeatother
1949 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{inline text}}}}} in large, bold, small-caps.
1951 \item Custom roles can be based on standard roles:
1953 This is a \emph{\DUrole{custom-emphasis}{customized emphasis text role}}
1955 This is a \texttt{\DUrole{custom-literal}{customized literal text role}}
1957 This is a \textbf{\DUrole{custom-strong}{customized strong text role}}
1959 This is a \textsubscript{\DUrole{custom-subscript}{customized subscript text role}}
1961 This is a \textsuperscript{\DUrole{custom-superscript}{customized superscript text role}}
1963 This is a \DUroletitlereference{\DUrole{custom-title-reference}{customized title-reference text role}}
1964 \end{itemize}
1967 \subsection{3.2   class handling%
1968 \label{class-handling}%
1971 This section tests class handling for block level elements by the LaTeX
1972 writer. See the input file \texttt{classes\_latex.txt} for the raw LaTeX code used
1973 to style the examples.
1975 An “epigraph” directive is exported as “quote” wrapped in a “DUclass”
1976 environment. Here, it is styled by a “DUCLASSepigraph” environment
1977 redefining the “quote” environment as “minipage”:
1979 \newcommand*{\DUCLASSepigraph}{%
1980 \renewenvironment{quote}{\vspace{1em}
1981 \footnotesize\hfill{}%
1982 \begin{minipage}{0.4\columnwidth}}%
1983 {\end{minipage}\vskip\baselineskip}}
1985 \begin{DUclass}{epigraph}
1986 \begin{quote}
1987 Do not play this piece fast. It is never right to play \emph{Ragtime} fast.
1988 \nopagebreak
1990 \raggedleft —Scott Joplin
1991 \end{quote}
1992 \end{DUclass}
1994 Raw latex is also used to style the following lists: “DUCLASSenumerateitems”
1995 redefines “itemize” as “enumerate”, “DUCLASSrules” draws horizontal lines
1996 above and below.
1998 \newcommand*{\DUCLASSenumerateitems}{%
1999 \renewenvironment{itemize}{\begin{enumerate}}%
2000 {\end{enumerate}}%
2003 \newenvironment{DUCLASSrules}%
2004 {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}%
2005 {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}
2007 An “enumerated” bullet list:
2009 \begin{DUclass}{enumerateitems}
2010 \begin{itemize}
2011 \item item
2013 \item next item
2015 \item third item
2016 \end{itemize}
2017 \end{DUclass}
2019 A list with lines above and below:
2021 \begin{DUclass}{rules}
2022 \begin{itemize}
2023 \item item
2025 \item next item
2026 \end{itemize}
2027 \end{DUclass}
2029 A normal bullet list is kept unchanged by the above redefinitions:
2031 \begin{itemize}
2032 \item item
2034 \item next item
2036 \item third item
2037 \end{itemize}
2039 A container wraps several elements in a common “class wrapper”. Here, we use
2040 it to set 2 paragraphs and a list in small caps:
2042 \newcommand*{\DUCLASSscshape}{\scshape}
2044 \begin{DUclass}{scshape}
2046 paragraph 1
2048 paragraph 2
2050 \begin{itemize}
2051 \item bullet list
2053 \item still bullet list
2054 \end{itemize}
2055 \end{DUclass}
2057 A right-aligned line-block. Alignment handling is built into the latex
2058 writer for image, table, and line block elements.
2060 \begin{DUlineblock}{0em}
2061 \raggedleft
2062 \item[] Max Mustermann
2063 \item[] Waldstr. 22
2064 \item[] D 01234 Testdorf
2065 \item[] Tel.: 0123/456789
2066 \end{DUlineblock}
2069 \subsection{3.3   More Tables%
2070 \label{more-tables}%
2073 A table with multi-paragraph multicolumn cells:
2075 \setlength{\DUtablewidth}{\linewidth}
2076 \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}|}
2077 \hline
2079 test
2081 \textbf{bold hd}
2082 & \multicolumn{3}{p{0.41\DUtablewidth}|}{%
2083 multicolumn 1
2085 With a second paragraph
2086 } &
2087 \emph{emph hd}
2089 \hline
2090 \multicolumn{2}{|p{0.31\DUtablewidth}|}{%
2091 multicolumn 2
2093 With a second paragraph
2094 } &
2095 cell
2097 cell
2099 cell
2101 cell
2103 \hline
2105 cell
2106 & \multicolumn{2}{p{0.36\DUtablewidth}|}{%
2107 multicolumn 3 (one line,
2108 but very very very very
2109 very looooong)
2110 } &
2111 cell
2113 cell
2115 cell
2117 \hline
2119 cell
2121 cell
2123 cell
2124 & \multicolumn{3}{p{0.38\DUtablewidth}|}{%
2125 Short multicolumn 4
2126 } \\
2127 \hline
2128 \end{longtable*}
2130 Tables with multi-paragraph multirow cells currently fail due to a LaTeX
2131 limitation (see \url{https://sourceforge.net/p/docutils/bugs/225/}).
2133 A table with multirow header and column-widths set by LaTeX:
2135 \begin{longtable*}[c]{|l|l|}
2136 \hline
2137 \multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\
2138 \cline{2-2}
2139 & \textbf{Description} \\
2140 \hline
2141 \endfirsthead
2142 \hline
2143 \multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\
2144 \cline{2-2}
2145 & \textbf{Description} \\
2146 \hline
2147 \endhead
2148 \multicolumn{2}{c}{\hfill ... continued on next page} \\
2149 \endfoot
2150 \endlastfoot
2151 \multicolumn{2}{|l|}{multicollumn cell} \\
2152 \hline
2153 \end{longtable*}
2155 In a table with column-widths set by LaTeX, each cell has just one line.
2156 Paragraphs are merged (a warning is given).
2158 \begin{longtable*}[c]{|l|l|}
2159 \hline
2160 11 & first paragraph
2161 second paragraph
2162 third paragraph \\
2163 \hline
2164 21 & 22 \\
2165 \hline
2166 \end{longtable*}
2168 % This file is used by the standalone_rst_latex test.
2171 \subsection{3.4   Option lists%
2172 \label{id23}%
2175 The LaTeX-2e description environment is used for definition lists.
2176 The definition is continued on the same line as the term, this should
2177 not happen if a option-list is at the top of the definition.
2179 If the option list is not at the first element in the definition, it
2180 is contained in a quote
2182 \begin{quote}
2183 \begin{DUoptionlist}
2184 \item[-{}-help] show help
2186 \item[-v] verbose
2187 \end{DUoptionlist}
2188 \end{quote}
2190 \begin{description}
2191 \item[{In a definition list:}] \leavevmode
2192 \begin{DUoptionlist}
2193 \item[-{}-help] show help
2195 \item[-v] verbose
2196 \end{DUoptionlist}
2198 \end{description}
2201 \subsection{3.5   Monospaced non-alphanumeric characters%
2202 \label{monospaced-non-alphanumeric-characters}%
2205 These are all ASCII characters except a-zA-Z0-9 and space:
2207 \texttt{!!!\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'{}'{}'((()))***+++,{},{},-{}-{}-...///:::}
2209 \texttt{;;;<{}<{}<===>{}>{}>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_`{}`{}`\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}}
2211 \texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
2213 The two lines of non-alphanumeric characters should both have the same
2214 width as the third line.
2217 \subsection{3.6   Non-ASCII characters%
2218 \label{non-ascii-characters}%
2221 Punctuation and footnote symbols
2223 \setlength{\DUtablewidth}{\linewidth}
2224 \begin{longtable*}[c]{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|}
2225 \hline
2229 en-dash
2231 \hline
2235 em-dash
2237 \hline
2241 single turned comma quotation mark
2243 \hline
2247 single comma quotation mark
2249 \hline
2253 low single comma quotation mark
2255 \hline
2259 double turned comma quotation mark
2261 \hline
2265 double comma quotation mark
2267 \hline
2271 low double comma quotation mark
2273 \hline
2277 dagger
2279 \hline
2283 double dagger
2285 \hline
2287 \ding{169}
2289 black diamond suit
2291 \hline
2293 \ding{170}
2295 black heart suit
2297 \hline
2301 black spade suit
2303 \hline
2307 black club suit
2309 \hline
2313 ellipsis
2315 \hline
2319 trade mark sign
2321 \hline
2325 left-right double arrow
2327 \hline
2328 \end{longtable*}
2330 The \DUroletitlereference{Latin-1 extended} Unicode block
2332 \setlength{\DUtablewidth}{\linewidth}
2333 \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}|}
2334 \hline
2358 \hline
2361 & &
2367 & &
2378 \hline
2402 \hline
2426 \hline
2450 \hline
2474 \hline
2498 \hline
2522 \hline
2546 \hline
2570 \hline
2585 & & & & \\
2586 \hline
2587 \end{longtable*}
2589 \begin{itemize}
2590 \item The following line should not be wrapped, because it uses
2591 no-break spaces (\textbackslash{}u00a0):
2593 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
2595 \item Line wrapping with/without breakpoints marked by soft hyphens
2596 (\textbackslash{}u00ad):
2598 pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch
2600 pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch
2601 \end{itemize}
2604 \subsection{3.7   Encoding special chars%
2605 \label{encoding-special-chars}%
2608 The LaTeX Info pages lists under “2.18 Special Characters”
2610 \begin{quote}
2611 The following characters play a special role in LaTeX and are called
2612 “special printing characters”, or simply “special characters”.
2614 \begin{quote}
2615 \# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \}
2616 \end{quote}
2617 \end{quote}
2619 The special chars verbatim:
2621 \begin{quote}
2622 \begin{alltt}
2623 # $ % & ~ _ ^ \textbackslash{} \{ \}
2624 \end{alltt}
2625 \end{quote}
2627 However also \emph{square brackets} {[}{]} need special care.
2629 \begin{quote}
2630 Commands with optional arguments (e.g. \texttt{\textbackslash{}item}) check
2631 if the token right after the macro name is an opening bracket.
2632 In that case the contents between that bracket and the following
2633 closing bracket on the same grouping level are taken as the
2634 optional argument. What makes this unintuitive is the fact that
2635 the square brackets aren’t grouping characters themselves, so in
2636 your last example item{[}{[}{]}{]} the optional argument consists of
2637 {[}… (without the closing bracket).
2638 \end{quote}
2640 Compare the items in the following lists:
2642 \begin{itemize}
2643 \item simple item
2645 \item {[}bracketed{]} item
2646 \end{itemize}
2648 \begin{description}
2649 \item[{simple}] \leavevmode
2650 description term
2652 \item[{{[}bracketed{]}}] \leavevmode
2653 description term
2655 \end{description}
2657 The OT1 font-encoding has different characters for the less-than,
2658 greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}:
2660 \begin{quote}
2661 \begin{alltt}
2662 < | >
2663 \end{alltt}
2664 \end{quote}
2667 \subsection{3.8   Hyperlinks and -targets%
2668 \label{hyperlinks-and-targets}%
2671 In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a
2673 \phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or
2674 caption:
2676 \setlength{\DUtablewidth}{\linewidth}
2677 \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
2678 \caption{Table with %
2679 \label{hypertarget-in-table-title}hypertarget in table title.}\\
2680 \hline
2682 False
2684 True
2686 None
2688 \hline
2689 \end{longtable}
2690 \label{table-label}
2692 \begin{figure}
2693 \phantomsection\label{figure-label}
2694 \noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
2695 \caption{Figure with %
2696 \label{hypertarget-in-figure-caption}hypertarget in figure caption.}
2697 \begin{DUlegend}
2698 Legend with %
2699 \phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend.
2700 \end{DUlegend}
2701 \end{figure}
2703 \includegraphics{../../../docs/user/rst/images/biohazard.png}
2704 \phantomsection\label{image-label}
2706 See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text},
2707 \hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title},
2708 \hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption},
2709 \hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and
2710 \hyperref[image-label]{image label}.
2713 \subsection{3.9   External references%
2714 \label{external-references}%
2717 Long URLs should be wrapped in the PDF.
2718 This can be achieved with the url command which is used by the LaTeX writer
2719 whenever the content (name) of a reference node equals the link URL.
2721 \begin{description}
2722 \item[{Example:}] \leavevmode
2723 a long URL that should wrap in the output
2724 \url{http://docutils.sourceforge.net/docs/user/latex.html\#id79}
2726 \end{description}
2728 If the argument contains any “\%”, “\#”, or “\textasciicircum{}\textasciicircum{}”, or ends with \texttt{\textbackslash{}}, it can’t
2729 be used in the argument to another command. The argument must not contain
2730 unbalanced braces.
2732 The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a “http:” or “ftp:” URL
2733 and not recognized as part of it:
2735 \begin{DUlineblock}{0em}
2736 \item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name
2737 \item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{}
2738 \item[] \url{http://www.example.org/XML}/strange\{n\}ame
2739 \end{DUlineblock}
2741 They can, however be used in paths and/or filenames.
2743 Handling by the LaTeX writer:
2745 \begin{itemize}
2746 \item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped:
2748 \begin{DUlineblock}{0em}
2749 \item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#}
2750 \url{http://www.w3.org/XML/Schema\#dev}
2751 \item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%}
2752 \url{http://example.org/Schema\%dev}
2753 \item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{id42}{id41}{9} \url{A:DOS\\path\\}\DUfootnotemark{id43}{id41}{9}
2754 \end{DUlineblock}
2756 \DUadmonition[note]{
2757 \DUtitle[note]{Note}
2759 These URLs are typeset inside a LaTeX command without error.
2761 \begin{DUlineblock}{0em}
2762 \item[] \url{http://www.w3.org/XML/Schema\#dev}
2763 \item[] \url{http://example.org/Schema\%dev}
2764 \item[] \url{A:DOS\\path\\}\DUfootnotemark{id44}{id41}{9}
2765 \end{DUlineblock}
2767 \end{itemize}
2769 \begin{itemize}
2770 \item \textasciicircum{}\textasciicircum{} LaTeX’s special syntax for characters results in “strange” replacements
2771 (both with href and url). A warning is given.
2773 \href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}:
2774 \url{../strange^^name}
2776 \item Unbalanced braces, \{ or \}, will fail (both with href and url):
2778 \begin{quote}
2779 \begin{alltt}
2780 `file with \{ <../strange\{name>`__
2781 `<../strange\{name>`__
2782 \end{alltt}
2783 \end{quote}
2785 while balanced braces are suported:
2787 \begin{DUlineblock}{0em}
2788 \item[] \url{../strange{n}ame}
2789 \item[] \url{../st{r}ange{n}ame}
2790 \item[] \url{../{st{r}ange{n}ame}}
2791 \end{DUlineblock}
2792 \end{itemize}
2795 \subsection{3.10   Section titles with \hyperref[inline-markup]{inline markup}%
2796 \label{section-titles-with-inline-markup}%
2800 \subsubsection{3.10.1   \emph{emphasized}, H\textsubscript{2}O and $x^2$%
2801 \label{emphasized-h2o-and-x-2}%
2805 \subsubsection{3.10.2   Substitutions work%
2806 \label{substitutions-fail}%
2810 \subsection{3.11   Deeply nested sections%
2811 \label{deeply-nested-sections}%
2814 In LaTeX and HTML,
2817 \subsubsection{3.11.1   Level 3%
2818 \label{level-3}%
2821 nested sections
2824 \paragraph{3.11.1.1   level 4%
2825 \label{level-4}%
2828 reach at some level
2831 \subparagraph{3.11.1.1.1   level 5%
2832 \label{level-5}%
2835 (depending on the document class)
2838 \DUtitle[sectionVI]{3.11.1.1.1.1   level 6%
2839 \label{level-6}%
2842 an unsupported level.
2844 % unusual combinations (currently separately tested)
2845 % .. include:: data/latex_cornercases.txt
2847 % Preface for System Messages:
2850 \section{4   Error Handling%
2851 \label{error-handling}%
2854 Any errors caught during processing will generate system messages.
2856 There should be five messages in the following, auto-generated
2857 section, “Docutils System Messages”:
2859 % section should be added by Docutils automatically
2862 \section[Docutils System Messages]{\color{red}Docutils System Messages%
2865 \DUadmonition[system-message]{
2866 \DUtitle[system-message]{system-message}
2867 \raisebox{1em}{\hypertarget{id27}{}}
2869 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~104
2871 \hyperlink{id28}{
2872 Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}.
2875 \DUadmonition[system-message]{
2876 \DUtitle[system-message]{system-message}
2877 \raisebox{1em}{\hypertarget{id45}{}}
2879 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~391
2881 \hyperlink{id17}{
2882 Unknown target name: \textquotedbl{}5\textquotedbl{}.
2885 \DUadmonition[system-message]{
2886 \DUtitle[system-message]{system-message}
2887 \raisebox{1em}{\hypertarget{id46}{}}
2889 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~400
2891 \hyperlink{id19}{
2892 Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
2895 \DUadmonition[system-message]{
2896 \DUtitle[system-message]{system-message}
2897 \raisebox{1em}{\hypertarget{id47}{}}
2899 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~427
2901 \hyperlink{id48}{
2902 Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}.
2905 \DUadmonition[system-message]{
2906 \DUtitle[system-message]{system-message}
2907 \raisebox{1em}{\hypertarget{id49}{}}
2909 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~440
2911 \hyperlink{id50}{
2912 Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}.
2915 \end{document}