1

I have a document that has a structure like this:

\setupinteraction[state=start]
\placebookmarks[chapter,section,subsection][chapter,section][force=yes]
\setupinteractionscreen[option=bookmark]

\startfrontmatter
  \startstandardmakeup
    \starttitle[title=Contents]
      \placecontent
    \stoptitle
  \stopstandardmakeup
\stopfrontmatter

\startbodymatter
  \startchapter[title=Chapter1]
  Unimportant content...
  \stopchapter
\stopbodymatter

So far, so no problems. But there is one thing that bothers me: in the bookmark window of Sumatra PDF bookmarks start with Chapter1. Is there a way to also insert a bookmark to the table of contents?

Say you are on page 30 of a document and want to go to the TOC: right now you'd either scroll manually to the top of the document or click the bookmark of Chapter1 and then scroll up one or several pages, again manually. So the idea is to create a bookmark to the TOC, so that you click it and get redirected to the TOC directly. I don't need an entry to the TOC in the TOC (box in the box so to speak, which on the other hand would be interesting to know) but only a bookmark in the PDF file.

I tried to add \bookmark[]{TOC} to several places within the standardmakup environment and also before the makeup within frontmatter, but the TOC still doesn't show up in the PDF bookmarks.

I see that the standardmakeup doesn't count pages or at least doesn't print them in the document. I don't know whether makeup has anything to do with this, but if it has, is there a way to create a bookmark to the title within the makeup manually somehow?

  • Does \pdfbookmark[chapter]{Contents}{whatever your toc is referred to as}work, if you just add it in your code just before you add your TOC? – Paul Jul 26 '17 at 15:21
  • No, \pdfbookmark doesn't work at all as I think it's a LaTeX command (undefined control sequence). I tried the same with \bookmark[... but that neither adds any bookmark. – Koenich Jul 26 '17 at 15:47
1

Quoting directly from the source file strc-bmk.mkiv (with changes to the formatting):

Bookmarks are a very viewer dependent feature. They are mostly used as additional table of contents and therefore relate directly to lists.

A bookmark list is added to the document only when interaction is enabled. The given lists are bookmarked and a second argument specifies the opened bookmark trees.

\placebookmarks
  [chapter,section,subsection,mylist]
  [chapter]

So, based off this description, I changed the line

\placebookmarks[chapter,section,subsection][chapter,section][force=yes]

in your example to this

\placebookmarks[chapter,title,section,subsection][chapter,title,section][force=yes]

since your table of contents is a title, and that has done the trick for me. I'm viewing the PDF in evince, as I don't have sumatra on my current machine, but I assume that the result is the same in both.

  • And in case you also wanted the frontpage to be in the bookmarks? I call it with \component c-frontpage01.tex – Koenich Jul 26 '17 at 19:48

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.