Adapt tests to latest latex writer fix.
[docutils.git] / docutils / test / functional / expected / standalone_rst_latex.tex
blobcd6bede51042aab1301c97d7a54ac95d92e2cb6c
1 \documentclass[a4paper]{article}
2 % generated by Docutils <http://docutils.sourceforge.net/>
3 \usepackage{fixltx2e} % LaTeX patches, \textsubscript
4 \usepackage{cmap} % fix search and cut-and-paste in Acrobat
5 \usepackage{ifthen}
6 \usepackage[T1]{fontenc}
7 \usepackage[utf8]{inputenc}
8 \usepackage{amsmath}
9 \usepackage[british,french,ngerman,english]{babel}
10 % Prevent side-effects if French hyphenation patterns are not loaded:
11 \frenchbsetup{StandardLayout}
12 \AtBeginDocument{\selectlanguage{english}\noextrasfrench}
13 \usepackage{color}
14 \usepackage{float} % float configuration
15 \floatplacement{figure}{H} % place figures here definitely
16 \usepackage{graphicx}
17 \usepackage{alltt}
18 \usepackage{multirow}
19 \usepackage{pifont}
20 \setcounter{secnumdepth}{0}
21 \usepackage{longtable,ltcaption,array}
22 \setlength{\extrarowheight}{2pt}
23 \newlength{\DUtablewidth} % internal use in tables
24 \usepackage{tabularx}
25 \usepackage{textcomp} % text symbol macros
27 %%% Custom LaTeX preamble
28 % PDF Standard Fonts
29 \usepackage{mathptmx} % Times
30 \usepackage[scaled=.90]{helvet}
31 \usepackage{courier}
33 %%% User specified packages and stylesheets
35 %%% Fallback definitions for Docutils-specific commands
37 % providelength (provide a length variable and set default, if it is new)
38 \providecommand*{\DUprovidelength}[2]{
39 \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
42 % abstract title
43 \providecommand*{\DUtitleabstract}[1]{\centering\textbf{#1}}
45 % admonition (specially marked topic)
46 \providecommand{\DUadmonition}[2][class-arg]{%
47 % try \DUadmonition#1{#2}:
48 \ifcsname DUadmonition#1\endcsname%
49 \csname DUadmonition#1\endcsname{#2}%
50 \else
51 \begin{center}
52 \fbox{\parbox{0.9\linewidth}{#2}}
53 \end{center}
54 \fi
57 \makeatletter
58 \@namedef{DUrolealign-center}{\centering}
59 \makeatother
62 % dedication topic
63 \providecommand{\DUtopicdedication}[1]{\begin{center}#1\end{center}}
65 % docinfo (width of docinfo table)
66 \DUprovidelength{\DUdocinfowidth}{0.9\linewidth}
68 % subtitle (in document title)
69 \providecommand*{\DUdocumentsubtitle}[1]{{\large #1}}
70 \newcounter{enumv}
72 % error admonition title
73 \providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}}
75 % fieldlist environment
76 \ifthenelse{\isundefined{\DUfieldlist}}{
77 \newenvironment{DUfieldlist}%
78 {\quote\description}
79 {\enddescription\endquote}
80 }{}
81 % numeric or symbol footnotes with hyperlinks
82 \providecommand*{\DUfootnotemark}[3]{%
83 \raisebox{1em}{\hypertarget{#1}{}}%
84 \hyperlink{#2}{\textsuperscript{#3}}%
86 \providecommand{\DUfootnotetext}[4]{%
87 \begingroup%
88 \renewcommand{\thefootnote}{%
89 \protect\raisebox{1em}{\protect\hypertarget{#1}{}}%
90 \protect\hyperlink{#2}{#3}}%
91 \footnotetext{#4}%
92 \endgroup%
95 % inline markup (custom roles)
96 % \DUrole{#1}{#2} tries \DUrole#1{#2}
97 \providecommand*{\DUrole}[2]{%
98 \ifcsname DUrole#1\endcsname%
99 \csname DUrole#1\endcsname{#2}%
100 \else% backwards compatibility: try \docutilsrole#1{#2}
101 \ifcsname docutilsrole#1\endcsname%
102 \csname docutilsrole#1\endcsname{#2}%
103 \else%
105 \fi%
106 \fi%
109 % legend environment
110 \ifthenelse{\isundefined{\DUlegend}}{
111 \newenvironment{DUlegend}{\small}{}
114 % lineblock environment
115 \DUprovidelength{\DUlineblockindent}{2.5em}
116 \ifthenelse{\isundefined{\DUlineblock}}{
117 \newenvironment{DUlineblock}[1]{%
118 \list{}{\setlength{\partopsep}{\parskip}
119 \addtolength{\partopsep}{\baselineskip}
120 \setlength{\topsep}{0pt}
121 \setlength{\itemsep}{0.15\baselineskip}
122 \setlength{\parsep}{0pt}
123 \setlength{\leftmargin}{#1}}
124 \raggedright
126 {\endlist}
129 % optionlist environment
130 \providecommand*{\DUoptionlistlabel}[1]{\bf #1 \hfill}
131 \DUprovidelength{\DUoptionlistindent}{3cm}
132 \ifthenelse{\isundefined{\DUoptionlist}}{
133 \newenvironment{DUoptionlist}{%
134 \list{}{\setlength{\labelwidth}{\DUoptionlistindent}
135 \setlength{\rightmargin}{1cm}
136 \setlength{\leftmargin}{\rightmargin}
137 \addtolength{\leftmargin}{\labelwidth}
138 \addtolength{\leftmargin}{\labelsep}
139 \renewcommand{\makelabel}{\DUoptionlistlabel}}
141 {\endlist}
144 % rubric (informal heading)
145 \providecommand*{\DUrubric}[2][class-arg]{%
146 \subsubsection*{\centering\textit{\textmd{#2}}}}
148 % sidebar (text outside the main text flow)
149 \providecommand{\DUsidebar}[2][class-arg]{%
150 \begin{center}
151 \colorbox[gray]{0.80}{\parbox{0.9\linewidth}{#2}}
152 \end{center}
155 % subtitle (for topic/sidebar)
156 \providecommand*{\DUsubtitle}[2][class-arg]{\par\emph{#2}\smallskip}
158 % title for topics, admonitions, unsupported section levels, and sidebar
159 \providecommand*{\DUtitle}[2][class-arg]{%
160 % call \DUtitle#1{#2} if it exists:
161 \ifcsname DUtitle#1\endcsname%
162 \csname DUtitle#1\endcsname{#2}%
163 \else
164 \smallskip\noindent\textbf{#2}\smallskip%
168 % titlereference role
169 \providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
171 % topic (quote with heading)
172 \providecommand{\DUtopic}[2][class-arg]{%
173 \ifcsname DUtopic#1\endcsname%
174 \csname DUtopic#1\endcsname{#2}%
175 \else
176 \begin{quote}#2\end{quote}
180 % transition (break, fancybreak, anonymous section)
181 \providecommand*{\DUtransition}[1][class-arg]{%
182 \hspace*{\fill}\hrulefill\hspace*{\fill}
183 \vskip 0.5\baselineskip
186 % hyperlinks:
187 \ifthenelse{\isundefined{\hypersetup}}{
188 \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
189 \usepackage{bookmark}
190 \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
192 \hypersetup{
193 pdftitle={reStructuredText Test Document},
194 pdfauthor={David Goodger;Me;Myself;I}
197 %%% Title Data
198 \title{\phantomsection%
199 reStructuredText Test Document%
200 \label{restructuredtext-test-document}%
201 \label{doctitle}%
202 \\ % subtitle%
203 \DUdocumentsubtitle{Examples of Syntax Constructs}%
204 \label{examples-of-syntax-constructs}%
205 \label{subtitle}}
206 \author{}
207 \date{}
209 %%% Body
210 \begin{document}
211 \maketitle
213 % Docinfo
214 \begin{center}
215 \begin{tabularx}{\DUdocinfowidth}{lX}
216 \textbf{Author}: &
217 David Goodger \\
218 \textbf{Address}: &
219 {\raggedright
220 123 Example Street\\
221 Example, EX Canada\\
222 A1B 2C3 } \\
223 \textbf{Contact}: &
224 \href{mailto:goodger@python.org}{goodger@python.org} \\
225 \textbf{Author}: &
226 Me \\
227 \textbf{Author}: &
228 Myself \\
229 \textbf{Author}: &
230 I \\
231 \textbf{Organization}: &
232 humankind \\
233 \textbf{Date}: &
234 Now, or yesterday. Or maybe even \emph{before} yesterday. \\
235 \textbf{Status}: &
236 This is a “work in progress” \\
237 \textbf{Revision}: &
238 is managed by a version control system. \\
239 \textbf{Version}: &
240 1 \\
241 \textbf{Copyright}: &
242 This document has been placed in the public domain. You
243 may do with it as you wish. You may copy, modify,
244 redistribute, reattribute, sell, buy, rent, lease,
245 destroy, or improve it, quote it at length, excerpt,
246 incorporate, collate, fold, staple, or mutilate it, or do
247 anything else to it that your or anyone else’s heart
248 desires. \\
249 \textbf{field name}: &
250 This is a “generic bibliographic field”.
252 \textbf{field name “2}: &
253 Generic bibliographic fields may contain multiple body elements.
255 Like this.
257 \end{tabularx}
258 \end{center}
260 \DUtopic[dedication]{
261 \DUtitle[dedication]{Dedication}
263 For Docutils users \& co-developers.
266 \DUtopic[abstract]{
267 \DUtitle[abstract]{Abstract}
269 This is a test document, containing at least one example of each
270 reStructuredText construct.
273 % This is a comment. Note how any initial comments are moved by
274 % transforms to after the document title, subtitle, and docinfo.
276 % Above is the document title, and below is the subtitle.
277 % They are transformed from section titles after parsing.
279 % bibliographic fields (which also require a transform):
281 \pagebreak[4] % start ToC on new page
283 \phantomsection\label{table-of-contents}
284 \pdfbookmark[1]{Table of Contents}{table-of-contents}
285 \renewcommand{\contentsname}{Table of Contents}
286 \tableofcontents
290 \section{1~~~Structural Elements%
291 \label{structural-elements}%
295 \subsection{1.1~~~Section Title%
296 \label{section-title}%
298 \subsubsection*{Section Subtitle}
300 Lone subsections are converted to a section subtitle by a transform
301 activated with the \texttt{-{}-section-subtitles} command line option or the
302 \texttt{sectsubtitle-xform} configuration value.
305 \subsection{1.2~~~Empty Section%
306 \label{empty-section}%
310 \subsection{1.3~~~Transitions%
311 \label{transitions}%
314 Here’s a transition:
317 %___________________________________________________________________________
318 \DUtransition
321 It divides the section. Transitions may also occur between sections:
324 %___________________________________________________________________________
325 \DUtransition
329 \section{2~~~Body Elements%
330 \label{body-elements}%
334 \subsection{2.1~~~Paragraphs%
335 \label{paragraphs}%
338 A paragraph.
341 \subsubsection{2.1.1~~~Inline Markup%
342 \label{inline-markup}%
345 Paragraphs contain text and may contain inline markup: \emph{emphasis},
346 \textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks
347 (\url{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\DUfootnotemark{id30}{id29}{5}), internal
348 cross-references (\hyperref[example]{example}), external hyperlinks with embedded URIs
349 (\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink
350 references}\DUfootnotemark{id38}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id40}{id39}{8}), footnote references (manually
351 numbered\DUfootnotemark{id1}{id8}{1}, anonymous auto-numbered\DUfootnotemark{id2}{id12}{3}, labeled auto-numbered\DUfootnotemark{id3}{label}{2}, or symbolic\DUfootnotemark{id4}{id13}{*}), citation references (\hyperlink{cit2002}{[CIT2002]}),
352 substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and %
353 \phantomsection\label{inline-hyperlink-targets}inline hyperlink targets
354 (see \hyperref[targets]{Targets} below for a reference back to here). Character-level
355 inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by %
356 \raisebox{1em}{\hypertarget{id28}{}}\hyperlink{id27}{\textbf{\color{red}|problematic|}} text
357 (generated by processing errors; this one is intentional). Here is a
358 reference to the \hyperref[doctitle]{doctitle} and the \hyperref[subtitle]{subtitle}.
360 The default role for interpreted text is \DUroletitlereference{Title Reference}. Here are
361 some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/dev/peps/pep-0287}{PEP 287}); an
362 RFC reference (\href{http://tools.ietf.org/html/rfc2822.html}{RFC 2822}); an abbreviation (\DUrole{abbreviation}{abb.}), an acronym
363 (\DUrole{acronym}{reST}), code (\texttt{\DUrole{code}{print \textquotedbl{}hello world\textquotedbl{}}}); a \textsubscript{subscript};
364 a \textsuperscript{superscript} and explicit roles for \DUroletitlereference{Docutils}
365 \emph{standard} \textbf{inline} \texttt{markup}.
367 % DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
369 Let’s test wrapping and whitespace significance in inline literals:
370 \texttt{This is an example of -{}-inline-literal -{}-text, -{}-including some-{}-
371 strangely-{}-hyphenated-words. ~Adjust-the-width-of-your-browser-window
372 to see how the text is wrapped. ~-{}- -{}-{}-{}- -{}-{}-{}-{}-{}-{}-{}- ~Now note ~ ~the
373 spacing ~ ~between the ~ ~words of ~ ~this sentence ~ ~(words
374 should ~ ~be grouped ~ ~in pairs).}
376 If the \texttt{-{}-pep-references} option was supplied, there should be a
377 live link to PEP 258 here.
380 \subsection{2.2~~~Bullet Lists%
381 \label{bullet-lists}%
384 \begin{itemize}
386 \item A bullet list
388 \begin{itemize}
390 \item Nested bullet list.
392 \item Nested item 2.
394 \end{itemize}
396 \item Item 2.
398 Paragraph 2 of item 2.
400 \begin{itemize}
402 \item Nested bullet list.
404 \item Nested item 2.
406 \begin{itemize}
408 \item Third level.
410 \item Item 2.
412 \end{itemize}
414 \item Nested item 3.
416 \item This nested list should be compacted by the HTML writer.
418 \phantomsection\label{target}
419 % Even if this item contains a target and a comment.
421 \end{itemize}
423 \end{itemize}
426 \subsection{2.3~~~Enumerated Lists%
427 \label{enumerated-lists}%
429 \begin{enumerate}
431 \item Arabic numerals.
432 \begin{enumerate}
433 \renewcommand{\labelenumii}{\alph{enumii})}
435 \item lower alpha)
436 \begin{enumerate}
437 \renewcommand{\labelenumiii}{(\roman{enumiii})}
439 \item (lower roman)
440 \begin{enumerate}
442 \item upper alpha.
443 \begin{list}{\Roman{enumv})}{\usecounter{enumv}}
445 \item upper roman)
446 \end{list}
447 \end{enumerate}
448 \end{enumerate}
449 \end{enumerate}
451 \item Lists that don’t start at 1:
452 \begin{enumerate}
453 \renewcommand{\labelenumii}{\arabic{enumii}.}
454 \setcounter{enumii}{2}
456 \item Three
458 \item Four
459 \end{enumerate}
460 \begin{enumerate}
461 \renewcommand{\labelenumii}{\Alph{enumii}.}
462 \setcounter{enumii}{2}
464 \item C
466 \item D
467 \end{enumerate}
468 \begin{enumerate}
469 \renewcommand{\labelenumii}{\roman{enumii}.}
470 \setcounter{enumii}{2}
472 \item iii
474 \item iv
475 \end{enumerate}
476 \end{enumerate}
479 \subsection{2.4~~~Definition Lists%
480 \label{definition-lists}%
483 \begin{description}
484 \item[{Term}] \leavevmode
485 Definition
487 \item[{Term}] \leavevmode (\textbf{classifier})
489 Definition paragraph 1.
491 Definition paragraph 2.
493 \item[{Term}] \leavevmode
494 Definition
496 \item[{Term}] \leavevmode (\textbf{classifier one})
497 (\textbf{classifier two})
499 Definition
501 \end{description}
504 \subsection{2.5~~~Field Lists%
505 \label{field-lists}%
508 \begin{DUfieldlist}
509 \item[{what:}]
510 Field lists map field names to field bodies, like database
511 records. They are often part of an extension syntax. They are
512 an unambiguous variant of RFC 2822 fields.
514 \item[{how arg1 arg2:}]
515 The field marker is a colon, the field name, and a colon.
517 The field body may contain one or more body elements, indented
518 relative to the field marker.
520 \item[{credits:}]
521 \DUrole{credits}{This paragraph has the \DUroletitlereference{credits} class set. (This is actually not
522 about credits but just for ensuring that the class attribute
523 doesn’t get stripped away.)}
525 \end{DUfieldlist}
528 \subsection{2.6~~~Option Lists%
529 \label{option-lists}%
532 For listing command-line options:
534 \begin{DUoptionlist}
536 \item[-a] command-line option “a”
538 \item[-b file] options can have arguments
539 and long descriptions
541 \item[-{}-long] options can be long also
543 \item[-{}-input=file] long options can also have
544 arguments
546 \item[-{}-very-long-option] The description can also start on the next line.
548 The description may contain multiple body elements,
549 regardless of where it starts.
551 \item[-x, -y, -z] Multiple options are an “option group”.
553 \item[-v, -{}-verbose] Commonly-seen: short \& long options.
555 \item[-1 file, -{}-one=file, -{}-two file] Multiple options with arguments.
557 \item[/V] DOS/VMS-style options too
559 \end{DUoptionlist}
561 There must be at least two spaces between the option and the
562 description.
565 \subsection{2.7~~~Literal Blocks%
566 \label{literal-blocks}%
569 Literal blocks are indicated with a double-colon (“::”) at the end of
570 the preceding paragraph (over there \texttt{-{}->}). They can be indented:
572 \begin{quote}
573 \begin{alltt}
574 if literal_block:
575 text = 'is left as-is'
576 spaces_and_linebreaks = 'are preserved'
577 markup_processing = None
578 \end{alltt}
579 \end{quote}
581 Or they can be quoted without indentation:
583 \begin{quote}
584 \begin{alltt}
585 >> Great idea!
587 > Why didn't I think of that?
588 \end{alltt}
589 \end{quote}
592 \subsection{2.8~~~Line Blocks%
593 \label{line-blocks}%
596 This section tests line blocks. Line blocks are body elements which
597 consist of lines and other line blocks. Nested line blocks cause
598 indentation.
600 \begin{DUlineblock}{0em}
601 \item[] This is a line block. It ends with a blank line.
602 \item[]
603 \begin{DUlineblock}{\DUlineblockindent}
604 \item[] New lines begin with a vertical bar (“|”).
605 \item[] Line breaks and initial indent are significant, and preserved.
606 \item[]
607 \begin{DUlineblock}{\DUlineblockindent}
608 \item[] Continuation lines are also possible. A long line that is intended
609 to wrap should begin with a space in place of the vertical bar.
610 \end{DUlineblock}
611 \item[] The left edge of a continuation line need not be aligned with
612 the left edge of the text above it.
613 \end{DUlineblock}
614 \end{DUlineblock}
616 \begin{DUlineblock}{0em}
617 \item[] This is a second line block.
618 \item[]
619 \item[] Blank lines are permitted internally, but they must begin with a “|”.
620 \end{DUlineblock}
622 Another line block, surrounded by paragraphs:
624 \begin{DUlineblock}{0em}
625 \item[] And it’s no good waiting by the window
626 \item[] It’s no good waiting for the sun
627 \item[] Please believe me, the things you dream of
628 \item[] They don’t fall in the lap of no-one
629 \end{DUlineblock}
631 Take it away, Eric the Orchestra Leader!
633 \begin{quote}
635 \begin{DUlineblock}{0em}
636 \item[] A one, two, a one two three four
637 \item[]
638 \item[] Half a bee, philosophically,
639 \item[]
640 \begin{DUlineblock}{\DUlineblockindent}
641 \item[] must, \emph{ipso facto}, half not be.
642 \end{DUlineblock}
643 \item[] But half the bee has got to be,
644 \item[]
645 \begin{DUlineblock}{\DUlineblockindent}
646 \item[] \emph{vis a vis} its entity. D’you see?
647 \item[]
648 \end{DUlineblock}
649 \item[] But can a bee be said to be
650 \item[]
651 \begin{DUlineblock}{\DUlineblockindent}
652 \item[] or not to be an entire bee,
653 \item[]
654 \begin{DUlineblock}{\DUlineblockindent}
655 \item[] when half the bee is not a bee,
656 \item[]
657 \begin{DUlineblock}{\DUlineblockindent}
658 \item[] due to some ancient injury?
659 \item[]
660 \end{DUlineblock}
661 \end{DUlineblock}
662 \end{DUlineblock}
663 \item[] Singing…
664 \end{DUlineblock}
666 \end{quote}
668 A line block, like the following poem by Christian Morgenstern, can
669 also be centre-aligned:
671 \begin{DUlineblock}{0em}
672 \foreignlanguage{ngerman}{\DUrole{align-center}{
673 \item[] \textbf{Die Trichter}
674 \item[]
675 \item[] Zwei Trichter wandeln durch die Nacht.
676 \item[] Durch ihres Rumpfs verengten Schacht
677 \item[] fließt weißes Mondlicht
678 \item[] still und heiter
679 \item[] auf ~ ihren
680 \item[] Waldweg
681 \item[] u. s.
682 \item[] w.
683 \item[]
685 \end{DUlineblock}
688 \subsection{2.9~~~Block Quotes%
689 \label{block-quotes}%
692 Block quotes consist of indented body elements:
694 \begin{quote}
696 My theory by A. Elk. Brackets Miss, brackets. This theory goes
697 as follows and begins now. All brontosauruses are thin at one
698 end, much much thicker in the middle and then thin again at the
699 far end. That is my theory, it is mine, and belongs to me and I
700 own it, and what it is too.
701 \nopagebreak
703 \raggedleft —Anne Elk (Miss)
705 \end{quote}
707 The language of a quote (like any other object) can be specified by
708 a class attribute:
712 \begin{quote}
713 \foreignlanguage{french}{
714 ReStructuredText est un langage de balisage léger utilisé
715 notamment dans la documentation du langage Python.
717 \end{quote}
720 \subsection{2.10~~~Doctest Blocks%
721 \label{doctest-blocks}%
724 \begin{quote}
725 \begin{alltt}
726 >>> print 'Python-specific usage examples; begun with ">>>"'
727 Python-specific usage examples; begun with ">>>"
728 >>> print '(cut and pasted from interactive Python sessions)'
729 (cut and pasted from interactive Python sessions)
730 \end{alltt}
731 \end{quote}
734 \subsection{2.11~~~Footnotes%
735 \label{footnotes}%
738 \DUfootnotetext{id8}{id1}{1}{%
739 A footnote contains body elements, consistently indented by at
740 least 3 spaces.
742 This is the footnote’s second paragraph.
745 \DUfootnotetext{label}{id3}{2}{\phantomsection\label{label}%
746 Footnotes may be numbered, either manually (as in\DUfootnotemark{id9}{id8}{1}) or
747 automatically using a “\#”-prefixed label. This footnote has a
748 label so it can be referred to from multiple places, both as a
749 footnote reference (\DUfootnotemark{id10}{label}{2}) and as a \hyperref[label]{hyperlink reference}.
752 \DUfootnotetext{id12}{id2}{3}{%
753 This footnote is numbered automatically and anonymously using a
754 label of “\#” only.
756 This is the second paragraph.
758 And this is the third paragraph.
761 \DUfootnotetext{id13}{id4}{*}{%
762 Footnotes may also use symbols, specified with a “*” label.
763 Here’s a reference to the next footnote:\DUfootnotemark{id14}{id15}{}.
766 \DUfootnotetext{id15}{id14}{}{%
767 This footnote shows the next symbol in the sequence.
770 \DUfootnotetext{id16}{id16}{4}{%
771 Here’s an unreferenced footnote, with a reference to a
772 nonexistent footnote:%
773 \raisebox{1em}{\hypertarget{id46}{}}%
774 \raisebox{1em}{\hypertarget{id17}{}}\hyperlink{id45}{\textbf{\color{red}{[}5{]}\_}}.
778 \subsection{2.12~~~Citations%
779 \label{citations}%
781 \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
782 Citations are text-labeled footnotes. They may be
783 rendered separately and differently from footnotes.
784 \end{figure}
786 Here’s a reference to the above, \hyperlink{cit2002}{[CIT2002]}, and a %
787 \raisebox{1em}{\hypertarget{id48}{}}%
788 \raisebox{1em}{\hypertarget{id19}{}}\hyperlink{id47}{\textbf{\color{red}{[}nonexistent{]}\_}}
789 citation.
792 \subsection{2.13~~~Targets%
793 \label{targets}%
794 \label{another-target}%
797 \phantomsection\label{example}
798 This paragraph is pointed to by the explicit “example” target. A
799 reference can be found under \hyperref[inline-markup]{Inline Markup}, above. \hyperref[inline-hyperlink-targets]{Inline
800 hyperlink targets} are also possible.
802 Section headers are implicit targets, referred to by name. See
803 \hyperref[targets]{Targets}, which is a subsection of \hyperref[body-elements]{Body Elements}.
805 Explicit external targets are interpolated into references such as
806 \href{http://www.python.org/}{Python}\DUfootnotemark{id31}{id29}{5}”.
808 Targets may be indirect and anonymous. Thus \hyperref[targets]{this phrase} may also
809 refer to the \hyperref[targets]{Targets} section.
811 Here’s a %
812 \raisebox{1em}{\hypertarget{id50}{}}\hyperlink{id49}{\textbf{\color{red}`hyperlink reference without a target`\_}}, which generates an
813 error.
816 \subsubsection{2.13.1~~~Duplicate Target Names%
817 \label{duplicate-target-names}%
820 Duplicate names in section headers or other implicit targets will
821 generate “info” (level-1) system messages. Duplicate names in
822 explicit targets will generate “warning” (level-2) system messages.
825 \subsubsection{2.13.2~~~Duplicate Target Names%
826 \label{id21}%
829 Since there are two “Duplicate Target Names” section headers, we
830 cannot uniquely refer to either of them by name. If we try to (like
831 this: %
832 \raisebox{1em}{\hypertarget{id52}{}}\hyperlink{id51}{\textbf{\color{red}`Duplicate Target Names`\_}}), an error is generated.
835 \subsection{2.14~~~Directives%
836 \label{directives}%
839 \phantomsection\label{contents}
840 These are just a sample of the many reStructuredText Directives. For
841 others, please see
842 \url{http://docutils.sourceforge.net/docs/ref/rst/directives.html}.
845 \subsubsection{2.14.1~~~Document Parts%
846 \label{document-parts}%
849 An example of the “contents” directive can be seen above this section
850 (a local, untitled table of \hyperref[contents]{contents}) and at the beginning of the
851 document (a document-wide \hyperref[table-of-contents]{table of contents}).
854 \subsubsection{2.14.2~~~Images and Figures%
855 \label{images-and-figures}%
858 An image directive (also clickable – a hyperlink reference):
860 \hyperref[directives]{\includegraphics{../../../docs/user/rst/images/title.png}}
862 Image with multiple IDs:
864 \includegraphics{../../../docs/user/rst/images/title.png}
865 \phantomsection\label{image-target-3}\label{image-target-2}\label{image-target-1}
867 A centered image:
869 \noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
871 A left-aligned image:
873 \noindent{\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill}
875 This paragraph might flow around the image.
876 The specific behavior depends upon the style sheet and
877 the browser or rendering software used.
879 A right-aligned image:
881 \noindent{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}}
883 This paragraph might flow around the image.
884 The specific behavior depends upon the style sheet and
885 the browser or rendering software used.
887 For inline images see \hyperref[substitution-definitions]{Substitution Definitions}.
889 Image size:
891 An image 2 em wide:
893 \includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png}
895 An image 2 em wide and 15 pixel high:
897 \includegraphics[height=15px,width=2em]{../../../docs/user/rst/images/biohazard.png}
899 An image occupying 50\% of the line width:
901 \includegraphics[width=0.500\linewidth]{../../../docs/user/rst/images/title.png}
903 An image 2 cm high:
905 \includegraphics[height=2cm]{../../../docs/user/rst/images/biohazard.png}
907 A \emph{figure} is an image with a caption and/or a legend. With page-based output
908 media, figures might float to a different position if this helps the page
909 layout.
911 \begin{figure}
912 \noindent\makebox[\linewidth][c]{\includegraphics[width=258bp]{../../../docs/user/rst/images/title.png}}
913 \caption{Plaintext markup syntax and parser system.}
914 \begin{DUlegend}
915 \setlength{\DUtablewidth}{\linewidth}
916 \begin{longtable*}[c]{|p{0.156\DUtablewidth}|p{0.563\DUtablewidth}|}
917 \hline
921 Revised, revisited, based on ‘re’ module.
923 \hline
925 Structured
927 Structure-enhanced text, structuredtext.
929 \hline
931 Text
933 Well it is, isn’t it?
935 \hline
936 \end{longtable*}
938 This paragraph is also part of the legend.
939 \end{DUlegend}
940 \end{figure}
942 A left-aligned figure:
944 \begin{figure} % align = "left"
945 \noindent\makebox[\linewidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
946 \caption{This is the caption.}
947 \begin{DUlegend}
948 This is the legend.
950 The legend may consist of several paragraphs.
951 \end{DUlegend}
952 \end{figure}
954 This paragraph might flow around the figure.
956 The specific behavior depends upon the style sheet and the browser or
957 rendering software used.
959 A centered figure:
961 \begin{figure}
962 \noindent\makebox[\linewidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
963 \caption{This is the caption.}
964 \begin{DUlegend}
965 This is the legend.
967 The legend may consist of several paragraphs.
968 \end{DUlegend}
969 \end{figure}
971 This paragraph might flow around the figure.
973 The specific behavior depends upon the style sheet and the browser or
974 rendering software used.
976 A right-aligned figure:
978 \begin{figure} % align = "right"
979 \noindent\makebox[\linewidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
980 \caption{This is the caption.}
981 \begin{DUlegend}
982 This is the legend.
984 The legend may consist of several paragraphs.
985 \end{DUlegend}
986 \end{figure}
988 This paragraph might flow around the figure. The specific behavior depends
989 upon the style sheet and the browser or rendering software used.
992 \subsubsection{2.14.3~~~Admonitions%
993 \label{admonitions}%
996 \DUadmonition[attention]{
997 \DUtitle[attention]{Attention!}
999 Directives at large.
1002 \DUadmonition[caution]{
1003 \DUtitle[caution]{Caution!}
1005 Don’t take any wooden nickels.
1008 \DUadmonition[danger]{
1009 \DUtitle[danger]{!DANGER!}
1011 Mad scientist at work!
1014 \DUadmonition[error]{
1015 \DUtitle[error]{Error}
1017 Does not compute.
1020 \DUadmonition[hint]{
1021 \DUtitle[hint]{Hint}
1023 It’s bigger than a bread box.
1026 \DUadmonition[important]{
1027 \DUtitle[important]{Important}
1029 \begin{itemize}
1031 \item Wash behind your ears.
1033 \item Clean up your room.
1035 \item Call your mother.
1037 \item Back up your data.
1039 \end{itemize}
1042 \DUadmonition[note]{
1043 \DUtitle[note]{Note}
1045 This is a note.
1048 \DUadmonition[tip]{
1049 \DUtitle[tip]{Tip}
1051 15\% if the service is good.
1054 \DUadmonition[warning]{
1055 \DUtitle[warning]{Warning}
1057 Strong prose may provoke extreme mental exertion.
1058 Reader discretion is strongly advised.
1061 \DUadmonition[admonition-and-by-the-way]{
1062 \DUtitle[admonition-and-by-the-way]{And, by the way…}
1064 You can make up your own admonition too.
1068 \subsubsection{2.14.4~~~Topics, Sidebars, and Rubrics%
1069 \label{topics-sidebars-and-rubrics}%
1072 \emph{Sidebars} are like miniature, parallel documents.
1074 \DUsidebar{
1075 \DUtitle[title]{Sidebar Title}
1077 \DUsubtitle[sidebar]{Optional Subtitle}
1079 This is a sidebar. It is for text outside the flow of the main
1080 text.
1082 \DUrubric{This is a rubric inside a sidebar}
1084 Sidebars often appear beside the main text with a border and a different
1085 background or font color.
1088 A \emph{topic} is like a block quote with a title, or a self-contained section
1089 with no subsections.
1091 \DUtopic[]{
1092 \DUtitle[title]{Topic Title}
1094 This is a topic.
1097 A \emph{rubric} is like an informal heading that doesn’t correspond to the
1098 document’s structure. It is typically highlighted in red (hence the name).
1100 \DUrubric{This is a rubric}
1102 Topics and rubrics can be used at places where a \hyperref[section-title]{section title} is not
1103 allowed (e.g. inside a directive).
1106 \subsubsection{2.14.5~~~Target Footnotes%
1107 \label{target-footnotes}%
1110 \DUfootnotetext{id29}{id30}{5}{%
1111 \url{http://www.python.org/}
1114 \DUfootnotetext{id33}{id34}{6}{%
1115 \url{http://pygments.org/}
1118 \DUfootnotetext{id35}{id36}{7}{%
1119 \url{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}
1122 \DUfootnotetext{id39}{id40}{8}{%
1123 \url{http://docutils.sourceforge.net/}
1126 \DUfootnotetext{id41}{id42}{9}{%
1127 \url{A:DOS\\path\\}
1131 \subsubsection{2.14.6~~~Replacement Text%
1132 \label{replacement-text}%
1135 I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\DUfootnotemark{id32}{id29}{5}.
1138 \subsubsection{2.14.7~~~Compound Paragraph%
1139 \label{compound-paragraph}%
1142 Compound 1, paragraph 1.
1144 Compound 1, paragraph 2.
1146 \begin{itemize}
1148 \item Compound 1, list item one.
1150 \item Compound 1, list item two.
1152 \end{itemize}
1154 Another compound statement:
1156 Compound 2, a literal block:
1158 \begin{quote}
1159 \begin{alltt}
1160 Compound 2, literal.
1161 \end{alltt}
1162 \end{quote}
1163 Compound 2, this is a test.
1165 Compound 3, only consisting of one paragraph.
1167 \begin{quote}
1168 \begin{alltt}
1169 Compound 4.
1170 This one starts with a literal block.
1171 \end{alltt}
1172 \end{quote}
1173 Compound 4, a paragraph.
1175 Now something \emph{really} perverted – a nested compound block. This is
1176 just to test that it works at all; the results don’t have to be
1177 meaningful.
1179 Compound 5, block 1 (a paragraph).
1181 Compound 6, block 2 in compound 5.
1183 Compound 6, another paragraph.
1185 Compound 5, block 3 (a paragraph).
1187 Compound 7, with a table inside:
1189 \setlength{\DUtablewidth}{\linewidth}
1190 \begin{longtable*}[c]{|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|}
1191 \hline
1193 Left cell, first
1194 paragraph.
1196 Left cell, second
1197 paragraph.
1199 Middle cell,
1200 consisting of
1201 exactly one
1202 paragraph.
1204 Right cell.
1206 Paragraph 2.
1208 Paragraph 3.
1210 \hline
1211 \end{longtable*}
1212 Compound 7, a paragraph after the table.
1214 Compound 7, another paragraph.
1217 \subsubsection{2.14.8~~~Parsed Literal Blocks%
1218 \label{parsed-literal-blocks}%
1221 \begin{quote}
1222 {\ttfamily \raggedright \noindent
1223 This~is~a~parsed~literal~block.\\
1224 ~~~~This~line~is~indented.~~The~next~line~is~blank.\\
1226 Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\
1227 text},~\textsubscript{sub-}~and~\textsuperscript{super}scripts,\\
1228 inline~formulas:~$A = 2 \pi r^2$,\\
1229 footnotes\DUfootnotemark{id22}{id8}{1},~%
1230 \phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
1232 \end{quote}
1235 \subsubsection{2.14.9~~~Code%
1236 \label{code}%
1239 Blocks of source code can be set with the \DUroletitlereference{code} directive. If the code
1240 language is specified, the content is parsed and tagged by the \href{http://pygments.org/}{Pygments}\DUfootnotemark{id34}{id33}{6}
1241 syntax highlighter and can be formatted with a style sheet. (Code parsing
1242 is turned off using the \texttt{syntax-highlight} config setting in the test
1243 conversions in order to get identical results with/without installed
1244 Pygments highlighter.)
1246 \begin{quote}
1247 \begin{alltt}
1248 print 'This is Python code.'
1249 \end{alltt}
1250 \end{quote}
1252 The \texttt{:number-lines:} option (with optional start value) generates line
1253 numbers:
1255 \begin{quote}
1256 {\ttfamily \raggedright \noindent
1257 \DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
1258 \DUrole{ln}{~9~}for~i~in~range(10):\\
1259 \DUrole{ln}{10~}~~~~print~i
1261 \end{quote}
1263 For inline code snippets, there is the \DUroletitlereference{code} role, which can be used
1264 directly (the code will not be parsed/tagged, as the language is not known)
1265 or as base for special code roles, e.g. the LaTeX code in the next
1266 paragraph.
1268 Docutils uses LaTeX syntax for math directives and roles:
1269 \texttt{\DUrole{code}{\DUrole{tex}{\textbackslash{}alpha = f(x)}}} prints $\alpha = f(x)$.
1271 The \texttt{:code:} option of the \DUroletitlereference{include} directive sets the included content
1272 as a code block, here the rst file \texttt{header\_footer.txt} with line numbers:
1274 \begin{quote}
1275 {\ttfamily \raggedright \noindent
1276 \DUrole{ln}{1~}..~header::~Document~header\\
1277 \DUrole{ln}{2~}..~footer::~Document~footer
1279 \end{quote}
1282 \subsection{2.15~~~Substitution Definitions%
1283 \label{substitution-definitions}%
1286 An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example:
1288 (Substitution definitions are not visible in the HTML source.)
1291 \subsection{2.16~~~Comments%
1292 \label{comments}%
1295 Here’s one:
1297 % Comments begin with two dots and a space. Anything may
1298 % follow, except for the syntax of footnotes, hyperlink
1299 % targets, directives, or substitution definitions.
1301 % Double-dashes -- "--" -- must be escaped somehow in HTML output.
1303 % Comments may contain non-ASCII characters: ä ö ü æ ø å
1305 (View the HTML source to see the comment.)
1308 \subsection{2.17~~~Raw text%
1309 \label{raw-text}%
1312 This does not necessarily look nice, because there may be missing white space.
1314 It’s just there to freeze the behavior.
1316 A test.
1318 Second test.
1320 \DUrole{myclass}{Another test with myclass set.}
1322 This is the \DUrole{myrawroleclass}{fourth test} with myrawroleclass set.
1324 Fifth test in LaTeX.\\Line two.
1327 \subsection{2.18~~~Container%
1328 \label{container}%
1331 paragraph 1
1333 paragraph 2
1335 % currently not implemented in LaTeX:
1336 % .. include:: data/header_footer.txt
1339 \subsection{2.19~~~Colspanning tables%
1340 \label{colspanning-tables}%
1343 This table has a cell spanning two columns:
1345 \setlength{\DUtablewidth}{\linewidth}
1346 \begin{longtable*}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|}
1347 \hline
1348 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1349 Inputs
1350 }} & \textbf{%
1351 Output
1352 } \\
1353 \hline
1354 \textbf{%
1356 } & \textbf{%
1358 } & \textbf{%
1359 A or B
1360 } \\
1361 \hline
1362 \endfirsthead
1363 \hline
1364 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1365 Inputs
1366 }} & \textbf{%
1367 Output
1368 } \\
1369 \hline
1370 \textbf{%
1372 } & \textbf{%
1374 } & \textbf{%
1375 A or B
1376 } \\
1377 \hline
1378 \endhead
1379 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1380 \endfoot
1381 \endlastfoot
1383 False
1385 False
1387 False
1389 \hline
1391 True
1393 False
1395 True
1397 \hline
1399 False
1401 True
1403 True
1405 \hline
1407 True
1409 True
1411 True
1413 \hline
1414 \end{longtable*}
1417 \subsection{2.20~~~Rowspanning tables%
1418 \label{rowspanning-tables}%
1421 Here’s a table with cells spanning several rows:
1423 \setlength{\DUtablewidth}{\linewidth}
1424 \begin{longtable*}[c]{|p{0.296\DUtablewidth}|p{0.156\DUtablewidth}|p{0.226\DUtablewidth}|}
1425 \hline
1426 \textbf{%
1427 Header row, column 1
1428 (header rows optional)
1429 } & \textbf{%
1430 Header 2
1431 } & \textbf{%
1432 Header 3
1433 } \\
1434 \hline
1435 \endfirsthead
1436 \hline
1437 \textbf{%
1438 Header row, column 1
1439 (header rows optional)
1440 } & \textbf{%
1441 Header 2
1442 } & \textbf{%
1443 Header 3
1444 } \\
1445 \hline
1446 \endhead
1447 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1448 \endfoot
1449 \endlastfoot
1451 body row 1, column 1
1453 column 2
1455 column 3
1457 \hline
1459 body row 2
1460 & \multirow{2}{0.16\DUtablewidth}{%
1461 Cells may
1462 span rows.
1463 } & \multirow{2}{0.23\DUtablewidth}{%
1464 Another
1465 rowspanning
1466 cell.
1467 } \\
1468 \cline{1-1}
1470 body row 3
1471 & \\
1472 \hline
1473 \end{longtable*}
1476 \subsection{2.21~~~Custom Roles%
1477 \label{custom-roles}%
1480 \begin{itemize}
1482 \item A role based on an existing role.
1484 \texttt{\DUrole{custom}{one}} \texttt{\DUrole{custom}{two}} \texttt{\DUrole{custom}{three}}
1486 \item A new role.
1488 \DUrole{customnew}{one two three}
1490 \item A role with class attribute.
1492 \DUrole{special}{interpreted text}
1494 \item A language-switching role:
1496 Let’s count in German \foreignlanguage{ngerman}{eins zwei drei}.
1498 \item A role with multiple class attributes, styled with raw directives:
1500 \newcommand{\DUrolegreen}[1]{\textcolor{green}{#1}}
1501 \newcommand{\DUrolesc}[1]{\textsc{#1}}
1503 The following works in most browsers but does not validate
1504 (\texttt{<style>} is only allowed in the document head):
1506 \begin{quote}
1507 \begin{alltt}
1508 .. raw:: html
1510 <style type="text/css"><!-{}-
1511 .green \{color: green;\}
1512 .sc \{font-variant: small-caps;\}
1513 -{}-></style>
1514 \end{alltt}
1515 \end{quote}
1517 \DUrole{green}{\DUrole{sc}{\foreignlanguage{british}{British colourful text in small-caps}}}.
1519 \end{itemize}
1522 \subsection{2.22~~~Mathematics%
1523 \label{mathematics}%
1526 Docutils supports inline math with the prefix or postfix \texttt{:math:}
1527 role specificator, $n! + \sin(x_n^2)$ and $A_\text{c} =
1528 \frac{\pi}{4} d^2$, as well as displayed math via the
1529 \DUroletitlereference{math} directive:
1531 \begin{equation*}
1532 f(\epsilon) = \frac{1}{1 + \exp\left(\frac{\varepsilon}{k_\text{B}T}\right)}
1533 \end{equation*}
1534 Content may start on the first line of the directive, e.g.
1536 \begin{equation*}
1537 N = \frac{\text{number of apples}}{7}
1538 \end{equation*}
1539 Equations can be labeled with a reference name using the \texttt{:name:} option.
1540 See \hyperref[eq-m]{eq:M} and \hyperref[eq-schrodinger]{eq:schrödinger} below.
1542 The determinant of the matrix
1544 \begin{equation*}
1545 \mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)
1546 \phantomsection
1547 \label{eq-m}
1548 \end{equation*}
1549 is $|\mathbf{M}| = ad - bc$.
1551 More than one display math block can be put in one math directive.
1552 For example, the following sum and integral with limits:
1554 \begin{equation*}
1555 \int_0^1 x^n dx = \frac{1}{n + 1}
1556 \end{equation*}%
1557 \begin{equation*}
1558 \sum_{n=1}^m n = \frac{m(m+1)}{2}
1559 \end{equation*}
1560 LaTeX-supported Unicode math symbols can be used in math roles and
1561 directives:
1563 The Schrödinger equation
1565 \begin{equation*}
1566 i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi ,
1567 \phantomsection
1568 \label{eq-schrodinger}
1569 \end{equation*}
1570 with the \emph{wave function} $\Psi $, describes how the quantum state of a
1571 physical system changes in time.
1573 \begin{description}
1574 \item[{Math-Accents:}] \leavevmode
1575 \setlength{\DUtablewidth}{\linewidth}
1576 \begin{longtable*}[c]{p{0.315\DUtablewidth}p{0.315\DUtablewidth}p{0.315\DUtablewidth}}
1578 $\acute{a}$ \texttt{\textbackslash{}acute\{a\}}
1580 $\dot{t}$ \texttt{\textbackslash{}dot\{t\}}
1582 $\hat{\gamma}$ \texttt{\textbackslash{}hat\{\textbackslash{}gamma\}}
1585 $\grave{a}$ \texttt{\textbackslash{}grave\{a\}}
1587 $\ddot{t}$ \texttt{\textbackslash{}ddot\{t\}}
1589 $\tilde{\alpha}$ \texttt{\textbackslash{}tilde\{\textbackslash{}alpha\}}
1592 $\breve{x}$ \texttt{\textbackslash{}breve\{x\}}
1594 $\dddot{t}$ \texttt{\textbackslash{}dddot\{t\}}
1596 $\vec{\imath}$ \texttt{\textbackslash{}vec\{\textbackslash{}imath\}}
1599 $\check{a}$ \texttt{\textbackslash{}check\{a\}}
1601 $\bar{a}$ \texttt{\textbackslash{}bar\{a\}}
1603 $\vec{R}$ \texttt{\textbackslash{}vec\{R\}}
1605 \end{longtable*}
1607 \end{description}
1609 % \widetilde{xxx}
1610 % \widehat{xxx}
1612 Modulation Transfer Function:
1614 \begin{equation*}
1615 \text{MTF} = \left|\frac{\mathcal{F}\{s(x)\}}
1616 {\mathcal{F}\{ s(x)\} |_{\omega _{x}=0}}\right|
1617 = \mathrm{abs}\left(\frac
1618 {\int _{-\infty }^{\infty }s(x) \mathrm{e}^{\mathrm{i}\omega _{x}x}\mathrm{d}{x}}
1619 {\int _{-\infty }^{\infty }s(x)\mathrm{d}{x}}
1620 \right).
1621 \end{equation*}
1622 Math split over two lines: If a double backslash is detected outside a
1623 \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}
1624 \texttt{align} environment:
1626 \begin{align*}
1627 s_{\mathrm{out}}(x) & = s_{\mathrm{in}}(x') * s_\delta (x-x') \\
1628 & = \int s_{\mathrm{in}}(x')s_\delta (x-x')\mathrm{d}x'
1629 \end{align*}
1630 Cases (“manually”, with \texttt{matrix} environment):
1632 \begin{equation*}
1633 \mathrm{sgn}(x) = \left\{\begin{matrix}
1634 -1 & x<0\\
1635 1 & x>0
1636 \end{matrix}\right.
1637 \end{equation*}
1638 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
1639 HTML writers with \texttt{-{}-math-output=MathML}):
1641 \begin{equation*}
1642 \mathrm{sgn}(x) = \begin{cases}
1643 -1 & x<0\\
1644 1 & x>0
1645 \end{cases}
1646 \end{equation*}
1648 \section{3~~~Tests for the LaTeX writer%
1649 \label{tests-for-the-latex-writer}%
1652 Test syntax elements which may cause trouble for the LaTeX writer but might
1653 not need to be tested with other writers (e.g. the HTML writer).
1656 \subsection{3.1~~~Custom Roles in LaTeX%
1657 \label{custom-roles-in-latex}%
1660 \begin{itemize}
1662 \item Role names and class arguments are converted to conform to the
1663 regular expression \texttt{{[}a-z{]}{[}-a-z0-9{]}*} (letters are downcased,
1664 accents and similar decoration is stripped, non-conforming
1665 characters are replaced by a hyphen).
1667 Class arguments may contain numbers and hyphens, which need special
1668 treatment in LaTeX command names.
1670 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}}
1672 \item With LaTeX, roles can be styled within the document using the \DUroletitlereference{raw}
1673 directive.
1675 \newcommand{\DUrolelarge}[1]{{\large #1}}
1676 \makeatletter
1677 \@namedef{DUrolesmall-caps}{\textsc}
1678 \@namedef{DUrolecustom4}{\textbf}
1679 \makeatother
1681 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}} in large, bold, small-caps.
1683 \item Custom roles can be based on standard roles:
1685 This is a \emph{\DUrole{custom-emphasis}{customized emphasis text role}}
1687 This is a \texttt{\DUrole{custom-literal}{customized literal text role}}
1689 This is a \textbf{\DUrole{custom-strong}{customized strong text role}}
1691 This is a \textsubscript{\DUrole{custom-subscript}{customized subscript text role}}
1693 This is a \textsuperscript{\DUrole{custom-superscript}{customized superscript text role}}
1695 This is a \DUroletitlereference{\DUrole{custom-title-reference}{customized title-reference text role}}
1697 \end{itemize}
1700 \subsection{3.2~~~More Tables%
1701 \label{more-tables}%
1704 A multicolumn table with multi-paragraph rowspanning cells:
1706 \setlength{\DUtablewidth}{\linewidth}
1707 \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}|}
1708 \hline
1710 test
1712 \textbf{bold hd}
1713 & \multicolumn{3}{p{0.41\DUtablewidth}|}{
1714 multicolumn 1
1716 With a second paragraph
1717 } &
1718 \emph{emph hd}
1720 \hline
1721 \multicolumn{2}{|p{0.31\DUtablewidth}|}{
1722 multicolumn 2
1724 With a second paragraph
1725 } &
1726 cell
1728 cell
1730 cell
1732 cell
1734 \hline
1736 cell
1737 & \multicolumn{2}{p{0.36\DUtablewidth}|}{
1738 multicolumn 3 (one line,
1739 but very very very very
1740 very looooong)
1741 } &
1742 cell
1744 cell
1746 cell
1748 \hline
1750 cell
1752 cell
1754 cell
1755 & \multicolumn{3}{p{0.38\DUtablewidth}|}{
1756 Short multicolumn 4
1757 } \\
1758 \hline
1759 \end{longtable*}
1761 A table with multirow header
1763 \begin{quote}
1765 \setlength{\DUtablewidth}{\linewidth}
1766 \begin{longtable*}[c]{|p{0.156\DUtablewidth}|p{0.238\DUtablewidth}|}
1767 \hline
1768 \multirow{2}{0.16\DUtablewidth}{%
1769 \textbf{%
1771 }} & \textbf{%
1772 Variable Summary
1773 } \\
1774 \cline{2-2}
1775 & \textbf{%
1776 Description
1777 } \\
1778 \hline
1779 \endfirsthead
1780 \hline
1781 \multirow{2}{0.16\DUtablewidth}{%
1782 \textbf{%
1784 }} & \textbf{%
1785 Variable Summary
1786 } \\
1787 \cline{2-2}
1788 & \textbf{%
1789 Description
1790 } \\
1791 \hline
1792 \endhead
1793 \multicolumn{2}{c}{\hfill ... continued on next page} \\
1794 \endfoot
1795 \endlastfoot
1796 \multicolumn{2}{|p{0.39\DUtablewidth}|}{
1797 multirow header breaks latex
1798 } \\
1799 \hline
1800 \end{longtable*}
1802 \end{quote}
1804 % This file is used by the standalone_rst_latex test.
1807 \subsection{3.3~~~Option lists%
1808 \label{id23}%
1811 The LaTeX-2e description environment is used for definition lists.
1812 The definition is continued on the same line as the term, this should
1813 not happen if a option-list is at the top of the definition.
1815 If the option list is not at the first element in the definition, it
1816 is contained in a quote
1818 \begin{quote}
1820 \begin{DUoptionlist}
1822 \item[-{}-help] show help
1824 \item[-v] verbose
1826 \end{DUoptionlist}
1828 \end{quote}
1830 \begin{description}
1831 \item[{In a definition list:}] \leavevmode %
1832 \begin{DUoptionlist}
1834 \item[-{}-help] show help
1836 \item[-v] verbose
1838 \end{DUoptionlist}
1840 \end{description}
1843 \subsection{3.4~~~Monospaced non-alphanumeric characters%
1844 \label{monospaced-non-alphanumeric-characters}%
1847 These are all ASCII characters except a-zA-Z0-9 and space:
1849 \texttt{!!!\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'{}'{}'((()))***+++,{},{},-{}-{}-...///:::}
1851 \texttt{;;;<{}<{}<===>{}>{}>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_`{}`{}`\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}}
1853 \texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
1855 The two lines of non-alphanumeric characters should both have the same
1856 width as the third line.
1859 \subsection{3.5~~~Non-ASCII characters%
1860 \label{non-ascii-characters}%
1863 Punctuation and footnote symbols
1865 \setlength{\DUtablewidth}{\linewidth}
1866 \begin{longtable*}[c]{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|}
1867 \hline
1871 en-dash
1873 \hline
1877 em-dash
1879 \hline
1883 single turned comma quotation mark
1885 \hline
1889 single comma quotation mark
1891 \hline
1895 low single comma quotation mark
1897 \hline
1901 double turned comma quotation mark
1903 \hline
1907 double comma quotation mark
1909 \hline
1913 low double comma quotation mark
1915 \hline
1919 dagger
1921 \hline
1925 double dagger
1927 \hline
1929 \ding{169}
1931 black diamond suit
1933 \hline
1935 \ding{170}
1937 black heart suit
1939 \hline
1941 $\spadesuit$
1943 black spade suit
1945 \hline
1947 $\clubsuit$
1949 black club suit
1951 \hline
1955 ellipsis
1957 \hline
1961 trade mark sign
1963 \hline
1965 $\Leftrightarrow$
1967 left-right double arrow
1969 \hline
1970 \end{longtable*}
1972 The \DUroletitlereference{Latin-1 extended} Unicode block
1974 \setlength{\DUtablewidth}{\linewidth}
1975 \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}|}
1976 \hline
2000 \hline
2003 & &
2009 & &
2020 \hline
2044 \hline
2068 \hline
2092 \hline
2116 \hline
2140 \hline
2164 \hline
2188 \hline
2212 \hline
2227 & & & & \\
2228 \hline
2229 \end{longtable*}
2231 \begin{itemize}
2233 \item The following line should not be wrapped, because it uses
2234 no-break spaces (\textbackslash{}u00a0):
2236 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
2238 \item Line wrapping with/without breakpoints marked by soft hyphens
2239 (\textbackslash{}u00ad):
2241 pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch
2243 pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch
2245 \item The currency sign (\textbackslash{}u00a4) is not supported by all fonts
2246 (some have an Euro sign at its place). You might see an error
2247 like:
2249 \begin{quote}
2250 \begin{alltt}
2251 ! Package textcomp Error: Symbol \textbackslash{}textcurrency not provided by
2252 (textcomp) font family ptm in TS1 encoding.
2253 (textcomp) Default family used instead.
2254 \end{alltt}
2255 \end{quote}
2257 (which in case of font family ptm is a false positive). Add either
2259 \begin{DUfieldlist}
2260 \item[{warn:}]
2261 turn the error in a warning, use the default symbol (bitmap), or
2263 \item[{force,almostfull:}]
2264 use the symbol provided by the font at the users
2265 risk,
2267 \end{DUfieldlist}
2269 to the document options or use a different font package.
2271 \end{itemize}
2274 \subsection{3.6~~~Encoding special chars%
2275 \label{encoding-special-chars}%
2278 The LaTeX Info pages lists under “2.18 Special Characters”
2280 \begin{quote}
2282 The following characters play a special role in LaTeX and are called
2283 “special printing characters”, or simply “special characters”.
2285 \begin{quote}
2287 \# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \}
2289 \end{quote}
2291 \end{quote}
2293 The special chars verbatim:
2295 \begin{quote}
2296 \begin{alltt}
2297 # $ % & ~ _ ^ \textbackslash{} \{ \}
2298 \end{alltt}
2299 \end{quote}
2301 However also \emph{square brackets} {[}{]} need special care.
2303 \begin{quote}
2305 Commands with optional arguments (e.g. \texttt{\textbackslash{}item}) check
2306 if the token right after the macro name is an opening bracket.
2307 In that case the contents between that bracket and the following
2308 closing bracket on the same grouping level are taken as the
2309 optional argument. What makes this unintuitive is the fact that
2310 the square brackets aren’t grouping characters themselves, so in
2311 your last example item{[}{[}{]}{]} the optional argument consists of
2312 {[}… (without the closing bracket).
2314 \end{quote}
2316 Compare the items in the following lists:
2318 \begin{itemize}
2320 \item simple item
2322 \item {[}bracketed{]} item
2324 \end{itemize}
2326 \begin{description}
2327 \item[{simple}] \leavevmode
2328 description term
2330 \item[{{[}bracketed{]}}] \leavevmode
2331 description term
2333 \end{description}
2335 The OT1 font-encoding has different characters for the less-than,
2336 greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}:
2338 \begin{quote}
2339 \begin{alltt}
2340 < | >
2341 \end{alltt}
2342 \end{quote}
2345 \subsection{3.7~~~Hyperlinks and -targets%
2346 \label{hyperlinks-and-targets}%
2349 In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a
2351 \phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or
2352 caption:
2354 \setlength{\DUtablewidth}{\linewidth}
2355 \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
2356 \caption{Table with %
2357 \label{hypertarget-in-table-title}hypertarget in table title.}\\
2358 \hline
2360 False
2362 True
2364 None
2366 \hline
2367 \end{longtable}
2368 \label{table-label}
2370 \begin{figure}
2371 \phantomsection\label{figure-label}
2372 \noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
2373 \caption{Figure with %
2374 \label{hypertarget-in-figure-caption}hypertarget in figure caption.}
2375 \begin{DUlegend}
2376 Legend with %
2377 \phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend.
2378 \end{DUlegend}
2379 \end{figure}
2381 \includegraphics{../../../docs/user/rst/images/biohazard.png}
2382 \phantomsection\label{image-label}
2384 See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text},
2385 \hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title},
2386 \hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption},
2387 \hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and
2388 \hyperref[image-label]{image label}.
2391 \subsection{3.8~~~External references%
2392 \label{external-references}%
2395 Long URLs should be wrapped in the PDF.
2396 This can be achieved with the url command which is used by the LaTeX writer
2397 whenever the content (name) of a reference node equals the link URL.
2399 \begin{description}
2400 \item[{Example:}] \leavevmode
2401 a long URL that should wrap in the output
2402 \url{http://docutils.sourceforge.net/docs/user/latex.html\#id79}
2404 \end{description}
2406 If the argument contains any “\%”, “\#”, or “\textasciicircum{}\textasciicircum{}”, or ends with \texttt{\textbackslash{}}, it can’t
2407 be used in the argument to another command. The argument must not contain
2408 unbalanced braces.
2410 The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a “http:” or “ftp:” URL
2411 and not recognized as part of it:
2413 \begin{DUlineblock}{0em}
2414 \item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name
2415 \item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{}
2416 \item[] \url{http://www.example.org/XML}/strange\{n\}ame
2417 \end{DUlineblock}
2419 They can, however be used in paths and/or filenames.
2421 Handling by the LaTeX writer:
2423 \begin{itemize}
2425 \item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped:
2427 \begin{DUlineblock}{0em}
2428 \item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#}
2429 \url{http://www.w3.org/XML/Schema\#dev}
2430 \item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%}
2431 \url{http://example.org/Schema\%dev}
2432 \item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{id42}{id41}{9} \url{A:DOS\\path\\}\DUfootnotemark{id43}{id41}{9}
2433 \end{DUlineblock}
2435 \DUadmonition[note]{
2436 \DUtitle[note]{Note}
2438 These URLs are typeset inside a LaTeX command without error.
2440 \begin{DUlineblock}{0em}
2441 \item[] \url{http://www.w3.org/XML/Schema\#dev}
2442 \item[] \url{http://example.org/Schema\%dev}
2443 \item[] \url{A:DOS\\path\\}\DUfootnotemark{id44}{id41}{9}
2444 \end{DUlineblock}
2447 \end{itemize}
2449 \begin{itemize}
2451 \item \textasciicircum{}\textasciicircum{} LaTeX’s special syntax for characters results in “strange” replacements
2452 (both with href and url). A warning is given.
2454 \href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}:
2455 \url{../strange^^name}
2457 \item Unbalanced braces, \{ or \}, will fail (both with href and url):
2459 \begin{quote}
2460 \begin{alltt}
2461 `file with \{ <../strange\{name>`__
2462 `<../strange\{name>`__
2463 \end{alltt}
2464 \end{quote}
2466 while balanced braces are suported:
2468 \begin{DUlineblock}{0em}
2469 \item[] \url{../strange{n}ame}
2470 \item[] \url{../st{r}ange{n}ame}
2471 \item[] \url{../{st{r}ange{n}ame}}
2472 \end{DUlineblock}
2474 \end{itemize}
2477 \subsection{3.9~~~Section titles with \hyperref[inline-markup]{inline markup}%
2478 \label{section-titles-with-inline-markup}%
2482 \subsubsection{3.9.1~~~\emph{emphasized}, H\textsubscript{2}O and $x^2$%
2483 \label{emphasized-h2o-and-x-2}%
2487 \subsubsection{3.9.2~~~Substitutions work%
2488 \label{substitutions-fail}%
2492 \subsection{3.10~~~Deeply nested sections%
2493 \label{deeply-nested-sections}%
2496 In LaTeX and HTML,
2499 \subsubsection{3.10.1~~~Level 3%
2500 \label{level-3}%
2503 nested sections
2506 \paragraph{3.10.1.1~~~level 4%
2507 \label{level-4}%
2510 reach at some level
2513 \subparagraph{3.10.1.1.1~~~level 5%
2514 \label{level-5}%
2517 (depending on the document class)
2520 \DUtitle[sectionVI]{3.10.1.1.1.1~~~level 6%
2521 \label{level-6}%
2524 an unsupported level.
2526 % unusual combinations (from newlatex, for interactive testing)
2527 % .. include:: data/latex.txt
2529 % Preface for System Messages:
2532 \section{4~~~Error Handling%
2533 \label{error-handling}%
2536 Any errors caught during processing will generate system messages.
2538 There should be five messages in the following, auto-generated
2539 section, “Docutils System Messages”:
2541 % section should be added by Docutils automatically
2544 \section[Docutils System Messages]{\color{red}Docutils System Messages%
2547 \DUadmonition[system-message]{
2548 \DUtitle[system-message]{system-message}
2549 \raisebox{1em}{\hypertarget{id27}{}}
2551 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~104
2553 \hyperlink{id28}{
2554 Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}.
2557 \DUadmonition[system-message]{
2558 \DUtitle[system-message]{system-message}
2559 \raisebox{1em}{\hypertarget{id45}{}}
2561 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~391
2563 \hyperlink{id46}{
2564 Unknown target name: \textquotedbl{}5\textquotedbl{}.
2567 \DUadmonition[system-message]{
2568 \DUtitle[system-message]{system-message}
2569 \raisebox{1em}{\hypertarget{id47}{}}
2571 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~400
2573 \hyperlink{id48}{
2574 Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
2577 \DUadmonition[system-message]{
2578 \DUtitle[system-message]{system-message}
2579 \raisebox{1em}{\hypertarget{id49}{}}
2581 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~427
2583 \hyperlink{id50}{
2584 Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}.
2587 \DUadmonition[system-message]{
2588 \DUtitle[system-message]{system-message}
2589 \raisebox{1em}{\hypertarget{id51}{}}
2591 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~440
2593 \hyperlink{id52}{
2594 Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}.
2597 \end{document}