Debian Codegraph @

test/functional/expected/latex_cornercases.tex

raw
1 \documentclass[a4paper]{article}
2 % generated by Docutils <https://docutils.sourceforge.io/>
3 \usepackage{cmap} % fix search and cut-and-paste in Acrobat
4 \usepackage[T1]{fontenc}
5 \DeclareUnicodeCharacter{21D4}{\ensuremath{\Leftrightarrow}}
6 \DeclareUnicodeCharacter{2660}{\ensuremath{\spadesuit}}
7 \DeclareUnicodeCharacter{2663}{\ensuremath{\clubsuit}}
8 \usepackage{alltt}
9 \usepackage{amsmath}
10 \usepackage{color}
11 \usepackage{float} % extended float configuration
12 \floatplacement{figure}{H} % place figures here definitely
13 \usepackage{graphicx}
14 \usepackage{multirow}
15 \usepackage{pifont}
16 \setcounter{secnumdepth}{0}
17 \usepackage{soul}
18 \usepackage{longtable,ltcaption,array}
19 \setlength{\extrarowheight}{2pt}
20 \newlength{\DUtablewidth} % internal use in tables
21 \newcommand{\DUcolumnwidth}[1]{\dimexpr#1\DUtablewidth-2\tabcolsep\relax}
22 \usepackage{textcomp} % text symbol macros
23
24 %%% Custom LaTeX preamble
25 % PDF Standard Fonts
26 \usepackage{mathptmx} % Times
27 \usepackage[scaled=.90]{helvet}
28 \usepackage{courier}
29
30 %%% User specified packages and stylesheets
31
32 %%% Fallback definitions for Docutils-specific commands
33
34 % class handling for environments (block-level elements)
35 % \begin{DUclass}{spam} tries \DUCLASSspam and
36 % \end{DUclass}{spam} tries \endDUCLASSspam
37 \ifdefined\DUclass
38 \else % poor man's "provideenvironment"
39 \newenvironment{DUclass}[1]%
40 {% "#1" does not work in end-part of environment.
41 \def\DocutilsClassFunctionName{DUCLASS#1}
42 \csname \DocutilsClassFunctionName \endcsname}%
43 {\csname end\DocutilsClassFunctionName \endcsname}%
44 \fi
45
46 % Provide a length variable and set default, if it is new
47 \providecommand*{\DUprovidelength}[2]{%
48 \ifdefined#1
49 \else
50 \newlength{#1}\setlength{#1}{#2}%
51 \fi
52 }
53
54 % admonition environment (specially marked topic)
55 \ifdefined\DUadmonition
56 \else % poor man's "provideenvironment"
57 \newbox{\DUadmonitionbox}
58 \newenvironment{DUadmonition}%
59 {\begin{center}
60 \begin{lrbox}{\DUadmonitionbox}
61 \begin{minipage}{0.9\linewidth}
62 }%
63 { \end{minipage}
64 \end{lrbox}
65 \fbox{\usebox{\DUadmonitionbox}}
66 \end{center}
67 }
68 \fi
69
70 % custom inline roles: \DUrole{#1}{#2} tries \DUrole#1{#2}
71 \providecommand*{\DUrole}[2]{%
72 \ifcsname DUrole#1\endcsname%
73 \csname DUrole#1\endcsname{#2}%
74 \else%
75 #2%
76 \fi%
77 }
78
79 \providecommand{\DUroleb}{\textbf}
80
81 \providecommand{\DUroledel}{\st}
82
83 \providecommand{\DUroledfn}{\emph}
84
85 \providecommand{\DUrolei}{\textit}
86
87 \providecommand{\DUroleins}{\ul}
88
89 \providecommand{\DUrolekbd}{\texttt}
90
91 \providecommand{\DUrolemark}{\hl}
92
93 \providecommand{\DUroleq}[1]{“#1”}
94
95 \providecommand{\DUroles}{\st}
96
97 \providecommand{\DUrolesmall}[1]{{\footnotesize #1}}
98
99 \providecommand{\DUroleu}{\ul}
100
101 \providecommand{\DUrolevar}{\textit}
102
103 % legend environment (in figures and formal tables)
104 \ifdefined\DUlegend
105 \else
106 \newenvironment{DUlegend}{\small}{}
107 \fi
108
109 % line block environment
110 \DUprovidelength{\DUlineblockindent}{2.5em}
111 \ifdefined\DUlineblock
112 \else
113 \newenvironment{DUlineblock}[1]{%
114 \list{}{\setlength{\partopsep}{\parskip}
115 \addtolength{\partopsep}{\baselineskip}
116 \setlength{\topsep}{0pt}
117 \setlength{\itemsep}{0.15\baselineskip}
118 \setlength{\parsep}{0pt}
119 \setlength{\leftmargin}{#1}}
120 \raggedright
121 }
122 {\endlist}
123 \fi
124
125 % list of command line options
126 \providecommand*{\DUoptionlistlabel}[1]{\bfseries #1 \hfill}
127 \DUprovidelength{\DUoptionlistindent}{3cm}
128 \ifdefined\DUoptionlist
129 \else
130 \newenvironment{DUoptionlist}{%
131 \list{}{\setlength{\labelwidth}{\DUoptionlistindent}
132 \setlength{\rightmargin}{1cm}
133 \setlength{\leftmargin}{\rightmargin}
134 \addtolength{\leftmargin}{\labelwidth}
135 \addtolength{\leftmargin}{\labelsep}
136 \renewcommand{\makelabel}{\DUoptionlistlabel}}
137 }
138 {\endlist}
139 \fi
140
141 % title for topics, admonitions, unsupported section levels, and sidebar
142 \providecommand*{\DUtitle}[1]{%
143 \smallskip\noindent\textbf{#1}\smallskip}
144
145 % titlereference standard role
146 \providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
147
148 % transition (break / fancybreak / anonymous section)
149 \providecommand*{\DUtransition}{%
150 \hspace*{\fill}\hrulefill\hspace*{\fill}
151 \vskip 0.5\baselineskip
152 }
153
154 % hyperlinks:
155 \ifdefined\hypersetup
156 \else
157 \usepackage[hyperfootnotes=false,
158 colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
159 \usepackage{bookmark}
160 \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
161 \fi
162 \hypersetup{
163 pdftitle={Additional Tests for the LaTeX Writer},
164 }
165
166 %%% Body
167 \begin{document}
168 \title{Additional Tests for the LaTeX Writer}
169 \author{}
170 \date{}
171 \maketitle
172
173 These tests contain syntax elements and combinations which may cause
174 trouble for the LaTeX writer.
175
176 \pdfbookmark[1]{Contents}{contents}
177 \tableofcontents
178
179
180 \section{Section heading levels}
181
182
183 \section{Level 1}
184
185 Nested sections
186
187
188 \subsection{Level 2}
189
190 reach at some level
191
192
193 \subsubsection{Level 3}
194
195 (depending on the document class and output format)
196
197
198 \paragraph{level 4}
199
200 a level
201
202
203 \subparagraph{level 5}
204
205 that is not supported by the output format.
206
207
208 \begin{DUclass}{sectionVI}
209 \DUtitle{level 6}
210 \end{DUclass}
211
212 Unsupported in LaTeX and HTML5
213 (HTML5 reserves the 1st level for the document title).
214
215
216 \begin{DUclass}{sectionVII}
217 \DUtitle{level 7}
218 \end{DUclass}
219
220 Unsupported in HTML4.
221
222
223 \begin{DUclass}{sectionVIII}
224 \DUtitle{level 8}
225 \end{DUclass}
226
227 Unsupported in ODT.
228
229
230 \section{Section titles with inline markup%
231 \label{references}%
232 }
233
234
235 \subsection{\emph{emphasized}, H\textsubscript{2}O, $x^2$, and \hyperref[references]{references}}
236
237
238 \subsection{Substitutions work%
239 \label{substitutions-fail}%
240 }
241
242 Note, that the \textquotedbl{}reference name\textquotedbl{} for this section is derived from the
243 content \emph{before} substitution. You can link to it with the \href{https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html\#hyperlink-references}{phrase
244 reference} \textquotedbl{}\hyperref[substitutions-fail]{substitutions fail}\textquotedbl{}.
245 This behaviour may be exploited to get intelligible IDs after \href{https://docutils.sourceforge.io/docs/ref/rst/directives.html\#identifier-normalization}{identifier
246 normalization} of the section's reference name.
247
248 % This file is used by the standalone_rst_latex test.
249
250
251 \section{Option lists}
252
253 The LaTeX-2e description environment is used for definition lists.
254 The definition is continued on the same line as the term, this should
255 not happen if an option-list is at the top of the definition.
256
257 If the option list is not at the first element in the definition, it
258 is contained in a quote
259
260 \begin{quote}
261 \begin{DUoptionlist}
262 \item[-{}-help] show help
263 \item[-v] verbose
264 \end{DUoptionlist}
265 \end{quote}
266
267 \begin{description}
268 \item[{In a definition list:}] \leavevmode
269 \begin{DUoptionlist}
270 \item[-{}-help] show help
271 \item[-v] verbose
272 \end{DUoptionlist}
273 \end{description}
274
275
276 \section{Block Quotes}
277
278 \begin{quote}
279 This block quote comes directly after the section heading and is
280 followed by a paragraph.
281
282 This is the second paragraph of the block quote and it contains
283 some more text filling up some space which would otherwise be
284 empty.
285 \nopagebreak
286
287 \raggedleft —Attribution
288 \end{quote}
289
290 This is a paragraph.
291
292 \begin{quote}
293 This block quote does not have an attribution.
294 \end{quote}
295
296 This is another paragraph.
297
298 \begin{quote}
299 Another block quote at the end of the section.
300 \end{quote}
301
302
303 \section{More Block Quotes}
304
305 \begin{quote}
306 Block quote followed by a transition.
307 \end{quote}
308
309 %___________________________________________________________________________
310 \DUtransition
311
312 \begin{quote}
313 Another block quote.
314 \end{quote}
315
316
317 \section{Images}
318
319 Image with 20\% width:
320
321 \includegraphics[width=0.2\linewidth]{../../../docs/user/rst/images/title.png}
322
323 Image with 100\% width:
324
325 \includegraphics[width=1\linewidth]{../../../docs/user/rst/images/title.png}
326
327
328 \section{Additional text roles}
329
330 Including the \textquotedbl{}html-roles.txt\textquotedbl{} standard definition file adds
331 roles matching semantic HTML inline markup elements.
332
333 % Standard definition file for additional roles matching HTML tags.
334 %
335 % :Copyright: © 2025 Günter Milde.
336 % :License: Released under the terms of the
337 % `2-Clause BSD license <http://www.spdx.org/licenses/BSD-2-Clause>`__
338
339 \setlength{\DUtablewidth}{\dimexpr\linewidth-4\arrayrulewidth\relax}%
340 \begin{longtable*}{|p{\DUcolumnwidth{0.102}}|p{\DUcolumnwidth{0.271}}|p{\DUcolumnwidth{0.627}}|}
341 \hline
342 \textbf{%
343 Role
344 } & \textbf{%
345 Example
346 } & \textbf{%
347 Notes
348 } \\
349 \hline
350 \endfirsthead
351 \hline
352 \textbf{%
353 Role
354 } & \textbf{%
355 Example
356 } & \textbf{%
357 Notes
358 } \\
359 \hline
360 \endhead
361 \multicolumn{3}{p{\DUcolumnwidth{1.000}}}{\raggedleft\ldots continued on next page}\\
362 \endfoot
363 \endlastfoot
364
365 del
366 &
367 \DUrole{del}{removed}
368 &
369 removed content
370 \\
371 \hline
372
373 ins
374 &
375 \DUrole{ins}{inserted}
376 &
377 editional additions
378 \\
379 \hline
380
381 b
382 &
383 \DUrole{b}{keyword}
384 &
385 highlight \DUrole{b}{key words}
386 without marking them up as important
387 \\
388 \hline
389
390 dfn
391 &
392 \DUrole{dfn}{dfn}
393 &
394 the defining instance of a term
395 \\
396 \hline
397
398 i
399 &
400 \DUrole{i}{rôle}
401 &
402 \DUrole{i}{voix alternative}
403 \\
404 \hline
405
406 kbd
407 &
408 \texttt{\DUrole{kbd}{Ctrl X}}
409 &
410 user input
411 \\
412 \hline
413
414 mark
415 &
416 \DUrole{mark}{up}
417 &
418 highlight a \DUrole{mark}{run of text}
419 \\
420 \hline
421
422 q
423 &
424 \DUrole{q}{Tagline!}
425 &
426 content quoted from another source
427 \\
428 \hline
429
430 s
431 &
432 \DUrole{s}{strike}
433 &
434 text that is inaccurate or
435 no longer relevant
436 \\
437 \hline
438
439 samp
440 &
441 \texttt{\DUrole{samp}{Ready!}}
442 &
443 computer output
444 \\
445 \hline
446
447 small
448 &
449 \DUrole{small}{print}
450 &
451 side comments
452 \\
453 \hline
454
455 u
456 &
457 \DUrole{u}{anotation}
458 &
459 unarticulated annotations of, e.g,
460 \DUrole{u}{comon mispellings}
461 \\
462 \hline
463
464 var
465 &
466 \DUrole{var}{n}
467 &
468 variables (or constants)
469 \\
470 \hline
471 \end{longtable*}
472
473
474 \section{Tables}
475
476 In contrast to HTML, LaTeX does not support line-breaks in tables with
477 \textquotedbl{}automatic\textquotedbl{} column widths. Each cell has just one line, paragraphs are
478 merged (the writer emits a warning).
479
480 \begin{longtable}{|l|l|}
481 \caption{problems with \textquotedbl{}auto\textquotedbl{} widths}\\
482 \hline
483 11 & first paragraph
484 second paragraph \\
485 \hline
486 content
487 with
488 linebreak & 22 \\
489 \hline
490 \end{longtable}
491
492 To provide for arbitrary cell content, the LaTeX writer defaults to
493 specifying column widths computed from the source column widths. This
494 works sufficiently in many cases:
495
496 \setlength{\DUtablewidth}{\dimexpr\linewidth-7\arrayrulewidth\relax}%
497 \begin{longtable}{|p{\DUcolumnwidth{0.153}}|p{\DUcolumnwidth{0.208}}|p{\DUcolumnwidth{0.208}}|p{\DUcolumnwidth{0.125}}|p{\DUcolumnwidth{0.139}}|p{\DUcolumnwidth{0.167}}|}
498 \caption{a table with multi-paragraph multi-column cells}\\
499 \hline
500
501 test
502 &
503 \textbf{bold hd}
504 & \multicolumn{3}{p{\DUcolumnwidth{0.472}}|}{%
505 multicolumn 1
506
507 With a second paragraph
508 } &
509 \emph{emph hd}
510 \\
511 \hline
512 \multicolumn{2}{|p{\DUcolumnwidth{0.361}}|}{%
513 multicolumn 2
514
515 With a second paragraph
516 } &
517 cell
518 &
519 cell
520 &
521 cell
522 &
523 cell
524 \\
525 \hline
526
527 cell
528 & \multicolumn{2}{p{\DUcolumnwidth{0.417}}|}{%
529 multicolumn 3 (one line,
530 but very very very very
531 very looooong)
532 } &
533 cell
534 &
535 cell
536 &
537 cell
538 \\
539 \hline
540
541 cell
542 &
543 cell
544 &
545 cell
546 & \multicolumn{3}{p{\DUcolumnwidth{0.431}}|}{%
547 Short multicolumn 4
548 } \\
549 \hline
550 \end{longtable}
551
552 A problem with the source-derived column widths is that simple tables
553 often use no padding while grid tables without padding look cramped:
554
555 \setlength{\DUtablewidth}{\dimexpr\linewidth-5\arrayrulewidth\relax}%
556 \begin{longtable}{|p{\DUcolumnwidth{0.100}}|p{\DUcolumnwidth{0.050}}|p{\DUcolumnwidth{0.050}}|p{\DUcolumnwidth{0.050}}|}
557 \caption{simple table, not padded in the source}\\
558 \hline
559 \textbf{%
560 A
561 } & \textbf{%
562 B
563 } & \textbf{%
564 C
565 } & \textbf{%
566 D
567 } \\
568 \hline
569 \endfirsthead
570 \caption[]{simple table, not padded in the source (... continued)}\\
571 \hline
572 \textbf{%
573 A
574 } & \textbf{%
575 B
576 } & \textbf{%
577 C
578 } & \textbf{%
579 D
580 } \\
581 \hline
582 \endhead
583 \multicolumn{4}{p{\DUcolumnwidth{0.250}}}{\raggedleft\ldots continued on next page}\\
584 \endfoot
585 \endlastfoot
586
587 100
588 &
589 2
590 &
591 3
592 &
593 4
594 \\
595 \hline
596
597 EUR
598 &
599 b
600 &
601 c
602 &
603 d
604 \\
605 \hline
606 \end{longtable}
607
608 \setlength{\DUtablewidth}{\dimexpr\linewidth-5\arrayrulewidth\relax}%
609 \begin{longtable}{|p{\DUcolumnwidth{0.150}}|p{\DUcolumnwidth{0.100}}|p{\DUcolumnwidth{0.100}}|p{\DUcolumnwidth{0.100}}|}
610 \caption{grid table, padded cells}\\
611 \hline
612 \textbf{%
613 A
614 } & \textbf{%
615 B
616 } & \textbf{%
617 C
618 } & \textbf{%
619 D
620 } \\
621 \hline
622 \endfirsthead
623 \caption[]{grid table, padded cells (... continued)}\\
624 \hline
625 \textbf{%
626 A
627 } & \textbf{%
628 B
629 } & \textbf{%
630 C
631 } & \textbf{%
632 D
633 } \\
634 \hline
635 \endhead
636 \multicolumn{4}{p{\DUcolumnwidth{0.450}}}{\raggedleft\ldots continued on next page}\\
637 \endfoot
638 \endlastfoot
639
640 100
641 &
642 2
643 &
644 3
645 &
646 4
647 \\
648 \hline
649
650 EUR
651 &
652 b
653 &
654 c
655 &
656 d
657 \\
658 \hline
659 \end{longtable}
660
661 For better typographic results, setting the \DUroletitlereference{width} and/or
662 \DUroletitlereference{widths} options of the \href{https://docutils.sourceforge.io/docs/ref/rst/directives.html\#table}{table directive} is recommended.
663
664 \begin{longtable}{|l|l|l|l|}
665 \caption{grid table, auto-width columns}\\
666 \hline
667 \textbf{A} & \textbf{B} & \textbf{C} & \textbf{D} \\
668 \hline
669 \endfirsthead
670 \caption[]{grid table, auto-width columns (... continued)}\\
671 \hline
672 \textbf{A} & \textbf{B} & \textbf{C} & \textbf{D} \\
673 \hline
674 \endhead
675 \endfoot
676 \endlastfoot
677 100 & 2 & 3 & 4 \\
678 \hline
679 EUR & b & c & d \\
680 \hline
681 \end{longtable}
682
683 \begin{longtable}{|l|l|}
684 \caption{table with multi-row header and \textquotedbl{}auto\textquotedbl{} column-widths}\\
685 \hline
686 \multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\
687 \cline{2-2}
688 & \textbf{Description} \\
689 \hline
690 \endfirsthead
691 \caption[]{table with multi-row header and \textquotedbl{}auto\textquotedbl{} column-widths (... continued)}\\
692 \hline
693 \multirow{2}{*}{\textbf{XXX}} & \textbf{Variable Summary} \\
694 \cline{2-2}
695 & \textbf{Description} \\
696 \hline
697 \endhead
698 \multicolumn{2}{l}{\raggedleft\ldots continued on next page}\\
699 \endfoot
700 \endlastfoot
701 \multicolumn{2}{|l|}{multi-column cell} \\
702 \hline
703 \end{longtable}
704
705 The \DUroletitlereference{width} option overrides \textquotedbl{}auto\textquotedbl{} \DUroletitlereference{widths} as standard LaTeX tables
706 don't have a global width setting:
707
708 \setlength{\DUtablewidth}{\dimexpr0.6\linewidth-5\arrayrulewidth\relax}%
709 \begin{longtable}{|p{\DUcolumnwidth{0.400}}|p{\DUcolumnwidth{0.200}}|p{\DUcolumnwidth{0.200}}|p{\DUcolumnwidth{0.200}}|}
710 \caption{This table has \DUroletitlereference{widths} \textquotedbl{}auto\textquotedbl{} (ignored) and \DUroletitlereference{width} 60\%.}\\
711 \hline
712 \textbf{%
713 A
714 } & \textbf{%
715 B
716 } & \textbf{%
717 C
718 } & \textbf{%
719 D
720 } \\
721 \hline
722 \endfirsthead
723 \caption[]{This table has \DUroletitlereference{widths} \textquotedbl{}auto\textquotedbl{} (ignored) and \DUroletitlereference{width} 60\%. (... continued)}\\
724 \hline
725 \textbf{%
726 A
727 } & \textbf{%
728 B
729 } & \textbf{%
730 C
731 } & \textbf{%
732 D
733 } \\
734 \hline
735 \endhead
736 \multicolumn{4}{p{\DUcolumnwidth{1.000}}}{\raggedleft\ldots continued on next page}\\
737 \endfoot
738 \endlastfoot
739
740 100
741 &
742 2
743 &
744 3
745 &
746 4
747 \\
748 \hline
749
750 EUR
751 &
752 b
753 &
754 c
755 &
756 d
757 \\
758 \hline
759 \end{longtable}
760
761
762 \subsection{Nested tables}
763
764 \setlength{\DUtablewidth}{\dimexpr\linewidth-3\arrayrulewidth\relax}%
765 \begin{longtable*}{|p{\DUcolumnwidth{0.700}}|p{\DUcolumnwidth{0.300}}|}
766 \hline
767
768 Lorem ipsum dolor sit amet, consectetur
769 &
770 adipisicing elit
771 \\
772 \hline
773
774 \label{nested-table}
775 \noindent\makebox[\linewidth][r]{%
776 \setlength{\DUtablewidth}{\dimexpr\linewidth-3\arrayrulewidth\relax}%
777 \begin{tabular}{|p{\DUcolumnwidth{0.150}}|p{\DUcolumnwidth{0.150}}|}
778 \hline
779
780 1
781 &
782 2
783 \\
784 \hline
785 \end{tabular}
786 }
787 &
788 cell 1, 2
789 \\
790 \hline
791
792 table width depends on parent column
793
794 \noindent\makebox[\linewidth][c]{%
795 \setlength{\DUtablewidth}{\dimexpr\linewidth-3\arrayrulewidth\relax}%
796 \begin{tabular}{|p{\DUcolumnwidth{0.150}}|p{\DUcolumnwidth{0.150}}|}
797 \hline
798
799 1
800 &
801 2
802 \\
803 \hline
804 \end{tabular}
805 }
806
807 better use \textquotedbl{}auto\textquotedbl{} widths, see below
808 &
809 same table
810
811 \setlength{\DUtablewidth}{\dimexpr\linewidth-3\arrayrulewidth\relax}%
812 \begin{tabular}{|p{\DUcolumnwidth{0.150}}|p{\DUcolumnwidth{0.150}}|}
813 \hline
814
815 1
816 &
817 2
818 \\
819 \hline
820 \end{tabular}
821
822 in narrow column
823 \\
824 \hline
825
826 \noindent\makebox[\linewidth][r]{%
827 \begin{tabular}{|l|l|}
828 \hline
829 1 & 2 \\
830 \hline
831 \end{tabular}
832 }
833
834 \begin{description}
835 \item[{definition:}]
836 list
837 \end{description}
838 &
839 cell 3, 2
840 \\
841 \hline
842 \end{longtable*}
843
844
845 \subsection{TODO}
846
847 \begin{itemize}
848 \item Tables with multi-paragraph multi-row cells currently fail due to a
849 LaTeX limitation (see \url{https://sourceforge.net/p/docutils/bugs/225/}).
850
851 \item Tweak vertical spacing in table cells containing multiple elements.
852 \end{itemize}
853
854 See also \texttt{test/functional/input/data/latex-problematic.rst}.
855
856
857 \section{Monospaced non-alphanumeric characters}
858
859 These are all ASCII characters except a-zA-Z0-9 and space:
860
861 \texttt{!!!\textquotedbl{}\textquotedbl{}\textquotedbl{}\#\#\#\$\$\$\%\%\%\&\&\&'{}'{}'((()))***+++,{},{},-{}-{}-...///:::}
862
863 \texttt{;;;<{}<{}<===>{}>{}>???@@@{[}{[}{[}\textbackslash{}\textbackslash{}\textbackslash{}{]}{]}{]}\textasciicircum{}\textasciicircum{}\textasciicircum{}\_\_\_`{}`{}`\{\{\{|||\}\}\}\textasciitilde{}\textasciitilde{}\textasciitilde{}}
864
865 \texttt{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
866
867 The two lines of non-alphanumeric characters should both have the same
868 width as the third line.
869
870
871 \section{Non-ASCII characters}
872
873 \begin{longtable}{|l|l|}
874 \caption{Punctuation and footnote symbols}\\
875 \hline
876 – & en-dash \\
877 \hline
878 — & em-dash \\
879 \hline
880 ‘ & single turned comma quotation mark \\
881 \hline
882 ’ & single comma quotation mark \\
883 \hline
884 ‚ & low single comma quotation mark \\
885 \hline
886 “ & double turned comma quotation mark \\
887 \hline
888 ” & double comma quotation mark \\
889 \hline
890 „ & low double comma quotation mark \\
891 \hline
892 † & dagger \\
893 \hline
894 ‡ & double dagger \\
895 \hline
896 \ding{169} & black diamond suit \\
897 \hline
898 \ding{170} & black heart suit \\
899 \hline
900 ♠ & black spade suit \\
901 \hline
902 ♣ & black club suit \\
903 \hline
904 … & ellipsis \\
905 \hline
906 ™ & trade mark sign \\
907 \hline
908 ⇔ & left-right double arrow \\
909 \hline
910 \end{longtable}
911
912 \begin{longtable}{|l|l|l|l|l|l|l|l|l|l|l|}
913 \caption{The \DUroletitlereference{Latin-1 extended} Unicode block}\\
914 \hline
915
916 %
917 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\
918 \hline
919 160 & & ¡ & ¢ & £ & & ¥ & ¦ & § & ¨ & © \\
920 \hline
921 170 & ª & « & ¬ & \- & ® & ¯ & ° & ± & ² & ³ \\
922 \hline
923 180 & ´ & µ & ¶ & · & ¸ & ¹ & º & » & ¼ & ½ \\
924 \hline
925 190 & ¾ & ¿ & À & Á & Â & Ã & Ä & Å & Æ & Ç \\
926 \hline
927 200 & È & É & Ê & Ë & Ì & Í & Î & Ï & Ð & Ñ \\
928 \hline
929 210 & Ò & Ó & Ô & Õ & Ö & × & Ø & Ù & Ú & Û \\
930 \hline
931 220 & Ü & Ý & Þ & ß & à & á & â & ã & ä & å \\
932 \hline
933 230 & æ & ç & è & é & ê & ë & ì & í & î & ï \\
934 \hline
935 240 & ð & ñ & ò & ó & ô & õ & ö & ÷ & ø & ù \\
936 \hline
937 250 & ú & û & ü & ý & þ & ÿ & & & & \\
938 \hline
939 \end{longtable}
940
941 \begin{itemize}
942 \item The following line should not be wrapped, because it uses
943 no-break spaces (\textbackslash{}u00a0):
944
945 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
946
947 \item Line wrapping with/without breakpoints marked by soft hyphens
948 (\textbackslash{}u00ad):
949
950 pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch
951
952 pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch
953 \end{itemize}
954
955
956 \section{Encoding special characters}
957
958 The LaTeX Info pages list under \textquotedbl{}2.18 Special Characters\textquotedbl{}
959
960 \begin{quote}
961 The following characters play a special role in LaTeX and are called
962 \textquotedbl{}special printing characters\textquotedbl{}, or simply \textquotedbl{}special characters\textquotedbl{}.
963
964 \begin{quote}
965 \# \$ \% \& \textasciitilde{} \_ \textasciicircum{} \textbackslash{} \{ \}
966 \end{quote}
967 \end{quote}
968
969 The special chars verbatim:
970
971 \begin{quote}
972 \begin{alltt}
973 # $ % & ~ _ ^ \textbackslash{} \{ \}
974 \end{alltt}
975 \end{quote}
976
977 However also \emph{square brackets} {[}{]} need special care.
978
979 \begin{quote}
980 Commands with optional arguments (e.g. \texttt{\textbackslash{}item}) check
981 if the token right after the macro name is an opening bracket.
982 In that case the contents between that bracket and the following
983 closing bracket on the same grouping level are taken as the
984 optional argument. What makes this unintuitive is the fact that
985 the square brackets aren't grouping characters themselves, so in
986 your last example \texttt{\textbackslash{}item{[}{[}...{]}{]}} the optional argument consists of
987 {[}... (without the closing bracket).
988 \end{quote}
989
990 Compare the items in the following lists:
991
992 \begin{itemize}
993 \item simple item
994
995 \item {[}bracketed{]} item
996 \end{itemize}
997
998 \begin{description}
999 \item[{simple}]
1000 description term
1001
1002 \item[{{[}bracketed{]}}]
1003 description term
1004 \end{description}
1005
1006 The OT1 font-encoding differs from ASCII for the less-than, greater-than
1007 and bar characters (< | >) except for typewriter font \DUroletitlereference{cmtt}
1008 (\texttt{< | >}).
1009
1010
1011 \section{Hyperlinks and -targets}
1012
1013 In LaTeX, we must set an explicit anchor (\texttt{\textbackslash{}phantomsection}) for a
1014 %
1015 \phantomsection\label{hypertarget-in-plain-text}hypertarget in plain text or in a figure but not in a table title
1016 or figure caption:
1017
1018 \setlength{\DUtablewidth}{\dimexpr\linewidth-4\arrayrulewidth\relax}%
1019 \begin{longtable}{|p{\DUcolumnwidth{0.150}}|p{\DUcolumnwidth{0.150}}|p{\DUcolumnwidth{0.150}}|}
1020 \caption{Table with %
1021 \label{hypertarget-in-table-title}hypertarget in table title.\label{table-label}}\\
1022 \hline
1023
1024 False
1025 &
1026 True
1027 &
1028 None
1029 \\
1030 \hline
1031 \end{longtable}
1032
1033 \phantomsection\label{figure-label}
1034 \begin{figure}
1035 \noindent\makebox[\linewidth][c]{\includegraphics{../../../docs/user/rst/images/biohazard.png}}
1036 \caption{Figure with %
1037 \label{hypertarget-in-figure-caption}hypertarget in figure caption.}
1038 \begin{DUlegend}
1039 Legend with %
1040 \phantomsection\label{hypertarget-in-figure-legend}hypertarget in figure legend.
1041 \end{DUlegend}
1042 \end{figure}
1043
1044 \phantomsection\label{image-label}
1045 \includegraphics{../../../docs/user/rst/images/biohazard.png}
1046
1047 See \hyperref[hypertarget-in-plain-text]{hypertarget in plain text},
1048 \hyperref[table-label]{table label}, \hyperref[hypertarget-in-table-title]{hypertarget in table title},
1049 \hyperref[nested-table]{nested table},
1050 \hyperref[figure-label]{figure label}, \hyperref[hypertarget-in-figure-caption]{hypertarget in figure caption},
1051 \hyperref[hypertarget-in-figure-legend]{hypertarget in figure legend}, and
1052 \hyperref[image-label]{image label}.
1053
1054
1055 \section{External references}
1056
1057 Long URLs should be wrapped in the PDF. This can be achieved with the
1058 \texttt{\textbackslash{}url} command which is used by the LaTeX writer whenever the content
1059 (name) of a reference node equals the link URL.
1060
1061 \begin{description}
1062 \item[{Example:}]
1063 a long URL that should wrap in the output
1064 \url{https://docutils.sourceforge.io/docs/user/latex.html\#id79}
1065 \end{description}
1066
1067 If the argument contains any \textquotedbl{}\%\textquotedbl{}, \textquotedbl{}\#\textquotedbl{}, or \textquotedbl{}\textasciicircum{}\textasciicircum{}\textquotedbl{}, or ends with \texttt{\textbackslash{}}, it can't
1068 be used in the argument to another command. The argument must not contain
1069 unbalanced braces.
1070
1071 The characters \textasciicircum{}, \{, \}, and \texttt{\textbackslash{}} are invalid in a \textquotedbl{}http:\textquotedbl{} or \textquotedbl{}ftp:\textquotedbl{} URL
1072 and not recognized as part of it:
1073
1074 \begin{DUlineblock}{0em}
1075 \item[] \url{http://www.example.org}/strange\textasciicircum{}\textasciicircum{}name
1076 \item[] \url{http://www.example.org}\textbackslash{}using\textbackslash{}DOS\textbackslash{}paths\textbackslash{}
1077 \item[] \url{http://www.example.org/XML}/strange\{n\}ame
1078 \end{DUlineblock}
1079
1080 They can, however be used in paths and/or filenames.
1081
1082 Handling by the LaTeX writer:
1083
1084 \begin{itemize}
1085 \item \texttt{\#}, \texttt{\textbackslash{}} and \texttt{\%} are escaped:
1086
1087 \begin{DUlineblock}{0em}
1088 \item[] \href{http://www.w3.org/XML/Schema\#dev}{URL with \#}
1089 \url{http://www.w3.org/XML/Schema\#dev}
1090 \item[] \href{http://www.w3.org/XML/Schema\%dev}{URL with \%}
1091 \url{http://example.org/Schema\%dev}
1092 \item[] \href{A:DOS\\path\\}{file with DOS path} \url{A:DOS\\path\\}
1093 \end{DUlineblock}
1094
1095 \begin{DUclass}{note}
1096 \begin{DUadmonition}
1097 \DUtitle{Note}
1098
1099 These URLs are typeset inside a LaTeX command without error.
1100
1101 \begin{DUlineblock}{0em}
1102 \item[] \url{http://www.w3.org/XML/Schema\#dev}
1103 \item[] \url{http://example.org/Schema\%dev}
1104 \item[] \url{A:DOS\\path\\}
1105 \end{DUlineblock}
1106 \end{DUadmonition}
1107 \end{DUclass}
1108 \end{itemize}
1109
1110 \begin{itemize}
1111 \item \texttt{\textasciicircum{}\textasciicircum{}} LaTeX's special syntax for characters results in \textquotedbl{}strange\textquotedbl{} replacements
1112 (both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}). The writer emits a warning.
1113
1114 \href{../strange^^name}{file with \textasciicircum{}\textasciicircum{}}:
1115 \url{../strange^^name}
1116
1117 \item Unbalanced braces, \{ or \}, will fail (both with \texttt{\textbackslash{}href} and \texttt{\textbackslash{}url}):
1118
1119 \begin{quote}
1120 \begin{alltt}
1121 `file with \{ <../strange\{name>`__
1122 `<../strange\{name>`__
1123 \end{alltt}
1124 \end{quote}
1125
1126 while balanced braces are suported:
1127
1128 \begin{DUlineblock}{0em}
1129 \item[] \url{../strange{n}ame}
1130 \item[] \url{../st{r}ange{n}ame}
1131 \item[] \url{../{st{r}ange{n}ame}}
1132 \end{DUlineblock}
1133 \end{itemize}
1134
1135 \end{document}