# Export to PDF with index bookmarks and unnumbered sections

I want to export my .org file to pdf, with a table of contents. But I don't want the table of contents to be printed in the first page of the document. Rather I want the table of contents to be embedded in the pdf file as bookmars. For example, see the figure:

How do I do this?

Update:

Currently the first lines of my .org file look like this:

``````#+OPTIONS: num:nil
#+OPTIONS: toc:nil
``````

If I remove the `#+OPTIONS: num:nil` option, I get the desired PDF index (thanks @NickD). But then the sections get automatic numbers which I want to remove.

Is there a way to get the PDF index, and also remove section numbering?

• isn't this just the way your reader presents navigation in the file? which means you probably want `#+OPTIONS: toc:nil` – manandearth Sep 25 '18 at 13:34
• @manandearth It only works if the PDF file has the table of contents embedded. The viewer does not detect the headings automatically. But yes, I need `#+OPTIONS: toc:nil` to get rid of the table of contents in the first page of the document. Now I only need to get the table of contents embedded in the file. There is a way to do this in latex. – becko Sep 25 '18 at 13:36
• If you know how to do it in latex, perhaps you could put the right commands in a `#+BEGIN_EXPORT latex` block? – rpluim Sep 25 '18 at 13:55
• @rpluim I have seen it done in LaTeX, but right now it seems cannot find the correct command. I tried `#+LATEX_HEADER: \usepackage{bookmark}` at the first line of my org file but nothing happens. – becko Sep 25 '18 at 13:56
• I thought this is handled by `hyperref` package: tex.stackexchange.com/questions/42343/… – wvxvw Sep 25 '18 at 16:23

Here is how I got it working. This produces the PDF index, no table of contents in the document, and no section numbering.

``````#+OPTIONS: toc:nil
#+LATEX: \setcounter{secnumdepth}{0}
``````

Note that I am not using `#+OPTIONS: num:nil`, because for some reason this option breaks the PDF index. However `#+LATEX: \setcounter{secnumdepth}{0}` is a workaround to prevent section numbering.

• – becko Sep 25 '18 at 21:04
• Very nice! I forgot that what you cannot do with org, you can do in latex. – NickD Sep 25 '18 at 21:46

I don't think you can get rid of section numbers with `num:nil` and still get the index. As I explained in the chat, `num:nil` produces starred sections which latex treats as unnumbered sections. But then it also fails to add them to the `.aux` file as `\contentsline`s, so the PDF does not get any information that can be used to generate the index.

• I got it working. See my answer. Thanks for your help! – becko Sep 25 '18 at 21:04