# Exclude section number from the ToC link

Is there a way I can make hyperref exclude section/chapter/etc numbering from the link in toc/lof/lot?

I want it becase I highlight the link, and number is not really a part of the section/chapter/etc name.

I searched the manual -- but could not find an option. Perhaps the only way is to redefine some hyperref external command.

Edit:

\documentclass{book}

\usepackage{polyglossia} % support for languages

% fonts:
\defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text} % without this XeLaTeX won't turn "--" into dashes
\setmainfont{Arial}
\setsansfont{Arial}
\setmonofont{DejaVu Sans Mono}

\usepackage[usenames,dvipsnames]{xcolor}

\begin{document}

\tableofcontents
\chapter{foo}

Foo!

\chapter{bar}

Bar!

\chapter{baz}

Baz!

\end{document}


(supposed to be compiled with XeLaTeX).

-
There is probably a cleaner solution, but I think it is possible to do this using the package titletoc and the \titlecontents command. It would be easier to answer if you could provide a minimal working example (MWE). –  Corentin Feb 21 '13 at 15:26

\documentclass{book}
\usepackage{hyperref}
\usepackage{etoc}
\makeatletter
% (they are not modified by hyperref, only \contentsline is)
\let\latchapter\l@chapter
\let\latsection\l@section
\let\latsubsection\l@subsection
%
% then use the etoc package to feed the l@ macros with a filtered out data

\etocsetstyle{chapter}{}{}
{\latchapter{\numberline{\etocthenumber}\etocname}{\etocpage}}{}

\etocsetstyle{section}{}{}
{\latsection{\numberline{\etocthenumber}\etocname}{\etocpage}}{}

\etocsetstyle{subsection}{}{}
{\latsubsection{\numberline{\etocthenumber}\etocname}{\etocpage}}{}
\makeatother

\begin{document}
\tableofcontents

\chapter{One}
hello
\section{This is a section}
hello
\subsection{a subsection}
hello
\subsection{another subsection}
hello
\section{Another section}
a
\chapter{Two}
b
\section{And one more section}
c
\subsection{an a subsection}
d
\end{document}

-
It works! I don't have etoc in repository, so here's a ctan link. –  Adobe Feb 21 '13 at 20:36
Despite there could be some simpler solutions with e.g. titlesec -- it's nice to have this one also -- since sometimes titlesec is not an option -- for example when it conflicts with some other packages. –  Adobe Feb 21 '13 at 20:39
I am not sure about titlesec/titletoc. A brief look at titletoc has not given me any reason to believe it can separate the number from the name. Both are inside what it calls the label. –  user700902 Feb 22 '13 at 21:26