diff options
| author | John MacFarlane <[email protected]> | 2023-08-19 09:52:01 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-08-19 09:52:01 -0700 |
| commit | 70329edcd7afb7b3f8f015b13ab2e734c9e31d05 (patch) | |
| tree | 34c8363de72e10ae737681f4cdbdb3f25b5f4a97 /test/writer.latex | |
| parent | 068fce4293eb139f54d4825e1dbdcaf35e34da03 (diff) | |
LaTeX writer: improve internal links and targets.
We no longer wrap section headings in a `\hypertarget`.
This is unnecessary (hyperref creates an anchor based on the
label) and it interferes with tagging.
In addition, we now use `\hyperref` rather than `\hyperlink`
for internal links.
Currently `\hypertarget` is still being used for link anchors
not on headings.
Closes #8744. Thanks to @u-fischer.
Diffstat (limited to 'test/writer.latex')
| -rw-r--r-- | test/writer.latex | 93 |
1 files changed, 31 insertions, 62 deletions
diff --git a/test/writer.latex b/test/writer.latex index d5ba851d7..829ab16ab 100644 --- a/test/writer.latex +++ b/test/writer.latex @@ -85,44 +85,34 @@ markdown test suite. \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{headers}{% -\section{Headers}\label{headers}} +\section{Headers}\label{headers} -\hypertarget{level-2-with-an-embedded-link}{% \subsection{\texorpdfstring{Level 2 with an \href{/url}{embedded -link}}{Level 2 with an embedded link}}\label{level-2-with-an-embedded-link}} +link}}{Level 2 with an embedded link}}\label{level-2-with-an-embedded-link} -\hypertarget{level-3-with-emphasis}{% \subsubsection{\texorpdfstring{Level 3 with -\emph{emphasis}}{Level 3 with emphasis}}\label{level-3-with-emphasis}} +\emph{emphasis}}{Level 3 with emphasis}}\label{level-3-with-emphasis} -\hypertarget{level-4}{% -\paragraph{Level 4}\label{level-4}} +\paragraph{Level 4}\label{level-4} -\hypertarget{level-5}{% -\subparagraph{Level 5}\label{level-5}} +\subparagraph{Level 5}\label{level-5} -\hypertarget{level-1}{% -\section{Level 1}\label{level-1}} +\section{Level 1}\label{level-1} -\hypertarget{level-2-with-emphasis}{% \subsection{\texorpdfstring{Level 2 with -\emph{emphasis}}{Level 2 with emphasis}}\label{level-2-with-emphasis}} +\emph{emphasis}}{Level 2 with emphasis}}\label{level-2-with-emphasis} -\hypertarget{level-3}{% -\subsubsection{Level 3}\label{level-3}} +\subsubsection{Level 3}\label{level-3} with no blank line -\hypertarget{level-2}{% -\subsection{Level 2}\label{level-2}} +\subsection{Level 2}\label{level-2} with no blank line \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{paragraphs}{% -\section{Paragraphs}\label{paragraphs}} +\section{Paragraphs}\label{paragraphs} Here's a regular paragraph. @@ -137,8 +127,7 @@ here. \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{block-quotes}{% -\section{Block Quotes}\label{block-quotes}} +\section{Block Quotes}\label{block-quotes} E-mail style: @@ -183,8 +172,7 @@ And a following paragraph. \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{code-blocks}{% -\section{Code Blocks}\label{code-blocks}} +\section{Code Blocks}\label{code-blocks} Code: @@ -208,11 +196,9 @@ These should not be escaped: \$ \\ \> \[ \{ \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{lists}{% -\section{Lists}\label{lists}} +\section{Lists}\label{lists} -\hypertarget{unordered}{% -\subsection{Unordered}\label{unordered}} +\subsection{Unordered}\label{unordered} Asterisks tight: @@ -283,8 +269,7 @@ Minuses loose: Minus 3 \end{itemize} -\hypertarget{ordered}{% -\subsection{Ordered}\label{ordered}} +\subsection{Ordered}\label{ordered} Tight: @@ -350,8 +335,7 @@ Multiple paragraphs: Item 3. \end{enumerate} -\hypertarget{nested}{% -\subsection{Nested}\label{nested}} +\subsection{Nested}\label{nested} \begin{itemize} \tightlist @@ -416,8 +400,7 @@ Same thing but with paragraphs: Third \end{enumerate} -\hypertarget{tabs-and-spaces}{% -\subsection{Tabs and spaces}\label{tabs-and-spaces}} +\subsection{Tabs and spaces}\label{tabs-and-spaces} \begin{itemize} \item @@ -433,8 +416,7 @@ Same thing but with paragraphs: \end{itemize} \end{itemize} -\hypertarget{fancy-list-markers}{% -\subsection{Fancy list markers}\label{fancy-list-markers}} +\subsection{Fancy list markers}\label{fancy-list-markers} \begin{enumerate} \def\labelenumi{(\arabic{enumi})} @@ -522,8 +504,7 @@ B. Williams \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{definition-lists}{% -\section{Definition Lists}\label{definition-lists}} +\section{Definition Lists}\label{definition-lists} Tight using spaces: @@ -626,8 +607,7 @@ orange fruit \end{enumerate} \end{description} -\hypertarget{html-blocks}{% -\section{HTML Blocks}\label{html-blocks}} +\section{HTML Blocks}\label{html-blocks} Simple block on one line: @@ -689,8 +669,7 @@ Hr's: \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{inline-markup}{% -\section{Inline Markup}\label{inline-markup}} +\section{Inline Markup}\label{inline-markup} This is \emph{emphasized}, and so \emph{is this}. @@ -722,8 +701,7 @@ a\^{}b c\^{}d, a\textasciitilde b c\textasciitilde d. \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{smart-quotes-ellipses-dashes}{% -\section{Smart quotes, ellipses, dashes}\label{smart-quotes-ellipses-dashes}} +\section{Smart quotes, ellipses, dashes}\label{smart-quotes-ellipses-dashes} ``Hello,'' said the spider. ``\,`Shelob' is my name.'' @@ -744,8 +722,7 @@ Ellipses\ldots and\ldots and\ldots. \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{latex}{% -\section{LaTeX}\label{latex}} +\section{LaTeX}\label{latex} \begin{itemize} \tightlist @@ -793,8 +770,7 @@ Cat & 1 \\ \hline \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{special-characters}{% -\section{Special Characters}\label{special-characters}} +\section{Special Characters}\label{special-characters} Here is some unicode: @@ -856,11 +832,9 @@ Minus: - \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{links}{% -\section{Links}\label{links}} +\section{Links}\label{links} -\hypertarget{explicit}{% -\subsection{Explicit}\label{explicit}} +\subsection{Explicit}\label{explicit} Just a \href{/url/}{URL}. @@ -880,8 +854,7 @@ Just a \href{/url/}{URL}. \href{}{Empty}. -\hypertarget{reference}{% -\subsection{Reference}\label{reference}} +\subsection{Reference}\label{reference} Foo \href{/url/}{bar}. @@ -905,8 +878,7 @@ Foo \href{/url/}{bar}. Foo \href{/url/}{biz}. -\hypertarget{with-ampersands}{% -\subsection{With ampersands}\label{with-ampersands}} +\subsection{With ampersands}\label{with-ampersands} Here's a \href{http://example.com/?foo=1&bar=2}{link with an ampersand in the URL}. @@ -917,8 +889,7 @@ Here's an \href{/script?foo=1&bar=2}{inline link}. Here's an \href{/script?foo=1&bar=2}{inline link in pointy braces}. -\hypertarget{autolinks}{% -\subsection{Autolinks}\label{autolinks}} +\subsection{Autolinks}\label{autolinks} With an ampersand: \url{http://example.com/?foo=1&bar=2} @@ -948,8 +919,7 @@ or here: <http://example.com/> \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{images}{% -\section{Images}\label{images}} +\section{Images}\label{images} From ``Voyage dans la Lune'' by Georges Melies (1902): @@ -963,8 +933,7 @@ Here is a movie \includegraphics{movie.jpg} icon. \begin{center}\rule{0.5\linewidth}{0.5pt}\end{center} -\hypertarget{footnotes}{% -\section{Footnotes}\label{footnotes}} +\section{Footnotes}\label{footnotes} Here is a footnote reference,\footnote{Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the |
