Debian Codegraph @

test/functional/expected/footnotes_latex.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 \setcounter{secnumdepth}{0}
6 \usepackage{longtable,ltcaption,array}
7 \setlength{\extrarowheight}{2pt}
8 \newlength{\DUtablewidth} % internal use in tables
9 \newcommand{\DUcolumnwidth}[1]{\dimexpr#1\DUtablewidth-2\tabcolsep\relax}
10
11 %%% Custom LaTeX preamble
12 % PDF Standard Fonts
13 \usepackage{mathptmx} % Times
14 \usepackage[scaled=.90]{helvet}
15 \usepackage{courier}
16
17 %%% User specified packages and stylesheets
18
19 %%% Fallback definitions for Docutils-specific commands
20
21 % class handling for environments (block-level elements)
22 % \begin{DUclass}{spam} tries \DUCLASSspam and
23 % \end{DUclass}{spam} tries \endDUCLASSspam
24 \ifdefined\DUclass
25 \else % poor man's "provideenvironment"
26 \newenvironment{DUclass}[1]%
27 {% "#1" does not work in end-part of environment.
28 \def\DocutilsClassFunctionName{DUCLASS#1}
29 \csname \DocutilsClassFunctionName \endcsname}%
30 {\csname end\DocutilsClassFunctionName \endcsname}%
31 \fi
32
33 % admonition environment (specially marked topic)
34 \ifdefined\DUadmonition
35 \else % poor man's "provideenvironment"
36 \newbox{\DUadmonitionbox}
37 \newenvironment{DUadmonition}%
38 {\begin{center}
39 \begin{lrbox}{\DUadmonitionbox}
40 \begin{minipage}{0.9\linewidth}
41 }%
42 { \end{minipage}
43 \end{lrbox}
44 \fbox{\usebox{\DUadmonitionbox}}
45 \end{center}
46 }
47 \fi
48
49 % use full-size footnotemarks with brackets
50 \providecommand*{\DUbracketfootnotemark}[3]{%
51 \raisebox{1em}{\hypertarget{#1}{}}%
52 \hyperref[#2]{[#3]}%
53 }
54
55 % field list environment (for separate configuration of `field lists`)
56 \ifdefined\DUfieldlist
57 \else
58 \newenvironment{DUfieldlist}%
59 {\quote\description}
60 {\enddescription\endquote}
61 \fi
62
63 % numbered or symbol footnotes with hyperlinks and backlinks
64 \providecommand*{\DUfootnotemark}[3]{%
65 \raisebox{1em}{\hypertarget{#1}{}}%
66 \hyperref[#2]{\textsuperscript{#3}}%
67 }
68 \providecommand{\DUfootnotetext}[4]{%
69 \begingroup%
70 \renewcommand{\thefootnote}{%
71 \protect\phantomsection\protect\label{#1}
72 \protect\hyperlink{#2}{#3}}%
73 \footnotetext{#4}%
74 \endgroup%
75 }
76
77 % title for topics, admonitions, unsupported section levels, and sidebar
78 \providecommand*{\DUtitle}[1]{%
79 \smallskip\noindent\textbf{#1}\smallskip}
80
81 % titlereference standard role
82 \providecommand*{\DUroletitlereference}[1]{\textsl{#1}}
83
84 % hyperlinks:
85 \ifdefined\hypersetup
86 \else
87 \usepackage[hyperfootnotes=false,
88 colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
89 \usepackage{bookmark}
90 \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
91 \fi
92 \hypersetup{
93 pdftitle={Test footnote and citation rendering},
94 }
95
96 %%% Body
97 \begin{document}
98 \title{Test footnote and citation rendering}
99 \author{}
100 \date{}
101 \maketitle
102
103 Paragraphs may contain footnote references (manually numbered
104 \DUbracketfootnotemark{footnote-reference-1}{footnote-1}{1}, anonymous auto-numbered \DUbracketfootnotemark{footnote-reference-2}{footnote-2}{3}, labeled auto-numbered \DUbracketfootnotemark{footnote-reference-3}{label}{2}, or
105 symbolic \DUbracketfootnotemark{footnote-reference-4}{footnote-3}{*}) or citation references (\cite{CIT2002}, \cite{DU2015}).
106 %
107 \DUfootnotetext{footnote-1}{footnote-reference-1}{[1]}{%
108 A footnote contains body elements, consistently indented by at
109 least 1 space.
110
111 This is the footnote's second paragraph.
112 }
113 %
114 \DUfootnotetext{label}{footnote-reference-3}{[2]}{%
115 Footnotes may be numbered, either manually (as in \DUbracketfootnotemark{footnote-reference-5}{footnote-1}{1}) or
116 automatically using a \textquotedbl{}\#\textquotedbl{}-prefixed label. This footnote has a
117 label so it can be referred to from multiple places, both as a
118 footnote reference (\DUbracketfootnotemark{footnote-reference-6}{label}{2}) and as a \hyperref[label]{hyperlink reference}.
119 }
120 %
121 \DUfootnotetext{footnote-2}{footnote-reference-2}{[3]}{%
122 This footnote is numbered automatically and anonymously using a
123 label of \textquotedbl{}\#\textquotedbl{} only.
124
125 This is the second paragraph.
126
127 And this is the third paragraph.
128 }
129 %
130 \DUfootnotetext{footnote-3}{footnote-reference-4}{[*]}{%
131 Footnotes may also use symbols, specified with a \textquotedbl{}*\textquotedbl{} label.
132 Here's a reference to the next footnote: \DUbracketfootnotemark{footnote-reference-7}{footnote-4}{†}.
133 }
134 %
135 \DUfootnotetext{footnote-4}{footnote-reference-7}{[†]}{%
136 This footnote shows the next symbol in the sequence.
137 }
138 %
139 \DUfootnotetext{footnote-5}{}{[4]}{%
140 Here's an unreferenced footnote, with a reference to a
141 nonexistent footnote: \DUbracketfootnotemark{footnote-reference-8}{footnote-9}{5}.
142 }
143
144
145 \section{Body elements in footnotes \texorpdfstring{\protect\DUbracketfootnotemark{footnote-reference-9}{note-note}{9}}{}}
146
147 Footnotes may contain block elements like lists \DUbracketfootnotemark{footnote-reference-10}{footnote-6}{6} \DUbracketfootnotemark{footnote-reference-11}{list-note}{7} \DUbracketfootnotemark{footnote-reference-12}{footnote-7}{8},
148 admonitions \DUbracketfootnotemark{footnote-reference-13}{note-note}{9}, or tables \DUbracketfootnotemark{footnote-reference-14}{footnote-8}{10}.
149 %
150 \DUfootnotetext{footnote-6}{footnote-reference-10}{[6]}{%
151 \begin{enumerate}
152 \item An ordered list
153
154 \item in a footnote.
155 \end{enumerate}
156 }
157 %
158 \DUfootnotetext{list-note}{footnote-reference-11}{[7]}{%
159 \begin{itemize}
160 \item An unordered list (bullet list)
161
162 \item in a footnote.
163 \end{itemize}
164
165 And a trailing paragraph.
166 }
167 %
168 \DUfootnotetext{footnote-7}{footnote-reference-12}{[8]}{%
169 \begin{DUfieldlist}
170 \item[{Field:}]
171 list
172
173 \item[{with:}]
174 2 items.
175 \end{DUfieldlist}
176 }
177 %
178 \DUfootnotetext{note-note}{footnote-reference-9}{[9]}{%
179 \begin{DUclass}{note}
180 \begin{DUadmonition}
181 \DUtitle{Note}
182
183 This is a note in a note.
184 \end{DUadmonition}
185 \end{DUclass}
186 \smallskip}
187 %
188 \DUfootnotetext{footnote-8}{footnote-reference-14}{[10]}{%
189 \setlength{\DUtablewidth}{\dimexpr\linewidth-3\arrayrulewidth\relax}%
190 \begin{longtable*}{|p{\DUcolumnwidth{0.150}}|p{\DUcolumnwidth{0.250}}|}
191 \hline
192
193 a
194 &
195 table
196 \\
197 \hline
198
199 in a
200 &
201 footnote
202 \\
203 \hline
204 \end{longtable*}
205 }
206 %
207 \DUfootnotetext{footnote-9}{footnote-reference-8}{[5]}{%
208 This footnote is missing in the standard example document.
209 }
210
211 This \DUbracketfootnotemark{footnote-reference-15}{list-note}{7} is a second reference to the footnote containing
212 a bullet list.
213
214 A second reference to \cite{CIT2002}.
215
216 \begin{thebibliography}{CIT2002}
217 \bibitem[CIT2002]{CIT2002}{
218 Citations are text-labeled footnotes. They may be
219 rendered separately and differently from footnotes.
220 }
221 \bibitem[DU2015]{DU2015}{
222 \DUroletitlereference{Example document}, Hometown: 2015.
223 }
224 \end{thebibliography}
225
226 \end{document}