4

I am trying to add a table of contents to a document produced using the memoir class. I have customized the section headings to emulate a publication I like. When I produce the pdf (using xelatex -shell-escape), the chapter-level and subsection-level hyperlinks in the table of contents work as expected, but the section-level hyperlinks do not. There is the appearance of a hyperlink for each section, but when I click on one, nothing happens.

Two constraints:

  1. I need to stay in the memoir class.
  2. The section (and sub-section) headings need to appear as formatted below (e.g., I don't want section numbering).

Two observations:

  1. If I set the section numbering depth to 'section', the hyperlinks work as desired (but then I get numbered sections).
  2. If I add \bfseries or any other series to \setsecheadstyle{\Large\scshape\MakeLowercase}, then the hyperlinks work (but again, I lose the formatting desired).

Minimal working example:

\documentclass[11pt,oneside,article]{memoir}
\usepackage{graphicx,url}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{listings}
\setcounter{tocdepth}{2}
\usepackage[usenames,dvipsnames]{color}                     
\usepackage[xetex]{hyperref}   
\usepackage{lipsum}
\setsecheadstyle{\Large\scshape\MakeLowercase} 
\setsubsecheadstyle{\normalsize\itshape} 
\setsubsubsecheadstyle{\small\bfseries}
\setaftersubsubsecskip{-1em}
\maxsecnumdepth{chapter}
\setsecnumdepth{chapter} 
\setaftersecskip{1.7ex}

\begin{document} 

\maketitle                                                       

\tableofcontents

\section{Introduction}
\lipsum
\section{Another Section}
Text.
\subsection{Subsection 1}
Text.
\subsection{Subsection 2}
Text.
\section{Last Section}
Text.

\end{document}
3

You can quickly fix the problem by defining your section heading style to include a hyperref anchor \phantomsection:

\setsecheadstyle{\phantomsection\Large\scshape\MakeLowercase}
  • Nice, works for the MWE. Now implementing in the full document . . . – brorgschlr Nov 12 '13 at 6:06
  • I had to had \phantomsection's to the \setsubsecheadstyle also. This worked well for me. Thanks. – brorgschlr Nov 12 '13 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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