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

URLs on notes page not clickable #115

Open
ferdinand-fichtner opened this issue Sep 11, 2019 · 8 comments
Open

URLs on notes page not clickable #115

ferdinand-fichtner opened this issue Sep 11, 2019 · 8 comments
Labels
bug external dependency Progress on this issue is blocked by a bug or lacking feature in software on which we depend

Comments

@ferdinand-fichtner
Copy link

ferdinand-fichtner commented Sep 11, 2019

See the issue below. Thank you for any suggestions how to overcome this problem.

Environment

  • MS Windows 10
  • Python 3.7

Pympress

  • ver 1.4.1
  • binary installer

Expected behaviour

URLs on a second screen notes page should be clickable

Steps to reproduce

\documentclass{beamer} %
\usepackage{pgfpages}
\setbeameroption{show notes on second screen}
\begin{document}
  \begin{frame}{Foo}
    Some content\\
    and a Test link: \url{http://www.google.com}
    \note{\begin{itemize}
      \item Other content
      \item Test link: \url{http://www.google.com}
    \end{itemize}}
  \end{frame}
\end{document}

test_slide.pdf

Problem

The link on the presentation page (left screen) is clickable and opens a browser window. The link on the notes page (right screen) is not clickable. This is independent of the document being compiled with XeLatex, PDFLatex or dvips/ps2pdf. Clicking works as expected in other viewers (Sumatra, Adobe Acrobat).

From pympress.log (possibly unrelated):

INFO:__main__:Pympress: 1.4.1 ; Python: 3.7.4 ; OS: Windows 10 ; Gtk 3.24.10 ; GLib 2.60.4 ; Poppler 0.78.0 cairo ; Cairo 1.16.0 , pycairo 1.18.1 ; Media: Gif-Wiedergabe mit GtkImage, VLC 3.0.8 Vetinari
WARNING:pympress.ui:Inhalts- und Präsentator-Fenster werden nicht im Vollbild gestartet, da nur ein Monitor vorhanden ist
CRITICAL:__main__:Uncaught exception:
Traceback (most recent call last):
  File "C:\projects\pympress/pympress/ui.py", line 470, in save_and_quit
AttributeError: 'NoneType' object has no attribute 'get_state'
@Cimbali
Copy link
Owner

Cimbali commented Sep 12, 2019

Thanks for reporting ! The links of the “current page” preview in the presenter window (what you call the “right screen”, so next to the notes widget) do work, right? That would provide a workaround if the links in the notes are simply reproducing the links in the displayed slide.

Interestingly, the link on the notes page does not seem to work with the PDF you provide in okular, and when I open it with adobe reader (the only/old version for Linux, v9.5.5 from April 2013) only the link in the notes part works, not the one in the main page.

Regardless, there seem to be 3 URI annotations in the PDF, all pointing to www.google.com, so I would expect them to behave correctly.

@Cimbali
Copy link
Owner

Cimbali commented Sep 12, 2019

What seems to be the problem are the coordinates of the link annotations in the pdf. This is some debug output printing the locations of the links, in absolute numbers and relative positions (%):

URI at x1=93.253 y1=162.590 x2=203.091 y2=175.860 / w=725.670 h=272.130
       x1=12.851% y1=59.747% x2=27.987% y2=64.624%
     -> http://www.google.com
URI at x1=376.695 y1=336.577 x2=496.967 y2=351.108 / w=725.670 h=272.130
       x1=51.910% y1=123.682% x2=68.484% y2=129.022%
     -> http://www.google.com
URI at x1=104.568 y1=132.482 x2=224.841 y2=147.013 / w=725.670 h=272.130
       x1=14.410% y1=48.683% x2=30.984% y2=54.023%
     -> http://www.google.com

x coordinates are 0 at the left-most edge of the full slide (content + notes), and 725 or 100% at the right-most edge. y coordinates are 0 at the bottom and of the slide and 272 or 100% at the top of the slide.

As you can see the 3rd URI is placed correctly and corresponds to the link in the current slide. The 1st URI is placed incorrectly a little higher and to the left of the link in the current slide (hovering the mouse over there show the mouse as a pointer). The 2nd URI is placed out of the bounds of the slide as the y coordinates are over 100%.

Even when removing any fancy templating of the notes slide (i.e. \setbeamertemplate{note page}{\insertnote}) it seems that the location of the URIs is incorrect. In particular, the first link (in both tests) is the one in the notes slide, and its coordinates in the annotation appear to be shifted left by 50%. Basically the annotations for links in the notes half of the page seem shifted at the same position but in the other half of the page.

pgfpages_bug

@ferdinand-fichtner
Copy link
Author

Thank you for looking into this and, by the way, thank you for providing this unique tool!

Your finding regarding the positioning of the URI is interesting. I find it a bit puzzling that other PDF viewers seem to not have this problem. If I open the file in Sumatra or Acrobat, the link in the notes page is clickable and the URI appears to be positioned correctly. Does this fit with your observation?

@Cimbali
Copy link
Owner

Cimbali commented Sep 12, 2019

I’m afraid I don’t have Sumatra or Acrobat to test here. I’ll report the bug at the pgf repo and see what they have to say about it.

@ferdinand-fichtner
Copy link
Author

Thank you!

Cimbali added a commit that referenced this issue Sep 12, 2019
Partial fix for #115, still requires figuring out why the links are in
the wrong place.
@Cimbali
Copy link
Owner

Cimbali commented Sep 13, 2019

Compiling with \hypersetup{pdfborder={0 0 1}} as suggested in the pgf issue confirms that the location of the link in the notes is wrong. I’ll close this issue as apparently nothing is wrong with pympress − feel free to follow the linked pgf issue.

@Cimbali Cimbali closed this as completed Sep 13, 2019
@qukhan
Copy link

qukhan commented Apr 19, 2021

For people reaching this issue after hours of search. The linked pgf issue provides a hacky solution for the \href command. It can be extended to \url.

Here's the full hack.

\makeatletter
\AtBeginNote{%
   \let\hyper@link@\hyper@link@note%
   \let\hyper@linkurl\hyper@linkurl@note%
}
\AtEndNote{%
   \let\hyper@link@\hyper@link@default%
   \let\hyper@linkurl\hyper@linkurl@default%
}
\let\hyper@link@default\hyper@link@
\let\hyper@linkurl@default\hyper@linkurl
\def\hyper@link@note[#1]#2#3#4{%
   \begingroup%
      \parbox[t][0pt][t]{0pt}{%
         \hfuzz=\maxdimen%
         \hspace*{\paperwidth}%
         \vbox{\hyper@link@default[{#1}]{#2}{#3}{\phantom{#4}}}%
      }%
      \Hy@colorlink\@urlcolor#4\Hy@xspace@end\Hy@endcolorlink%
   \endgroup%
}
\def\hyper@linkurl@note#1#2{%
   \begingroup%
      \parbox[t][0pt][t]{0pt}{%
         \hfuzz=\maxdimen%
         \hspace*{\paperwidth}%
         \vbox{\hyper@linkurl@default{\phantom{#1}}{#2}}%
      }%
      \begingroup%
      \Hy@colorlink\@urlcolor#1\Hy@xspace@end\Hy@endcolorlink%
      \endgroup%
   \endgroup%
}
\makeatother

@Cimbali Cimbali added bug external dependency Progress on this issue is blocked by a bug or lacking feature in software on which we depend labels Apr 19, 2021
smbct pushed a commit to smbct/pympress that referenced this issue Aug 4, 2023
Partial fix for Cimbali#115, still requires figuring out why the links are in
the wrong place.
@Cimbali
Copy link
Owner

Cimbali commented Feb 21, 2024

Actually I disagree with @Cimbali from 2019, this shouldn’t be closed.

It’s an ongoing issue that we just can’t do anything about, but that doesn’t mean we shouldn’t track it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug external dependency Progress on this issue is blocked by a bug or lacking feature in software on which we depend
Projects
None yet
Development

No branches or pull requests

3 participants