在 PDF 書籤中的節編號末尾添加點

在 PDF 書籤中的節編號末尾添加點

我使用該包在章節、小節等標題的末尾有點secdot。我也想在 PDF 書籤中每個節號的末尾插入一個點(我正在使用hyperref)。

這是我想要實現的螢幕截圖(請參閱左側書籤中的第 5 節),以及一個最小的工作範例(包括可能導致問題、衝突的套件和序言部分):

微量元素

\documentclass[12pt]{article}

\usepackage[a4paper, hscale=0.85, vscale=0.85]{geometry}
\usepackage[T1]{fontenc}
\usepackage{url}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage[dotinlabels]{titletoc}
\usepackage{secdot}

\hypersetup{bookmarks=true,%
    bookmarksnumbered=true,%
    pdfencoding=unicode,%
    colorlinks=true,%
    pdfborder={0 0 0},%
    linkcolor=red,%
    menucolor=green,%
    citecolor=blue,%
    urlcolor=blue,%
    filecolor=blue}

\sectiondot{section}
\sectiondot{subsection}
\sectiondot{subsubsection}
\sectiondot{paragraph}
\sectiondot{subparagraph}

% changing the style of \paragraph and \subparagraph titles, so
% text after \paragraph and \subparagraph are broken into new lines
\makeatletter
    \renewcommand\paragraph{%
        \@startsection{paragraph}{4}{0mm}%
            {-\baselineskip}%
            {.3\baselineskip}%
            {\normalfont\normalsize\bfseries}}
    \renewcommand\subparagraph{%
        \@startsection{subparagraph}{5}{0mm}%
            {-\baselineskip}%
            {.3\baselineskip}%
            {\normalfont\normalsize\bfseries}}
\makeatother

\setcounter{secnumdepth}{5}


\begin{document}

\section{section}

section

\subsection{subsection}

subsection

\subsubsection{subsubsection}

subsubsection

\paragraph{paragraph}

paragraph

\subparagraph{subparagraph}

subparagraph

\end{document}

我已經開始研究hyperref的程式碼,但我找不到我必須修改/修補/更新的部分。

答案1

hyperref將此格式儲存在\Hy@numberline.因此,下面的重新定義.在每個分段編號單元後面加上一個:

\makeatletter
\renewcommand{\Hy@numberline}[1]{#1. }
\makeatother

將其添加到序言中的某個位置載入中hyperref.

在此輸入影像描述

相關內容