Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have dots at the end of section, subsection, etc. titles using the secdot package. And I'd like to insert a dot at the end of each section number in the PDF bookmarks too (I'm using hyperref).

Here is a screenshot what I'd like to achieve (see section 5 in the bookmarks on the left ), and a minimal working example (included packages and parts of the preamble which may cause problems, clashes):

MWE

\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}

I've started to look into hyperref's code, but I couldn't find the part that I have to modify/patch/renew.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

hyperref stores this formatting in \Hy@numberline. So, the following redefinition adds a . after every sectional number unit:

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

Add it somewhere in your preamble after loading hyperref.

enter image description here

share|improve this answer
    
Thank you! Such a nice, and easy solution. :) –  szantaii Dec 22 '13 at 16:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.