\hyperlink agrega espacio no deseado alrededor de las imágenes. Cómo deshacerse de él?

\hyperlink agrega espacio no deseado alrededor de las imágenes. Cómo deshacerse de él?

Con pdflatex lo siguiente

\documentclass{beamer}
\usepackage{hyperref}
\usepackage{tikz}
\begin{document}
  \begin{frame}
    \begin{figure}
        \hyperlink{bar}{
          \begin{tikzpicture}
                \filldraw (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
          \end{tikzpicture}
        }
        \hyperlink{bar}{
          \begin{tikzpicture}
                \filldraw (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
          \end{tikzpicture}
        }\\
        \begin{tikzpicture}
              \filldraw (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
        \end{tikzpicture}
        \begin{tikzpicture}
              \filldraw (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
        \end{tikzpicture}
  \end{figure}
 \end{frame}
\end{document}

produce una diapositiva donde el espacio entre los tikzpictureentornos con hipervínculos (fila superior) es mayor que el espacio entre los entornos sin hipervínculos tikzpicture(fila inferior). El mismo efecto también se puede ver cuando se usa, por ejemplo \includegraphics. ¿Hay alguna manera de deshacerse de este espacio?

Respuesta1

Un tikzpictureentorno es básicamente como un cuadro de letra/carácter, por lo que no tener %después de a \end{tikzpicture}provocará espacios y \hyperlink{bar}{el salto de línea agregará espacios falsos.

Si alguno de esos espacios debe ser "eliminado", debe colocarlo %después \hyperlink{bar}{y después de los enlaces y después \end{tikzpicture}de los entornos no vinculados, además de decir \offinterlineskip: las cuatro imágenes son contiguas entonces.

Vea las diferencias entre ambos métodos.

\documentclass{beamer}
\usepackage{hyperref}
\usepackage{tikz}
\begin{document}
\begin{frame}
  \begin{figure}
    \hyperlink{bar}{%
      \begin{tikzpicture}
        \filldraw[blue] (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
      \end{tikzpicture}%
    }
    \hyperlink{bar}{%
      \begin{tikzpicture}
        \filldraw[red] (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
      \end{tikzpicture}%
    } 

    \begin{tikzpicture}
      \filldraw[yellow] (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
    \end{tikzpicture}
    \begin{tikzpicture}
      \filldraw[green] (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
    \end{tikzpicture}%
  \end{figure}

  \begin{figure}
    \hyperlink{bar}{%
      \begin{tikzpicture}
        \filldraw[blue] (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
      \end{tikzpicture}%
    }%
    \hyperlink{bar}{%
      \begin{tikzpicture}
        \filldraw[red] (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
      \end{tikzpicture}%
    }%
    \offinterlineskip% Only within groups!!!

    \begin{tikzpicture}
      \filldraw[yellow] (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
    \end{tikzpicture}%
    \begin{tikzpicture}
      \filldraw[green] (0,0) -- (0,1) -- (1,1) -- (1,0) -- cycle;
    \end{tikzpicture}%
  \end{figure}

\end{frame}
\end{document}

ingrese la descripción de la imagen aquí

información relacionada