Apply [ 3148141 ] fix multicolumn support.
[docutils.git] / test / functional / expected / standalone_rst_latex.tex
blobe016b78c32aaa8b1afba35ef9ddfb21d98f6caa2
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{multirow}
18 \usepackage{pifont}
19 \usepackage{longtable}
20 \usepackage{array}
21 \setlength{\extrarowheight}{2pt}
22 \newlength{\DUtablewidth} % internal use in tables
23 \usepackage{tabularx}
24 \usepackage{textcomp} % text symbol macros
26 %%% Custom LaTeX preamble
27 % PDF Standard Fonts
28 \usepackage{mathptmx} % Times
29 \usepackage[scaled=.90]{helvet}
30 \usepackage{courier}
32 %%% User specified packages and stylesheets
34 %%% Fallback definitions for Docutils-specific commands
36 % providelength (provide a length variable and set default, if it is new)
37 \providecommand*{\DUprovidelength}[2]{
38 \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
41 % abstract title
42 \providecommand*{\DUtitleabstract}[1]{\centerline{\textbf{#1}}}
44 % admonition (specially marked topic)
45 \providecommand{\DUadmonition}[2][class-arg]{%
46 % try \DUadmonition#1{#2}:
47 \ifcsname DUadmonition#1\endcsname%
48 \csname DUadmonition#1\endcsname{#2}%
49 \else
50 \begin{center}
51 \fbox{\parbox{0.9\textwidth}{#2}}
52 \end{center}
53 \fi
56 \makeatletter
57 \@namedef{DUrolealign-center}{\centering}
58 \makeatother
61 % dedication topic
62 \providecommand{\DUtopicdedication}[1]{\begin{center}#1\end{center}}
64 % docinfo (width of docinfo table)
65 \DUprovidelength{\DUdocinfowidth}{0.9\textwidth}
67 % error admonition title
68 \providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}}
70 % fieldlist environment
71 \ifthenelse{\isundefined{\DUfieldlist}}{
72 \newenvironment{DUfieldlist}%
73 {\quote\description}
74 {\enddescription\endquote}
75 }{}
76 % numeric or symbol footnotes with hyperlinks
77 \providecommand*{\DUfootnotemark}[3]{%
78 \raisebox{1em}{\hypertarget{#1}{}}%
79 \hyperlink{#2}{\textsuperscript{#3}}%
81 \providecommand{\DUfootnotetext}[4]{%
82 \begingroup%
83 \renewcommand{\thefootnote}{%
84 \protect\raisebox{1em}{\protect\hypertarget{#1}{}}%
85 \protect\hyperlink{#2}{#3}}%
86 \footnotetext{#4}%
87 \endgroup%
90 % inline markup (custom roles)
91 % \DUrole{#1}{#2} tries \DUrole#1{#2}
92 \providecommand*{\DUrole}[2]{%
93 \ifcsname DUrole#1\endcsname%
94 \csname DUrole#1\endcsname{#2}%
95 \else% backwards compatibility: try \docutilsrole#1{#2}
96 \ifcsname docutilsrole#1\endcsname%
97 \csname docutilsrole#1\endcsname{#2}%
98 \else%
99 #2%
100 \fi%
101 \fi%
104 % legend environment
105 \ifthenelse{\isundefined{\DUlegend}}{
106 \newenvironment{DUlegend}{\small}{}
109 % lineblock environment
110 \DUprovidelength{\DUlineblockindent}{2.5em}
111 \ifthenelse{\isundefined{\DUlineblock}}{
112 \newenvironment{DUlineblock}[1]{%
113 \list{}{\setlength{\partopsep}{\parskip}
114 \addtolength{\partopsep}{\baselineskip}
115 \setlength{\topsep}{0pt}
116 \setlength{\itemsep}{0.15\baselineskip}
117 \setlength{\parsep}{0pt}
118 \setlength{\leftmargin}{#1}}
119 \raggedright
121 {\endlist}
124 % optionlist environment
125 \providecommand*{\DUoptionlistlabel}[1]{\bf #1 \hfill}
126 \DUprovidelength{\DUoptionlistindent}{3cm}
127 \ifthenelse{\isundefined{\DUoptionlist}}{
128 \newenvironment{DUoptionlist}{%
129 \list{}{\setlength{\labelwidth}{\DUoptionlistindent}
130 \setlength{\rightmargin}{1cm}
131 \setlength{\leftmargin}{\rightmargin}
132 \addtolength{\leftmargin}{\labelwidth}
133 \addtolength{\leftmargin}{\labelsep}
134 \renewcommand{\makelabel}{\DUoptionlistlabel}}
136 {\endlist}
139 % rubric (informal heading)
140 \providecommand*{\DUrubric}[2][class-arg]{%
141 \subsubsection*{\centering\textit{\textmd{#2}}}}
143 % sidebar (text outside the main text flow)
144 \providecommand{\DUsidebar}[2][class-arg]{%
145 \begin{center}
146 \colorbox[gray]{0.80}{\parbox{0.9\textwidth}{#2}}
147 \end{center}
150 % subtitle (for topic/sidebar)
151 \providecommand*{\DUsubtitle}[2][class-arg]{\par\emph{#2}\smallskip}
153 % title for topics, admonitions and sidebar
154 \providecommand*{\DUtitle}[2][class-arg]{%
155 % call \DUtitle#1{#2} if it exists:
156 \ifcsname DUtitle#1\endcsname%
157 \csname DUtitle#1\endcsname{#2}%
158 \else
159 \smallskip\noindent\textbf{#2}\smallskip%
163 % titlereference role
164 \providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
166 % topic (quote with heading)
167 \providecommand{\DUtopic}[2][class-arg]{%
168 \ifcsname DUtopic#1\endcsname%
169 \csname DUtopic#1\endcsname{#2}%
170 \else
171 \begin{quote}#2\end{quote}
175 % transition (break, fancybreak, anonymous section)
176 \providecommand*{\DUtransition}[1][class-arg]{%
177 \hspace*{\fill}\hrulefill\hspace*{\fill}
178 \vskip 0.5\baselineskip
181 % hyperlinks:
182 \ifthenelse{\isundefined{\hypersetup}}{
183 \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
184 \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
186 \hypersetup{
187 pdftitle={reStructuredText Test Document},
188 pdfauthor={David Goodger;Me;Myself;I}
191 %%% Title Data
192 \title{\phantomsection%
193 reStructuredText Test Document%
194 \label{restructuredtext-test-document}%
195 \label{doctitle}%
196 \\ % subtitle%
197 \large{Examples of Syntax Constructs}%
198 \label{examples-of-syntax-constructs}%
199 \label{subtitle}}
200 \author{}
201 \date{}
203 %%% Body
204 \begin{document}
205 \maketitle
207 % Docinfo
208 \begin{center}
209 \begin{tabularx}{\DUdocinfowidth}{lX}
210 \textbf{Author}: &
211 David Goodger \\
212 \textbf{Address}: &
213 {\raggedright
214 123 Example Street\\
215 Example, EX Canada\\
216 A1B 2C3 } \\
217 \textbf{Contact}: &
218 \href{mailto:goodger@python.org}{goodger@python.org} \\
219 \textbf{Author}: &
220 Me \\
221 \textbf{Author}: &
222 Myself \\
223 \textbf{Author}: &
224 I \\
225 \textbf{Organization}: &
226 humankind \\
227 \textbf{Date}: &
228 Now, or yesterday. Or maybe even \emph{before} yesterday. \\
229 \textbf{Status}: &
230 This is a ``work in progress'' \\
231 \textbf{Revision}: &
232 is managed by a version control system. \\
233 \textbf{Version}: &
234 1 \\
235 \textbf{Copyright}: &
236 This document has been placed in the public domain. You
237 may do with it as you wish. You may copy, modify,
238 redistribute, reattribute, sell, buy, rent, lease,
239 destroy, or improve it, quote it at length, excerpt,
240 incorporate, collate, fold, staple, or mutilate it, or do
241 anything else to it that your or anyone else's heart
242 desires. \\
243 \textbf{field name}: &
244 This is a ``generic bibliographic field''.
246 \textbf{field name ``2''}: &
247 Generic bibliographic fields may contain multiple body elements.
249 Like this.
251 \end{tabularx}
252 \end{center}
254 \DUtopic[dedication]{
255 \DUtitle[dedication]{Dedication}
257 For Docutils users \& co-developers.
260 \DUtopic[abstract]{
261 \DUtitle[abstract]{Abstract}
263 This is a test document, containing at least one example of each
264 reStructuredText construct.
267 % This is a comment. Note how any initial comments are moved by
268 % transforms to after the document title, subtitle, and docinfo.
270 % Above is the document title, and below is the subtitle.
271 % They are transformed from section titles after parsing.
273 % bibliographic fields (which also require a transform):
275 \pagebreak[4] % start ToC on new page
277 \phantomsection\label{table-of-contents}
278 \pdfbookmark[1]{Table of Contents}{table-of-contents}
279 \renewcommand{\contentsname}{Table of Contents}
280 \tableofcontents
284 %___________________________________________________________________________
286 \section*{\phantomsection%
287 1~~~Structural Elements%
288 \addcontentsline{toc}{section}{1~~~Structural Elements}%
289 \label{structural-elements}%
293 %___________________________________________________________________________
295 \subsection*{\phantomsection%
296 1.1~~~Section Title%
297 \addcontentsline{toc}{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 %___________________________________________________________________________
309 \subsection*{\phantomsection%
310 1.2~~~Empty Section%
311 \addcontentsline{toc}{subsection}{1.2~~~Empty Section}%
312 \label{empty-section}%
316 %___________________________________________________________________________
318 \subsection*{\phantomsection%
319 1.3~~~Transitions%
320 \addcontentsline{toc}{subsection}{1.3~~~Transitions}%
321 \label{transitions}%
324 Here's a transition:
327 %___________________________________________________________________________
328 \DUtransition
331 It divides the section. Transitions may also occur between sections:
334 %___________________________________________________________________________
335 \DUtransition
339 %___________________________________________________________________________
341 \section*{\phantomsection%
342 2~~~Body Elements%
343 \addcontentsline{toc}{section}{2~~~Body Elements}%
344 \label{body-elements}%
348 %___________________________________________________________________________
350 \subsection*{\phantomsection%
351 2.1~~~Paragraphs%
352 \addcontentsline{toc}{subsection}{2.1~~~Paragraphs}%
353 \label{paragraphs}%
356 A paragraph.
359 %___________________________________________________________________________
361 \subsubsection*{\phantomsection%
362 2.1.1~~~Inline Markup%
363 \addcontentsline{toc}{subsubsection}{2.1.1~~~Inline Markup}%
364 \label{inline-markup}%
367 Paragraphs contain text and may contain inline markup: \emph{emphasis},
368 \textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks
369 (\url{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\DUfootnotemark{id30}{id29}{5}), internal
370 cross-references (\hyperref[example]{example}), external hyperlinks with embedded URIs
371 (\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink
372 references}\DUfootnotemark{id33}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id35}{id34}{6}), footnote references (manually
373 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}]),
374 substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and %
375 \phantomsection\label{inline-hyperlink-targets}inline hyperlink targets
376 (see \hyperref[targets]{Targets} below for a reference back to here). Character-level
377 inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by %
378 \raisebox{1em}{\hypertarget{id28}{}}\hyperlink{id27}{\textbf{\color{red}|problematic|}} text
379 (generated by processing errors; this one is intentional). Here is a
380 reference to the \hyperref[doctitle]{doctitle} and the \hyperref[subtitle]{subtitle}.
382 The default role for interpreted text is \DUroletitlereference{Title Reference}. Here are
383 some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/dev/peps/pep-0287}{PEP 287}); an
384 RFC reference (\href{http://www.faqs.org/rfcs/rfc2822.html}{RFC 2822}); a \textsubscript{subscript}; a \textsuperscript{superscript};
385 and explicit roles for \emph{standard} \textbf{inline}
386 \texttt{markup}.
388 % DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
390 Let's test wrapping and whitespace significance in inline literals:
391 \texttt{This is an example of -{}-inline-literal -{}-text, -{}-including some-{}-
392 strangely-{}-hyphenated-words. ~Adjust-the-width-of-your-browser-window
393 to see how the text is wrapped. ~-{}- -{}-{}-{}- -{}-{}-{}-{}-{}-{}-{}- ~Now note ~ ~the
394 spacing ~ ~between the ~ ~words of ~ ~this sentence ~ ~(words
395 should ~ ~be grouped ~ ~in pairs).}
397 If the \texttt{-{}-pep-references} option was supplied, there should be a
398 live link to PEP 258 here.
401 %___________________________________________________________________________
403 \subsection*{\phantomsection%
404 2.2~~~Bullet Lists%
405 \addcontentsline{toc}{subsection}{2.2~~~Bullet Lists}%
406 \label{bullet-lists}%
409 \begin{itemize}
411 \item A bullet list
413 \begin{itemize}
415 \item Nested bullet list.
417 \item Nested item 2.
419 \end{itemize}
421 \item Item 2.
423 Paragraph 2 of item 2.
425 \begin{itemize}
427 \item Nested bullet list.
429 \item Nested item 2.
431 \begin{itemize}
433 \item Third level.
435 \item Item 2.
437 \end{itemize}
439 \item Nested item 3.
441 \item This nested list should be compacted by the HTML writer.
443 \phantomsection\label{target}
444 % Even if this item contains a target and a comment.
446 \end{itemize}
448 \end{itemize}
451 %___________________________________________________________________________
453 \subsection*{\phantomsection%
454 2.3~~~Enumerated Lists%
455 \addcontentsline{toc}{subsection}{2.3~~~Enumerated Lists}%
456 \label{enumerated-lists}%
458 \newcounter{listcnt0}
459 \begin{list}{\arabic{listcnt0}.}
461 \usecounter{listcnt0}
462 \setlength{\rightmargin}{\leftmargin}
465 \item Arabic numerals.
466 \newcounter{listcnt1}
467 \begin{list}{\alph{listcnt1})}
469 \usecounter{listcnt1}
470 \setlength{\rightmargin}{\leftmargin}
473 \item lower alpha)
474 \newcounter{listcnt2}
475 \begin{list}{(\roman{listcnt2})}
477 \usecounter{listcnt2}
478 \setlength{\rightmargin}{\leftmargin}
481 \item (lower roman)
482 \newcounter{listcnt3}
483 \begin{list}{\Alph{listcnt3}.}
485 \usecounter{listcnt3}
486 \setlength{\rightmargin}{\leftmargin}
489 \item upper alpha.
490 \newcounter{listcnt4}
491 \begin{list}{\Roman{listcnt4})}
493 \usecounter{listcnt4}
494 \setlength{\rightmargin}{\leftmargin}
497 \item upper roman)
498 \end{list}
499 \end{list}
500 \end{list}
501 \end{list}
503 \item Lists that don't start at 1:
504 \setcounter{listcnt1}{0}
505 \begin{list}{\arabic{listcnt1}.}
507 \usecounter{listcnt1}
508 \addtocounter{listcnt1}{2}
509 \setlength{\rightmargin}{\leftmargin}
512 \item Three
514 \item Four
515 \end{list}
516 \setcounter{listcnt1}{0}
517 \begin{list}{\Alph{listcnt1}.}
519 \usecounter{listcnt1}
520 \addtocounter{listcnt1}{2}
521 \setlength{\rightmargin}{\leftmargin}
524 \item C
526 \item D
527 \end{list}
528 \setcounter{listcnt1}{0}
529 \begin{list}{\roman{listcnt1}.}
531 \usecounter{listcnt1}
532 \addtocounter{listcnt1}{2}
533 \setlength{\rightmargin}{\leftmargin}
536 \item iii
538 \item iv
539 \end{list}
540 \end{list}
543 %___________________________________________________________________________
545 \subsection*{\phantomsection%
546 2.4~~~Definition Lists%
547 \addcontentsline{toc}{subsection}{2.4~~~Definition Lists}%
548 \label{definition-lists}%
551 \begin{description}
552 \item[{Term}] \leavevmode
553 Definition
555 \item[{Term}] \leavevmode (\textbf{classifier})
557 Definition paragraph 1.
559 Definition paragraph 2.
561 \item[{Term}] \leavevmode
562 Definition
564 \item[{Term}] \leavevmode (\textbf{classifier one})
565 (\textbf{classifier two})
567 Definition
569 \end{description}
572 %___________________________________________________________________________
574 \subsection*{\phantomsection%
575 2.5~~~Field Lists%
576 \addcontentsline{toc}{subsection}{2.5~~~Field Lists}%
577 \label{field-lists}%
580 \begin{DUfieldlist}
581 \item[{what:}]
582 Field lists map field names to field bodies, like database
583 records. They are often part of an extension syntax. They are
584 an unambiguous variant of RFC 2822 fields.
586 \item[{how arg1 arg2:}]
587 The field marker is a colon, the field name, and a colon.
589 The field body may contain one or more body elements, indented
590 relative to the field marker.
592 \item[{credits:}]
593 \DUrole{credits}{This paragraph has the \DUroletitlereference{credits} class set. (This is actually not
594 about credits but just for ensuring that the class attribute
595 doesn't get stripped away.)}
597 \end{DUfieldlist}
600 %___________________________________________________________________________
602 \subsection*{\phantomsection%
603 2.6~~~Option Lists%
604 \addcontentsline{toc}{subsection}{2.6~~~Option Lists}%
605 \label{option-lists}%
608 For listing command-line options:
610 \begin{DUoptionlist}
612 \item[-a] command-line option ``a''
614 \item[-b file] options can have arguments
615 and long descriptions
617 \item[-{}-long] options can be long also
619 \item[-{}-input=file] long options can also have
620 arguments
622 \item[-{}-very-long-option] The description can also start on the next line.
624 The description may contain multiple body elements,
625 regardless of where it starts.
627 \item[-x, -y, -z] Multiple options are an ``option group''.
629 \item[-v, -{}-verbose] Commonly-seen: short \& long options.
631 \item[-1 file, -{}-one=file, -{}-two file] Multiple options with arguments.
633 \item[/V] DOS/VMS-style options too
635 \end{DUoptionlist}
637 There must be at least two spaces between the option and the
638 description.
641 %___________________________________________________________________________
643 \subsection*{\phantomsection%
644 2.7~~~Literal Blocks%
645 \addcontentsline{toc}{subsection}{2.7~~~Literal Blocks}%
646 \label{literal-blocks}%
649 Literal blocks are indicated with a double-colon (``::'') at the end of
650 the preceding paragraph (over there \texttt{-{}->}). They can be indented:
652 \begin{quote}{\ttfamily \raggedright \noindent
653 if~literal\_block:\\
654 ~~~~text~=~'is~left~as-is'\\
655 ~~~~spaces\_and\_linebreaks~=~'are~preserved'\\
656 ~~~~markup\_processing~=~None
658 \end{quote}
660 Or they can be quoted without indentation:
662 \begin{quote}{\ttfamily \raggedright \noindent
663 >{}>~Great~idea!\\
665 >~Why~didn't~I~think~of~that?
667 \end{quote}
670 %___________________________________________________________________________
672 \subsection*{\phantomsection%
673 2.8~~~Line Blocks%
674 \addcontentsline{toc}{subsection}{2.8~~~Line Blocks}%
675 \label{line-blocks}%
678 This section tests line blocks. Line blocks are body elements which
679 consist of lines and other line blocks. Nested line blocks cause
680 indentation.
682 \begin{DUlineblock}{0em}
683 \item[] This is a line block. It ends with a blank line.
684 \item[]
685 \begin{DUlineblock}{\DUlineblockindent}
686 \item[] New lines begin with a vertical bar (``|'').
687 \item[] Line breaks and initial indent are significant, and preserved.
688 \item[]
689 \begin{DUlineblock}{\DUlineblockindent}
690 \item[] Continuation lines are also possible. A long line that is intended
691 to wrap should begin with a space in place of the vertical bar.
692 \end{DUlineblock}
693 \item[] The left edge of a continuation line need not be aligned with
694 the left edge of the text above it.
695 \end{DUlineblock}
696 \end{DUlineblock}
698 \begin{DUlineblock}{0em}
699 \item[] This is a second line block.
700 \item[]
701 \item[] Blank lines are permitted internally, but they must begin with a ``|''.
702 \end{DUlineblock}
704 Another line block, surrounded by paragraphs:
706 \begin{DUlineblock}{0em}
707 \item[] And it's no good waiting by the window
708 \item[] It's no good waiting for the sun
709 \item[] Please believe me, the things you dream of
710 \item[] They don't fall in the lap of no-one
711 \end{DUlineblock}
713 Take it away, Eric the Orchestra Leader!
715 \begin{quote}
717 \begin{DUlineblock}{0em}
718 \item[] A one, two, a one two three four
719 \item[]
720 \item[] Half a bee, philosophically,
721 \item[]
722 \begin{DUlineblock}{\DUlineblockindent}
723 \item[] must, \emph{ipso facto}, half not be.
724 \end{DUlineblock}
725 \item[] But half the bee has got to be,
726 \item[]
727 \begin{DUlineblock}{\DUlineblockindent}
728 \item[] \emph{vis a vis} its entity. D'you see?
729 \item[]
730 \end{DUlineblock}
731 \item[] But can a bee be said to be
732 \item[]
733 \begin{DUlineblock}{\DUlineblockindent}
734 \item[] or not to be an entire bee,
735 \item[]
736 \begin{DUlineblock}{\DUlineblockindent}
737 \item[] when half the bee is not a bee,
738 \item[]
739 \begin{DUlineblock}{\DUlineblockindent}
740 \item[] due to some ancient injury?
741 \item[]
742 \end{DUlineblock}
743 \end{DUlineblock}
744 \end{DUlineblock}
745 \item[] Singing...
746 \end{DUlineblock}
748 \end{quote}
750 A line block, like the following poem by Christian Morgenstern, can
751 also be centre-aligned:
753 \begin{DUlineblock}{0em}
754 \otherlanguage{ngerman}{\DUrole{align-center}{
755 \item[] \textbf{Die Trichter}
756 \item[]
757 \item[] Zwei Trichter wandeln durch die Nacht.
758 \item[] Durch ihres Rumpfs verengten Schacht
759 \item[] fließt weißes Mondlicht
760 \item[] still und heiter
761 \item[] auf ~ ihren
762 \item[] Waldweg
763 \item[] u. s.
764 \item[] w.
765 \item[]
767 \end{DUlineblock}
770 %___________________________________________________________________________
772 \subsection*{\phantomsection%
773 2.9~~~Block Quotes%
774 \addcontentsline{toc}{subsection}{2.9~~~Block Quotes}%
775 \label{block-quotes}%
778 Block quotes consist of indented body elements:
780 \begin{quote}
782 My theory by A. Elk. Brackets Miss, brackets. This theory goes
783 as follows and begins now. All brontosauruses are thin at one
784 end, much much thicker in the middle and then thin again at the
785 far end. That is my theory, it is mine, and belongs to me and I
786 own it, and what it is too.
787 \nopagebreak
789 \raggedleft —Anne Elk (Miss)
791 \end{quote}
793 The language of a quote (like any other object) can be specified by
794 a class attribute:
798 \begin{quote}
799 \otherlanguage{french}{
800 ReStructuredText est un langage de balisage léger utilisé
801 notamment dans la documentation du langage Python.
803 \end{quote}
806 %___________________________________________________________________________
808 \subsection*{\phantomsection%
809 2.10~~~Doctest Blocks%
810 \addcontentsline{toc}{subsection}{2.10~~~Doctest Blocks}%
811 \label{doctest-blocks}%
814 \begin{quote}{\ttfamily \raggedright \noindent
815 >{}>{}>~print~'Python-specific~usage~examples;~begun~with~">{}>{}>"'\\
816 Python-specific~usage~examples;~begun~with~">{}>{}>"\\
817 >{}>{}>~print~'(cut~and~pasted~from~interactive~Python~sessions)'\\
818 (cut~and~pasted~from~interactive~Python~sessions)
820 \end{quote}
823 %___________________________________________________________________________
825 \subsection*{\phantomsection%
826 2.11~~~Footnotes%
827 \addcontentsline{toc}{subsection}{2.11~~~Footnotes}%
828 \label{footnotes}%
831 \DUfootnotetext{id8}{id1}{1}{%
832 A footnote contains body elements, consistently indented by at
833 least 3 spaces.
835 This is the footnote's second paragraph.
838 \DUfootnotetext{label}{id3}{2}{\phantomsection\label{label}%
839 Footnotes may be numbered, either manually (as in\DUfootnotemark{id9}{id8}{1}) or
840 automatically using a ``\#''-prefixed label. This footnote has a
841 label so it can be referred to from multiple places, both as a
842 footnote reference (\DUfootnotemark{id10}{label}{2}) and as a \hyperref[label]{hyperlink reference}.
845 \DUfootnotetext{id12}{id2}{3}{%
846 This footnote is numbered automatically and anonymously using a
847 label of ``\#'' only.
849 This is the second paragraph.
851 And this is the third paragraph.
854 \DUfootnotetext{id13}{id4}{*}{%
855 Footnotes may also use symbols, specified with a ``*'' label.
856 Here's a reference to the next footnote:\DUfootnotemark{id14}{id15}{}.
859 \DUfootnotetext{id15}{id14}{}{%
860 This footnote shows the next symbol in the sequence.
863 \DUfootnotetext{id16}{id16}{4}{%
864 Here's an unreferenced footnote, with a reference to a
865 nonexistent footnote:%
866 \raisebox{1em}{\hypertarget{id41}{}}%
867 \raisebox{1em}{\hypertarget{id17}{}}\hyperlink{id40}{\textbf{\color{red}{[}5{]}\_}}.
871 %___________________________________________________________________________
873 \subsection*{\phantomsection%
874 2.12~~~Citations%
875 \addcontentsline{toc}{subsection}{2.12~~~Citations}%
876 \label{citations}%
878 \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
879 Citations are text-labeled footnotes. They may be
880 rendered separately and differently from footnotes.
881 \end{figure}
883 Here's a reference to the above, [\hyperlink{cit2002}{CIT2002}], and a %
884 \raisebox{1em}{\hypertarget{id43}{}}%
885 \raisebox{1em}{\hypertarget{id19}{}}\hyperlink{id42}{\textbf{\color{red}{[}nonexistent{]}\_}}
886 citation.
889 %___________________________________________________________________________
891 \subsection*{\phantomsection%
892 2.13~~~Targets%
893 \addcontentsline{toc}{subsection}{2.13~~~Targets}%
894 \label{targets}%
895 \label{another-target}%
898 \phantomsection\label{example}
899 This paragraph is pointed to by the explicit ``example'' target. A
900 reference can be found under \hyperref[inline-markup]{Inline Markup}, above. \hyperref[inline-hyperlink-targets]{Inline
901 hyperlink targets} are also possible.
903 Section headers are implicit targets, referred to by name. See
904 \hyperref[targets]{Targets}, which is a subsection of \hyperref[body-elements]{Body Elements}.
906 Explicit external targets are interpolated into references such as
907 ``\href{http://www.python.org/}{Python}\DUfootnotemark{id31}{id29}{5}''.
909 Targets may be indirect and anonymous. Thus \hyperref[targets]{this phrase} may also
910 refer to the \hyperref[targets]{Targets} section.
912 Here's a %
913 \raisebox{1em}{\hypertarget{id45}{}}\hyperlink{id44}{\textbf{\color{red}`hyperlink reference without a target`\_}}, which generates an
914 error.
917 %___________________________________________________________________________
919 \subsubsection*{\phantomsection%
920 2.13.1~~~Duplicate Target Names%
921 \addcontentsline{toc}{subsubsection}{2.13.1~~~Duplicate Target Names}%
922 \label{duplicate-target-names}%
925 Duplicate names in section headers or other implicit targets will
926 generate ``info'' (level-1) system messages. Duplicate names in
927 explicit targets will generate ``warning'' (level-2) system messages.
930 %___________________________________________________________________________
932 \subsubsection*{\phantomsection%
933 2.13.2~~~Duplicate Target Names%
934 \addcontentsline{toc}{subsubsection}{2.13.2~~~Duplicate Target Names}%
935 \label{id21}%
938 Since there are two ``Duplicate Target Names'' section headers, we
939 cannot uniquely refer to either of them by name. If we try to (like
940 this: %
941 \raisebox{1em}{\hypertarget{id47}{}}\hyperlink{id46}{\textbf{\color{red}`Duplicate Target Names`\_}}), an error is generated.
944 %___________________________________________________________________________
946 \subsection*{\phantomsection%
947 2.14~~~Directives%
948 \addcontentsline{toc}{subsection}{2.14~~~Directives}%
949 \label{directives}%
952 \phantomsection\label{contents}
953 These are just a sample of the many reStructuredText Directives. For
954 others, please see
955 \url{http://docutils.sourceforge.net/docs/ref/rst/directives.html}.
958 %___________________________________________________________________________
960 \subsubsection*{\phantomsection%
961 2.14.1~~~Document Parts%
962 \addcontentsline{toc}{subsubsection}{2.14.1~~~Document Parts}%
963 \label{document-parts}%
966 An example of the ``contents'' directive can be seen above this section
967 (a local, untitled table of \hyperref[contents]{contents}) and at the beginning of the
968 document (a document-wide \hyperref[table-of-contents]{table of contents}).
971 %___________________________________________________________________________
973 \subsubsection*{\phantomsection%
974 2.14.2~~~Images and Figures%
975 \addcontentsline{toc}{subsubsection}{2.14.2~~~Images and Figures}%
976 \label{images-and-figures}%
979 An image directive (also clickable -{}- a hyperlink reference):
981 \hyperref[directives]{\includegraphics{../../../docs/user/rst/images/title.png}}
983 Image with multiple IDs:
985 \includegraphics{../../../docs/user/rst/images/title.png}
986 \phantomsection\label{image-target-3}\label{image-target-2}\label{image-target-1}
988 A centered image:
990 \noindent\makebox[\textwidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
992 A left-aligned image:
994 \noindent{\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill}
996 This paragraph might flow around the image.
997 The specific behavior depends upon the style sheet and
998 the browser or rendering software used.
1000 A right-aligned image:
1002 \noindent{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}}
1004 This paragraph might flow around the image.
1005 The specific behavior depends upon the style sheet and
1006 the browser or rendering software used.
1008 For inline images see \hyperref[substitution-definitions]{Substitution Definitions}.
1010 Image size:
1012 An image 2 em wide:
1014 \includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png}
1016 An image 2 em wide and 15 pixel high:
1018 \includegraphics[height=15px,width=2em]{../../../docs/user/rst/images/biohazard.png}
1020 An image occupying 50\% of the line width:
1022 \includegraphics[width=0.500\linewidth]{../../../docs/user/rst/images/title.png}
1024 An image 2 cm high:
1026 \includegraphics[height=2cm]{../../../docs/user/rst/images/biohazard.png}
1028 A \emph{figure} is an image with a caption and/or a legend. With page-based output
1029 media, figures might float to a different position if this helps the page
1030 layout.
1031 \begin{figure}
1032 \noindent\makebox[\textwidth][c]{\includegraphics[width=258bp]{../../../docs/user/rst/images/title.png}}
1033 \caption{Plaintext markup syntax and parser system.}
1034 \begin{DUlegend}
1035 \leavevmode
1036 \setlength{\DUtablewidth}{\linewidth}
1037 \begin{longtable}[c]{|p{0.156\DUtablewidth}|p{0.563\DUtablewidth}|}
1038 \hline
1042 Revised, revisited, based on 're' module.
1044 \hline
1046 Structured
1048 Structure-enhanced text, structuredtext.
1050 \hline
1052 Text
1054 Well it is, isn't it?
1056 \hline
1057 \end{longtable}
1059 This paragraph is also part of the legend.
1060 \end{DUlegend}
1061 \end{figure}
1063 A left-aligned figure:
1064 \begin{figure}
1065 \noindent\makebox[\textwidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
1066 \caption{This is the caption.}
1067 \begin{DUlegend}
1068 This is the legend.
1070 The legend may consist of several paragraphs.
1071 \end{DUlegend}
1072 \end{figure}
1074 This paragraph might flow around the figure.
1076 The specific behavior depends upon the style sheet and the browser or
1077 rendering software used.
1079 A centered figure:
1080 \begin{figure}
1081 \noindent\makebox[\textwidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
1082 \caption{This is the caption.}
1083 \begin{DUlegend}
1084 This is the legend.
1086 The legend may consist of several paragraphs.
1087 \end{DUlegend}
1088 \end{figure}
1090 This paragraph might flow around the figure.
1092 The specific behavior depends upon the style sheet and the browser or
1093 rendering software used.
1095 A right-aligned figure:
1096 \begin{figure}
1097 \noindent\makebox[\textwidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
1098 \caption{This is the caption.}
1099 \begin{DUlegend}
1100 This is the legend.
1102 The legend may consist of several paragraphs.
1103 \end{DUlegend}
1104 \end{figure}
1106 This paragraph might flow around the figure. The specific behavior depends
1107 upon the style sheet and the browser or rendering software used.
1110 %___________________________________________________________________________
1112 \subsubsection*{\phantomsection%
1113 2.14.3~~~Admonitions%
1114 \addcontentsline{toc}{subsubsection}{2.14.3~~~Admonitions}%
1115 \label{admonitions}%
1118 \DUadmonition[attention]{
1119 \DUtitle[attention]{Attention!}
1121 Directives at large.
1124 \DUadmonition[caution]{
1125 \DUtitle[caution]{Caution!}
1127 Don't take any wooden nickels.
1130 \DUadmonition[danger]{
1131 \DUtitle[danger]{!DANGER!}
1133 Mad scientist at work!
1136 \DUadmonition[error]{
1137 \DUtitle[error]{Error}
1139 Does not compute.
1142 \DUadmonition[hint]{
1143 \DUtitle[hint]{Hint}
1145 It's bigger than a bread box.
1148 \DUadmonition[important]{
1149 \DUtitle[important]{Important}
1151 \begin{itemize}
1153 \item Wash behind your ears.
1155 \item Clean up your room.
1157 \item Call your mother.
1159 \item Back up your data.
1161 \end{itemize}
1164 \DUadmonition[note]{
1165 \DUtitle[note]{Note}
1167 This is a note.
1170 \DUadmonition[tip]{
1171 \DUtitle[tip]{Tip}
1173 15\% if the service is good.
1176 \DUadmonition[warning]{
1177 \DUtitle[warning]{Warning}
1179 Strong prose may provoke extreme mental exertion.
1180 Reader discretion is strongly advised.
1183 \DUadmonition[admonition-and-by-the-way]{
1184 \DUtitle[admonition-and-by-the-way]{And, by the way...}
1186 You can make up your own admonition too.
1190 %___________________________________________________________________________
1192 \subsubsection*{\phantomsection%
1193 2.14.4~~~Topics, Sidebars, and Rubrics%
1194 \addcontentsline{toc}{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 \DUtopic[]{
1218 \DUtitle[title]{Topic Title}
1220 This is a topic.
1223 A \emph{rubric} is like an informal heading that doesn't correspond to the
1224 document's structure. It is typically highlighted in red (hence the name).
1226 \DUrubric{This is a rubric}
1228 Topics and rubrics can be used at places where a \hyperref[section-title]{section title} is not
1229 allowed (e.g. inside a directive).
1232 %___________________________________________________________________________
1234 \subsubsection*{\phantomsection%
1235 2.14.5~~~Target Footnotes%
1236 \addcontentsline{toc}{subsubsection}{2.14.5~~~Target Footnotes}%
1237 \label{target-footnotes}%
1240 \DUfootnotetext{id29}{id30}{5}{%
1241 \url{http://www.python.org/}
1244 \DUfootnotetext{id34}{id35}{6}{%
1245 \url{http://docutils.sourceforge.net/}
1248 \DUfootnotetext{id36}{id37}{7}{%
1249 \url{A:DOS\\path\\}
1253 %___________________________________________________________________________
1255 \subsubsection*{\phantomsection%
1256 2.14.6~~~Replacement Text%
1257 \addcontentsline{toc}{subsubsection}{2.14.6~~~Replacement Text}%
1258 \label{replacement-text}%
1261 I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\DUfootnotemark{id32}{id29}{5}.
1264 %___________________________________________________________________________
1266 \subsubsection*{\phantomsection%
1267 2.14.7~~~Compound Paragraph%
1268 \addcontentsline{toc}{subsubsection}{2.14.7~~~Compound Paragraph}%
1269 \label{compound-paragraph}%
1272 Compound 1, paragraph 1.
1274 Compound 1, paragraph 2.
1276 \begin{itemize}
1278 \item Compound 1, list item one.
1280 \item Compound 1, list item two.
1282 \end{itemize}
1284 Another compound statement:
1286 Compound 2, a literal block:
1288 \begin{quote}{\ttfamily \raggedright \noindent
1289 Compound~2,~literal.
1291 \end{quote}
1292 Compound 2, this is a test.
1294 Compound 3, only consisting of one paragraph.
1296 \begin{quote}{\ttfamily \raggedright \noindent
1297 Compound~4.\\
1298 This~one~starts~with~a~literal~block.
1300 \end{quote}
1301 Compound 4, a paragraph.
1303 Now something \emph{really} perverted -{}- a nested compound block. This is
1304 just to test that it works at all; the results don't have to be
1305 meaningful.
1307 Compound 5, block 1 (a paragraph).
1309 Compound 6, block 2 in compound 5.
1311 Compound 6, another paragraph.
1313 Compound 5, block 3 (a paragraph).
1315 Compound 7, with a table inside:
1317 \leavevmode
1318 \setlength{\DUtablewidth}{\linewidth}
1319 \begin{longtable}[c]{|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|}
1320 \hline
1322 Left cell, first
1323 paragraph.
1325 Left cell, second
1326 paragraph.
1328 Middle cell,
1329 consisting of
1330 exactly one
1331 paragraph.
1333 Right cell.
1335 Paragraph 2.
1337 Paragraph 3.
1339 \hline
1340 \end{longtable}
1341 Compound 7, a paragraph after the table.
1343 Compound 7, another paragraph.
1346 %___________________________________________________________________________
1348 \subsubsection*{\phantomsection%
1349 2.14.8~~~Parsed Literal Blocks%
1350 \addcontentsline{toc}{subsubsection}{2.14.8~~~Parsed Literal Blocks}%
1351 \label{parsed-literal-blocks}%
1354 \begin{quote}{\ttfamily \raggedright \noindent
1355 This~is~a~parsed~literal~block.\\
1356 ~~~~This~line~is~indented.~~The~next~line~is~blank.\\
1358 Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\
1359 text},~footnotes\DUfootnotemark{id22}{id8}{1},~%
1360 \phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
1362 \end{quote}
1365 %___________________________________________________________________________
1367 \subsection*{\phantomsection%
1368 2.15~~~Substitution Definitions%
1369 \addcontentsline{toc}{subsection}{2.15~~~Substitution Definitions}%
1370 \label{substitution-definitions}%
1373 An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example:
1375 (Substitution definitions are not visible in the HTML source.)
1378 %___________________________________________________________________________
1380 \subsection*{\phantomsection%
1381 2.16~~~Comments%
1382 \addcontentsline{toc}{subsection}{2.16~~~Comments}%
1383 \label{comments}%
1386 Here's one:
1388 % Comments begin with two dots and a space. Anything may
1389 % follow, except for the syntax of footnotes, hyperlink
1390 % targets, directives, or substitution definitions.
1392 % Double-dashes -- "--" -- must be escaped somehow in HTML output.
1394 % Comments may contain non-ASCII characters: ä ö ü æ ø å
1396 (View the HTML source to see the comment.)
1399 %___________________________________________________________________________
1401 \subsection*{\phantomsection%
1402 2.17~~~Raw text%
1403 \addcontentsline{toc}{subsection}{2.17~~~Raw text}%
1404 \label{raw-text}%
1407 This does not necessarily look nice, because there may be missing white space.
1409 It's just there to freeze the behavior.
1411 A test.
1413 Second test.
1415 \DUrole{myclass}{Another test with myclass set.}
1417 This is the \DUrole{myrawroleclass}{fourth test} with myrawroleclass set.
1419 Fifth test in LaTeX.\\Line two.
1422 %___________________________________________________________________________
1424 \subsection*{\phantomsection%
1425 2.18~~~Container%
1426 \addcontentsline{toc}{subsection}{2.18~~~Container}%
1427 \label{container}%
1430 paragraph 1
1432 paragraph 2
1434 % currently not implemented in LaTeX:
1435 % .. include:: data/header_footer.txt
1438 %___________________________________________________________________________
1440 \subsection*{\phantomsection%
1441 2.19~~~Colspanning tables%
1442 \addcontentsline{toc}{subsection}{2.19~~~Colspanning tables}%
1443 \label{colspanning-tables}%
1446 This table has a cell spanning two columns:
1448 \leavevmode
1449 \setlength{\DUtablewidth}{\linewidth}
1450 \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|}
1451 \hline
1452 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1453 Inputs
1454 }} & \textbf{%
1455 Output
1456 } \\
1457 \hline
1458 \textbf{%
1460 } & \textbf{%
1462 } & \textbf{%
1463 A or B
1464 } \\
1465 \hline
1466 \endfirsthead
1467 \hline
1468 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1469 Inputs
1470 }} & \textbf{%
1471 Output
1472 } \\
1473 \hline
1474 \textbf{%
1476 } & \textbf{%
1478 } & \textbf{%
1479 A or B
1480 } \\
1481 \hline
1482 \endhead
1483 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1484 \endfoot
1485 \endlastfoot
1487 False
1489 False
1491 False
1493 \hline
1495 True
1497 False
1499 True
1501 \hline
1503 False
1505 True
1507 True
1509 \hline
1511 True
1513 True
1515 True
1517 \hline
1518 \end{longtable}
1521 %___________________________________________________________________________
1523 \subsection*{\phantomsection%
1524 2.20~~~Rowspanning tables%
1525 \addcontentsline{toc}{subsection}{2.20~~~Rowspanning tables}%
1526 \label{rowspanning-tables}%
1529 Here's a table with cells spanning several rows:
1531 \leavevmode
1532 \setlength{\DUtablewidth}{\linewidth}
1533 \begin{longtable}[c]{|p{0.296\DUtablewidth}|p{0.156\DUtablewidth}|p{0.226\DUtablewidth}|}
1534 \hline
1535 \textbf{%
1536 Header row, column 1
1537 (header rows optional)
1538 } & \textbf{%
1539 Header 2
1540 } & \textbf{%
1541 Header 3
1542 } \\
1543 \hline
1544 \endfirsthead
1545 \hline
1546 \textbf{%
1547 Header row, column 1
1548 (header rows optional)
1549 } & \textbf{%
1550 Header 2
1551 } & \textbf{%
1552 Header 3
1553 } \\
1554 \hline
1555 \endhead
1556 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1557 \endfoot
1558 \endlastfoot
1560 body row 1, column 1
1562 column 2
1564 column 3
1566 \hline
1568 body row 2
1569 & \multirow{2}{0.16\DUtablewidth}{%
1570 Cells may
1571 span rows.
1572 } & \multirow{2}{0.23\DUtablewidth}{%
1573 Another
1574 rowspanning
1575 cell.
1576 } \\
1577 \cline{1-1}
1579 body row 3
1580 & \\
1581 \hline
1582 \end{longtable}
1585 %___________________________________________________________________________
1587 \subsection*{\phantomsection%
1588 2.21~~~Custom Roles%
1589 \addcontentsline{toc}{subsection}{2.21~~~Custom Roles}%
1590 \label{custom-roles}%
1593 \begin{itemize}
1595 \item A role based on an existing role.
1597 \texttt{\DUrole{custom}{one}} \texttt{\DUrole{custom}{two}} \texttt{\DUrole{custom}{three}}
1599 \item A new role.
1601 \DUrole{customnew}{one two three}
1603 \item A role with class attribute.
1605 \DUrole{special}{interpreted text}
1607 \item A language-switching role:
1609 Let's count in German \otherlanguage{ngerman}{eins zwei drei}.
1611 \item A role with multiple class attributes, styled with raw directives:
1613 \newcommand{\DUrolegreen}[1]{\textcolor{green}{#1}}
1614 \newcommand{\DUrolesc}[1]{\textsc{#1}}
1616 The following works in most browsers but does not validate
1617 (\texttt{<style>} is only allowed in the document head):
1619 \begin{quote}{\ttfamily \raggedright \noindent
1620 ..~raw::~html\\
1622 ~~<style~type="text/css"><!-{}-\\
1623 ~~~.green~\{color:~green;\}\\
1624 ~~~.sc~\{font-variant:~small-caps;\}\\
1625 ~~~-{}-></style>
1627 \end{quote}
1629 \otherlanguage{british}{\DUrole{green}{\DUrole{sc}{British colourful text in small-caps}}}.
1631 \end{itemize}
1634 %___________________________________________________________________________
1636 \subsection*{\phantomsection%
1637 2.22~~~Testing Math%
1638 \addcontentsline{toc}{subsection}{2.22~~~Testing Math}%
1639 \label{testing-math}%
1642 Docutils supports inline math with the prefix or postfix \texttt{:math:}
1643 role specificator, $n! + \sin(x_n^2)$ and $A_\text{c} =
1644 \frac{\pi}{4} d^2$, as well as displayed math via the
1645 \texttt{math} directive:
1647 \begin{equation*}
1648 f(\epsilon) = \frac{1}{1 + \exp\left(\frac{\varepsilon}{k_\text{B}T}\right)}
1649 \end{equation*}%
1650 \begin{equation*}
1651 N = \frac{\text{number of apples}}{7}
1652 \end{equation*}
1653 The determinant of the matrix
1655 \begin{equation*}
1656 \mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)
1657 \end{equation*}
1658 is $|\mathbf{M}| = ad - bc$.
1660 Sum and Integral with limits:
1662 \begin{equation*}
1663 \int_0^1 x^n dx = \frac{1}{n + 1}
1664 \end{equation*}%
1665 \begin{equation*}
1666 \sum_{n=1}^m n = \frac{m(m+1)}{2}
1667 \end{equation*}%
1668 \begin{description}
1669 \item[{Math-Accents:}] \leavevmode
1670 \leavevmode
1671 \setlength{\DUtablewidth}{\linewidth}
1672 \begin{longtable}[c]{p{0.315\DUtablewidth}p{0.315\DUtablewidth}p{0.315\DUtablewidth}}
1674 $\acute{a}$ \texttt{\textbackslash{}acute\{a\}}
1676 $\dot{t}$ \texttt{\textbackslash{}dot\{t\}}
1678 $\hat{\gamma}$ \texttt{\textbackslash{}hat\{\textbackslash{}gamma\}}
1681 $\grave{a}$ \texttt{\textbackslash{}grave\{a\}}
1683 $\ddot{t}$ \texttt{\textbackslash{}ddot\{t\}}
1685 $\tilde{\alpha}$ \texttt{\textbackslash{}tilde\{\textbackslash{}alpha\}}
1688 $\breve{x}$ \texttt{\textbackslash{}breve\{x\}}
1690 $\dddot{t}$ \texttt{\textbackslash{}dddot\{t\}}
1692 $\vec{\imath}$ \texttt{\textbackslash{}vec\{\textbackslash{}imath\}}
1695 $\check{a}$ \texttt{\textbackslash{}check\{a\}}
1697 $\bar{a}$ \texttt{\textbackslash{}bar\{a\}}
1699 $\vec{R}$ \texttt{\textbackslash{}vec\{R\}}
1701 \end{longtable}
1703 \end{description}
1705 % \widetilde{xxx}
1706 % \widehat{xxx}
1708 Quantum mechanics:
1710 \begin{equation*}
1711 -\frac{1}{2}\nabla^2 \psi + v \psi = \varepsilon \psi
1712 \end{equation*}
1713 Modulation Transfer Function:
1715 \begin{equation*}
1716 \text{MTF}=\left|\frac{\mathcal{F}\left\{ s(x)\right\} }
1717 {\mathcal{F}\left\{ s(x)\right\} |_{\omega_{x}=0}}\right|
1718 =\text{abs}\left(\frac{\int_{-\infty}^{\infty}s(x)
1719 \text{e}^{\text{i}\omega_{x}x}\text{d}{x}}
1720 {\int_{-\infty}^{\infty}s(x)\text{d}{x}}
1721 \right).
1722 \end{equation*}
1723 Math split over two lines:
1725 \begin{align*}
1726 g(\alpha) = & (1 + \alpha + \alpha^2 + \alpha^3 + \alpha^4\\
1727 & + \alpha^5)
1728 \end{align*}
1729 Cases (``manually'', with \texttt{matrix} environment):
1731 \begin{equation*}
1732 f(x) = \left\{
1733 \begin{matrix}
1734 -1 & x<0\\
1735 1 & x>0
1736 \end{matrix}\right.
1737 \end{equation*}
1738 Cases with the AMSmath \texttt{cases} environment is not (yet)
1739 supported by latex2MathML.
1741 % math:
1743 % \mathrm{sgn}(x) = \begin{cases}
1744 % -1 & x<0\\
1745 % 1 & x>0
1746 % \end{cases}
1749 %___________________________________________________________________________
1751 \section*{\phantomsection%
1752 3~~~Tests for the LaTeX writer%
1753 \addcontentsline{toc}{section}{3~~~Tests for the LaTeX writer}%
1754 \label{tests-for-the-latex-writer}%
1757 Test syntax elements which may cause trouble for the LaTeX writer but might
1758 not need to be tested with other writers (e.g. the HTML writer).
1761 %___________________________________________________________________________
1763 \subsection*{\phantomsection%
1764 3.1~~~Custom Roles in LaTeX%
1765 \addcontentsline{toc}{subsection}{3.1~~~Custom Roles in LaTeX}%
1766 \label{custom-roles-in-latex}%
1769 \begin{itemize}
1771 \item Role names and class arguments are converted to conform to the
1772 regular expression \texttt{{[}a-z{]}{[}-a-z0-9{]}*} (letters are downcased,
1773 accents and similar decoration is stripped, non-conforming
1774 characters are replaced by a hyphen).
1776 Class arguments may contain numbers and hyphens, which need special
1777 treatment in LaTeX command names.
1779 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}}
1781 \item With LaTeX, roles can be styled within the document using the \DUroletitlereference{raw}
1782 directive.
1784 \newcommand{\DUrolelarge}[1]{{\large #1}}
1785 \makeatletter
1786 \@namedef{DUrolesmall-caps}{\textsc}
1787 \@namedef{DUrolecustom4}{\textbf}
1788 \makeatother
1790 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}} in large, bold, small-caps.
1792 \item Custom roles can be based on standard roles:
1794 This is a \emph{\DUrole{custom-emphasis}{customized emphasis text role}}
1796 This is a \texttt{\DUrole{custom-literal}{customized literal text role}}
1798 This is a \textbf{\DUrole{custom-strong}{customized strong text role}}
1800 This is a \textsubscript{\DUrole{custom-subscript}{customized subscript text role}}
1802 This is a \textsuperscript{\DUrole{custom-superscript}{customized superscript text role}}
1804 This is a \DUroletitlereference{\DUrole{custom-title-reference}{customized title-reference text role}}
1806 \end{itemize}
1809 %___________________________________________________________________________
1811 \subsection*{\phantomsection%
1812 3.2~~~More Tables%
1813 \addcontentsline{toc}{subsection}{3.2~~~More Tables}%
1814 \label{more-tables}%
1817 A multicolumn table with multi-paragraph rowspanning cells:
1819 \leavevmode
1820 \setlength{\DUtablewidth}{\linewidth}
1821 \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}|}
1822 \hline
1824 test
1826 \textbf{bold hd}
1827 & \multicolumn{3}{p{0.41\DUtablewidth}|}{
1828 multicolumn 1
1830 With a second paragraph
1831 } &
1832 \emph{emph hd}
1834 \hline
1835 \multicolumn{2}{|p{0.31\DUtablewidth}|}{
1836 multicolumn 2
1838 With a second paragraph
1839 } &
1840 cell
1842 cell
1844 cell
1846 cell
1848 \hline
1850 cell
1851 & \multicolumn{2}{p{0.36\DUtablewidth}|}{
1852 multicolumn 3 (one line,
1853 but very very very very
1854 very looooong)
1855 } &
1856 cell
1858 cell
1860 cell
1862 \hline
1864 cell
1866 cell
1868 cell
1869 & \multicolumn{3}{p{0.38\DUtablewidth}|}{
1870 Short multicolumn 4
1871 } \\
1872 \hline
1873 \end{longtable}
1875 % This file is used by the standalone_rst_latex test.
1878 %___________________________________________________________________________
1880 \subsection*{\phantomsection%
1881 3.3~~~Option lists%
1882 \addcontentsline{toc}{subsection}{3.3~~~Option lists}%
1883 \label{id23}%
1886 The LaTeX-2e description environment is used for definition lists.
1887 The definition is continued on the same line as the term, this should
1888 not happen if a option-list is at the top of the definition.
1890 If the option list is not at the first element in the definition, it
1891 is contained in a quote
1893 \begin{quote}
1895 \begin{DUoptionlist}
1897 \item[-{}-help] show help
1899 \item[-v] verbose
1901 \end{DUoptionlist}
1903 \end{quote}
1905 \begin{description}
1906 \item[{In a definition list:}] \leavevmode %
1907 \begin{DUoptionlist}
1909 \item[-{}-help] show help
1911 \item[-v] verbose
1913 \end{DUoptionlist}
1915 \end{description}
1918 %___________________________________________________________________________
1920 \subsection*{\phantomsection%
1921 3.4~~~Monospaced non-alphanumeric characters%
1922 \addcontentsline{toc}{subsection}{3.4~~~Monospaced non-alphanumeric characters}%
1923 \label{monospaced-non-alphanumeric-characters}%
1926 These are all ASCII characters except a-zA-Z0-9 and space:
1928 \texttt{!!!"{}"{}"\#\#\#\$\$\$\%\%\%\&\&\&'{}'{}'((()))***+++,{},{},-{}-{}-...///:::}
1930 \texttt{;;;<{}<{}<===>{}>{}>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_`{}`{}`\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}}
1932 \texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
1934 The two lines of non-alphanumeric characters should both have the same
1935 width as the third line.
1938 %___________________________________________________________________________
1940 \subsection*{\phantomsection%
1941 3.5~~~Non-ASCII characters%
1942 \addcontentsline{toc}{subsection}{3.5~~~Non-ASCII characters}%
1943 \label{non-ascii-characters}%
1946 Punctuation and footnote symbols
1948 \leavevmode
1949 \setlength{\DUtablewidth}{\linewidth}
1950 \begin{longtable}[c]{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|}
1951 \hline
1955 en-dash
1957 \hline
1961 em-dash
1963 \hline
1967 single turned comma quotation mark
1969 \hline
1973 single comma quotation mark
1975 \hline
1979 low single comma quotation mark
1981 \hline
1985 double turned comma quotation mark
1987 \hline
1991 double comma quotation mark
1993 \hline
1997 low double comma quotation mark
1999 \hline
2003 dagger
2005 \hline
2009 double dagger
2011 \hline
2013 \ding{169}
2015 black diamond suit
2017 \hline
2019 \ding{170}
2021 black heart suit
2023 \hline
2025 $\spadesuit$
2027 black spade suit
2029 \hline
2031 $\clubsuit$
2033 black club suit
2035 \hline
2039 ellipsis
2041 \hline
2045 trade mark sign
2047 \hline
2049 $\Leftrightarrow$
2051 left-right double arrow
2053 \hline
2054 \end{longtable}
2056 The \DUroletitlereference{Latin-1 extended} Unicode block
2058 \leavevmode
2059 \setlength{\DUtablewidth}{\linewidth}
2060 \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}|}
2061 \hline
2085 \hline
2088 & &
2094 & &
2105 \hline
2129 \hline
2153 \hline
2177 \hline
2201 \hline
2225 \hline
2249 \hline
2273 \hline
2297 \hline
2312 & & & & \\
2313 \hline
2314 \end{longtable}
2316 \begin{itemize}
2318 \item The following line should not be wrapped, because it uses
2319 no-break spaces (\textbackslash{}u00a0):
2321 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
2323 \item Line wrapping with/without breakpoints marked by soft hyphens
2324 (\textbackslash{}u00ad):
2326 pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch
2328 pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch
2330 \item The currency sign (\textbackslash{}u00a4) is not supported by all fonts
2331 (some have an Euro sign at its place). You might see an error
2332 like:
2334 \begin{quote}{\ttfamily \raggedright \noindent
2335 !~Package~textcomp~Error:~Symbol~\textbackslash{}textcurrency~not~provided~by\\
2336 (textcomp)~~~~~~~~~~~~~~~~font~family~ptm~in~TS1~encoding.\\
2337 (textcomp)~~~~~~~~~~~~~~~~Default~family~used~instead.
2339 \end{quote}
2341 (which in case of font family ptm is a false positive). Add either
2343 \begin{DUfieldlist}
2344 \item[{warn:}]
2345 turn the error in a warning, use the default symbol (bitmap), or
2347 \item[{force,almostfull:}]
2348 use the symbol provided by the font at the users
2349 risk,
2351 \end{DUfieldlist}
2353 to the document options or use a different font package.
2355 \end{itemize}
2358 %___________________________________________________________________________
2360 \subsection*{\phantomsection%
2361 3.6~~~Encoding special chars%
2362 \addcontentsline{toc}{subsection}{3.6~~~Encoding special chars}%
2363 \label{encoding-special-chars}%
2366 The LaTeX Info pages lists under ``2.18 Special Characters''
2368 \begin{quote}
2370 The following characters play a special role in LaTeX and are called
2371 ``special printing characters'', or simply ``special characters''.
2373 \begin{quote}
2375 \# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \}
2377 \end{quote}
2379 \end{quote}
2381 The special chars verbatim:
2383 \begin{quote}{\ttfamily \raggedright \noindent
2384 \#~\$~\%~\&~\textasciitilde{}~\_~\textasciicircum{}~\textbackslash{}~\{~\}
2386 \end{quote}
2388 However also \emph{square brackets} {[}{]} need special care.
2390 \begin{quote}
2392 item and all the other commands with optional arguments check
2393 if the token right after the macro name is an opening bracket.
2394 In that case the contents between that bracket and the following
2395 closing bracket on the same grouping level are taken as the
2396 optional argument. What makes this unintuitive is the fact that
2397 the square brackets aren't grouping characters themselves, so in
2398 your last example item{[}{[}...{]}{]} the optional argument consists of
2399 {[}... (without the closing bracket).
2401 \end{quote}
2403 Compare the items in the following lists:
2405 \begin{itemize}
2407 \item simple item
2409 \item {[}bracketed{]} item
2411 \end{itemize}
2413 \begin{description}
2414 \item[{simple}] \leavevmode
2415 description term
2417 \item[{{[}bracketed{]}}] \leavevmode
2418 description term
2420 \end{description}
2422 The OT1 font-encoding has different characters for the less-than,
2423 greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}:
2425 \begin{quote}{\ttfamily \raggedright \noindent
2426 <~|~>
2428 \end{quote}
2431 %___________________________________________________________________________
2433 \subsection*{\phantomsection%
2434 3.7~~~Hyperlinks and -targets%
2435 \addcontentsline{toc}{subsection}{3.7~~~Hyperlinks and -targets}%
2436 \label{hyperlinks-and-targets}%
2439 In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a
2441 \phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or
2442 caption:
2444 \leavevmode
2445 \setlength{\DUtablewidth}{\linewidth}
2446 \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
2447 \caption{Table with %
2448 \label{hypertarget-in-table-title}hypertarget in table title.}\\
2449 \hline
2451 False
2453 True
2455 None
2457 \hline
2458 \end{longtable}
2459 \label{table-label}
2460 \begin{figure}
2461 \phantomsection\label{figure-label}
2462 \noindent\makebox[\textwidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
2463 \caption{Figure with %
2464 \label{hypertarget-in-figure-caption}hypertarget in figure caption.}
2465 \begin{DUlegend}
2466 Legend with %
2467 \phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend.
2468 \end{DUlegend}
2469 \end{figure}
2471 \includegraphics{../../../docs/user/rst/images/biohazard.png}
2472 \phantomsection\label{image-label}
2474 See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text},
2475 \hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title},
2476 \hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption},
2477 \hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and
2478 \hyperref[image-label]{image label}.
2481 %___________________________________________________________________________
2483 \subsection*{\phantomsection%
2484 3.8~~~External references%
2485 \addcontentsline{toc}{subsection}{3.8~~~External references}%
2486 \label{external-references}%
2489 Long URLs should be wrapped in the PDF.
2490 This can be achieved with the url command which is used by the LaTeX writer
2491 wheneve the content (name) of a reference node equals the link URL.
2493 \begin{description}
2494 \item[{Example:}] \leavevmode
2495 a long URL that should wrap in the output
2496 \url{http://docutils.sourceforge.net/docs/user/latex.html\#id79}
2498 \end{description}
2500 If the argument contains any ``\%'', ``\#'', or ``\textasciicircum{}\textasciicircum{}'', or ends with \texttt{\textbackslash{}}, it can't
2501 be used in the argument to another command. The argument must not contain
2502 unbalanced braces.
2504 The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a ``http:'' or ``ftp:'' URL
2505 and not recognized as part of it:
2507 \begin{DUlineblock}{0em}
2508 \item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name
2509 \item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{}
2510 \item[] \url{http://www.example.org/XML}/strange\{n\}ame
2511 \end{DUlineblock}
2513 They can, however be used in paths and/or filenames.
2515 Handling by the LaTeX writer:
2517 \begin{itemize}
2519 \item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped:
2521 \begin{DUlineblock}{0em}
2522 \item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#}
2523 \url{http://www.w3.org/XML/Schema\#dev}
2524 \item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%}
2525 \url{http://example.org/Schema\%dev}
2526 \item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{id37}{id36}{7} \url{A:DOS\\path\\}\DUfootnotemark{id38}{id36}{7}
2527 \end{DUlineblock}
2529 \DUadmonition[note]{
2530 \DUtitle[note]{Note}
2532 These URLs are typeset inside a LaTeX command without error.
2534 \begin{DUlineblock}{0em}
2535 \item[] \url{http://www.w3.org/XML/Schema\#dev}
2536 \item[] \url{http://example.org/Schema\%dev}
2537 \item[] \url{A:DOS\\path\\}\DUfootnotemark{id39}{id36}{7}
2538 \end{DUlineblock}
2541 \end{itemize}
2543 \begin{itemize}
2545 \item \textasciicircum{}\textasciicircum{} LaTeX's special syntax for characters results in ``strange'' replacements
2546 (both with href and url). A warning is given.
2548 \href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}:
2549 \url{../strange^^name}
2551 \item Unbalanced braces, \{ or \}, will fail (both with href and url):
2553 \begin{quote}{\ttfamily \raggedright \noindent
2554 `file~with~\{~<../strange\{name>`\_\_\\
2555 `<../strange\{name>`\_\_
2557 \end{quote}
2559 while balanced braces are suported:
2561 \begin{DUlineblock}{0em}
2562 \item[] \url{../strange{n}ame}
2563 \item[] \url{../st{r}ange{n}ame}
2564 \item[] \url{../{st{r}ange{n}ame}}
2565 \end{DUlineblock}
2567 \end{itemize}
2569 % unusual combinations (from newlatex, for interactive testing)
2570 % .. include:: data/latex.txt
2572 % Preface for System Messages:
2575 %___________________________________________________________________________
2577 \section*{\phantomsection%
2578 4~~~Error Handling%
2579 \addcontentsline{toc}{section}{4~~~Error Handling}%
2580 \label{error-handling}%
2583 Any errors caught during processing will generate system messages.
2585 There should be five messages in the following, auto-generated
2586 section, ``Docutils System Messages'':
2588 % section should be added by Docutils automatically
2591 %___________________________________________________________________________
2593 \section*{\phantomsection%
2594 \color{red}Docutils System Messages%
2595 \addcontentsline{toc}{section}{Docutils System Messages}%
2598 \DUadmonition[system-message]{
2599 \DUtitle[system-message]{system-message}
2600 \raisebox{1em}{\hypertarget{id27}{}}
2602 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~104
2604 \hyperlink{id28}{
2605 Undefined substitution referenced: ``problematic''.
2608 \DUadmonition[system-message]{
2609 \DUtitle[system-message]{system-message}
2610 \raisebox{1em}{\hypertarget{id40}{}}
2612 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~390
2614 \hyperlink{id41}{
2615 Unknown target name: ``5''.
2618 \DUadmonition[system-message]{
2619 \DUtitle[system-message]{system-message}
2620 \raisebox{1em}{\hypertarget{id42}{}}
2622 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~399
2624 \hyperlink{id43}{
2625 Unknown target name: ``nonexistent''.
2628 \DUadmonition[system-message]{
2629 \DUtitle[system-message]{system-message}
2630 \raisebox{1em}{\hypertarget{id44}{}}
2632 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~426
2634 \hyperlink{id45}{
2635 Unknown target name: ``hyperlink reference without a target''.
2638 \DUadmonition[system-message]{
2639 \DUtitle[system-message]{system-message}
2640 \raisebox{1em}{\hypertarget{id46}{}}
2642 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~439
2644 \hyperlink{id47}{
2645 Duplicate target name, cannot be used as a unique reference: ``duplicate target names''.
2648 \end{document}