| 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 |
% title for topics, admonitions, unsupported section levels, and sidebar |
| 50 |
\providecommand*{\DUtitle}[1]{% |
| 51 |
\smallskip\noindent\textbf{#1}\smallskip} |
| 52 |
|
| 53 |
% hyperlinks: |
| 54 |
\ifdefined\hypersetup |
| 55 |
\else |
| 56 |
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref} |
| 57 |
\usepackage{bookmark} |
| 58 |
\urlstyle{same} % normal text font (alternatives: tt, rm, sf) |
| 59 |
\fi |
| 60 |
|
| 61 |
%%% Body |
| 62 |
\begin{document} |
| 63 |
|
| 64 |
|
| 65 |
\section{Test features of rST footnotes} |
| 66 |
|
| 67 |
\emph{Numbered} footnotes% |
| 68 |
\footnote{\label{exi}% |
| 69 |
autonumber-label footnote |
| 70 |
}% |
| 71 |
\footnote{\label{footnote-2}% |
| 72 |
auto-numbered footnote (skipping 2) |
| 73 |
}% |
| 74 |
\footnote{\label{footnote-1}% |
| 75 |
manually numbered footnote |
| 76 |
} may be referenced more than |
| 77 |
once and also via hyperlink references: |
| 78 |
|
| 79 |
\emph{Symbol} footnotes% |
| 80 |
\footnote{% |
| 81 |
auto-symbol footnote\footref{footnote-4}\footref{footnote-5} |
| 82 |
}% |
| 83 |
\refstepcounter{footnote}\footnotetext{\label{footnote-4}% |
| 84 |
auto-numbered footnote referenced from the first auto-symbol footnote |
| 85 |
(skipping \hyperref[footnote-1]{4} and \hyperref[section-2]{5}) |
| 86 |
}% |
| 87 |
\refstepcounter{footnote}\footnotetext{\label{footnote-5}% |
| 88 |
auto-symbol footnote referenced from the first auto-symbol footnote |
| 89 |
} do not have a reference name. |
| 90 |
They can only be referenced once and only with a footnote-reference. |
| 91 |
|
| 92 |
\setlength{\DUtablewidth}{\dimexpr1\linewidth-3\arrayrulewidth\relax}% |
| 93 |
\begin{longtable}{|p{\DUcolumnwidth{0.342}}|p{\DUcolumnwidth{0.658}}|} |
| 94 |
\caption{Numbered footnotes% |
| 95 |
\protect\footnote{\label{tab}% |
| 96 |
autonumber-label footnote referenced from a table title |
| 97 |
(missing with \textquotedbl{}latex-footnotes\textquotedbl{}). |
| 98 |
}}\\ |
| 99 |
\hline |
| 100 |
|
| 101 |
autonumber label\footref{exi} |
| 102 |
& |
| 103 |
Reference name is the \emph{label} (\hyperref[exi]{exi}), |
| 104 |
not the number (both \texttt{1\_} and \texttt{{[}1{]}\_} fail). |
| 105 |
\\ |
| 106 |
\hline |
| 107 |
|
| 108 |
auto-numbered\footref{footnote-2} |
| 109 |
& |
| 110 |
Reference name is the Docutils-assigned |
| 111 |
number (\hyperref[footnote-2]{3}).% |
| 112 |
\footnote{\label{unstable}% |
| 113 |
\begin{DUclass}{caution} |
| 114 |
\begin{DUadmonition} |
| 115 |
\DUtitle{Caution!} |
| 116 |
|
| 117 |
The assigned number may change if numbered |
| 118 |
footnotes are added, removed or rearranged. |
| 119 |
\end{DUadmonition} |
| 120 |
\end{DUclass} |
| 121 |
\smallskip |
| 122 |
}% |
| 123 |
\footnote{\label{latex}% |
| 124 |
Numbers assigned by LaTeX may differ from the |
| 125 |
numbers assigned manually or by Docutils. |
| 126 |
} |
| 127 |
\\ |
| 128 |
\hline |
| 129 |
|
| 130 |
manually numbered\footref{footnote-1} |
| 131 |
& |
| 132 |
Reference name is the specified number |
| 133 |
(\hyperref[footnote-1]{4}).\footref{latex} |
| 134 |
\\ |
| 135 |
\hline |
| 136 |
\end{longtable} |
| 137 |
|
| 138 |
|
| 139 |
\section{Name Conflicts% |
| 140 |
\texorpdfstring{% |
| 141 |
\protect\footnote{\label{sec}% |
| 142 |
autonumber-label footnote referenced from a section title |
| 143 |
}}{}} |
| 144 |
|
| 145 |
|
| 146 |
\subsection{4} |
| 147 |
|
| 148 |
An \emph{implicit} target with conflicting refname (like this section and the |
| 149 |
next) is overwritten by manually numbered footnotes\footref{footnote-1} and footnotes |
| 150 |
with autonumber-label\footref{exi}. An INFO is generated. |
| 151 |
|
| 152 |
Hyperlink references to \hyperref[footnote-1]{4} and \hyperref[exi]{exi} point to the footnotes, not the |
| 153 |
sections. |
| 154 |
|
| 155 |
|
| 156 |
\subsection{exi} |
| 157 |
|
| 158 |
Numbers of manually numbered footnotes and autonumber-labels |
| 159 |
cannot be used in \emph{explicit} targets: |
| 160 |
\texttt{\_`4`} and \texttt{\_`exi`} would lead to a \textquotedbl{}duplicate target name\textquotedbl{} ERROR . |
| 161 |
|
| 162 |
The markup characters for auto-labeled footnotes \textquotedbl{}% |
| 163 |
\phantomsection\label{target-1}*\textquotedbl{} and \textquotedbl{}% |
| 164 |
\phantomsection\label{target-2}\#\textquotedbl{} and |
| 165 |
the symbols selected by auto-symbol footnotes \textquotedbl{}% |
| 166 |
\phantomsection\label{target-3}†\textquotedbl{} do not become |
| 167 |
reference names. They can be used in other hyperref targets allowing |
| 168 |
links to \hyperref[target-1]{*}, \hyperref[target-2]{\#} and \hyperref[target-3]{†}. |
| 169 |
|
| 170 |
|
| 171 |
\subsection{5% |
| 172 |
\label{section-2}% |
| 173 |
} |
| 174 |
|
| 175 |
Both, explicit and implicit targets with a number as reference name (e.g. |
| 176 |
the inline target \textquotedbl{}% |
| 177 |
\phantomsection\label{target-4}2\textquotedbl{} and the section title \textquotedbl{}5\textquotedbl{} above) cause a gap in |
| 178 |
footnote auto-numbering.\footref{latex} The number can be used in a |
| 179 |
footnote-reference although it does not refer to a footnote!\textsuperscript{\hyperref[section-2]{5}}\textsuperscript{\hyperref[target-4]{2}} |
| 180 |
|
| 181 |
\begin{DUclass}{admonition-todo} |
| 182 |
\begin{DUadmonition} |
| 183 |
\DUtitle{TODO% |
| 184 |
\protect\footnote{% |
| 185 |
auto-number footnote referenced from admonition title |
| 186 |
}} |
| 187 |
|
| 188 |
Emit a warning if a footnote-reference refers to something else?% |
| 189 |
\footnote{% |
| 190 |
auto-symbol footnote referenced from admonition text |
| 191 |
} |
| 192 |
\end{DUadmonition} |
| 193 |
\end{DUclass} |
| 194 |
|
| 195 |
\end{document} |