13

According to the Evince help, one can open a PDF at the location of a "named destination":

SYNTAX
       evince [--help]  [--page-label=PAGE |  --page-index=NUM‐
       BER | --named-dest=DEST] [--fullscreen] [--presentation]
       [--preview] [--find=STRING] [filename(s)...]
...
       -n, --named-dest=DEST
              Open the document on the specified named destina‐
              tion.

In Acrobat (acroread) the corresponding command is (documentation)

acroread /a "nameddest=pos2" hyperref.pdf

How can I generate such named destinations in a PDF from LaTeX?

In the past, (mainly for Acrobat) I used the zref-savepos package to open the document at a desired location (set at compilation). This doesn't seem to work well with Evince.

The question is not so much about Evince but what is that Evince calls "named destination" and how to produce them.

Below it is a series of attempts I made. When running Evince I get the following messages:

$ evince hyperref.pdf -n pos3 #or pos2
failed to look up pos3
failed to look up pos3

MWE

\documentclass[]{article}
\usepackage{hyperref}
\hypersetup{pdfstartview=FitBH \hypercalcbp{\zposy{pos2}sp}} %open at pos2 (works only in Acrobat)
\usepackage{bookmark}
\usepackage{zref-savepos}
\begin{document}

\zsavepos{pos1}

Bla

\zsavepos{pos2}

Ble

\belowpdfbookmark{Pos3}{pos3}

Bli

\end{document}
12

In my point of view, it's sufficient to set a \hypertarget{destname}{} and use the destname as argument to the evince --named-dest option. This works at least in my evince version (3.6.1, very old, I believe)

It works with Acrobat Reader as well, the calling syntax is slightly different, however:

acroread /a "nameddest=pos2" nameddestexample.pdf

to open the file at the named destination (hypertarget) "pos2".

\documentclass[]{article}

\usepackage{blindtext}
\usepackage{hyperref}
%\hypersetup{pdfstartview=FitBH \hypercalcbp{\zposy{pos2}sp}} %open at pos2 (works only in Acrobat)
\usepackage{bookmark}
\begin{document}


Bla

\blindtext[1]
\hypertarget{pos1}{}%



Ble
\blindtext[5]
\hypertarget{pos2}{}%


Bli

\blindtext[10]
\hypertarget{pos3}{Blue}

\blindtext[10]

\hypertarget{pos4}{Blofeld}



\end{document}
  • Great! I though I needed a bookmark or something like that. By coincidence I also added the command line for acroread. It is a pitty that Evince and Acrobat don't have consistent command-line syntax. Do you know if the target can be used for the pdfstartview option in hyperref? – alfC Nov 25 '14 at 4:19
  • 2
    No, you don't even need the bookmark package for this, but the \hypertarget feature is useful, if you want to generate arbitray bookmarks with \bookmark[dest=destname]{Bookmark entry}, by the way. (In this case, you need the bookmark package however) -- Regarding evince and acroread ... different programmers, different interfaces ... :-( – user31729 Nov 25 '14 at 4:22
  • @alfC: Regarding pdfstartview I don't know, but I'll try – user31729 Nov 25 '14 at 4:24

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.