3

I am writing a document in ConTeXt and when I click on an internal link or bookmark in the generated PDF my PDF viewer jumps to the desired page but fully zooms out to fit the whole height in one screen and that is annyoing because I always have to zoom back in to continue reading. Here is a minimal working example (click on a heading in the TOC):

\setupinteraction[state=start]

\starttext
\completecontent
\chapter{Chapter one}
\dorecurse{5}{
  \input ward
  \input tufte
  \input ward
  \input knuth
  \input weisman
}
\section{Something specific}
\input ward
\chapter{A second chapter}

The PDF viewer I use is Evince 3.10.3 on Ubuntu 14.04 LTS. This does not happen if I open the PDF with Chrome, but neither does it happen with LaTeX generated documents that I read with my PDF viewer so it has to be something in the PDF. I have also tried focus=width and openAction=fitWidth in the \setupinteraction command but it didn't have any effect. Does someone have a solution?

Edit in response to the answers How strange: With this configuration the problem described above arises:

\setupinteraction[state=start,
  menu=on,
  title=\theTitle,
  author=\theAuthor,
  color=black,
  openaction=FitWidth,
  focus=width
]

but when I move the focus=width command up right after state=start it works:

\setupinteraction[state=start,
  focus=width,
  menu=on,
  title=\theTitle,
  author=\theAuthor,
  color=black,
  openaction=FitWidth
]

The problem is solved now, but, just out of interest: Does anyone have an explanation for that? Is it a bug?

Edit 2: It works fine with table of contents and PDF bookmarks, but not figure links created with \in:

\setupinteraction[state=start,
  menu=on,
  title=\theTitle,
  author=\theAuthor,
  color=black,
  openaction=FitWidth,
  focus=width,
]

\starttext
Look at \in{Figure}[example].
\page
\placefigure[here][example]{An example.}{
  \externalfigure[dummy][width=\textwidth]
}
\stoptext

Why is that?

  • 1
    I believe \setupinteraction[focus=standard] should do the trick. – 9tTn9B Jul 20 '17 at 21:05
  • 2
    you are missing a comma after width. – Aditya Jul 21 '17 at 15:11
  • @Aditya you mean I have to put a comma even after the last option when there are multiple? That is weird! Edit: You are right, it works, but that is truly a strange and unintuitive language design decision. – DP. Jul 21 '17 at 17:34
  • 1
    @DP. It might seem strange to you, but this has been the default ConTeXt behaviour since ever. That is why in the core files you will see that the closing bracket ] is always right after the last option in the list (as in my answer). – Henri Menke Jul 22 '17 at 2:24
  • @HenriMenke oh, ok, so it's either a comma and newline or bracket on the same line. I see. Still a bit more flexibility wouldn't hurt I guess. There are languages like Javascript or Ruby that allow you to use a comma or leave it out after the last element and I think that's quite nice. After all, the language is a tool for the programmer and he is the one that the design should focus on. – DP. Jul 22 '17 at 9:28
4

focus=width is exactly the correct option. For me it works nicely with ConTeXt from TL2017 and the Evince fork Atril.

\setupinteraction
  [state=start,
   focus=width]

\starttext
\completecontent
\chapter{Chapter one}
\dorecurse{5}{
  \input ward
  \input tufte
  \input ward
  \input knuth
  \input weisman
}
\section{Something specific}
\input ward
\chapter{A second chapter}
\stoptext

enter image description here

Screencast was made with byzanz.

  • Wow, thanks for the answer and for even making a screencast! I have updated my question, would you mind taking a look at it? – DP. Jul 21 '17 at 13:48
  • @Aditya and HenriMenke: I updated the post again, could you take a look at it again? – DP. Jul 26 '17 at 9:56
  • @DP. Interesting. The link doesn't work at all with focus=width. Since this delves into the realm of PDF which I am not familiar with, you should ask this on the mailing list. – Henri Menke Jul 26 '17 at 10:42

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.