1

I want to display a section on the sidebar of the .pdf. Unfortunately, it seems that it does not appear when I am using \section*{section_name}. But it appears when I use \section{section_name}

How to display the section heading on the side bar using \section*{section_name}?

3
  • \section* does not enter the ToC and as such does not enter the PDF outline. Please provide a compilable document. It should be possible with the \currentpdfbookmark macro, however. Of course you don't mean section_name literally, do you?
    – user31729
    Aug 5, 2017 at 19:48
  • Thank you for your reply. No section_name is just a dummy. But suppose I want to use \section{name} but wish to hide the section number. Will it then work? Aug 5, 2017 at 19:56
  • Yes, but hiding the number is the crusher ;-)
    – user31729
    Aug 5, 2017 at 19:57

1 Answer 1

3

If there's only one \section* like - content to be entered to the bookmark (or PDF outline), the easiest way is to strip the number by a quick \setcounter{secnumdepth}{0} and later restore it to the old value. This way, the \section{Foo} is not numbered, but enters the ToC still and has an bookmark entry.

I assumed the article class here, which has a secnumdepth value of 3 by default.

\documentclass{article}

\usepackage[bookmarksopen=true]{hyperref}
\usepackage{bookmark}

\begin{document}
\tableofcontents

\setcounter{secnumdepth}{0}
\section{Foo}
\setcounter{secnumdepth}{3}
\clearpage
\section{Other section}


\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .