Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interaction with hyperref and destlabel=true #1

Open
mrpiggi opened this issue Feb 24, 2020 · 3 comments
Open

interaction with hyperref and destlabel=true #1

mrpiggi opened this issue Feb 24, 2020 · 3 comments

Comments

@mrpiggi
Copy link

@mrpiggi mrpiggi commented Feb 24, 2020

Following MWE raises the warning
pdfTeX warning (dest): name{chapter.1} has been referenced but does not exist, replaced by a fixed one

\documentclass{book}
\usepackage[destlabel=true]{hyperref}
\usepackage{bookmark}
\begin{document}
\chapter{Test}
\label{sec:chap}
\end{document}
@u-fischer

This comment has been minimized.

Copy link

@u-fischer u-fischer commented Feb 25, 2020

yes, bookmark doesn't honor the destlabel setting. You try the following (but it is not much tested)

\documentclass{book}
\usepackage[destlabel=true]{hyperref}
\usepackage{bookmark}

\makeatletter
\def\Hy@writebookmark#1#2#3#4#5{%
  \ifnum#4>\BKM@depth\relax
  \else
    \def\BKM@type{#5}%
    \ifx\BKM@type\Hy@bookmarkstype
      \begingroup
        \ifBKM@numbered
          \let\numberline\Hy@numberline
          \let\booknumberline\Hy@numberline
          \let\partnumberline\Hy@numberline
          \let\chapternumberline\Hy@numberline
        \else
          \let\numberline\@gobble
          \let\booknumberline\@gobble
          \let\partnumberline\@gobble
          \let\chapternumberline\@gobble
        \fi
        \bookmark[level=#4,dest={\HyperDestNameFilter{#3}}]{#2}%
      \endgroup
    \fi
  \fi
}
\makeatother
\begin{document}
\chapter{Test}
\label{sec:chap}
\chapter{Test2}
\label{sec:chap2}

\chapter{Test3}
\end{document}
@mrpiggi

This comment has been minimized.

Copy link
Author

@mrpiggi mrpiggi commented Feb 26, 2020

This seems to work, at least I did not find any problems. Is this something, what would be integrated in the next version? Then I would wrap it within \@ifpackagelater{bookmark}{2019/12/04}{}{...}. Thanks for your help.

u-fischer pushed a commit that referenced this issue Feb 26, 2020
@u-fischer

This comment has been minimized.

Copy link

@u-fischer u-fischer commented Feb 26, 2020

I added a new version in a test branch. But as there are no testfiles, it should be tried a bit before it is released to ctan.

u-fischer pushed a commit that referenced this issue Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.