Generalbookmarks doesn't point the right place

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
dieinfolk
Posts: 12
Joined: Sun Sep 30, 2012 11:26 pm

bookmarks doesn't point the right place

Post by dieinfolk »

Hello,

I'm creating my own bookmarks since I'm not using parts, sections nor chapters.

Code: Select all

\documentclass{article}
\usepackage[english]{babel}
\usepackage[ansinew]{inputenc}
\usepackage[]{hyperref}
\hypersetup{
    bookmarks    = true,                      
    pdftoolbar   = true,            
    pdfmenubar   = true,           
}
\begin{document}
\pdfbookmark[-1]{AAA}{a0}
AAA\\[150pt]
\pdfbookmark[1]{title1}{a1}
aaa a1\\[150pt]
\pdfbookmark[1]{title2}{a2}
aaa a2\\[50pt]
\pdfbookmark[1]{title3}{a3}
aaa a3
\newpage
\pdfbookmark[-1]{BBB}{b0}
BBB\\[150pt]
\pdfbookmark[1]{title4}{b1}
bbb b1 \\[150pt]
\pdfbookmark[1]{title5}{b2}
bbb b2
\end{document}
I have two problems:

1) Levels are changed

For some reason, levels are changed:
- Title 2 and 3: are inside title 1
- Title 5: is inside title 4
Even though levels are correctly specified.

I want them to appear at the bookmark bar (adobe reader) like this:

AAA
  • title1
    title2
    title3
BBB
  • title4
    title5
2) Bookmarks do not point the right place

If I click AAA, then AAA appears at the very top. Why is not happening the same with the others?

Thank you very much for giving me a hand with this mess..
dieinfolk.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

bookmarks doesn't point the right place

Post by Stefan Kottwitz »

You should get such warnings which point to the problem:

Code: Select all

Package hyperref Warning: Difference (2) between bookmark levels is greater 
(hyperref)                than one, level fixed on input line 13.
If you would change the bookmark levels -1 to 0, the levels would be fixed.

Stefan
LaTeX.org admin
dieinfolk
Posts: 12
Joined: Sun Sep 30, 2012 11:26 pm

Re: bookmarks doesn't point the right place

Post by dieinfolk »

Thanks a lot! It solved my problem!

But I used -1 level because on page 168 - Beginner's Guide -, I found this specifications:

Command Level
\part .............. -1 (book and report class)
\chapter ........... 0 (not available in article class)
\section ........... 1
\subsection ........ 2
\subsubsection ..... 3
\paragraph ......... 4
\subparagraph ...... 5

So I understood 0 level didn't exist for an article. So then, what does page 168 means?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

bookmarks doesn't point the right place

Post by Stefan Kottwitz »

The book refers to table of contents levels, not to hyperref's bookmark levels at this place.

hyperref complains when you omit a level and jump from -1 to 1, or from 1 to 3. The bookmark package, mentioned on page 251 of the book, fixes this issue. It's already sufficient to load it, but it can do even more for you.

Stefan
LaTeX.org admin
dieinfolk
Posts: 12
Joined: Sun Sep 30, 2012 11:26 pm

Re: bookmarks doesn't point the right place

Post by dieinfolk »

uuhh now I see, thanks.

I also tried with belowpdfbookmark and subpdfbookmark, and it work as well :)
However, there's something I didn't understand. It's not really important, but I'm wondering why.

By clicking on the bookmarks, it shows you where the text is, and locates the text at the very top. But this is only happening for bookmarks within the first page. All the others bookmarks show you just the page, but not where the text is. Is that normal?
Post Reply