Метка Hyperref, отображаемая в содержании средства просмотра PDF-файлов

Метка Hyperref, отображаемая в содержании средства просмотра PDF-файлов

У меня проблема с hyperref и с тем, что метки для моих разделов появляются в оглавлении моего просмотрщика PDF. Сам документ выглядит нормально, но (например) когда я смотрю на оглавление, я вижу [1.1a] перед заголовком раздела для задач 1.1 и [1.1q] перед заголовком раздела для ответов 1.1. По сути, я хочу, чтобы студенты могли щелкнуть по заголовку раздела, чтобы перейти к ответам для этого раздела, и аналогично щелкнуть по заголовку раздела в разделе ответов, чтобы вернуться к задачам.

Я гуглил довольно долго, но я просто недостаточно знаю о hyperref, чтобы даже правильно сформулировать свой поиск. Я нашел что-то похожее, но это было связано с реальным оглавлением LaTeX, которое я не хочу видеть в своем документе. Любая помощь с этим была бы очень признательна! MWE ниже.

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage[hidelinks]{hyperref}

\setcounter{secnumdepth}{0}

\begin{document}

\subsubsection{\hyperref[1.1a]{\S 1.1 Real Numbers and the Rectangular Coordinate System}}
\label{1.1q}
\begin{enumerate}
    \item Find the distance between the points $P_1=(3,-4)$ and $P_2=(5,4)$.
    
    \item Find the midpoint of the line segment joining the points $P_1=(3,-4)$ and $P_2=(5,4)$.
\end{enumerate}

\newpage

\subsubsection{\hyperref[1.1q]{\S 1.1 Real Numbers and the Rectangular Coordinate System}}
\label{1.1a}
\begin{enumerate}
    \item $\text{Distance} = 2\sqrt{17}$
    
    \item Midpoint: $(4,0)$
\end{enumerate}


\end{document}

решение1

введите описание изображения здесь

введите описание изображения здесь

Использование необязательных аргументов \subsubsectionозначает, что оглавление (и, следовательно, закладки) может содержать любой текст, который вы пожелаете, и удаляет гиперссылку:

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage[hidelinks]{hyperref}

\setcounter{secnumdepth}{0}

\begin{document}

\subsubsection[\S 1.1 Real Numbers and the Rectangular Coordinate System]{\hyperref[1.1a]{\S 1.1 Real Numbers and the Rectangular Coordinate System}}
\label{1.1q}
\begin{enumerate}
    \item Find the distance between the points $P_1=(3,-4)$ and $P_2=(5,4)$.
    
    \item Find the midpoint of the line segment joining the points $P_1=(3,-4)$ and $P_2=(5,4)$.
\end{enumerate}

\newpage

\subsubsection[{\S 1.1 Real Numbers and the Rectangular Coordinate System}]{\hyperref[1.1q]{\S 1.1 Real Numbers and the Rectangular Coordinate System}}
\label{1.1a}
\begin{enumerate}
    \item $\text{Distance} = 2\sqrt{17}$
    
    \item Midpoint: $(4,0)$
\end{enumerate}


\end{document}

Вы также можете создать команду, которая присоединяется \subsubsectionк форме:

\newcommand\mysubsubsection[2]{\subsubsection[#1]{\hyperref[#2]{#1}}}

который вы затем можете вызвать с помощью:

\mysubsubsection{\S 1.1 Real Numbers and the Rectangular Coordinate System}{1.1a}

чтобы устранить лишнюю суету, связанную с необходимостью иметь длинные \subsubsectionкоманды.

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage[hidelinks]{hyperref}

\setcounter{secnumdepth}{0}

\newcommand\mysubsubsection[2]{\subsubsection[#1]{\hyperref[#2]{#1}}}

\begin{document}

\mysubsubsection{\S 1.1 Real Numbers and the Rectangular Coordinate System}{1.1a}
\label{1.1q}
\begin{enumerate}
    \item Find the distance between the points $P_1=(3,-4)$ and $P_2=(5,4)$.
    
    \item Find the midpoint of the line segment joining the points $P_1=(3,-4)$ and $P_2=(5,4)$.
\end{enumerate}

\newpage

\mysubsubsection{\S 1.1 Real Numbers and the Rectangular Coordinate System}{1.1q}
\label{1.1a}
\begin{enumerate}
    \item $\text{Distance} = 2\sqrt{17}$
    
    \item Midpoint: $(4,0)$
\end{enumerate}

\end{document}

Связанный контент