PDF ビューアの目次に表示される Hyperref ラベル

PDF ビューアの目次に表示される Hyperref ラベル

ハイパーリファレンスで、セクションのラベルが PDF ビューアの目次に表示されてしまうという問題があります。ドキュメント自体は問題ないように見えますが、(たとえば) 目次を見ると、1.1 の問題のセクション タイトルの前に [1.1a] が表示され、1.1 の解答のセクション タイトルの前に [1.1q] が表示されます。基本的に、生徒がセクション タイトルをクリックしてそのセクションの解答にジャンプできるようにし、同様に解答セクションのセクション タイトルをクリックして問題に戻れるようにしたいと考えています。

かなり長い間 Google で検索していますが、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}

関連情報