Debian Codegraph @

test/functional/expected/latex_memoir.tex

raw
1 % generated by Docutils <https://docutils.sourceforge.io/>
2 \documentclass[a4paper]{memoir}
3
4 \usepackage[T1]{fontenc}
5 \usepackage{alltt}
6 \usepackage{amsmath}
7 \usepackage[british,french,ngerman,main=english]{babel}
8 % Prevent side-effects if French hyphenation patterns are not loaded:
9 \frenchbsetup{StandardLayout}
10 \AtBeginDocument{\selectlanguage{english}\noextrasfrench}
11 \usepackage{color}
12 \usepackage{float} % extended float configuration
13 \floatplacement{figure}{H} % place figures here definitely
14 \usepackage{graphicx}
15 \usepackage{multirow}
16 \usepackage{pifont}
17 \setcounter{secnumdepth}{-1}
18 \usepackage{longtable,ltcaption,array}
19 \setlength{\extrarowheight}{2pt}
20 \newlength{\DUtablewidth} % internal use in tables
21 \usepackage{tabularx}
22
23 %%% Custom LaTeX preamble
24 % PDF Standard Fonts
25 \usepackage{mathptmx} % Times
26 \usepackage[scaled=.90]{helvet}
27 \usepackage{courier}
28
29 %%% User specified packages and stylesheets
30
31 %%% Fallback definitions for Docutils-specific commands
32
33 % class handling for environments (block-level elements)
34 % \begin{DUclass}{spam} tries \DUCLASSspam and
35 % \end{DUclass}{spam} tries \endDUCLASSspam
36 \ifdefined\DUclass
37 \else % poor man's "provideenvironment"
38 \newenvironment{DUclass}[1]%
39 {% "#1" does not work in end-part of environment.
40 \def\DocutilsClassFunctionName{DUCLASS#1}
41 \csname \DocutilsClassFunctionName \endcsname}%
42 {\csname end\DocutilsClassFunctionName \endcsname}%
43 \fi
44
45 % Provide a length variable and set default, if it is new
46 \providecommand*{\DUprovidelength}[2]{%
47 \ifdefined#1
48 \else
49 \newlength{#1}\setlength{#1}{#2}%
50 \fi
51 }
52
53 % abstract title
54 \providecommand*{\DUtitleabstract}[1]{\centerline{\textbf{#1}}}
55
56 % admonition (specially marked topic)
57 \providecommand{\DUadmonition}[2][class-arg]{%
58 % try \DUadmonition#1{#2}:
59 \ifcsname DUadmonition#1\endcsname%
60 \csname DUadmonition#1\endcsname{#2}%
61 \else
62 \begin{center}
63 \fbox{\parbox{0.9\linewidth}{#2}}
64 \end{center}
65 \fi
66 }
67
68 % special topic for dedications
69 \providecommand*{\DUCLASSdedication}{%
70 \renewenvironment{quote}{\begin{center}}{\end{center}}%
71 }
72
73 % width of docinfo table
74 \DUprovidelength{\DUdocinfowidth}{0.9\linewidth}
75
76 % subtitle (in document title)
77 \providecommand*{\DUdocumentsubtitle}[1]{{\large #1}}
78 \newcounter{enumv}
79
80 % error admonition title
81 \providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}}
82
83 % field list environment (for separate configuration of `field lists`)
84 \ifdefined\DUfieldlist
85 \else
86 \newenvironment{DUfieldlist}%
87 {\quote\description}
88 {\enddescription\endquote}
89 \fi
90
91 % numbered or symbol footnotes with hyperlinks and backlinks
92 \providecommand*{\DUfootnotemark}[3]{%
93 \raisebox{1em}{\hypertarget{#1}{}}%
94 \hyperref[#2]{\textsuperscript{#3}}%
95 }
96 \providecommand{\DUfootnotetext}[4]{%
97 \begingroup%
98 \renewcommand{\thefootnote}{%
99 \protect\phantomsection\protect\label{#1}
100 \protect\hyperlink{#2}{#3}}%
101 \footnotetext{#4}%
102 \endgroup%
103 }
104
105 % custom inline roles: \DUrole{#1}{#2} tries \DUrole#1{#2}
106 \providecommand*{\DUrole}[2]{%
107 \ifcsname DUrole#1\endcsname%
108 \csname DUrole#1\endcsname{#2}%
109 \else%
110 #2%
111 \fi%
112 }
113
114 % legend environment (in figures and formal tables)
115 \ifdefined\DUlegend
116 \else
117 \newenvironment{DUlegend}{\small}{}
118 \fi
119
120 % line block environment
121 \DUprovidelength{\DUlineblockindent}{2.5em}
122 \ifdefined\DUlineblock
123 \else
124 \newenvironment{DUlineblock}[1]{%
125 \list{}{\setlength{\partopsep}{\parskip}
126 \addtolength{\partopsep}{\baselineskip}
127 \setlength{\topsep}{0pt}
128 \setlength{\itemsep}{0.15\baselineskip}
129 \setlength{\parsep}{0pt}
130 \setlength{\leftmargin}{#1}}
131 \raggedright
132 }
133 {\endlist}
134 \fi
135
136 % list of command line options
137 \providecommand*{\DUoptionlistlabel}[1]{\bfseries #1 \hfill}
138 \DUprovidelength{\DUoptionlistindent}{3cm}
139 \ifdefined\DUoptionlist
140 \else
141 \newenvironment{DUoptionlist}{%
142 \list{}{\setlength{\labelwidth}{\DUoptionlistindent}
143 \setlength{\rightmargin}{1cm}
144 \setlength{\leftmargin}{\rightmargin}
145 \addtolength{\leftmargin}{\labelwidth}
146 \addtolength{\leftmargin}{\labelsep}
147 \renewcommand{\makelabel}{\DUoptionlistlabel}}
148 }
149 {\endlist}
150 \fi
151
152 % informal heading
153 \providecommand*{\DUrubric}[1]{\subsubsection*{\emph{#1}}}
154
155 % text outside the main text flow
156 \providecommand{\DUsidebar}[1]{%
157 \begin{center}
158 \colorbox[gray]{0.80}{\parbox{0.9\linewidth}{#1}}
159 \end{center}
160 }
161
162 % subtitle (for sidebar)
163 \providecommand*{\DUsubtitle}[1]{\par\emph{#1}\smallskip}
164
165 % title for topics, admonitions, unsupported section levels, and sidebar
166 \providecommand*{\DUtitle}[2][class-arg]{%
167 % call \DUtitle#1{#2} if it exists:
168 \ifcsname DUtitle#1\endcsname%
169 \csname DUtitle#1\endcsname{#2}%
170 \else
171 \smallskip\noindent\textbf{#2}\smallskip%
172 \fi
173 }
174
175 % titlereference standard role
176 \providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
177
178 % transition (break / fancybreak / anonymous section)
179 \providecommand*{\DUtransition}{%
180 \hspace*{\fill}\hrulefill\hspace*{\fill}
181 \vskip 0.5\baselineskip
182 }
183 % hyperlinks:
184 \ifdefined\hypersetup
185 \else
186 \usepackage[hyperfootnotes=false,
187 colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
188 \usepackage{bookmark}
189 \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
190 \fi
191 \hypersetup{
192 pdftitle={reStructuredText Test Document},
193 pdfkeywords={reStructuredText, test, parser},
194 pdfinfo={description={A test document, containing at least one example of each reStructuredText construct.}},
195 pdfauthor={David Goodger; Me; Myself; I}
196 }
197
198 \title{reStructuredText Test Document%
199 \protect\label{doctitle}%
200 \\%
201 \DUdocumentsubtitle{Examples of Syntax Constructs}%
202 \protect\label{subtitle}}
203 \author{David Goodger\\
204 123 Example Street\\
205 Example, EX Canada\\
206 A1B 2C3\\
207 \href{mailto:[email protected]}{[email protected]} \and
208 Me \quad Myself \quad I\\
209 humankind}
210 \date{Now, or yesterday. Or maybe even \emph{before} yesterday.}
211
212 %%% Body
213 \begin{document}
214 \begin{titlingpage}
215 \thispagestyle{empty}
216 \maketitle
217
218 % Docinfo
219 \begin{center}
220 \begin{tabularx}{\DUdocinfowidth}{lX}
221 \textbf{Status}: & This is a \textquotedbl{}work in progress\textquotedbl{} \\
222 \textbf{Revision}: & is managed by a version control system. \\
223 \textbf{Version}: & 1 \\
224 \textbf{Copyright}: &
225 This document has been placed in the public domain. You
226 may do with it as you wish. You may copy, modify,
227 redistribute, reattribute, sell, buy, rent, lease,
228 destroy, or improve it, quote it at length, excerpt,
229 incorporate, collate, fold, staple, or mutilate it, or do
230 anything else to it that your or anyone else's heart
231 desires. \\
232 \textbf{field name}: &
233 This is a \textquotedbl{}generic bibliographic field\textquotedbl{}.
234 \\
235 \textbf{field name \textquotedbl{}2\textquotedbl{}}: &
236 Generic bibliographic fields may contain multiple body elements.
237
238 Like this.
239 \\
240 \end{tabularx}
241 \end{center}
242
243 \begin{DUclass}{dedication}
244 \begin{quote}
245 \DUtitle[dedication]{Dedication}
246
247 For Docutils users \& co-developers.
248 \end{quote}
249 \end{DUclass}
250
251 \begin{DUclass}{abstract}
252 \begin{quote}
253 \DUtitle[abstract]{Abstract}
254
255 This is a test document, containing at least one example of each
256 reStructuredText construct.
257 \end{quote}
258 \end{DUclass}
259
260 \end{titlingpage}
261
262 % This is a comment. Note how any initial comments are moved by
263 % transforms to after the document title, subtitle, and docinfo.
264
265 % Above is the document title, and below is the subtitle.
266 % They are transformed from section titles after parsing.
267
268 % bibliographic fields (which also require a transform):
269
270 \pagebreak[4] % start ToC on new page
271
272 \phantomsection\label{table-of-contents}
273 \renewcommand{\contentsname}{Table of Contents}
274 \tableofcontents
275
276
277 \chapter{1   Structural Elements}
278
279
280 \section{1.1   Section Title%
281 \label{section-title}%
282 }
283
284
285 \subsection{1.1.1   Section Subtitle}
286
287 Lone subsections are converted to a section subtitle by a transform
288 activated with the \texttt{-{}-section-subtitles} command line option or the
289 \texttt{sectsubtitle-xform} configuration value.
290
291
292 \section{1.2   Empty Section}
293
294
295 \section{1.3   Transitions}
296
297 Here's a transition:
298
299 %___________________________________________________________________________
300 \DUtransition
301
302 It divides the section. Transitions may also occur between sections:
303
304 %___________________________________________________________________________
305 \DUtransition
306
307
308 \chapter{2   Body Elements%
309 \label{body-elements}%
310 }
311
312
313 \section{2.1   Paragraphs}
314
315 A paragraph.
316
317
318 \subsection{2.1.1   Inline Markup%
319 \label{inline-markup}%
320 }
321
322 Paragraphs contain text and may contain inline markup: \emph{emphasis},
323 \textbf{strong emphasis}, \texttt{inline literals}, standalone hyperlinks
324 (\url{http://www.python.org}), external hyperlinks (\href{http://www.python.org/}{Python}\DUfootnotemark{footnote-reference-10}{footnote-6}{5}), internal
325 cross-references (\hyperref[example]{example}), external hyperlinks with embedded URIs
326 (\href{http://www.python.org}{Python web site}), \href{http://www.python.org/}{anonymous hyperlink
327 references}\DUfootnotemark{footnote-reference-16}{footnote-6}{5} (\href{https://docutils.sourceforge.io/}{a second reference}\DUfootnotemark{footnote-reference-17}{footnote-9}{8}), footnote references (manually
328 numbered\DUfootnotemark{footnote-reference-1}{footnote-1}{1}, anonymous auto-numbered\DUfootnotemark{footnote-reference-2}{footnote-2}{3}, labeled auto-numbered\DUfootnotemark{footnote-reference-3}{label}{2}, or symbolic\DUfootnotemark{footnote-reference-4}{footnote-3}{*}), citation references (see \hyperlink{cit2002}{[CIT2002]}),
329 substitution references (\includegraphics{../../../docs/user/rst/images/biohazard.png} \&
330 a \emph{trimmed heart} \texttt{(U+2665):}\ding{170}), and %
331 \phantomsection\label{inline-hyperlink-targets}inline hyperlink targets
332 (see \hyperref[targets]{Targets} below for a reference back to here). Character-level
333 inline markup is also possible (although exceedingly ugly!) in \emph{re}\texttt{Structured}\emph{Text}. Problems are indicated by %
334 \raisebox{1em}{\hypertarget{problematic-1}{}}\hyperlink{system-message-1}{\textbf{\color{red}|problematic|}} text
335 (generated by processing errors; this one is intentional). Here is a
336 reference to the \hyperref[doctitle]{doctitle} and the \hyperref[subtitle]{subtitle}.
337
338 The default role for interpreted text is \DUroletitlereference{Title Reference}. Here are
339 some explicit interpreted text roles: a PEP reference (\href{https://peps.python.org/pep-0287}{PEP 287}); an
340 RFC reference (\href{https://tools.ietf.org/html/rfc2822.html}{RFC 2822}); an abbreviation (\DUrole{abbreviation}{abb.}), an acronym
341 (\DUrole{acronym}{reST}), code (\texttt{\DUrole{code}{print \textquotedbl{}hello world\textquotedbl{}}}); a \textsubscript{subscript};
342 a \textsuperscript{superscript} and explicit roles for \DUroletitlereference{Docutils}'
343 \emph{standard} \textbf{inline} \texttt{markup}.
344
345 % DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
346
347 Let's test wrapping and whitespace significance in inline literals:
348 \texttt{This is an example of -{}-inline-literal -{}-text, -{}-including some-{}-
349 strangely-{}-hyphenated-words. ~Adjust-the-width-of-your-browser-window
350 to see how the text is wrapped. ~-{}- -{}-{}-{}- -{}-{}-{}-{}-{}-{}-{}- ~Now note ~ ~the
351 spacing ~ ~between the ~ ~words of ~ ~this sentence ~ ~(words
352 should ~ ~be grouped ~ ~in pairs).}
353
354 If the \texttt{-{}-pep-references} option was supplied, there should be a
355 live link to PEP 258 here.
356
357
358 \section{2.2   Bullet Lists}
359
360 \begin{itemize}
361 \item A bullet list
362
363 \begin{itemize}
364 \item Nested bullet list.
365
366 \item Nested item 2.
367 \end{itemize}
368
369 \item Item 2.
370
371 Paragraph 2 of item 2.
372
373 \begin{itemize}
374 \item Nested bullet list.
375
376 \item Nested item 2.
377
378 \begin{itemize}
379 \item Third level.
380
381 \item Item 2.
382 \end{itemize}
383
384 \item Nested item 3.
385
386 \item This nested list should be compacted by the HTML writer.
387
388 \phantomsection\label{target}
389 % Even if this item contains a target and a comment.
390 \end{itemize}
391 \end{itemize}
392
393
394 \section{2.3   Enumerated Lists}
395
396 \begin{enumerate}
397 \item Arabic numerals.
398
399 \begin{enumerate}
400 \renewcommand{\labelenumii}{\alph{enumii})}
401 \item lower alpha)
402
403 \begin{enumerate}
404 \renewcommand{\labelenumiii}{(\roman{enumiii})}
405 \item (lower roman)
406
407 \begin{enumerate}
408 \item upper alpha.
409
410 \begin{list}{\Roman{enumv})}{\usecounter{enumv}}
411 \item upper roman)
412 \end{list}
413 \end{enumerate}
414 \end{enumerate}
415 \end{enumerate}
416
417 \item Lists that don't start at 1:
418
419 \begin{enumerate}
420 \renewcommand{\labelenumii}{\arabic{enumii}.}
421 \setcounter{enumii}{2}
422 \item Three
423
424 \item Four
425 \end{enumerate}
426
427 \begin{enumerate}
428 \renewcommand{\labelenumii}{\Alph{enumii}.}
429 \setcounter{enumii}{2}
430 \item C
431
432 \item D
433 \end{enumerate}
434
435 \begin{enumerate}
436 \renewcommand{\labelenumii}{\roman{enumii}.}
437 \setcounter{enumii}{2}
438 \item iii
439
440 \item iv
441 \end{enumerate}
442 \end{enumerate}
443
444
445 \section{2.4   Definition Lists}
446
447 \begin{description}
448 \item[{Term}]
449 Definition
450
451 \item[{Term}] (\textbf{classifier})
452 Definition paragraph 1.
453
454 Definition paragraph 2.
455
456 \item[{Term}]
457 Definition
458
459 \item[{Term}] (\textbf{classifier one})(\textbf{classifier two})
460 Definition
461 \end{description}
462
463
464 \section{2.5   Field Lists}
465
466 \begin{DUfieldlist}
467 \item[{what:}]
468 Field lists map field names to field bodies, like database
469 records. They are often part of an extension syntax. They are
470 an unambiguous variant of RFC 2822 fields.
471
472 \item[{how arg1 arg2:}]
473 The field marker is a colon, the field name, and a colon.
474
475 The field body may contain one or more body elements, indented
476 relative to the field marker.
477
478 \item[{credits:}]
479 \DUrole{credits}{This paragraph has the \DUroletitlereference{credits} class set. (This is actually not
480 about credits but just for ensuring that the class attribute
481 doesn't get stripped away.)}
482 \end{DUfieldlist}
483
484
485 \section{2.6   Option Lists}
486
487 For listing command-line options:
488
489 \begin{DUoptionlist}
490 \item[-a] command-line option \textquotedbl{}a\textquotedbl{}
491 \item[-b file] options can have arguments
492 and long descriptions
493 \item[-{}-long] options can be long, too
494 \item[-{}-input=file] long options can also have arguments
495 \item[/V] DOS/VMS-style option
496 \item[-{}-very-long-option] The description can also start on the next line.
497
498 The description may contain multiple body elements,
499 regardless of where it starts.
500 \item[-x, -y, -z] Multiple options are an \textquotedbl{}option group\textquotedbl{}.
501 \item[-v, -{}-verbose] Commonly-seen: short \& long options.
502 \item[-1 file, -{}-one=file, -{}-two file] Multiple options with arguments.
503 \item[-f <{[}path{]}file>] Option argumens must start with a letter
504 or be wrapped in angle brackets.
505 \item[-d <src dest>] Angle brackets are also required if an
506 option expects more than one argument.
507 \end{DUoptionlist}
508
509 There must be at least two spaces between the option and the
510 description.
511
512
513 \section{2.7   Literal Blocks}
514
515 Literal blocks are indicated with a double-colon (\textquotedbl{}::\textquotedbl{}) at the end of
516 the preceding paragraph (over there \texttt{-{}->}). They can be indented:
517
518 \begin{quote}
519 \begin{alltt}
520 if literal_block:
521 text = 'is left as-is'
522 spaces_and_linebreaks = 'are preserved'
523 markup_processing = None
524 \end{alltt}
525 \end{quote}
526
527 Or they can be quoted without indentation:
528
529 \begin{quote}
530 \begin{alltt}
531 >> Great idea!
532 >
533 > Why didn't I think of that?
534 \end{alltt}
535 \end{quote}
536
537
538 \section{2.8   Line Blocks}
539
540 This section tests line blocks. Line blocks are body elements which
541 consist of lines and other line blocks. Nested line blocks cause
542 indentation.
543
544 \begin{DUlineblock}{0em}
545 \item[] This is a line block. It ends with a blank line.
546 \item[]
547 \begin{DUlineblock}{\DUlineblockindent}
548 \item[] New lines begin with a vertical bar (\textquotedbl{}|\textquotedbl{}).
549 \item[] Line breaks and initial indent are significant, and preserved.
550 \item[]
551 \begin{DUlineblock}{\DUlineblockindent}
552 \item[] Continuation lines are also possible. A long line that is intended
553 to wrap should begin with a space in place of the vertical bar.
554 \end{DUlineblock}
555 \item[] The left edge of a continuation line need not be aligned with
556 the left edge of the text above it.
557 \end{DUlineblock}
558 \end{DUlineblock}
559
560 \begin{DUlineblock}{0em}
561 \item[] This is a second line block.
562 \item[]
563 \item[] Blank lines are permitted internally, but they must begin with a \textquotedbl{}|\textquotedbl{}.
564 \end{DUlineblock}
565
566 Another line block, surrounded by paragraphs:
567
568 \begin{DUlineblock}{0em}
569 \item[] And it's no good waiting by the window
570 \item[] It's no good waiting for the sun
571 \item[] Please believe me, the things you dream of
572 \item[] They don't fall in the lap of no-one
573 \end{DUlineblock}
574
575 Take it away, Eric the Orchestra Leader!
576
577 \begin{quote}
578 \begin{DUlineblock}{0em}
579 \item[] A one, two, a one two three four
580 \item[]
581 \item[] Half a bee, philosophically,
582 \item[]
583 \begin{DUlineblock}{\DUlineblockindent}
584 \item[] must, \emph{ipso facto}, half not be.
585 \end{DUlineblock}
586 \item[] But half the bee has got to be,
587 \item[]
588 \begin{DUlineblock}{\DUlineblockindent}
589 \item[] \emph{vis a vis} its entity. D'you see?
590 \item[]
591 \end{DUlineblock}
592 \item[] But can a bee be said to be
593 \item[]
594 \begin{DUlineblock}{\DUlineblockindent}
595 \item[] or not to be an entire bee,
596 \item[]
597 \begin{DUlineblock}{\DUlineblockindent}
598 \item[] when half the bee is not a bee,
599 \item[]
600 \begin{DUlineblock}{\DUlineblockindent}
601 \item[] due to some ancient injury?
602 \item[]
603 \end{DUlineblock}
604 \end{DUlineblock}
605 \end{DUlineblock}
606 \item[] Singing...
607 \end{DUlineblock}
608 \end{quote}
609
610 A line block, like the following poem by Christian Morgenstern, can
611 also be centre-aligned:
612
613 \begin{selectlanguage}{ngerman}
614 \begin{DUlineblock}{0em}
615 \centering
616 \item[] \textbf{Die Trichter}
617 \item[]
618 \item[] Zwei Trichter wandeln durch die Nacht.
619 \item[] Durch ihres Rumpfs verengten Schacht
620 \item[] fließt weißes Mondlicht
621 \item[] still und heiter
622 \item[] auf   ihren
623 \item[] Waldweg
624 \item[] u. s.
625 \item[] w.
626 \item[]
627 \end{DUlineblock}
628 \end{selectlanguage}
629
630
631 \section{2.9   Block Quotes}
632
633 Block quotes consist of indented body elements:
634
635 \begin{quote}
636 My theory by A. Elk. Brackets Miss, brackets. This theory goes
637 as follows and begins now. All brontosauruses are thin at one
638 end, much much thicker in the middle and then thin again at the
639 far end. That is my theory, it is mine, and belongs to me and I
640 own it, and what it is too.
641 \nopagebreak
642
643 \raggedleft —Anne Elk (Miss)
644 \end{quote}
645
646 The language of a quote (like any other object) can be specified by
647 a class attribute:
648
649 %
650
651 \begin{selectlanguage}{french}
652 \begin{quote}
653 ReStructuredText est un langage de balisage léger utilisé
654 notamment dans la documentation du langage Python.
655 \end{quote}
656 \end{selectlanguage}
657
658
659 \section{2.10   Doctest Blocks}
660
661 \begin{quote}
662 \begin{alltt}
663 >>> print 'Python-specific usage examples; begun with ">>>"'
664 Python-specific usage examples; begun with ">>>"
665 >>> print '(cut and pasted from interactive Python sessions)'
666 (cut and pasted from interactive Python sessions)
667 \end{alltt}
668 \end{quote}
669
670
671 \section{2.11   Footnotes}
672 %
673 \DUfootnotetext{footnote-1}{footnote-reference-1}{1}{%
674 A footnote contains body elements, consistently indented by at
675 least 1 space.
676
677 This is the footnote's second paragraph.
678 }
679 %
680 \DUfootnotetext{label}{footnote-reference-3}{2}{%
681 Footnotes may be numbered, either manually (as in\DUfootnotemark{footnote-reference-5}{footnote-1}{1}) or
682 automatically using a \textquotedbl{}\#\textquotedbl{}-prefixed label. This footnote has a
683 label so it can be referred to from multiple places, both as a
684 footnote reference (\DUfootnotemark{footnote-reference-6}{label}{2}) and as a \hyperref[label]{hyperlink reference}.
685 }
686 %
687 \DUfootnotetext{footnote-2}{footnote-reference-2}{3}{%
688 This footnote is numbered automatically and anonymously using a
689 label of \textquotedbl{}\#\textquotedbl{} only.
690
691 This is the second paragraph.
692
693 And this is the third paragraph.
694 }
695 %
696 \DUfootnotetext{footnote-3}{footnote-reference-4}{*}{%
697 Footnotes may also use symbols, specified with a \textquotedbl{}*\textquotedbl{} label.
698 Here's a reference to the next footnote:\DUfootnotemark{footnote-reference-7}{footnote-4}{†}.
699 }
700 %
701 \DUfootnotetext{footnote-4}{footnote-reference-7}{†}{%
702 This footnote shows the next symbol in the sequence.
703 }
704 %
705 \DUfootnotetext{footnote-5}{}{4}{%
706 Here's an unreferenced footnote, with a reference to a
707 nonexistent footnote:%
708 \raisebox{1em}{\hypertarget{footnote-reference-8}{}}\hyperlink{system-message-2}{\textbf{\color{red}{[}5{]}\_}}.
709 }
710
711
712 \section{2.12   Citations}
713 \begin{figure}[b]\raisebox{1em}{\hypertarget{cit2002}{}}[CIT2002]
714 Citations are text-labeled footnotes. They may be
715 rendered separately and differently from footnotes.
716 \end{figure}
717
718 Here's a reference to the above, \hyperlink{cit2002}{[CIT2002]}, and a %
719 \raisebox{1em}{\hypertarget{citation-reference-3}{}}\hyperlink{system-message-3}{\textbf{\color{red}{[}nonexistent{]}\_}}
720 citation.
721
722
723 \section{2.13   Targets%
724 \label{targets}%
725 \label{another-target}%
726 }
727
728 \phantomsection\label{example}
729 This paragraph is pointed to by the explicit \textquotedbl{}example\textquotedbl{} target. A
730 reference can be found under \hyperref[inline-markup]{Inline Markup}, above. \hyperref[inline-hyperlink-targets]{Inline
731 hyperlink targets} are also possible.
732
733 Section headers are implicit targets, referred to by name. See
734 \hyperref[targets]{Targets}, which is a subsection of \hyperref[body-elements]{Body Elements}.
735
736 Explicit external targets are interpolated into references such as
737 \textquotedbl{}\href{http://www.python.org/}{Python}\DUfootnotemark{footnote-reference-11}{footnote-6}{5}\textquotedbl{}.
738
739 Targets may be indirect and anonymous. Thus \hyperref[targets]{this phrase} may also
740 refer to the \hyperref[targets]{Targets} section.
741
742 Here's a %
743 \raisebox{1em}{\hypertarget{problematic-2}{}}\hyperlink{system-message-4}{\textbf{\color{red}`hyperlink reference without a target`\_}}, which generates an
744 error.
745
746
747 \subsection{2.13.1   Duplicate Target Names}
748
749 Duplicate names in section headers or other implicit targets will
750 generate \textquotedbl{}info\textquotedbl{} (level-1) system messages. Duplicate names in
751 explicit targets will generate \textquotedbl{}warning\textquotedbl{} (level-2) system messages.
752
753
754 \subsection{2.13.2   Duplicate Target Names}
755
756 Since there are two \textquotedbl{}Duplicate Target Names\textquotedbl{} section headers, we
757 cannot uniquely refer to either of them by name. If we try to (like
758 this: %
759 \raisebox{1em}{\hypertarget{problematic-3}{}}\hyperlink{system-message-5}{\textbf{\color{red}`Duplicate Target Names`\_}}), an error is generated.
760
761
762 \section{2.14   Directives%
763 \label{directives}%
764 }
765
766 These are just a sample of the many reStructuredText Directives. For
767 others, please see \href{https://docutils.sourceforge.io/docs/ref/rst/directives.html}{reStructuredText Directives}\DUfootnotemark{footnote-reference-18}{footnote-10}{9}.
768
769
770 \subsection{2.14.1   Document Parts}
771
772 An example of the \textquotedbl{}contents\textquotedbl{} directive can be seen above this section
773 (a local, untitled table of \hyperref[contents]{contents}) and at the beginning of the
774 document (a document-wide \hyperref[table-of-contents]{table of contents}).
775
776
777 \subsection{2.14.2   Images and Figures}
778
779 An image directive (also clickable -{}- a hyperlink reference):
780
781 \hyperref[directives]{\includegraphics[width=0.7\linewidth]{../../../docs/user/rst/images/title.png}}
782
783 Image with multiple IDs:
784
785 \phantomsection\label{image-target-3}\label{image-target-2}\label{image-target-1}
786 \includegraphics{../../../docs/user/rst/images/biohazard.png}
787
788 A centered image:
789
790 \noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
791
792 A left-aligned image:
793
794 \noindent{\includegraphics{../../../docs/user/rst/images/biohazard.png}\hfill}
795
796 This paragraph might flow around the image.
797 The specific behavior depends upon the style sheet and
798 the browser or rendering software used.
799
800 A right-aligned image:
801
802 \noindent{\hfill\includegraphics{../../../docs/user/rst/images/biohazard.png}}
803
804 This paragraph might flow around the image.
805 The specific behavior depends upon the style sheet and
806 the browser or rendering software used.
807
808 For inline images see \hyperref[substitution-definitions]{Substitution Definitions}.
809
810 Image size:
811
812 An image 2 em wide:
813
814 \includegraphics[width=2em]{../../../docs/user/rst/images/biohazard.png}
815
816 An image 2 cm wide and 15 pixel high:
817
818 \includegraphics[height=15px,width=2cm]{../../../docs/user/rst/images/biohazard.png}
819
820 Relative units allow adaption of the image to the screen or paper size.
821 An image occupying 50\% of the line width:
822
823 \includegraphics[width=0.5\linewidth]{../../../docs/user/rst/images/title.png}
824
825 A \emph{figure} is an image with a caption and/or a legend. With page-based output
826 media, figures might float to a different position if this helps the page
827 layout.
828
829 \begin{DUclass}{figclass1}
830 \begin{DUclass}{figclass2}
831 \begin{figure}
832 \noindent\makebox[\linewidth][c]{\href{https://docutils.sourceforge.io/rst.html}{\includegraphics[width=258bp]{../../../docs/user/rst/images/title.png}}}
833 \caption{Plaintext markup syntax and parser system.}
834 \begin{DUlegend}
835 \setlength{\DUtablewidth}{\linewidth}%
836 \begin{longtable*}{|p{0.156\DUtablewidth}|p{0.563\DUtablewidth}|}
837 \hline
838
839 re
840 &
841 Revised, revisited, based on 're' module.
842 \\
843 \hline
844
845 Structured
846 &
847 Structure-enhanced text, structuredtext.
848 \\
849 \hline
850
851 Text
852 &
853 Well it is, isn't it?
854 \\
855 \hline
856 \end{longtable*}
857
858 This paragraph is also part of the legend.
859 \end{DUlegend}
860 \end{figure}
861 \end{DUclass}
862 \end{DUclass}
863
864 A left-aligned figure, 70\% wide:
865
866 \begin{DUclass}{figclass1}
867 \begin{DUclass}{figclass2}
868 \begin{figure} % align = "left"
869 \noindent\makebox[\linewidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
870 \caption{\label{caption-label}\DUrole{captionclass1}{\DUrole{captionclass2}{This is the caption.}}}
871 \begin{DUlegend}
872 This is the legend.
873
874 The legend may consist of several paragraphs.
875 \end{DUlegend}
876 \end{figure}
877 \end{DUclass}
878 \end{DUclass}
879
880 This paragraph might flow around the figure.
881
882 The specific behavior depends upon the style sheet and the browser or
883 rendering software used.
884
885 A centred figure, 40\% wide:
886
887 \begin{figure}
888 \noindent\makebox[\linewidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
889 \caption{This is the caption.}
890 \begin{DUlegend}
891 This is the legend.
892
893 The legend may consist of several paragraphs.
894 \end{DUlegend}
895 \end{figure}
896
897 This paragraph might flow around the figure.
898
899 The specific behavior depends upon the style sheet and the browser or
900 rendering software used.
901
902 A right-aligned figure:
903
904 \begin{figure} % align = "right"
905 \noindent\makebox[\linewidth][c]{\includegraphics[width=40px]{../../../docs/user/rst/images/biohazard.png}}
906 \caption{This is the caption.}
907 \begin{DUlegend}
908 This is the legend.
909
910 The legend may consist of several paragraphs.
911 \end{DUlegend}
912 \end{figure}
913
914 This paragraph might flow around the figure. The specific behavior depends
915 upon the style sheet and the browser or rendering software used.
916
917
918 \subsection{2.14.3   Tables}
919
920 Tables may be given titles and additional arguments with the \emph{table}
921 directive:
922
923 \setlength{\DUtablewidth}{\linewidth}%
924 \begin{longtable}[l]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
925 \caption{left-aligned table}\\
926 \hline
927 \textbf{%
928 A
929 } & \textbf{%
930 not A
931 } \\
932 \hline
933 \endfirsthead
934 \caption[]{left-aligned table (... continued)}\\
935 \hline
936 \textbf{%
937 A
938 } & \textbf{%
939 not A
940 } \\
941 \hline
942 \endhead
943 \multicolumn{2}{p{0.15\DUtablewidth}}{\raggedleft\ldots continued on next page}\\
944 \endfoot
945 \endlastfoot
946
947 False
948 &
949 True
950 \\
951 \hline
952
953 True
954 &
955 False
956 \\
957 \hline
958 \end{longtable}
959
960 \setlength{\DUtablewidth}{\linewidth}%
961 \begin{longtable}[c]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
962 \caption{center-aligned table}\\
963 \hline
964 \textbf{%
965 A
966 } & \textbf{%
967 not A
968 } \\
969 \hline
970 \endfirsthead
971 \caption[]{center-aligned table (... continued)}\\
972 \hline
973 \textbf{%
974 A
975 } & \textbf{%
976 not A
977 } \\
978 \hline
979 \endhead
980 \multicolumn{2}{p{0.15\DUtablewidth}}{\raggedleft\ldots continued on next page}\\
981 \endfoot
982 \endlastfoot
983
984 False
985 &
986 True
987 \\
988 \hline
989
990 True
991 &
992 False
993 \\
994 \hline
995 \end{longtable}
996
997 \setlength{\DUtablewidth}{\linewidth}%
998 \begin{longtable}[r]{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|}
999 \caption{right-aligned table}\\
1000 \hline
1001 \textbf{%
1002 A
1003 } & \textbf{%
1004 not A
1005 } \\
1006 \hline
1007 \endfirsthead
1008 \caption[]{right-aligned table (... continued)}\\
1009 \hline
1010 \textbf{%
1011 A
1012 } & \textbf{%
1013 not A
1014 } \\
1015 \hline
1016 \endhead
1017 \multicolumn{2}{p{0.15\DUtablewidth}}{\raggedleft\ldots continued on next page}\\
1018 \endfoot
1019 \endlastfoot
1020
1021 False
1022 &
1023 True
1024 \\
1025 \hline
1026
1027 True
1028 &
1029 False
1030 \\
1031 \hline
1032 \end{longtable}
1033
1034 With the \textquotedbl{}widths\textquotedbl{} argument \textquotedbl{}auto\textquotedbl{} (or \textquotedbl{}class\textquotedbl{} value \textquotedbl{}colwidths-auto\textquotedbl{}),
1035 column widths are determined by the backend (if supported by the
1036 writer/backend).
1037
1038 \phantomsection\label{target2}\label{target1}
1039 \begin{longtable*}{|l|l|l|}
1040 \hline
1041 \textbf{A} & \textbf{B} & \textbf{A or B} \\
1042 \hline
1043 \endfirsthead
1044 \hline
1045 \textbf{A} & \textbf{B} & \textbf{A or B} \\
1046 \hline
1047 \endhead
1048 \endfoot
1049 \endlastfoot
1050 False & False & False \\
1051 \hline
1052 True & False & True \\
1053 \hline
1054 False & True & True \\
1055 \hline
1056 True & True & True \\
1057 \hline
1058 \end{longtable*}
1059
1060
1061 \subsection{2.14.4   Admonitions}
1062
1063 \DUadmonition[attention]{
1064 \DUtitle[attention]{Attention!}
1065
1066 Directives at large.
1067 }
1068
1069 \DUadmonition[caution]{
1070 \DUtitle[caution]{Caution!}
1071
1072 Don't take any wooden nickels.
1073 }
1074
1075 \DUadmonition[danger]{
1076 \DUtitle[danger]{!DANGER!}
1077
1078 Mad scientist at work!
1079 }
1080
1081 \DUadmonition[error]{
1082 \DUtitle[error]{Error}
1083
1084 Does not compute.
1085 }
1086
1087 \DUadmonition[hint]{
1088 \DUtitle[hint]{Hint}
1089
1090 It's bigger than a bread box.
1091 }
1092
1093 \DUadmonition[important]{
1094 \DUtitle[important]{Important}
1095
1096 \begin{itemize}
1097 \item Wash behind your ears.
1098
1099 \item Clean up your room.
1100
1101 \item Call your mother.
1102
1103 \item Back up your data.
1104 \end{itemize}
1105 }
1106
1107 \DUadmonition[note]{
1108 \DUtitle[note]{Note}
1109
1110 This is a note.
1111 }
1112
1113 \DUadmonition[tip]{
1114 \DUtitle[tip]{Tip}
1115
1116 15\% if the service is good.
1117 }
1118
1119 \DUadmonition[warning]{
1120 \DUtitle[warning]{Warning}
1121
1122 Strong prose may provoke extreme mental exertion.
1123 Reader discretion is strongly advised.
1124 }
1125
1126 \DUadmonition[admonition-and-by-the-way]{
1127 \DUtitle[admonition-and-by-the-way]{And, by the way...}
1128
1129 You can make up your own admonition too.
1130 }
1131
1132
1133 \subsection{2.14.5   Topics, Sidebars, and Rubrics}
1134
1135 \emph{Sidebars} are like miniature, parallel documents.
1136
1137 \DUsidebar{
1138 \DUtitle[sidebar]{Optional Sidebar Title}
1139
1140 \DUsubtitle{Optional Subtitle}
1141
1142 This is a sidebar. It is for text outside the flow of the main
1143 text.
1144
1145 \DUrubric{This is a rubric inside a sidebar}
1146
1147 Sidebars often appear beside the main text with a border and a different
1148 background or font color.
1149 }
1150
1151 A \emph{topic} is like a block quote with a title, or a self-contained section
1152 with no subsections.
1153
1154 \begin{DUclass}{topic}
1155 \begin{quote}
1156 \DUtitle[topic]{Topic Title}
1157
1158 This is a topic.
1159 \end{quote}
1160 \end{DUclass}
1161
1162 A \emph{rubric} is like an informal heading that doesn't correspond to the
1163 document's structure. It is typically highlighted in red (hence the name).
1164
1165 \DUrubric{This is a rubric}
1166
1167 Topics and rubrics can be used at places where a \hyperref[section-title]{section title} is not
1168 allowed (e.g. inside a directive).
1169
1170
1171 \subsection{2.14.6   Target Footnotes}
1172 %
1173 \DUfootnotetext{footnote-6}{footnote-reference-10}{5}{%
1174 \url{http://www.python.org/}
1175 }
1176 %
1177 \DUfootnotetext{footnote-7}{footnote-reference-13}{6}{%
1178 \url{http://pygments.org/}
1179 }
1180 %
1181 \DUfootnotetext{footnote-8}{footnote-reference-14}{7}{%
1182 \url{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}
1183 }
1184 %
1185 \DUfootnotetext{footnote-9}{footnote-reference-17}{8}{%
1186 \url{https://docutils.sourceforge.io/}
1187 }
1188 %
1189 \DUfootnotetext{footnote-10}{footnote-reference-18}{9}{%
1190 \url{https://docutils.sourceforge.io/docs/ref/rst/directives.html}
1191 }
1192 %
1193 \DUfootnotetext{footnote-11}{footnote-reference-19}{10}{%
1194 \url{https://docutils.sourceforge.io/docs/ref/rst/directives.html\#metadata}
1195 }
1196
1197
1198 \subsection{2.14.7   Replacement Text}
1199
1200 I recommend you try \href{http://www.python.org/}{Python, \emph{the} best language around}\DUfootnotemark{footnote-reference-12}{footnote-6}{5}.
1201
1202
1203 \subsection{2.14.8   Compound Paragraph}
1204
1205 The \emph{compound} directive is used to create a \textquotedbl{}compound paragraph\textquotedbl{}, which
1206 is a single logical paragraph containing multiple physical body
1207 elements. For example:
1208
1209 \begin{DUclass}{compound}
1210 The 'rm' command is very dangerous. If you are logged
1211 in as root and enter
1212 \begin{quote}
1213 \begin{alltt}
1214 cd /
1215 rm -rf *
1216 \end{alltt}
1217 \end{quote}
1218 you will erase the entire contents of your file system.
1219 \end{DUclass}
1220
1221 Test the handling and display of compound paragraphs:
1222
1223 \begin{DUclass}{compound}
1224 \begin{DUclass}{some-class}
1225 Compound 2, paragraph 1,
1226
1227 compound 2, paragraph 2,
1228 \begin{itemize}
1229 \item list item 1,
1230
1231 \item list item 2,
1232 \end{itemize}
1233 compound 2, paragraph 3.
1234 \end{DUclass}
1235 \end{DUclass}
1236
1237 \begin{DUclass}{compound}
1238 Compound 3, only consisting of one paragraph.
1239 \end{DUclass}
1240
1241 \begin{DUclass}{compound}
1242 \begin{quote}
1243 \begin{alltt}
1244 Compound 4.
1245 This one starts with a literal block.
1246 \end{alltt}
1247 \end{quote}
1248 Compound 4, paragraph following the literal block.
1249 \end{DUclass}
1250
1251 Now something \emph{really} perverted -{}- a nested compound block. This is
1252 just to test that it works at all; the results don't have to be
1253 meaningful.
1254
1255 \begin{DUclass}{compound}
1256 Compound 5, block 1 (a paragraph).
1257
1258 \begin{DUclass}{compound}
1259 Compound 6 is block 2 in compound 5.
1260
1261 Compound 6, another paragraph.
1262 \end{DUclass}
1263
1264 Compound 5, block 3 (a paragraph).
1265 \end{DUclass}
1266
1267 \begin{DUclass}{compound}
1268 Compound 7, tests the inclusion of various block-level
1269 elements in one logical paragraph. First a table,
1270 \setlength{\DUtablewidth}{\linewidth}%
1271 \begin{longtable*}{|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|p{0.249\DUtablewidth}|}
1272 \hline
1273
1274 Left cell, first
1275 paragraph.
1276
1277 Left cell, second
1278 paragraph.
1279 &
1280 Middle cell,
1281 consisting of
1282 exactly one
1283 paragraph.
1284 &
1285 Right cell.
1286
1287 Paragraph 2.
1288
1289 Paragraph 3.
1290 \\
1291 \hline
1292 \end{longtable*}
1293 followed by a paragraph. This physical paragraph is
1294 actually a continuation of the paragraph before the table. It is followed
1295 by
1296 \begin{quote}
1297 a quote and
1298 \end{quote}
1299 \begin{enumerate}
1300 \item an enumerated list,
1301 \end{enumerate}
1302 a paragraph,
1303 \begin{DUoptionlist}
1304 \item[-{}-an] option list,
1305 \end{DUoptionlist}
1306 a paragraph,
1307 \begin{DUfieldlist}
1308 \item[{a field:}]
1309 list,
1310 \end{DUfieldlist}
1311 a paragraph,
1312 \begin{description}
1313 \item[{a definition}]
1314 list,
1315 \end{description}
1316 a paragraph, an image:
1317 \includegraphics{../../../docs/user/rst/images/biohazard.png}
1318 a paragraph,
1319 \begin{DUlineblock}{0em}
1320 \item[] a line
1321 \item[] block,
1322 \end{DUlineblock}
1323 a paragraph followed by a comment,
1324 % this is a comment
1325 a paragraph, a
1326
1327 \DUadmonition[note]{
1328 \DUtitle[note]{Note}
1329
1330 with content
1331 }
1332 and the final paragraph of the compound 7.
1333 \end{DUclass}
1334
1335
1336 \subsection{2.14.9   Parsed Literal Blocks}
1337
1338 \begin{quote}
1339 \ttfamily\raggedright
1340 This~is~a~parsed~literal~block.\\
1341 ~~~~This~line~is~indented.~~The~next~line~is~blank.\\
1342 ~\\
1343 Inline~markup~is~supported,~e.g.~\emph{emphasis},~\textbf{strong},~\texttt{literal\\
1344 text},~\textsubscript{sub-}~and~\textsuperscript{super}scripts,\\
1345 inline~formulas:~$A = 2 \pi r^2$,\\
1346 footnotes\DUfootnotemark{footnote-reference-9}{footnote-1}{1},~%
1347 \phantomsection\label{hyperlink-targets}hyperlink~targets,~and~\href{http://www.python.org/}{references}.
1348 \end{quote}
1349
1350
1351 \subsection{2.14.10   Code}
1352
1353 Blocks of source code can be set with the \DUroletitlereference{code} directive. If the code
1354 language is specified, the content is parsed and tagged by the \href{http://pygments.org/}{Pygments}\DUfootnotemark{footnote-reference-13}{footnote-7}{6}
1355 syntax highlighter and can be formatted with a style sheet. (Code parsing
1356 is turned off using the \texttt{syntax-highlight} config setting in the test
1357 conversions in order to get identical results with/without installed
1358 Pygments highlighter.)
1359
1360 \begin{DUclass}{code}
1361 \begin{DUclass}{python}
1362 \begin{quote}
1363 \begin{alltt}
1364 print 'This is Python code.'
1365 \end{alltt}
1366 \end{quote}
1367 \end{DUclass}
1368 \end{DUclass}
1369
1370 The \texttt{:number-lines:} option (with optional start value) generates line
1371 numbers:
1372
1373 \begin{DUclass}{code}
1374 \begin{DUclass}{python}
1375 \begin{quote}
1376 \ttfamily\raggedright
1377 \DUrole{ln}{~8~}\#~print~integers~from~0~to~9:\\
1378 \DUrole{ln}{~9~}for~i~in~range(10):\\
1379 \DUrole{ln}{10~}~~~~print~i
1380 \end{quote}
1381 \end{DUclass}
1382 \end{DUclass}
1383
1384 For inline code snippets, there is the \DUroletitlereference{code} role, which can be used
1385 directly (the code will not be parsed/tagged, as the language is not known)
1386 or as base for special code roles, e.g. the LaTeX code in the next
1387 paragraph.
1388
1389 Docutils uses LaTeX syntax for math directives and roles:
1390 \texttt{\DUrole{code}{\DUrole{tex}{\textbackslash{}alpha = f(x)}}} prints $\alpha = f(x)$.
1391
1392 The \texttt{:code:} option of the \DUroletitlereference{include} directive sets the included content
1393 as a code block, here the rst file \texttt{header\_footer.rst} with line numbers:
1394
1395 \begin{DUclass}{code}
1396 \begin{DUclass}{rst}
1397 \begin{quote}
1398 \ttfamily\raggedright
1399 \DUrole{ln}{1~}..~header::~Document~header\\
1400 \DUrole{ln}{2~}..~footer::~Document~footer
1401 \end{quote}
1402 \end{DUclass}
1403 \end{DUclass}
1404
1405
1406 \subsection{2.14.11   Meta}
1407
1408 The \href{https://docutils.sourceforge.io/docs/ref/rst/directives.html\#metadata}{“meta” directive}\DUfootnotemark{footnote-reference-19}{footnote-11}{10} is used to specify metadata to be stored in,
1409 e.g., HTML META tags or ODT file properties.
1410
1411
1412 \section{2.15   Substitution Definitions%
1413 \label{substitution-definitions}%
1414 }
1415
1416 An inline image (\includegraphics{../../../docs/user/rst/images/biohazard.png}) example:
1417
1418 A Unicode example:
1419
1420 (Substitution definitions are only visible in the rST source.)
1421
1422
1423 \section{2.16   Comments}
1424
1425 Here's one:
1426
1427 % Comments begin with two dots and a space. Anything may
1428 % follow, except for the syntax of footnotes, hyperlink
1429 % targets, directives, or substitution definitions.
1430 %
1431 % Double-dashes -- "--" -- must be escaped somehow in HTML output.
1432 %
1433 % Comments may contain non-ASCII characters: ä ö ü æ ø å
1434
1435 (View the HTML/LaTeX/... source to see the comment.)
1436
1437
1438 \section{2.17   Raw text}
1439
1440 This does not necessarily look nice, because there may be missing white space.
1441
1442 It's just there to freeze the behavior.
1443
1444 A test.
1445
1446 Second test.
1447
1448 \DUrole{myclass}{Another test with myclass set.}
1449
1450 This is the \DUrole{myrawroleclass}{fourth test} with myrawroleclass set.
1451
1452 Fifth test in LaTeX.\\Line two.
1453
1454
1455 \section{2.18   Container}
1456
1457 \begin{DUclass}{custom}
1458 paragraph 1
1459
1460 paragraph 2
1461 \end{DUclass}
1462
1463 % currently not implemented in LaTeX:
1464 % .. include:: data/header_footer.rst
1465
1466
1467 \section{2.19   Colspanning tables}
1468
1469 This table has a cell spanning two columns:
1470
1471 \setlength{\DUtablewidth}{\linewidth}%
1472 \begin{longtable*}{|p{0.075\DUtablewidth}|p{0.075\DUtablewidth}|p{0.086\DUtablewidth}|}
1473 \hline
1474 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1475 Inputs
1476 }} & \textbf{%
1477 Output
1478 } \\
1479 \hline
1480 \textbf{%
1481 A
1482 } & \textbf{%
1483 B
1484 } & \textbf{%
1485 A or B
1486 } \\
1487 \hline
1488 \endfirsthead
1489 \hline
1490 \multicolumn{2}{|p{0.15\DUtablewidth}|}{\textbf{%
1491 Inputs
1492 }} & \textbf{%
1493 Output
1494 } \\
1495 \hline
1496 \textbf{%
1497 A
1498 } & \textbf{%
1499 B
1500 } & \textbf{%
1501 A or B
1502 } \\
1503 \hline
1504 \endhead
1505 \multicolumn{3}{p{0.24\DUtablewidth}}{\raggedleft\ldots continued on next page}\\
1506 \endfoot
1507 \endlastfoot
1508
1509 False
1510 &
1511 False
1512 &
1513 False
1514 \\
1515 \hline
1516
1517 True
1518 &
1519 False
1520 &
1521 True
1522 \\
1523 \hline
1524
1525 False
1526 &
1527 True
1528 &
1529 True
1530 \\
1531 \hline
1532
1533 True
1534 &
1535 True
1536 &
1537 True
1538 \\
1539 \hline
1540 \end{longtable*}
1541
1542
1543 \section{2.20   Rowspanning tables}
1544
1545 Here's a table with cells spanning several rows:
1546
1547 \setlength{\DUtablewidth}{\linewidth}%
1548 \begin{longtable*}{|p{0.296\DUtablewidth}|p{0.156\DUtablewidth}|p{0.226\DUtablewidth}|}
1549 \hline
1550 \textbf{%
1551 Header row, column 1
1552 (header rows optional)
1553 } & \textbf{%
1554 Header 2
1555 } & \textbf{%
1556 Header 3
1557 } \\
1558 \hline
1559 \endfirsthead
1560 \hline
1561 \textbf{%
1562 Header row, column 1
1563 (header rows optional)
1564 } & \textbf{%
1565 Header 2
1566 } & \textbf{%
1567 Header 3
1568 } \\
1569 \hline
1570 \endhead
1571 \multicolumn{3}{p{0.68\DUtablewidth}}{\raggedleft\ldots continued on next page}\\
1572 \endfoot
1573 \endlastfoot
1574
1575 body row 1, column 1
1576 &
1577 column 2
1578 &
1579 column 3
1580 \\
1581 \hline
1582
1583 body row 2
1584 & \multirow{2}{0.16\DUtablewidth}{%
1585 Cells may
1586 span rows.
1587 } & \multirow{2}{0.23\DUtablewidth}{%
1588 Another
1589 rowspanning
1590 cell.
1591 } \\
1592 \cline{1-1}
1593
1594 body row 3
1595 & & \\
1596 \hline
1597 \end{longtable*}
1598
1599
1600 \section{2.21   List Tables}
1601
1602 Here's a list table exercising all features:
1603
1604 \begin{DUclass}{test}
1605 \setlength{\DUtablewidth}{0.95\linewidth}%
1606 \begin{longtable}{|p{0.133\DUtablewidth}|p{0.110\DUtablewidth}|p{0.249\DUtablewidth}|}
1607 \caption{list table with integral header}\\
1608 \hline
1609 \textbf{%
1610 Treat
1611 } & \textbf{%
1612 Quantity
1613 } & \textbf{%
1614 Description
1615 } \\
1616 \hline
1617 \endfirsthead
1618 \caption[]{list table with integral header (... continued)}\\
1619 \hline
1620 \textbf{%
1621 Treat
1622 } & \textbf{%
1623 Quantity
1624 } & \textbf{%
1625 Description
1626 } \\
1627 \hline
1628 \endhead
1629 \multicolumn{3}{p{0.49\DUtablewidth}}{\raggedleft\ldots continued on next page}\\
1630 \endfoot
1631 \endlastfoot
1632 \textbf{%
1633 Albatross
1634 } &
1635 2.99
1636 &
1637 On a stick!
1638 \\
1639 \hline
1640 \textbf{%
1641 Crunchy Frog
1642 } &
1643 1.49
1644 &
1645 If we took the bones out, it wouldn't be
1646 crunchy, now would it?
1647 \\
1648 \hline
1649 \textbf{%
1650 Gannet Ripple
1651 } &
1652 1.99
1653 &
1654 On a stick!
1655 \\
1656 \hline
1657 \end{longtable}
1658 \end{DUclass}
1659
1660 \begin{longtable}[c]{|l|l|}
1661 \caption{center aligned list table}\\
1662 \hline
1663 Albatross & 2.99 \\
1664 \hline
1665 Crunchy Frog & 1.49 \\
1666 \hline
1667 Gannet Ripple & 1.99 \\
1668 \hline
1669 \end{longtable}
1670
1671
1672 \section{2.22   Custom Roles}
1673
1674 \begin{itemize}
1675 \item A role based on an existing role.
1676
1677 \texttt{\DUrole{custom}{one}} \texttt{\DUrole{custom}{two}} \texttt{\DUrole{custom}{three}}
1678
1679 \item A new role.
1680
1681 \DUrole{customnew}{one two three}
1682
1683 \item A role with class attribute.
1684
1685 \DUrole{special}{interpreted text}
1686
1687 \item A language-switching role:
1688
1689 Let's count in German \foreignlanguage{ngerman}{eins zwei drei}.
1690
1691 \item A role with multiple class attributes, styled with raw directives:
1692
1693 \newcommand{\DUrolegreen}[1]{\textcolor{green}{#1}}
1694 \newcommand{\DUrolesc}[1]{\textsc{#1}}
1695
1696 The following works in most browsers but does not validate
1697 (\texttt{<style>} is only allowed in the document head):
1698
1699 \begin{quote}
1700 \begin{alltt}
1701 .. raw:: html
1702
1703 <style type="text/css"><!-{}-
1704 .green \{color: green;\}
1705 .sc \{font-variant: small-caps;\}
1706 -{}-></style>
1707 \end{alltt}
1708 \end{quote}
1709
1710 \DUrole{green}{\DUrole{sc}{\foreignlanguage{british}{British colourful text in small-caps}}}.
1711 \end{itemize}
1712
1713
1714 \section{2.23   Mathematics}
1715
1716 Docutils supports inline math with the prefix or postfix \texttt{:math:}
1717 role specificator, $n! + \sin(x_n^2)$ and $A_\text{c} =
1718 \frac{\pi}{4} d^2$, as well as displayed math via the
1719 \DUroletitlereference{math} directive:
1720 %
1721 \begin{equation*}
1722 f(\epsilon) = \frac{1}{1 + \exp\left(\frac{\varepsilon}{k_\text{B}T}\right)}
1723 \end{equation*}
1724 Content may start on the first line of the directive, e.g.
1725 %
1726 \begin{equation*}
1727 N = \frac{\text{number of apples}}{7}
1728 \end{equation*}
1729 Equations can be labeled with a reference name using the \texttt{:name:} option.
1730 See \hyperref[eq-m]{eq:M} and \hyperref[eq-schrodinger]{eq:schrödinger} below.
1731
1732 The determinant of the matrix
1733 %
1734 \phantomsection
1735 \begin{equation*}
1736 \mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right)
1737 \label{eq-m}
1738 \end{equation*}
1739 is $|\mathbf{M}| = ad - bc$.
1740
1741 More than one display math block can be put in one math directive.
1742 For example, the following sum and integral with limits:
1743 %
1744 \begin{equation*}
1745 \int_0^1 x^n dx = \frac{1}{n + 1}
1746 \end{equation*}%
1747 \begin{equation*}
1748 \sum_{n=1}^m n = \frac{m(m+1)}{2}
1749 \end{equation*}
1750 LaTeX-supported Unicode math symbols can be used in math roles and
1751 directives:
1752
1753 The Schrödinger equation
1754 %
1755 \phantomsection
1756 \begin{equation*}
1757 i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi ,
1758 \label{eq-schrodinger}
1759 \end{equation*}
1760 with the \emph{wave function} $\Psi $, describes how the quantum state of a
1761 physical system changes in time.
1762
1763 \begin{description}
1764 \item[{Math-Accents:}] \leavevmode
1765 \setlength{\DUtablewidth}{1\linewidth}%
1766 \begin{longtable*}{p{0.315\DUtablewidth}p{0.315\DUtablewidth}p{0.315\DUtablewidth}}
1767
1768 $\acute{a}$ \texttt{\textbackslash{}acute\{a\}}
1769 &
1770 $\dot{t}$ \texttt{\textbackslash{}dot\{t\}}
1771 &
1772 $\hat{\gamma}$ \texttt{\textbackslash{}hat\{\textbackslash{}gamma\}}
1773 \\
1774
1775 $\grave{a}$ \texttt{\textbackslash{}grave\{a\}}
1776 &
1777 $\ddot{t}$ \texttt{\textbackslash{}ddot\{t\}}
1778 &
1779 $\tilde{\alpha}$ \texttt{\textbackslash{}tilde\{\textbackslash{}alpha\}}
1780 \\
1781
1782 $\breve{x}$ \texttt{\textbackslash{}breve\{x\}}
1783 &
1784 $\dddot{t}$ \texttt{\textbackslash{}dddot\{t\}}
1785 &
1786 $\vec{\imath}$ \texttt{\textbackslash{}vec\{\textbackslash{}imath\}}
1787 \\
1788
1789 $\check{a}$ \texttt{\textbackslash{}check\{a\}}
1790 &
1791 $\bar{a}$ \texttt{\textbackslash{}bar\{a\}}
1792 &
1793 $\vec{R}$ \texttt{\textbackslash{}vec\{R\}}
1794 \\
1795 \end{longtable*}
1796 \end{description}
1797
1798 % \widetilde{xxx}
1799 % \widehat{xxx}
1800
1801 Modulation Transfer Function:
1802 %
1803 \begin{equation*}
1804 \text{MTF} = \left|\frac{\mathcal{F}\{s(x)\}}
1805 {\mathcal{F}\{ s(x)\} |_{\omega _{x}=0}}\right|
1806 = \mathrm{abs}\left(\frac
1807 {\int _{-\infty }^{\infty }s(x) \mathrm{e}^{\mathrm{i}\omega _{x}x}\mathrm{d}{x}}
1808 {\int _{-\infty }^{\infty }s(x)\mathrm{d}{x}}
1809 \right).
1810 \end{equation*}
1811 Math split over two lines: If a double backslash is detected outside a
1812 \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{footnote-reference-14}{footnote-8}{7}
1813 \texttt{align} environment:
1814 %
1815 \begin{align*}
1816 s_{\mathrm{out}}(x) & = s_{\mathrm{in}}(x') * s_\delta (x-x') \\
1817 & = \int s_{\mathrm{in}}(x')s_\delta (x-x')\mathrm{d}x'
1818 \end{align*}
1819 Cases with the \href{ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf}{AMSmath}\DUfootnotemark{footnote-reference-15}{footnote-8}{7} \texttt{cases} environment:
1820 %
1821 \begin{equation*}
1822 \mathrm{sgn}(x) = \begin{cases}
1823 -1 & x<0\\
1824 \phantom{-} 1 & x>0
1825 \end{cases}
1826 \end{equation*}
1827
1828 \chapter{3   Tests for the LaTeX writer}
1829
1830 Test syntax elements which may cause trouble for the LaTeX writer but might
1831 not need to be tested with other writers. See also the
1832 \textquotedbl{}latex\_cornercases\textquotedbl{} test.
1833
1834
1835 \section{3.1   Custom Roles in LaTeX}
1836
1837 \begin{itemize}
1838 \item Role names and class arguments are converted to conform to the
1839 regular expression \texttt{{[}a-z{]}{[}-a-z0-9{]}*} (letters are downcased,
1840 accents and similar decoration is stripped, non-conforming
1841 characters are replaced by a hyphen).
1842
1843 Class arguments may contain numbers and hyphens, which need special
1844 treatment in LaTeX command names.
1845
1846 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{Text with role \textquotedbl{}custom4\textquotedbl{}}}}}} (but without styling by \texttt{DUrole*}
1847 macros).
1848
1849 \item With LaTeX, roles can be styled within the document using the \DUroletitlereference{raw}
1850 directive.
1851
1852 \newcommand{\DUrolelarge}[1]{{\large #1}}
1853 \makeatletter
1854 \@namedef{DUrolesmall-caps}{\textsc}
1855 \@namedef{DUrolecustom4}{\textbf}
1856 \makeatother
1857
1858 \DUrole{large}{\DUrole{custom4}{\DUrole{small-caps}{\DUrole{custom-role}{\DUrole{custom-role}{inline text}}}}} in large, bold, small-caps.
1859
1860 \item Custom roles can be based on standard roles:
1861
1862 This is a \emph{\DUrole{custom-emphasis}{customized emphasis text role}}
1863
1864 This is a \texttt{\DUrole{custom-literal}{customized literal text role}}
1865
1866 This is a \textbf{\DUrole{custom-strong}{customized strong text role}}
1867
1868 This is a \textsubscript{\DUrole{custom-subscript}{customized subscript text role}}
1869
1870 This is a \textsuperscript{\DUrole{custom-superscript}{customized superscript text role}}
1871
1872 This is a \DUroletitlereference{\DUrole{custom-title-reference}{customized title-reference text role}}
1873 \end{itemize}
1874
1875
1876 \section{3.2   class handling}
1877
1878 This section tests class handling for block level elements by the LaTeX
1879 writer. See the input file \texttt{classes\_latex.rst} for the raw LaTeX code used
1880 to style the examples.
1881
1882 An \textquotedbl{}epigraph\textquotedbl{} directive is exported as \textquotedbl{}quote\textquotedbl{} wrapped in a \textquotedbl{}DUclass\textquotedbl{}
1883 environment. Here, it is styled by a \textquotedbl{}DUCLASSepigraph\textquotedbl{} environment
1884 redefining the \textquotedbl{}quote\textquotedbl{} environment as \textquotedbl{}minipage\textquotedbl{}:
1885
1886 \newcommand*{\DUCLASSepigraph}{%
1887 \renewenvironment{quote}{\vspace{1em}
1888 \footnotesize\hfill{}%
1889 \begin{minipage}{0.4\columnwidth}}%
1890 {\end{minipage}\vskip\baselineskip}}
1891
1892 \begin{DUclass}{epigraph}
1893 \begin{quote}
1894 Do not play this piece fast. It is never right to play \emph{Ragtime} fast.
1895 \nopagebreak
1896
1897 \raggedleft —Scott Joplin
1898 \end{quote}
1899 \end{DUclass}
1900
1901 Raw latex is also used to style the following lists: \textquotedbl{}DUCLASSenumerateitems\textquotedbl{}
1902 redefines \textquotedbl{}itemize\textquotedbl{} as \textquotedbl{}enumerate\textquotedbl{}, \textquotedbl{}DUCLASSrules\textquotedbl{} draws horizontal lines
1903 above and below.
1904
1905 \newcommand*{\DUCLASSenumerateitems}{%
1906 \renewenvironment{itemize}{\begin{enumerate}}%
1907 {\end{enumerate}}%
1908 }
1909
1910 \newenvironment{DUCLASSrules}%
1911 {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}%
1912 {\noindent\rule[0.5ex]{1\columnwidth}{1pt}}
1913
1914 An \textquotedbl{}enumerated\textquotedbl{} bullet list:
1915
1916 \begin{DUclass}{enumerateitems}
1917 \begin{itemize}
1918 \item item
1919
1920 \item next item
1921
1922 \item third item
1923 \end{itemize}
1924 \end{DUclass}
1925
1926 A list with lines above and below:
1927
1928 \begin{DUclass}{rules}
1929 \begin{itemize}
1930 \item item
1931
1932 \item next item
1933 \end{itemize}
1934 \end{DUclass}
1935
1936 A normal bullet list is kept unchanged by the above redefinitions:
1937
1938 \begin{itemize}
1939 \item item
1940
1941 \item next item
1942
1943 \item third item
1944 \end{itemize}
1945
1946 A container wraps several elements in a common \textquotedbl{}class wrapper\textquotedbl{}. Here, we use
1947 it to set 2 paragraphs and a list in small caps:
1948
1949 \newcommand*{\DUCLASSscshape}{\scshape}
1950
1951 \begin{DUclass}{scshape}
1952 paragraph 1
1953
1954 paragraph 2
1955
1956 \begin{itemize}
1957 \item bullet list
1958
1959 \item still bullet list
1960 \end{itemize}
1961 \end{DUclass}
1962
1963 A right-aligned line-block. Alignment handling is built into the latex
1964 writer for image, table, and line block elements.
1965
1966 \begin{DUlineblock}{0em}
1967 \raggedleft
1968 \item[] Max Mustermann
1969 \item[] Waldstr. 22
1970 \item[] D 01234 Testdorf
1971 \item[] Tel.: 0123/456789
1972 \end{DUlineblock}
1973
1974 % preface for System Messages:
1975
1976
1977 \chapter{4   Error Handling}
1978
1979 Any errors caught during processing will generate system messages.
1980
1981 There should be five messages in the following, auto-generated
1982 section, \textquotedbl{}Docutils System Messages\textquotedbl{}:
1983
1984 % section should be added by Docutils automatically
1985
1986
1987 \chapter[Docutils System Messages]{\color{red}Docutils System Messages}
1988
1989 \raisebox{1em}{\hypertarget{system-message-1}{}}
1990 \DUadmonition[system-message]{
1991 \DUtitle[system-message]{\color{red}System Message}
1992
1993 ERROR/3 in \texttt{functional/input/data/standard.rst}, line~99
1994
1995 \hyperlink{problematic-1}{
1996 Undefined substitution referenced: \textquotedbl{}problematic\textquotedbl{}.
1997 }
1998 }
1999
2000 \raisebox{1em}{\hypertarget{system-message-2}{}}
2001 \DUadmonition[system-message]{
2002 \DUtitle[system-message]{\color{red}System Message}
2003
2004 ERROR/3 in \texttt{functional/input/data/standard.rst}, line~390
2005
2006 \hyperlink{footnote-reference-8}{
2007 Unknown target name: \textquotedbl{}5\textquotedbl{}.
2008 }
2009 }
2010
2011 \raisebox{1em}{\hypertarget{system-message-3}{}}
2012 \DUadmonition[system-message]{
2013 \DUtitle[system-message]{\color{red}System Message}
2014
2015 ERROR/3 in \texttt{functional/input/data/standard.rst}, line~399
2016
2017 \hyperlink{citation-reference-3}{
2018 Unknown target name: \textquotedbl{}nonexistent\textquotedbl{}.
2019 }
2020 }
2021
2022 \raisebox{1em}{\hypertarget{system-message-4}{}}
2023 \DUadmonition[system-message]{
2024 \DUtitle[system-message]{\color{red}System Message}
2025
2026 ERROR/3 in \texttt{functional/input/data/standard.rst}, line~426
2027
2028 \hyperlink{problematic-2}{
2029 Unknown target name: \textquotedbl{}hyperlink reference without a target\textquotedbl{}.
2030 }
2031 }
2032
2033 \raisebox{1em}{\hypertarget{system-message-5}{}}
2034 \DUadmonition[system-message]{
2035 \DUtitle[system-message]{\color{red}System Message}
2036
2037 ERROR/3 in \texttt{functional/input/data/standard.rst}, line~439
2038
2039 \hyperlink{problematic-3}{
2040 Duplicate target name, cannot be used as a unique reference: \textquotedbl{}duplicate target names\textquotedbl{}.
2041 }
2042 }
2043
2044 \end{document}