Change Named Destinations using destlabel option of hyperref

PDF Named-Destinations are made by Hyperref. This shows how to change them by using hyperref option destlabel=true, then redefining using /label. Unfortunately, it does not seem to work. What am I missing?

In Lyx,exporting with pdflatex,hyperref=V6.83m, I have set the hyperref option by document->settings->pdf properties->options adding destnames=true

In the body I can put inline \section{Introduction} \label{intro} \HyperDestRename{section.3}{RenamedIt}

I expect that I should see a NamedDestination of Intro or RenamedIt, but I don't - it is still section.3

I can define NamedDests with either of these: \pdfbookmark{Text of bookmark2}{Anchor_Name2} \hypertarget{HTDest}{Blue}

Is there a way to automatically use the section names to make NamedDests (hypertargets)?

Replay

There is an option destlabel, which uses the name of the first \label after the anchor creation to name the anchor:

\ifx\pdfobjcompresslevel\undefined\else\pdfobjcompresslevel=0 \fi % Debug

\documentclass{article}
\usepackage[destlabel=true]{hyperref}

\begin{document}
\section{Introduction}
\label{intro}
\end{document}

The first line is just for pdfLaTeX to make it easier to read the PDF file via a text viewer (or editor) to find the destination names in the PDF file (in short, /Catalog/Names/Dests). The /Dests object references object 21 in the generated PDF file:

21 0 obj
<<
/Names [(Doc-Start) 10 0 R (intro) 2 0 R (page.1) 9 0 R]
/Limits [(Doc-Start) (page.1)]
>>
endobj

There are three names: Doc-Start is added by hyperref at the begin of the document. page.1 is the automatically created page label (controlled by option pageanchor). The destination for \section{Introduction} is intro, named by \label{intro}.

You can define a macro to contain the destination name.

\documentclass{article}
\usepackage{hyperref}
\usepackage{lipsum}

\makeatletter
\def\hyperdest#1{\global\let#1=\@currentHref}
\makeatother

\begin{document}
\lipsum[1-5]

\section{Introduction}
\label{intro}
\hyperdest{\myname}

\lipsum[6-10]

\section{Development}% new \@currentHref

\hyperlink{\myname}{test}

\end{document}

Category: pdftex Time: 2016-07-30 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.116 (s). 12 q(s)