0

I would like to bookmark sections even when they are not numbered. When I set sections as

\section*{Section 1}

Latex compiles the document with no bookmarks and there no numbers on sections. So it is typed as "Section 1" on the document.

When I set it as:

\section{Section 1}

Bookmarks are generated, but then it is typed as "1 Section 1" on the document.

How do I set it so that there are no numbers in front of the sections but there are still bookmarks?

1
  • why don't you use \setcounter{secnumdepth}{0} to suppress numbering? – Ulrike Fischer Apr 17 '20 at 6:32
0

thanks to @egreg -- https://tex.stackexchange.com/a/33701/197451

suppress the appearance of the section number -- The macro @seccntformat is responsible for printing the section number; by redefining it to "do nothing" the number is not printed, but hyperref is able to create the bookmark correctly.

\documentclass[a4paper]{article}
\usepackage{hyperref}
\usepackage{bookmark}
\makeatletter
\renewcommand\@seccntformat[1]{}
\makeatother

\begin{document}
\section{A}
a

\newpage
\section{B}
b
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy