josephwright / beamer

A LaTeX class for producing presentations and slides
Other
1.41k stars 142 forks source link

[shrink] makes clickable part of links appear totally offset from their corresponding texts #863

Closed liar666 closed 10 months ago

liar666 commented 11 months ago

Hi,

I'm using Emacs' org-mode to generate Beamer presentations. When I use [shink] on some slide, then the clickable parts of links appear totally offset from their corresponding texts.

As noticed by the org guys, the generated .tex code is valid. The bugs seems to be in Beamer itself.

MWE: If you apply org-beamer-export-to-pdf to the following org file: test.org.txt you get the following tex file: test.tex.txt If you compile it and open the resulting PDF (in Evince or PDF.js or any other PDF viewer), you'll find that blue text is not clickable. The clickable areas are generally slightly above the text of the link (at least with shrink=10), or at almost "random" position (with shrink=60).

It seems shrink applies to the text overlay, but not to the clickable overlay.

samcarter commented 11 months ago

related https://github.com/josephwright/beamer/issues/100

samcarter commented 11 months ago

There is a reason why the shrink option is called "evil" in the beamer user guide :)

See this comment https://tex.stackexchange.com/questions/516345/shrinked-frames-with-hyperrefs-in-beamer-have-displaced-hyperlinks#comment1305643_516345

That's a general problem with such transformations. You will see the same problem e.g. with combining pages with pgfpages etc.

samcarter commented 11 months ago

Instead of using the evil shrink option, you could use a smaller font size. You could even do this automatically using the fitting library of tcolorbox:

% Created 2023-09-22 Fri 20:17
% Intended LaTeX compiler: pdflatex
\documentclass[presentation]{beamer}
\usepackage{listings}
%\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage{graphicx}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
%\usepackage{amsmath}
%\usepackage{amssymb}
\usepackage{capt-of}
%\usepackage{hyperref}
\usetheme{default}
\author{Guillaume MULLER}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={Guillaume MULLER},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 28.1 (Org mode 9.7)}, 
 pdflang={English},
 pdfborder={0 0 1}% <- for this example to show the link positions
 }
\usepackage{biblatex}

\usepackage[most]{tcolorbox}
\tcbset{enhanced,frame empty,interior empty,size=tight}

\usepackage{relsize}
\setbeamerfont{block title}{size=}

\begin{document}

\begin{frame}[label={sec:org6881bbd}]{Test2}
\begin{tcolorbox}[fit,height=.8\textheight]
\begin{block}{Block1 with links}
\begin{itemize}
\item Some text \href{https://www.google.com}{Link1}
\item {\smaller \href{https://www.microsoft.com}{Link2}}
\item A very long text before the link \href{https://mail.google.com}{Link3} text text
\end{itemize}
\end{block}
\begin{block}{Block2 with links}
\begin{itemize}
\item Test \href{https://www.yopmail.com}{Link4}
\item \href{https://test.it}{Link5}
\end{itemize}
\end{block}
\begin{block}{Block1 with links}
\begin{itemize}
\item Some text \href{https://www.google.com}{Link1}
\item {\smaller \href{https://www.microsoft.com}{Link2}}
\item A very long text before the link \href{https://mail.google.com}{Link3} text text
\end{itemize}
\end{block}
\begin{block}{Block1 with links}
\begin{itemize}
\item Some text \href{https://www.google.com}{Link1}
\item {\smaller \href{https://www.microsoft.com}{Link2}}
\item A very long text before the link \href{https://mail.google.com}{Link3} text text
\end{itemize}
\end{block}
\end{tcolorbox}
\end{frame}
\end{document}

test-1