2

Hey anyone know how to keep the link to TOC due to \hyperref but still be using something like \tabelofcontents* og \keepFromToc to hide the TOC link in the table of contents.

First time asking here and first time I'm using Latex.

  • 1
    Welcome to TeX.SX! Please rephrase your question. It's a little bit difficult to understand. Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 May 27 '15 at 17:07
  • 1
    It might help if you explained what you mean? Self adding toc in the toc? Is it \tableofcontents* you are looking for? As always it is a good idea to provide a minimal example, a self contained document that others can copy and fun on their own systems. – daleif May 27 '15 at 17:07
  • 1
    Then copy the big document into a new file or folder and start removing stuff that is not relevant. I still do not understand what it us you are looking for. So a code example is necessary. – daleif May 27 '15 at 17:38
  • 1
    This is still as clear as mud. Please explain, in detail, what you mean by "self-adding to the ToC" and "keeping \hyperref to the ToC". It's not clear at all. – Werner May 27 '15 at 17:41
  • 1
    @Michael: Ahhh, these are referred to as bookmarks. And yes, hyperref automatically inserts a bookmark for every entry into the regular ToC. So you want only the bookmarks and no visible ToC in your document? – Werner May 27 '15 at 18:58
3

The question is still unclear to me, but I understood it this way:

  • Add a bookmark to the ToC
  • Don't add a ToC entry in the ToC itself.

This can be achieved, for example, bu manually adding the bookmark with a dest=toc::label (or use a different name.).

Use \hypertarget{toc::label}{} with an empty anchor just before \tableofcontents* will define the destination label, saying \bookmark[dest=toc::label]{\contentsname} will just add the bookmark entry.

Note: \blinddocument is just a quick way to build up a dummy document. It can be removed.

\documentclass{memoir}


\usepackage{blindtext}
\usepackage{hyperref}
\usepackage{bookmark}


\begin{document}

\hypertarget{toc::label}{}
\bookmark[dest=toc::label]{\contentsname}
\tableofcontents* 

\blinddocument

\end{document}

enter image description here

  • You are a Champ Christian. That was exactly what i was looking for, sorry for me bad explanation. Thanks alot :) – Michael May 28 '15 at 17:39
  • You're welcome. Happy TeXing – user31729 May 29 '15 at 5:06

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.