Fix literal use of babel shorthands (straight quote, tilde, ...).
[docutils.git] / test / functional / expected / standalone_rst_latex.tex
blob767db1c30a4d8da80103c8233fd13e751747da36
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 % basic code highlight:
14 \providecommand*\DUrolecomment[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
15 \providecommand*\DUroledeleted[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
16 \providecommand*\DUrolekeyword[1]{\textbf{#1}}
17 \providecommand*\DUrolestring[1]{\textit{#1}}
18 \usepackage{color}
19 \usepackage{float} % float configuration
20 \floatplacement{figure}{H} % place figures here definitely
21 \usepackage{graphicx}
22 \usepackage{multirow}
23 \usepackage{pifont}
24 \setcounter{secnumdepth}{0}
25 \usepackage{longtable,ltcaption,array}
26 \setlength{\extrarowheight}{2pt}
27 \newlength{\DUtablewidth} % internal use in tables
28 \usepackage{tabularx}
29 \usepackage{textcomp} % text symbol macros
31 %%% Custom LaTeX preamble
32 % PDF Standard Fonts
33 \usepackage{mathptmx} % Times
34 \usepackage[scaled=.90]{helvet}
35 \usepackage{courier}
37 %%% User specified packages and stylesheets
39 %%% Fallback definitions for Docutils-specific commands
41 % providelength (provide a length variable and set default, if it is new)
42 \providecommand*{\DUprovidelength}[2]{
43 \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{}
46 % abstract title
47 \providecommand*{\DUtitleabstract}[1]{\centerline{\textbf{#1}}}
49 % admonition (specially marked topic)
50 \providecommand{\DUadmonition}[2][class-arg]{%
51 % try \DUadmonition#1{#2}:
52 \ifcsname DUadmonition#1\endcsname%
53 \csname DUadmonition#1\endcsname{#2}%
54 \else
55 \begin{center}
56 \fbox{\parbox{0.9\textwidth}{#2}}
57 \end{center}
58 \fi
61 \makeatletter
62 \@namedef{DUrolealign-center}{\centering}
63 \makeatother
66 % dedication topic
67 \providecommand{\DUtopicdedication}[1]{\begin{center}#1\end{center}}
69 % docinfo (width of docinfo table)
70 \DUprovidelength{\DUdocinfowidth}{0.9\textwidth}
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\textwidth}{#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 \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
191 \hypersetup{
192 pdftitle={reStructuredText Test Document},
193 pdfauthor={David Goodger;Me;Myself;I}
196 %%% Title Data
197 \title{\phantomsection%
198 reStructuredText Test Document%
199 \label{restructuredtext-test-document}%
200 \label{doctitle}%
201 \\ % subtitle%
202 \large{Examples of Syntax Constructs}%
203 \label{examples-of-syntax-constructs}%
204 \label{subtitle}}
205 \author{}
206 \date{}
208 %%% Body
209 \begin{document}
210 \maketitle
212 % Docinfo
213 \begin{center}
214 \begin{tabularx}{\DUdocinfowidth}{lX}
215 \textbf{Author}: &
216 David Goodger \\
217 \textbf{Address}: &
218 {\raggedright
219 123 Example Street\\
220 Example, EX Canada\\
221 A1B 2C3 } \\
222 \textbf{Contact}: &
223 \href{mailto:goodger@python.org}{goodger@python.org} \\
224 \textbf{Author}: &
225 Me \\
226 \textbf{Author}: &
227 Myself \\
228 \textbf{Author}: &
229 I \\
230 \textbf{Organization}: &
231 humankind \\
232 \textbf{Date}: &
233 Now, or yesterday. Or maybe even \emph{before} yesterday. \\
234 \textbf{Status}: &
235 This is a “work in progress” \\
236 \textbf{Revision}: &
237 is managed by a version control system. \\
238 \textbf{Version}: &
239 1 \\
240 \textbf{Copyright}: &
241 This document has been placed in the public domain. You
242 may do with it as you wish. You may copy, modify,
243 redistribute, reattribute, sell, buy, rent, lease,
244 destroy, or improve it, quote it at length, excerpt,
245 incorporate, collate, fold, staple, or mutilate it, or do
246 anything else to it that your or anyone else’s heart
247 desires. \\
248 \textbf{field name}: &
249 This is a “generic bibliographic field”.
251 \textbf{field name “2}: &
252 Generic bibliographic fields may contain multiple body elements.
254 Like this.
256 \end{tabularx}
257 \end{center}
259 \DUtopic[dedication]{
260 \DUtitle[dedication]{Dedication}
262 For Docutils users \& co-developers.
265 \DUtopic[abstract]{
266 \DUtitle[abstract]{Abstract}
268 This is a test document, containing at least one example of each
269 reStructuredText construct.
272 % This is a comment. Note how any initial comments are moved by
273 % transforms to after the document title, subtitle, and docinfo.
275 % Above is the document title, and below is the subtitle.
276 % They are transformed from section titles after parsing.
278 % bibliographic fields (which also require a transform):
280 \pagebreak[4] % start ToC on new page
282 \phantomsection\label{table-of-contents}
283 \pdfbookmark[1]{Table of Contents}{table-of-contents}
284 \renewcommand{\contentsname}{Table of Contents}
285 \tableofcontents
289 \section{1~~~Structural Elements%
290 \label{structural-elements}%
294 \subsection{1.1~~~Section Title%
295 \label{section-title}%
297 \subsubsection*{Section Subtitle}
299 Lone subsections are converted to a section subtitle by a transform
300 activated with the \texttt{-{}-section-subtitles} command line option or the
301 \texttt{sectsubtitle-xform} configuration value.
304 \subsection{1.2~~~Empty Section%
305 \label{empty-section}%
309 \subsection{1.3~~~Transitions%
310 \label{transitions}%
313 Here’s a transition:
316 %___________________________________________________________________________
317 \DUtransition
320 It divides the section. Transitions may also occur between sections:
323 %___________________________________________________________________________
324 \DUtransition
328 \section{2~~~Body Elements%
329 \label{body-elements}%
333 \subsection{2.1~~~Paragraphs%
334 \label{paragraphs}%
337 A paragraph.
340 \subsubsection{2.1.1~~~Inline Markup%
341 \label{inline-markup}%
344 Paragraphs contain text and may contain inline markup: \emph{emphasis},
345 \textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks
346 (\url{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\DUfootnotemark{id30}{id29}{5}), internal
347 cross-references (\hyperref[example]{example}), external hyperlinks with embedded URIs
348 (\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink
349 references}\DUfootnotemark{id38}{id29}{5} (\href{http://docutils.sourceforge.net/}{a second reference}\DUfootnotemark{id40}{id39}{8}), footnote references (manually
350 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]}),
351 substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png}), and %
352 \phantomsection\label{inline-hyperlink-targets}inline hyperlink targets
353 (see \hyperref[targets]{Targets} below for a reference back to here). Character-level
354 inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by %
355 \raisebox{1em}{\hypertarget{id28}{}}\hyperlink{id27}{\textbf{\color{red}|problematic|}} text
356 (generated by processing errors; this one is intentional). Here is a
357 reference to the \hyperref[doctitle]{doctitle} and the \hyperref[subtitle]{subtitle}.
359 The default role for interpreted text is \DUroletitlereference{Title Reference}. Here are
360 some explicit interpreted text roles: a PEP reference (\href{http://www.python.org/dev/peps/pep-0287}{PEP 287}); an
361 RFC reference (\href{http://www.faqs.org/rfcs/rfc2822.html}{RFC 2822}); an abbreviation (\DUrole{abbreviation}{abb.}), an acronym
362 (\DUrole{acronym}{reST}), code (\texttt{\DUrole{code}{print \textquotedbl{}hello world\textquotedbl{}}}); a \textsubscript{subscript};
363 a \textsuperscript{superscript} and explicit roles for \DUroletitlereference{Docutils}
364 \emph{standard} \textbf{inline} \texttt{markup}.
366 % DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
368 Let’s test wrapping and whitespace significance in inline literals:
369 \texttt{This is an example of -{}-inline-literal -{}-text, -{}-including some-{}-
370 strangely-{}-hyphenated-words. ~Adjust-the-width-of-your-browser-window
371 to see how the text is wrapped. ~-{}- -{}-{}-{}- -{}-{}-{}-{}-{}-{}-{}- ~Now note ~ ~the
372 spacing ~ ~between the ~ ~words of ~ ~this sentence ~ ~(words
373 should ~ ~be grouped ~ ~in pairs).}
375 If the \texttt{-{}-pep-references} option was supplied, there should be a
376 live link to PEP 258 here.
379 \subsection{2.2~~~Bullet Lists%
380 \label{bullet-lists}%
383 \begin{itemize}
385 \item A bullet list
387 \begin{itemize}
389 \item Nested bullet list.
391 \item Nested item 2.
393 \end{itemize}
395 \item Item 2.
397 Paragraph 2 of item 2.
399 \begin{itemize}
401 \item Nested bullet list.
403 \item Nested item 2.
405 \begin{itemize}
407 \item Third level.
409 \item Item 2.
411 \end{itemize}
413 \item Nested item 3.
415 \item This nested list should be compacted by the HTML writer.
417 \phantomsection\label{target}
418 % Even if this item contains a target and a comment.
420 \end{itemize}
422 \end{itemize}
425 \subsection{2.3~~~Enumerated Lists%
426 \label{enumerated-lists}%
428 \newcounter{listcnt0}
429 \begin{list}{\arabic{listcnt0}.}
431 \usecounter{listcnt0}
432 \setlength{\rightmargin}{\leftmargin}
435 \item Arabic numerals.
436 \newcounter{listcnt1}
437 \begin{list}{\alph{listcnt1})}
439 \usecounter{listcnt1}
440 \setlength{\rightmargin}{\leftmargin}
443 \item lower alpha)
444 \newcounter{listcnt2}
445 \begin{list}{(\roman{listcnt2})}
447 \usecounter{listcnt2}
448 \setlength{\rightmargin}{\leftmargin}
451 \item (lower roman)
452 \newcounter{listcnt3}
453 \begin{list}{\Alph{listcnt3}.}
455 \usecounter{listcnt3}
456 \setlength{\rightmargin}{\leftmargin}
459 \item upper alpha.
460 \newcounter{listcnt4}
461 \begin{list}{\Roman{listcnt4})}
463 \usecounter{listcnt4}
464 \setlength{\rightmargin}{\leftmargin}
467 \item upper roman)
468 \end{list}
469 \end{list}
470 \end{list}
471 \end{list}
473 \item Lists that don’t start at 1:
474 \setcounter{listcnt1}{0}
475 \begin{list}{\arabic{listcnt1}.}
477 \usecounter{listcnt1}
478 \addtocounter{listcnt1}{2}
479 \setlength{\rightmargin}{\leftmargin}
482 \item Three
484 \item Four
485 \end{list}
486 \setcounter{listcnt1}{0}
487 \begin{list}{\Alph{listcnt1}.}
489 \usecounter{listcnt1}
490 \addtocounter{listcnt1}{2}
491 \setlength{\rightmargin}{\leftmargin}
494 \item C
496 \item D
497 \end{list}
498 \setcounter{listcnt1}{0}
499 \begin{list}{\roman{listcnt1}.}
501 \usecounter{listcnt1}
502 \addtocounter{listcnt1}{2}
503 \setlength{\rightmargin}{\leftmargin}
506 \item iii
508 \item iv
509 \end{list}
510 \end{list}
513 \subsection{2.4~~~Definition Lists%
514 \label{definition-lists}%
517 \begin{description}
518 \item[{Term}] \leavevmode
519 Definition
521 \item[{Term}] \leavevmode (\textbf{classifier})
523 Definition paragraph 1.
525 Definition paragraph 2.
527 \item[{Term}] \leavevmode
528 Definition
530 \item[{Term}] \leavevmode (\textbf{classifier one})
531 (\textbf{classifier two})
533 Definition
535 \end{description}
538 \subsection{2.5~~~Field Lists%
539 \label{field-lists}%
542 \begin{DUfieldlist}
543 \item[{what:}]
544 Field lists map field names to field bodies, like database
545 records. They are often part of an extension syntax. They are
546 an unambiguous variant of RFC 2822 fields.
548 \item[{how arg1 arg2:}]
549 The field marker is a colon, the field name, and a colon.
551 The field body may contain one or more body elements, indented
552 relative to the field marker.
554 \item[{credits:}]
555 \DUrole{credits}{This paragraph has the \DUroletitlereference{credits} class set. (This is actually not
556 about credits but just for ensuring that the class attribute
557 doesn’t get stripped away.)}
559 \end{DUfieldlist}
562 \subsection{2.6~~~Option Lists%
563 \label{option-lists}%
566 For listing command-line options:
568 \begin{DUoptionlist}
570 \item[-a] command-line option “a”
572 \item[-b file] options can have arguments
573 and long descriptions
575 \item[-{}-long] options can be long also
577 \item[-{}-input=file] long options can also have
578 arguments
580 \item[-{}-very-long-option] The description can also start on the next line.
582 The description may contain multiple body elements,
583 regardless of where it starts.
585 \item[-x, -y, -z] Multiple options are an “option group”.
587 \item[-v, -{}-verbose] Commonly-seen: short \& long options.
589 \item[-1 file, -{}-one=file, -{}-two file] Multiple options with arguments.
591 \item[/V] DOS/VMS-style options too
593 \end{DUoptionlist}
595 There must be at least two spaces between the option and the
596 description.
599 \subsection{2.7~~~Literal Blocks%
600 \label{literal-blocks}%
603 Literal blocks are indicated with a double-colon (“::”) at the end of
604 the preceding paragraph (over there \texttt{-{}->}). They can be indented:
606 \begin{quote}{\ttfamily \raggedright \noindent
607 if~literal\_block:\\
608 ~~~~text~=~'is~left~as-is'\\
609 ~~~~spaces\_and\_linebreaks~=~'are~preserved'\\
610 ~~~~markup\_processing~=~None
612 \end{quote}
614 Or they can be quoted without indentation:
616 \begin{quote}{\ttfamily \raggedright \noindent
617 >{}>~Great~idea!\\
619 >~Why~didn't~I~think~of~that?
621 \end{quote}
624 \subsection{2.8~~~Line Blocks%
625 \label{line-blocks}%
628 This section tests line blocks. Line blocks are body elements which
629 consist of lines and other line blocks. Nested line blocks cause
630 indentation.
632 \begin{DUlineblock}{0em}
633 \item[] This is a line block. It ends with a blank line.
634 \item[]
635 \begin{DUlineblock}{\DUlineblockindent}
636 \item[] New lines begin with a vertical bar (“|”).
637 \item[] Line breaks and initial indent are significant, and preserved.
638 \item[]
639 \begin{DUlineblock}{\DUlineblockindent}
640 \item[] Continuation lines are also possible. A long line that is intended
641 to wrap should begin with a space in place of the vertical bar.
642 \end{DUlineblock}
643 \item[] The left edge of a continuation line need not be aligned with
644 the left edge of the text above it.
645 \end{DUlineblock}
646 \end{DUlineblock}
648 \begin{DUlineblock}{0em}
649 \item[] This is a second line block.
650 \item[]
651 \item[] Blank lines are permitted internally, but they must begin with a “|”.
652 \end{DUlineblock}
654 Another line block, surrounded by paragraphs:
656 \begin{DUlineblock}{0em}
657 \item[] And it’s no good waiting by the window
658 \item[] It’s no good waiting for the sun
659 \item[] Please believe me, the things you dream of
660 \item[] They don’t fall in the lap of no-one
661 \end{DUlineblock}
663 Take it away, Eric the Orchestra Leader!
665 \begin{quote}
667 \begin{DUlineblock}{0em}
668 \item[] A one, two, a one two three four
669 \item[]
670 \item[] Half a bee, philosophically,
671 \item[]
672 \begin{DUlineblock}{\DUlineblockindent}
673 \item[] must, \emph{ipso facto}, half not be.
674 \end{DUlineblock}
675 \item[] But half the bee has got to be,
676 \item[]
677 \begin{DUlineblock}{\DUlineblockindent}
678 \item[] \emph{vis a vis} its entity. D’you see?
679 \item[]
680 \end{DUlineblock}
681 \item[] But can a bee be said to be
682 \item[]
683 \begin{DUlineblock}{\DUlineblockindent}
684 \item[] or not to be an entire bee,
685 \item[]
686 \begin{DUlineblock}{\DUlineblockindent}
687 \item[] when half the bee is not a bee,
688 \item[]
689 \begin{DUlineblock}{\DUlineblockindent}
690 \item[] due to some ancient injury?
691 \item[]
692 \end{DUlineblock}
693 \end{DUlineblock}
694 \end{DUlineblock}
695 \item[] Singing…
696 \end{DUlineblock}
698 \end{quote}
700 A line block, like the following poem by Christian Morgenstern, can
701 also be centre-aligned:
703 \begin{DUlineblock}{0em}
704 \foreignlanguage{ngerman}{\DUrole{align-center}{
705 \item[] \textbf{Die Trichter}
706 \item[]
707 \item[] Zwei Trichter wandeln durch die Nacht.
708 \item[] Durch ihres Rumpfs verengten Schacht
709 \item[] fließt weißes Mondlicht
710 \item[] still und heiter
711 \item[] auf ~ ihren
712 \item[] Waldweg
713 \item[] u. s.
714 \item[] w.
715 \item[]
717 \end{DUlineblock}
720 \subsection{2.9~~~Block Quotes%
721 \label{block-quotes}%
724 Block quotes consist of indented body elements:
726 \begin{quote}
728 My theory by A. Elk. Brackets Miss, brackets. This theory goes
729 as follows and begins now. All brontosauruses are thin at one
730 end, much much thicker in the middle and then thin again at the
731 far end. That is my theory, it is mine, and belongs to me and I
732 own it, and what it is too.
733 \nopagebreak
735 \raggedleft —Anne Elk (Miss)
737 \end{quote}
739 The language of a quote (like any other object) can be specified by
740 a class attribute:
744 \begin{quote}
745 \foreignlanguage{french}{
746 ReStructuredText est un langage de balisage léger utilisé
747 notamment dans la documentation du langage Python.
749 \end{quote}
752 \subsection{2.10~~~Doctest Blocks%
753 \label{doctest-blocks}%
756 \begin{quote}{\ttfamily \raggedright \noindent
757 >{}>{}>~print~'Python-specific~usage~examples;~begun~with~\textquotedbl{}>{}>{}>\textquotedbl{}'\\
758 Python-specific~usage~examples;~begun~with~\textquotedbl{}>{}>{}>\textquotedbl{}\\
759 >{}>{}>~print~'(cut~and~pasted~from~interactive~Python~sessions)'\\
760 (cut~and~pasted~from~interactive~Python~sessions)
762 \end{quote}
765 \subsection{2.11~~~Footnotes%
766 \label{footnotes}%
769 \DUfootnotetext{id8}{id1}{1}{%
770 A footnote contains body elements, consistently indented by at
771 least 3 spaces.
773 This is the footnote’s second paragraph.
776 \DUfootnotetext{label}{id3}{2}{\phantomsection\label{label}%
777 Footnotes may be numbered, either manually (as in\DUfootnotemark{id9}{id8}{1}) or
778 automatically using a “\#”-prefixed label. This footnote has a
779 label so it can be referred to from multiple places, both as a
780 footnote reference (\DUfootnotemark{id10}{label}{2}) and as a \hyperref[label]{hyperlink reference}.
783 \DUfootnotetext{id12}{id2}{3}{%
784 This footnote is numbered automatically and anonymously using a
785 label of “\#” only.
787 This is the second paragraph.
789 And this is the third paragraph.
792 \DUfootnotetext{id13}{id4}{*}{%
793 Footnotes may also use symbols, specified with a “*” label.
794 Here’s a reference to the next footnote:\DUfootnotemark{id14}{id15}{}.
797 \DUfootnotetext{id15}{id14}{}{%
798 This footnote shows the next symbol in the sequence.
801 \DUfootnotetext{id16}{id16}{4}{%
802 Here’s an unreferenced footnote, with a reference to a
803 nonexistent footnote:%
804 \raisebox{1em}{\hypertarget{id46}{}}%
805 \raisebox{1em}{\hypertarget{id17}{}}\hyperlink{id45}{\textbf{\color{red}{[}5{]}\_}}.
809 \subsection{2.12~~~Citations%
810 \label{citations}%
812 \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
813 Citations are text-labeled footnotes. They may be
814 rendered separately and differently from footnotes.
815 \end{figure}
817 Here’s a reference to the above, \hyperlink{cit2002}{[CIT2002]}, and a %
818 \raisebox{1em}{\hypertarget{id48}{}}%
819 \raisebox{1em}{\hypertarget{id19}{}}\hyperlink{id47}{\textbf{\color{red}{[}nonexistent{]}\_}}
820 citation.
823 \subsection{2.13~~~Targets%
824 \label{targets}%
825 \label{another-target}%
828 \phantomsection\label{example}
829 This paragraph is pointed to by the explicit “example” target. A
830 reference can be found under \hyperref[inline-markup]{Inline Markup}, above. \hyperref[inline-hyperlink-targets]{Inline
831 hyperlink targets} are also possible.
833 Section headers are implicit targets, referred to by name. See
834 \hyperref[targets]{Targets}, which is a subsection of \hyperref[body-elements]{Body Elements}.
836 Explicit external targets are interpolated into references such as
837 \href{http://www.python.org/}{Python}\DUfootnotemark{id31}{id29}{5}”.
839 Targets may be indirect and anonymous. Thus \hyperref[targets]{this phrase} may also
840 refer to the \hyperref[targets]{Targets} section.
842 Here’s a %
843 \raisebox{1em}{\hypertarget{id50}{}}\hyperlink{id49}{\textbf{\color{red}`hyperlink reference without a target`\_}}, which generates an
844 error.
847 \subsubsection{2.13.1~~~Duplicate Target Names%
848 \label{duplicate-target-names}%
851 Duplicate names in section headers or other implicit targets will
852 generate “info” (level-1) system messages. Duplicate names in
853 explicit targets will generate “warning” (level-2) system messages.
856 \subsubsection{2.13.2~~~Duplicate Target Names%
857 \label{id21}%
860 Since there are two “Duplicate Target Names” section headers, we
861 cannot uniquely refer to either of them by name. If we try to (like
862 this: %
863 \raisebox{1em}{\hypertarget{id52}{}}\hyperlink{id51}{\textbf{\color{red}`Duplicate Target Names`\_}}), an error is generated.
866 \subsection{2.14~~~Directives%
867 \label{directives}%
870 \phantomsection\label{contents}
871 These are just a sample of the many reStructuredText Directives. For
872 others, please see
873 \url{http://docutils.sourceforge.net/docs/ref/rst/directives.html}.
876 \subsubsection{2.14.1~~~Document Parts%
877 \label{document-parts}%
880 An example of the “contents” directive can be seen above this section
881 (a local, untitled table of \hyperref[contents]{contents}) and at the beginning of the
882 document (a document-wide \hyperref[table-of-contents]{table of contents}).
885 \subsubsection{2.14.2~~~Images and Figures%
886 \label{images-and-figures}%
889 An image directive (also clickable – a hyperlink reference):
891 \hyperref[directives]{\includegraphics{../../../docs/user/rst/images/title.png}}
893 Image with multiple IDs:
895 \includegraphics{../../../docs/user/rst/images/title.png}
896 \phantomsection\label{image-target-3}\label{image-target-2}\label{image-target-1}
898 A centered image:
900 \noindent\makebox[\textwidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
902 A left-aligned image:
904 \noindent{\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill}
906 This paragraph might flow around the image.
907 The specific behavior depends upon the style sheet and
908 the browser or rendering software used.
910 A right-aligned image:
912 \noindent{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}}
914 This paragraph might flow around the image.
915 The specific behavior depends upon the style sheet and
916 the browser or rendering software used.
918 For inline images see \hyperref[substitution-definitions]{Substitution Definitions}.
920 Image size:
922 An image 2 em wide:
924 \includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png}
926 An image 2 em wide and 15 pixel high:
928 \includegraphics[height=15px,width=2em]{../../../docs/user/rst/images/biohazard.png}
930 An image occupying 50\% of the line width:
932 \includegraphics[width=0.500\linewidth]{../../../docs/user/rst/images/title.png}
934 An image 2 cm high:
936 \includegraphics[height=2cm]{../../../docs/user/rst/images/biohazard.png}
938 A \emph{figure} is an image with a caption and/or a legend. With page-based output
939 media, figures might float to a different position if this helps the page
940 layout.
941 \begin{figure}
942 \noindent\makebox[\textwidth][c]{\includegraphics[width=258bp]{../../../docs/user/rst/images/title.png}}
943 \caption{Plaintext markup syntax and parser system.}
944 \begin{DUlegend}
945 \setlength{\DUtablewidth}{\linewidth}
946 \begin{longtable*}[c]{|p{0.156\DUtablewidth}|p{0.563\DUtablewidth}|}
947 \hline
951 Revised, revisited, based on ‘re’ module.
953 \hline
955 Structured
957 Structure-enhanced text, structuredtext.
959 \hline
961 Text
963 Well it is, isn’t it?
965 \hline
966 \end{longtable*}
968 This paragraph is also part of the legend.
969 \end{DUlegend}
970 \end{figure}
972 A left-aligned figure:
973 \begin{figure}
974 \noindent\makebox[\textwidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
975 \caption{This is the caption.}
976 \begin{DUlegend}
977 This is the legend.
979 The legend may consist of several paragraphs.
980 \end{DUlegend}
981 \end{figure}
983 This paragraph might flow around the figure.
985 The specific behavior depends upon the style sheet and the browser or
986 rendering software used.
988 A centered figure:
989 \begin{figure}
990 \noindent\makebox[\textwidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
991 \caption{This is the caption.}
992 \begin{DUlegend}
993 This is the legend.
995 The legend may consist of several paragraphs.
996 \end{DUlegend}
997 \end{figure}
999 This paragraph might flow around the figure.
1001 The specific behavior depends upon the style sheet and the browser or
1002 rendering software used.
1004 A right-aligned figure:
1005 \begin{figure}
1006 \noindent\makebox[\textwidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
1007 \caption{This is the caption.}
1008 \begin{DUlegend}
1009 This is the legend.
1011 The legend may consist of several paragraphs.
1012 \end{DUlegend}
1013 \end{figure}
1015 This paragraph might flow around the figure. The specific behavior depends
1016 upon the style sheet and the browser or rendering software used.
1019 \subsubsection{2.14.3~~~Admonitions%
1020 \label{admonitions}%
1023 \DUadmonition[attention]{
1024 \DUtitle[attention]{Attention!}
1026 Directives at large.
1029 \DUadmonition[caution]{
1030 \DUtitle[caution]{Caution!}
1032 Don’t take any wooden nickels.
1035 \DUadmonition[danger]{
1036 \DUtitle[danger]{!DANGER!}
1038 Mad scientist at work!
1041 \DUadmonition[error]{
1042 \DUtitle[error]{Error}
1044 Does not compute.
1047 \DUadmonition[hint]{
1048 \DUtitle[hint]{Hint}
1050 It’s bigger than a bread box.
1053 \DUadmonition[important]{
1054 \DUtitle[important]{Important}
1056 \begin{itemize}
1058 \item Wash behind your ears.
1060 \item Clean up your room.
1062 \item Call your mother.
1064 \item Back up your data.
1066 \end{itemize}
1069 \DUadmonition[note]{
1070 \DUtitle[note]{Note}
1072 This is a note.
1075 \DUadmonition[tip]{
1076 \DUtitle[tip]{Tip}
1078 15\% if the service is good.
1081 \DUadmonition[warning]{
1082 \DUtitle[warning]{Warning}
1084 Strong prose may provoke extreme mental exertion.
1085 Reader discretion is strongly advised.
1088 \DUadmonition[admonition-and-by-the-way]{
1089 \DUtitle[admonition-and-by-the-way]{And, by the way…}
1091 You can make up your own admonition too.
1095 \subsubsection{2.14.4~~~Topics, Sidebars, and Rubrics%
1096 \label{topics-sidebars-and-rubrics}%
1099 \emph{Sidebars} are like miniature, parallel documents.
1101 \DUsidebar{
1102 \DUtitle[title]{Sidebar Title}
1104 \DUsubtitle[sidebar]{Optional Subtitle}
1106 This is a sidebar. It is for text outside the flow of the main
1107 text.
1109 \DUrubric{This is a rubric inside a sidebar}
1111 Sidebars often appear beside the main text with a border and a different
1112 background or font color.
1115 A \emph{topic} is like a block quote with a title, or a self-contained section
1116 with no subsections.
1118 \DUtopic[]{
1119 \DUtitle[title]{Topic Title}
1121 This is a topic.
1124 A \emph{rubric} is like an informal heading that doesn’t correspond to the
1125 document’s structure. It is typically highlighted in red (hence the name).
1127 \DUrubric{This is a rubric}
1129 Topics and rubrics can be used at places where a \hyperref[section-title]{section title} is not
1130 allowed (e.g. inside a directive).
1133 \subsubsection{2.14.5~~~Target Footnotes%
1134 \label{target-footnotes}%
1137 \DUfootnotetext{id29}{id30}{5}{%
1138 \url{http://www.python.org/}
1141 \DUfootnotetext{id33}{id34}{6}{%
1142 \url{http://pygments.org/}
1145 \DUfootnotetext{id35}{id36}{7}{%
1146 \url{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}
1149 \DUfootnotetext{id39}{id40}{8}{%
1150 \url{http://docutils.sourceforge.net/}
1153 \DUfootnotetext{id41}{id42}{9}{%
1154 \url{A:DOS\\path\\}
1158 \subsubsection{2.14.6~~~Replacement Text%
1159 \label{replacement-text}%
1162 I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\DUfootnotemark{id32}{id29}{5}.
1165 \subsubsection{2.14.7~~~Compound Paragraph%
1166 \label{compound-paragraph}%
1169 Compound 1, paragraph 1.
1171 Compound 1, paragraph 2.
1173 \begin{itemize}
1175 \item Compound 1, list item one.
1177 \item Compound 1, list item two.
1179 \end{itemize}
1181 Another compound statement:
1183 Compound 2, a literal block:
1185 \begin{quote}{\ttfamily \raggedright \noindent
1186 Compound~2,~literal.
1188 \end{quote}
1189 Compound 2, this is a test.
1191 Compound 3, only consisting of one paragraph.
1193 \begin{quote}{\ttfamily \raggedright \noindent
1194 Compound~4.\\
1195 This~one~starts~with~a~literal~block.
1197 \end{quote}
1198 Compound 4, a paragraph.
1200 Now something \emph{really} perverted – a nested compound block. This is
1201 just to test that it works at all; the results don’t have to be
1202 meaningful.
1204 Compound 5, block 1 (a paragraph).
1206 Compound 6, block 2 in compound 5.
1208 Compound 6, another paragraph.
1210 Compound 5, block 3 (a paragraph).
1212 Compound 7, with a table inside:
1214 \setlength{\DUtablewidth}{\linewidth}
1215 \begin{longtable*}[c]{|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|}
1216 \hline
1218 Left cell, first
1219 paragraph.
1221 Left cell, second
1222 paragraph.
1224 Middle cell,
1225 consisting of
1226 exactly one
1227 paragraph.
1229 Right cell.
1231 Paragraph 2.
1233 Paragraph 3.
1235 \hline
1236 \end{longtable*}
1237 Compound 7, a paragraph after the table.
1239 Compound 7, another paragraph.
1242 \subsubsection{2.14.8~~~Parsed Literal Blocks%
1243 \label{parsed-literal-blocks}%
1246 \begin{quote}{\ttfamily \raggedright \noindent
1247 This~is~a~parsed~literal~block.\\
1248 ~~~~This~line~is~indented.~~The~next~line~is~blank.\\
1250 Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\
1251 text},~footnotes\DUfootnotemark{id22}{id8}{1},~%
1252 \phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
1254 \end{quote}
1257 \subsubsection{2.14.9~~~Code%
1258 \label{code}%
1261 Blocks of source code can be set with the \DUroletitlereference{code} directive. If the code
1262 language is specified, the content is parsed and tagged by the \href{http://pygments.org/}{Pygments}\DUfootnotemark{id34}{id33}{6}
1263 syntax highlighter and can be formatted with a style sheet. (Code parsing
1264 is turned off using the \texttt{syntax-highlight} config setting in the test
1265 conversions in order to get identical results with/without installed
1266 Pygments highlighter.)
1268 \begin{quote}{\ttfamily \raggedright \noindent
1269 print~'This~is~Python~code.'
1271 \end{quote}
1273 The \texttt{:number-lines:} option (with optional start value) generates line
1274 numbers:
1276 \begin{quote}{\ttfamily \raggedright \noindent
1277 \DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
1278 \DUrole{ln}{~9~}for~i~in~range(10):\\
1279 \DUrole{ln}{10~}~~~~print~i
1281 \end{quote}
1283 For inline code snippets, there is the \DUroletitlereference{code} role, which can be used
1284 directly (the code will not be parsed/tagged, as the language is not known)
1285 or as base for special code roles, e.g. the LaTeX code in the next
1286 paragraph.
1288 Docutils uses LaTeX syntax for math directives and roles:
1289 \texttt{\DUrole{code}{\DUrole{tex}{\textbackslash{}alpha = f(x)}}} prints $\alpha = f(x)$.
1291 The \texttt{:code:} option of the \DUroletitlereference{include} directive sets the included content
1292 as a code block, here the rst file \texttt{header\_footer.txt} with line numbers:
1294 \begin{quote}{\ttfamily \raggedright \noindent
1295 \DUrole{ln}{1~}..~header::~Document~header\\
1296 \DUrole{ln}{2~}..~footer::~Document~footer
1298 \end{quote}
1301 \subsection{2.15~~~Substitution Definitions%
1302 \label{substitution-definitions}%
1305 An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example:
1307 (Substitution definitions are not visible in the HTML source.)
1310 \subsection{2.16~~~Comments%
1311 \label{comments}%
1314 Here’s one:
1316 % Comments begin with two dots and a space. Anything may
1317 % follow, except for the syntax of footnotes, hyperlink
1318 % targets, directives, or substitution definitions.
1320 % Double-dashes -- "--" -- must be escaped somehow in HTML output.
1322 % Comments may contain non-ASCII characters: ä ö ü æ ø å
1324 (View the HTML source to see the comment.)
1327 \subsection{2.17~~~Raw text%
1328 \label{raw-text}%
1331 This does not necessarily look nice, because there may be missing white space.
1333 It’s just there to freeze the behavior.
1335 A test.
1337 Second test.
1339 \DUrole{myclass}{Another test with myclass set.}
1341 This is the \DUrole{myrawroleclass}{fourth test} with myrawroleclass set.
1343 Fifth test in LaTeX.\\Line two.
1346 \subsection{2.18~~~Container%
1347 \label{container}%
1350 paragraph 1
1352 paragraph 2
1354 % currently not implemented in LaTeX:
1355 % .. include:: data/header_footer.txt
1358 \subsection{2.19~~~Colspanning tables%
1359 \label{colspanning-tables}%
1362 This table has a cell spanning two columns:
1364 \setlength{\DUtablewidth}{\linewidth}
1365 \begin{longtable*}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|}
1366 \hline
1367 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1368 Inputs
1369 }} & \textbf{%
1370 Output
1371 } \\
1372 \hline
1373 \textbf{%
1375 } & \textbf{%
1377 } & \textbf{%
1378 A or B
1379 } \\
1380 \hline
1381 \endfirsthead
1382 \hline
1383 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1384 Inputs
1385 }} & \textbf{%
1386 Output
1387 } \\
1388 \hline
1389 \textbf{%
1391 } & \textbf{%
1393 } & \textbf{%
1394 A or B
1395 } \\
1396 \hline
1397 \endhead
1398 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1399 \endfoot
1400 \endlastfoot
1402 False
1404 False
1406 False
1408 \hline
1410 True
1412 False
1414 True
1416 \hline
1418 False
1420 True
1422 True
1424 \hline
1426 True
1428 True
1430 True
1432 \hline
1433 \end{longtable*}
1436 \subsection{2.20~~~Rowspanning tables%
1437 \label{rowspanning-tables}%
1440 Here’s a table with cells spanning several rows:
1442 \setlength{\DUtablewidth}{\linewidth}
1443 \begin{longtable*}[c]{|p{0.296\DUtablewidth}|p{0.156\DUtablewidth}|p{0.226\DUtablewidth}|}
1444 \hline
1445 \textbf{%
1446 Header row, column 1
1447 (header rows optional)
1448 } & \textbf{%
1449 Header 2
1450 } & \textbf{%
1451 Header 3
1452 } \\
1453 \hline
1454 \endfirsthead
1455 \hline
1456 \textbf{%
1457 Header row, column 1
1458 (header rows optional)
1459 } & \textbf{%
1460 Header 2
1461 } & \textbf{%
1462 Header 3
1463 } \\
1464 \hline
1465 \endhead
1466 \multicolumn{3}{c}{\hfill ... continued on next page} \\
1467 \endfoot
1468 \endlastfoot
1470 body row 1, column 1
1472 column 2
1474 column 3
1476 \hline
1478 body row 2
1479 & \multirow{2}{0.16\DUtablewidth}{%
1480 Cells may
1481 span rows.
1482 } & \multirow{2}{0.23\DUtablewidth}{%
1483 Another
1484 rowspanning
1485 cell.
1486 } \\
1487 \cline{1-1}
1489 body row 3
1490 & \\
1491 \hline
1492 \end{longtable*}
1495 \subsection{2.21~~~Custom Roles%
1496 \label{custom-roles}%
1499 \begin{itemize}
1501 \item A role based on an existing role.
1503 \texttt{\DUrole{custom}{one}} \texttt{\DUrole{custom}{two}} \texttt{\DUrole{custom}{three}}
1505 \item A new role.
1507 \DUrole{customnew}{one two three}
1509 \item A role with class attribute.
1511 \DUrole{special}{interpreted text}
1513 \item A language-switching role:
1515 Let’s count in German \foreignlanguage{ngerman}{eins zwei drei}.
1517 \item A role with multiple class attributes, styled with raw directives:
1519 \newcommand{\DUrolegreen}[1]{\textcolor{green}{#1}}
1520 \newcommand{\DUrolesc}[1]{\textsc{#1}}
1522 The following works in most browsers but does not validate
1523 (\texttt{<style>} is only allowed in the document head):
1525 \begin{quote}{\ttfamily \raggedright \noindent
1526 ..~raw::~html\\
1528 ~~<style~type=\textquotedbl{}text/css\textquotedbl{}><!-{}-\\
1529 ~~~.green~\{color:~green;\}\\
1530 ~~~.sc~\{font-variant:~small-caps;\}\\
1531 ~~~-{}-></style>
1533 \end{quote}
1535 \foreignlanguage{british}{\DUrole{green}{\DUrole{sc}{British colourful text in small-caps}}}.
1537 \end{itemize}
1540 \subsection{2.22~~~Mathematics%
1541 \label{mathematics}%
1544 Docutils supports inline math with the prefix or postfix \texttt{:math:}
1545 role specificator, $n! + \sin(x_n^2)$ and $A_\text{c} =
1546 \frac{\pi}{4} d^2$, as well as displayed math via the
1547 \DUroletitlereference{math} directive:
1549 \begin{equation*}
1550 f(\epsilon) = \frac{1}{1 + \exp\left(\frac{\varepsilon}{k_\text{B}T}\right)}
1551 \end{equation*}
1552 Content may start on the first line of the directive, e.g.
1554 \begin{equation*}
1555 N = \frac{\text{number of apples}}{7}
1556 \end{equation*}
1557 Equations can be labeled with a reference name using the \texttt{:name:} option.
1558 See \hyperref[eq-m]{eq:M} and \hyperref[eq-schrodinger]{eq:schrödinger} below.
1560 The determinant of the matrix
1562 \begin{equation*}
1563 \mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)
1564 \phantomsection
1565 \label{eq-m}
1566 \end{equation*}
1567 is $|\mathbf{M}| = ad - bc$.
1569 More than one display math block can be put in one math directive.
1570 For example, the following sum and integral with limits:
1572 \begin{equation*}
1573 \int_0^1 x^n dx = \frac{1}{n + 1}
1574 \end{equation*}%
1575 \begin{equation*}
1576 \sum_{n=1}^m n = \frac{m(m+1)}{2}
1577 \end{equation*}
1578 LaTeX-supported Unicode math symbols can be used in math roles and
1579 directives:
1581 The Schrödinger equation
1583 \begin{equation*}
1584 i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi ,
1585 \phantomsection
1586 \label{eq-schrodinger}
1587 \end{equation*}
1588 with the \emph{wave function} $\Psi $, describes how the quantum state of a
1589 physical system changes in time.
1591 \begin{description}
1592 \item[{Math-Accents:}] \leavevmode
1593 \setlength{\DUtablewidth}{\linewidth}
1594 \begin{longtable*}[c]{p{0.315\DUtablewidth}p{0.315\DUtablewidth}p{0.315\DUtablewidth}}
1596 $\acute{a}$ \texttt{\textbackslash{}acute\{a\}}
1598 $\dot{t}$ \texttt{\textbackslash{}dot\{t\}}
1600 $\hat{\gamma}$ \texttt{\textbackslash{}hat\{\textbackslash{}gamma\}}
1603 $\grave{a}$ \texttt{\textbackslash{}grave\{a\}}
1605 $\ddot{t}$ \texttt{\textbackslash{}ddot\{t\}}
1607 $\tilde{\alpha}$ \texttt{\textbackslash{}tilde\{\textbackslash{}alpha\}}
1610 $\breve{x}$ \texttt{\textbackslash{}breve\{x\}}
1612 $\dddot{t}$ \texttt{\textbackslash{}dddot\{t\}}
1614 $\vec{\imath}$ \texttt{\textbackslash{}vec\{\textbackslash{}imath\}}
1617 $\check{a}$ \texttt{\textbackslash{}check\{a\}}
1619 $\bar{a}$ \texttt{\textbackslash{}bar\{a\}}
1621 $\vec{R}$ \texttt{\textbackslash{}vec\{R\}}
1623 \end{longtable*}
1625 \end{description}
1627 % \widetilde{xxx}
1628 % \widehat{xxx}
1630 Modulation Transfer Function:
1632 \begin{equation*}
1633 \text{MTF} = \left|\frac{\mathcal{F}\{s(x)\}}
1634 {\mathcal{F}\{ s(x)\} |_{\omega _{x}=0}}\right|
1635 = \mathrm{abs}\left(\frac
1636 {\int _{-\infty }^{\infty }s(x) \mathrm{e}^{\mathrm{i}\omega _{x}x}\mathrm{d}{x}}
1637 {\int _{-\infty }^{\infty }s(x)\mathrm{d}{x}}
1638 \right).
1639 \end{equation*}
1640 Math split over two lines: If a double backslash is detected outside a
1641 \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}
1642 \texttt{align} environment:
1644 \begin{align*}
1645 s_{\mathrm{out}}(x) & = s_{\mathrm{in}}(x') * s_\delta (x-x') \\
1646 & = \int s_{\mathrm{in}}(x')s_\delta (x-x')\mathrm{d}x'
1647 \end{align*}
1648 Cases (“manually”, with \texttt{matrix} environment):
1650 \begin{equation*}
1651 \mathrm{sgn}(x) = \left\{\begin{matrix}
1652 -1 & x<0\\
1653 1 & x>0
1654 \end{matrix}\right.
1655 \end{equation*}
1656 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
1657 HTML writers with \texttt{-{}-math-output=MathML}):
1659 \begin{equation*}
1660 \mathrm{sgn}(x) = \begin{cases}
1661 -1 & x<0\\
1662 1 & x>0
1663 \end{cases}
1664 \end{equation*}
1666 \section{3~~~Tests for the LaTeX writer%
1667 \label{tests-for-the-latex-writer}%
1670 Test syntax elements which may cause trouble for the LaTeX writer but might
1671 not need to be tested with other writers (e.g. the HTML writer).
1674 \subsection{3.1~~~Custom Roles in LaTeX%
1675 \label{custom-roles-in-latex}%
1678 \begin{itemize}
1680 \item Role names and class arguments are converted to conform to the
1681 regular expression \texttt{{[}a-z{]}{[}-a-z0-9{]}*} (letters are downcased,
1682 accents and similar decoration is stripped, non-conforming
1683 characters are replaced by a hyphen).
1685 Class arguments may contain numbers and hyphens, which need special
1686 treatment in LaTeX command names.
1688 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}}
1690 \item With LaTeX, roles can be styled within the document using the \DUroletitlereference{raw}
1691 directive.
1693 \newcommand{\DUrolelarge}[1]{{\large #1}}
1694 \makeatletter
1695 \@namedef{DUrolesmall-caps}{\textsc}
1696 \@namedef{DUrolecustom4}{\textbf}
1697 \makeatother
1699 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Interpreted Text}}}}} in large, bold, small-caps.
1701 \item Custom roles can be based on standard roles:
1703 This is a \emph{\DUrole{custom-emphasis}{customized emphasis text role}}
1705 This is a \texttt{\DUrole{custom-literal}{customized literal text role}}
1707 This is a \textbf{\DUrole{custom-strong}{customized strong text role}}
1709 This is a \textsubscript{\DUrole{custom-subscript}{customized subscript text role}}
1711 This is a \textsuperscript{\DUrole{custom-superscript}{customized superscript text role}}
1713 This is a \DUroletitlereference{\DUrole{custom-title-reference}{customized title-reference text role}}
1715 \end{itemize}
1718 \subsection{3.2~~~More Tables%
1719 \label{more-tables}%
1722 A multicolumn table with multi-paragraph rowspanning cells:
1724 \setlength{\DUtablewidth}{\linewidth}
1725 \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}|}
1726 \hline
1728 test
1730 \textbf{bold hd}
1731 & \multicolumn{3}{p{0.41\DUtablewidth}|}{
1732 multicolumn 1
1734 With a second paragraph
1735 } &
1736 \emph{emph hd}
1738 \hline
1739 \multicolumn{2}{|p{0.31\DUtablewidth}|}{
1740 multicolumn 2
1742 With a second paragraph
1743 } &
1744 cell
1746 cell
1748 cell
1750 cell
1752 \hline
1754 cell
1755 & \multicolumn{2}{p{0.36\DUtablewidth}|}{
1756 multicolumn 3 (one line,
1757 but very very very very
1758 very looooong)
1759 } &
1760 cell
1762 cell
1764 cell
1766 \hline
1768 cell
1770 cell
1772 cell
1773 & \multicolumn{3}{p{0.38\DUtablewidth}|}{
1774 Short multicolumn 4
1775 } \\
1776 \hline
1777 \end{longtable*}
1779 % This file is used by the standalone_rst_latex test.
1782 \subsection{3.3~~~Option lists%
1783 \label{id23}%
1786 The LaTeX-2e description environment is used for definition lists.
1787 The definition is continued on the same line as the term, this should
1788 not happen if a option-list is at the top of the definition.
1790 If the option list is not at the first element in the definition, it
1791 is contained in a quote
1793 \begin{quote}
1795 \begin{DUoptionlist}
1797 \item[-{}-help] show help
1799 \item[-v] verbose
1801 \end{DUoptionlist}
1803 \end{quote}
1805 \begin{description}
1806 \item[{In a definition list:}] \leavevmode %
1807 \begin{DUoptionlist}
1809 \item[-{}-help] show help
1811 \item[-v] verbose
1813 \end{DUoptionlist}
1815 \end{description}
1818 \subsection{3.4~~~Monospaced non-alphanumeric characters%
1819 \label{monospaced-non-alphanumeric-characters}%
1822 These are all ASCII characters except a-zA-Z0-9 and space:
1824 \texttt{!!!\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'{}'{}'((()))***+++,{},{},-{}-{}-...///:::}
1826 \texttt{;;;<{}<{}<===>{}>{}>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_`{}`{}`\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}}
1828 \texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
1830 The two lines of non-alphanumeric characters should both have the same
1831 width as the third line.
1834 \subsection{3.5~~~Non-ASCII characters%
1835 \label{non-ascii-characters}%
1838 Punctuation and footnote symbols
1840 \setlength{\DUtablewidth}{\linewidth}
1841 \begin{longtable*}[c]{|p{0.028\DUtablewidth}|p{0.424\DUtablewidth}|}
1842 \hline
1846 en-dash
1848 \hline
1852 em-dash
1854 \hline
1858 single turned comma quotation mark
1860 \hline
1864 single comma quotation mark
1866 \hline
1870 low single comma quotation mark
1872 \hline
1876 double turned comma quotation mark
1878 \hline
1882 double comma quotation mark
1884 \hline
1888 low double comma quotation mark
1890 \hline
1894 dagger
1896 \hline
1900 double dagger
1902 \hline
1904 \ding{169}
1906 black diamond suit
1908 \hline
1910 \ding{170}
1912 black heart suit
1914 \hline
1916 $\spadesuit$
1918 black spade suit
1920 \hline
1922 $\clubsuit$
1924 black club suit
1926 \hline
1930 ellipsis
1932 \hline
1936 trade mark sign
1938 \hline
1940 $\Leftrightarrow$
1942 left-right double arrow
1944 \hline
1945 \end{longtable*}
1947 The \DUroletitlereference{Latin-1 extended} Unicode block
1949 \setlength{\DUtablewidth}{\linewidth}
1950 \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}|}
1951 \hline
1975 \hline
1978 & &
1984 & &
1995 \hline
2019 \hline
2043 \hline
2067 \hline
2091 \hline
2115 \hline
2139 \hline
2163 \hline
2187 \hline
2202 & & & & \\
2203 \hline
2204 \end{longtable*}
2206 \begin{itemize}
2208 \item The following line should not be wrapped, because it uses
2209 no-break spaces (\textbackslash{}u00a0):
2211 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
2213 \item Line wrapping with/without breakpoints marked by soft hyphens
2214 (\textbackslash{}u00ad):
2216 pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch
2218 pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch
2220 \item The currency sign (\textbackslash{}u00a4) is not supported by all fonts
2221 (some have an Euro sign at its place). You might see an error
2222 like:
2224 \begin{quote}{\ttfamily \raggedright \noindent
2225 !~Package~textcomp~Error:~Symbol~\textbackslash{}textcurrency~not~provided~by\\
2226 (textcomp)~~~~~~~~~~~~~~~~font~family~ptm~in~TS1~encoding.\\
2227 (textcomp)~~~~~~~~~~~~~~~~Default~family~used~instead.
2229 \end{quote}
2231 (which in case of font family ptm is a false positive). Add either
2233 \begin{DUfieldlist}
2234 \item[{warn:}]
2235 turn the error in a warning, use the default symbol (bitmap), or
2237 \item[{force,almostfull:}]
2238 use the symbol provided by the font at the users
2239 risk,
2241 \end{DUfieldlist}
2243 to the document options or use a different font package.
2245 \end{itemize}
2248 \subsection{3.6~~~Encoding special chars%
2249 \label{encoding-special-chars}%
2252 The LaTeX Info pages lists under “2.18 Special Characters”
2254 \begin{quote}
2256 The following characters play a special role in LaTeX and are called
2257 “special printing characters”, or simply “special characters”.
2259 \begin{quote}
2261 \# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \}
2263 \end{quote}
2265 \end{quote}
2267 The special chars verbatim:
2269 \begin{quote}{\ttfamily \raggedright \noindent
2270 \#~\$~\%~\&~\textasciitilde{}~\_~\textasciicircum{}~\textbackslash{}~\{~\}
2272 \end{quote}
2274 However also \emph{square brackets} {[}{]} need special care.
2276 \begin{quote}
2278 item and all the other commands with optional arguments check
2279 if the token right after the macro name is an opening bracket.
2280 In that case the contents between that bracket and the following
2281 closing bracket on the same grouping level are taken as the
2282 optional argument. What makes this unintuitive is the fact that
2283 the square brackets aren’t grouping characters themselves, so in
2284 your last example item{[}{[}{]}{]} the optional argument consists of
2285 {[}… (without the closing bracket).
2287 \end{quote}
2289 Compare the items in the following lists:
2291 \begin{itemize}
2293 \item simple item
2295 \item {[}bracketed{]} item
2297 \end{itemize}
2299 \begin{description}
2300 \item[{simple}] \leavevmode
2301 description term
2303 \item[{{[}bracketed{]}}] \leavevmode
2304 description term
2306 \end{description}
2308 The OT1 font-encoding has different characters for the less-than,
2309 greater-than and bar, < | >, except for typewriter font \DUroletitlereference{cmtt}:
2311 \begin{quote}{\ttfamily \raggedright \noindent
2312 <~|~>
2314 \end{quote}
2317 \subsection{3.7~~~Hyperlinks and -targets%
2318 \label{hyperlinks-and-targets}%
2321 In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a
2323 \phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a longtable or
2324 caption:
2326 \setlength{\DUtablewidth}{\linewidth}
2327 \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
2328 \caption{Table with %
2329 \label{hypertarget-in-table-title}hypertarget in table title.}\\
2330 \hline
2332 False
2334 True
2336 None
2338 \hline
2339 \end{longtable}
2340 \label{table-label}
2341 \begin{figure}
2342 \phantomsection\label{figure-label}
2343 \noindent\makebox[\textwidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
2344 \caption{Figure with %
2345 \label{hypertarget-in-figure-caption}hypertarget in figure caption.}
2346 \begin{DUlegend}
2347 Legend with %
2348 \phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend.
2349 \end{DUlegend}
2350 \end{figure}
2352 \includegraphics{../../../docs/user/rst/images/biohazard.png}
2353 \phantomsection\label{image-label}
2355 See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text},
2356 \hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title},
2357 \hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption},
2358 \hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and
2359 \hyperref[image-label]{image label}.
2362 \subsection{3.8~~~External references%
2363 \label{external-references}%
2366 Long URLs should be wrapped in the PDF.
2367 This can be achieved with the url command which is used by the LaTeX writer
2368 whenever the content (name) of a reference node equals the link URL.
2370 \begin{description}
2371 \item[{Example:}] \leavevmode
2372 a long URL that should wrap in the output
2373 \url{http://docutils.sourceforge.net/docs/user/latex.html\#id79}
2375 \end{description}
2377 If the argument contains any “\%”, “\#”, or “\textasciicircum{}\textasciicircum{}”, or ends with \texttt{\textbackslash{}}, it can’t
2378 be used in the argument to another command. The argument must not contain
2379 unbalanced braces.
2381 The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a “http:” or “ftp:” URL
2382 and not recognized as part of it:
2384 \begin{DUlineblock}{0em}
2385 \item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name
2386 \item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{}
2387 \item[] \url{http://www.example.org/XML}/strange\{n\}ame
2388 \end{DUlineblock}
2390 They can, however be used in paths and/or filenames.
2392 Handling by the LaTeX writer:
2394 \begin{itemize}
2396 \item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped:
2398 \begin{DUlineblock}{0em}
2399 \item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#}
2400 \url{http://www.w3.org/XML/Schema\#dev}
2401 \item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%}
2402 \url{http://example.org/Schema\%dev}
2403 \item[] \href{A:DOS\\path\\}{file with DOS path}\DUfootnotemark{id42}{id41}{9} \url{A:DOS\\path\\}\DUfootnotemark{id43}{id41}{9}
2404 \end{DUlineblock}
2406 \DUadmonition[note]{
2407 \DUtitle[note]{Note}
2409 These URLs are typeset inside a LaTeX command without error.
2411 \begin{DUlineblock}{0em}
2412 \item[] \url{http://www.w3.org/XML/Schema\#dev}
2413 \item[] \url{http://example.org/Schema\%dev}
2414 \item[] \url{A:DOS\\path\\}\DUfootnotemark{id44}{id41}{9}
2415 \end{DUlineblock}
2418 \end{itemize}
2420 \begin{itemize}
2422 \item \textasciicircum{}\textasciicircum{} LaTeX’s special syntax for characters results in “strange” replacements
2423 (both with href and url). A warning is given.
2425 \href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}:
2426 \url{../strange^^name}
2428 \item Unbalanced braces, \{ or \}, will fail (both with href and url):
2430 \begin{quote}{\ttfamily \raggedright \noindent
2431 `file~with~\{~<../strange\{name>`\_\_\\
2432 `<../strange\{name>`\_\_
2434 \end{quote}
2436 while balanced braces are suported:
2438 \begin{DUlineblock}{0em}
2439 \item[] \url{../strange{n}ame}
2440 \item[] \url{../st{r}ange{n}ame}
2441 \item[] \url{../{st{r}ange{n}ame}}
2442 \end{DUlineblock}
2444 \end{itemize}
2447 \subsection{3.9~~~Section titles with \hyperref[inline-markup]{inline markup}%
2448 \label{section-titles-with-inline-markup}%
2452 \subsubsection{3.9.1~~~\emph{emphasized}, H\textsubscript{2}O and $x^2$%
2453 \label{emphasized-h2o-and-x-2}%
2457 \subsubsection{3.9.2~~~Substitutions work%
2458 \label{substitutions-fail}%
2462 \subsection{3.10~~~Deeply nested sections%
2463 \label{deeply-nested-sections}%
2466 In LaTeX and HTML,
2469 \subsubsection{3.10.1~~~Level 3%
2470 \label{level-3}%
2473 nested sections
2476 \paragraph{3.10.1.1~~~level 4%
2477 \label{level-4}%
2480 reach at some level
2483 \subparagraph{3.10.1.1.1~~~level 5%
2484 \label{level-5}%
2487 (depending on the document class)
2490 \DUtitle[sectionVI]{3.10.1.1.1.1~~~level 6%
2491 \label{level-6}%
2494 an unsupported level.
2496 % unusual combinations (from newlatex, for interactive testing)
2497 % .. include:: data/latex.txt
2499 % Preface for System Messages:
2502 \section{4~~~Error Handling%
2503 \label{error-handling}%
2506 Any errors caught during processing will generate system messages.
2508 There should be five messages in the following, auto-generated
2509 section, “Docutils System Messages”:
2511 % section should be added by Docutils automatically
2514 \section[Docutils System Messages]{\color{red}Docutils System Messages%
2517 \DUadmonition[system-message]{
2518 \DUtitle[system-message]{system-message}
2519 \raisebox{1em}{\hypertarget{id27}{}}
2521 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~104
2523 \hyperlink{id28}{
2524 Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}.
2527 \DUadmonition[system-message]{
2528 \DUtitle[system-message]{system-message}
2529 \raisebox{1em}{\hypertarget{id45}{}}
2531 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~391
2533 \hyperlink{id46}{
2534 Unknown target name: \textquotedbl{}5\textquotedbl{}.
2537 \DUadmonition[system-message]{
2538 \DUtitle[system-message]{system-message}
2539 \raisebox{1em}{\hypertarget{id47}{}}
2541 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~400
2543 \hyperlink{id48}{
2544 Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
2547 \DUadmonition[system-message]{
2548 \DUtitle[system-message]{system-message}
2549 \raisebox{1em}{\hypertarget{id49}{}}
2551 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~427
2553 \hyperlink{id50}{
2554 Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}.
2557 \DUadmonition[system-message]{
2558 \DUtitle[system-message]{system-message}
2559 \raisebox{1em}{\hypertarget{id51}{}}
2561 {\color{red}ERROR/3} in \texttt{functional/input/data/standard.txt}, line~440
2563 \hyperlink{id52}{
2564 Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}.
2567 \end{document}