1

Is there a more elegant way to create clickable areas in LaTeX?

\documentclass{article}
\usepackage[papersize={123pt,103pt},textheight=1cm]{geometry}
\usepackage{hyperref}
\usepackage{xcolor}
\begin{document}
\setlength{\unitlength}{1cm}
\begin{picture}(2.5,1)
\multiput(0,0)(0,.2){5}{\multiput(0,0)(.2,0){5}{\textcolor{white}{\nameref{sec:alpha}}}}
\put(0,0){\framebox(1,1){}}
\put(.39,.43){\textcolor{black}{$\alpha$}}
\multiput(1.5,0)(0,.186){5}{\multiput(0,0)(.186,0){5}{\textcolor{white}{\nameref{sec:Omega}}}}
\put(1.88,.378){$\Omega$}
\put(1.5,0){\framebox(1,1){}}
\end{picture}
\section*{$\alpha$\label{sec:alpha}}
\pagebreak
\section*{$\Omega$\label{sec:Omega}}
\end{document}

This code yields 3 pages, like these:

3 pages

On the first page are two squares: one on the left, and one on the right. You may call these pushbuttons. When you click on the left square you go to the second page, when you click on the right square you go to the third page.

Juan Castaño
  • 28,426

1 Answers1

0

Based on Marijn's suggestion a solution may go as follows:

\documentclass{article}
\usepackage[papersize={123pt,103pt},textheight=1cm]{geometry}
\usepackage{hyperref}
\usepackage{xcolor}
\begin{document}
\setlength{\unitlength}{1cm}
\begin{picture}(2.5,1)
\put(0,0){\hyperlink{alpha}{\phantom{\rule{1cm}{1cm}}}}
\put(0,0){\framebox(1,1){}}
\put(.39,.43){\textcolor{black}{$\alpha$}}
\put(1.5,0){\hyperlink{Omega}{\framebox(1,1){}}}
\put(1.88,.378){$\Omega$}
\end{picture}
\section*{$\alpha$}
\hypertarget{alpha}{}
\pagebreak
\section*{$\Omega$}
\hypertarget{Omega}{}
\end{document}
'''