pgf add tag
Dr. Manuel Kuehner
**Edit 1:** I just see that the links in the MWE do not work (they lead all to page 1). Do you have an idea why?

**Edit 2:** Apparently, `\hyperlink{label}{text}` works and ` \hyperref[label]{text}` does not work (I updated the MWE).

* This is maybe too much to ask!
* I want to have the **bars (`ganttbar`) to be clickable** (`pgfgantt`) so that a click leads to another section within a `beamer` document, e. g. like `\hyperref[label]{text}` (Update: `\hyperlink{label}{text}`).
* The MWE below has clickable text but *not* clickable bars. The goal is that the bars (`ganttbar`) are clickable and lead to the corresponding sections.

![sdsdd_1.jpg](/image?hash=eb73fb6aa7aaf9240ecddd5c4b17273fdebe5856ad716899dcaa5ce0b7d10abd)

```
\documentclass{beamer}
\usepackage{pgfgantt}

\begin{document}

\section{Section A}
\label{Sec:A}
\begin{frame}{Frame Title in Section A}
    \begin{ganttchart}[
		hgrid,
		vgrid={*{11}{draw = none}, dotted},
		time slot format = isodate-yearmonth,
		time slot unit = month,
		x unit = 0.65mm,
		y unit title = 3.0ex,             
		y unit chart = 3.0ex,      
	]{2010-01}{2020-12}
	%
	\gantttitlecalendar{year} \\
	%	
	\ganttbar[bar/.append style = {fill = red}]{%
	        \hyperlink{Sec:B}{SecB}% <-- Link to Sec B, see https://tex.stackexchange.com/questions/180571 (does not work)
	    }{2010-03}{2011-02} \\
	\ganttbar[bar/.append style = {fill = red}]{%
	        \hyperlink{Sec:C}{SecC}% <-- Link to Sec C, see https://tex.stackexchange.com/questions/180571 (does not work)
	    }{2016-03}{2020-02}
	%	
\end{ganttchart}
\end{frame}

\section{Section B}
\label{Sec:B}
\begin{frame}{Frame Title in Section B}
\hyperref[Sec:A]{Back to Section A}
\end{frame}

\section{Section C}
\label{Sec:C}
\begin{frame}{Frame Title in Section C}
\hyperref[Sec:A]{Back to Section A}
\end{frame}

\end{document}
```
Top Answer
frougon
The initial syntax `\hyperref[label]{text}` that you tried was quite reasonable; however, [for some reason](https://topanswers.xyz/transcript?room=2064&id=140412#c140412), `beamer` seems to work better with `\hyperlink{label}{text}`, which is not the normal way to use `\hyperlink` (see [here](https://tex.stackexchange.com/q/364526/73317) for instance).

Other than that, it *is* possible to make only the bars clickable by using [this improvement](https://tex.stackexchange.com/a/526333/73317) of a [clever trick from Master Jake](https://tex.stackexchange.com/a/36111/73317). The idea is that we can pass `hyperlink={label}` to the Ti*k*Z node that represents the bar; thanks to the use of `/tikz/append after command`, this will place an additional node exactly on top of the bar node. This additional node contains an invisible `\rule` that precisely covers the bar node and is made into a hyperlink using `\hyperlink{label}{...}` (a LaTeX label works here because this is for `beamer`: see the previous paragraph).

```
\documentclass{beamer}
\usepackage{pgfgantt}

%\hypersetup{pdfborder={0 0 1}} % for debugging: show the hyperlink rectangles

% Based on <https://tex.stackexchange.com/a/526333/73317>.
%
% \XeTeXLinkBox is needed when building with XeTeX (XeTeX won't create a link
% unless it finds text; clickable rules don't work without \XeTeXLinkBox).
% This still works correctly with the pdfTeX and LuaTeX engines.
\tikzset{
  hyperlink/.style={
    alias=sourcenode,
    append after command={
      let \n0={\pgfkeysvalueof{/pgf/outer xsep}},
          \n1={\pgfkeysvalueof{/pgf/outer ysep}},
          \p1=([shift={(\n0, -\n1)}] sourcenode.north west),
          \p2=([shift={(-\n0, \n1)}] sourcenode.south east),
          \n2={\x2-\x1},
          \n3={\y1-\y2} in
      node [inner sep=0pt, outer sep=0pt, anchor=north west, at=(\p1)]
        {\hyperlink{#1}{\XeTeXLinkBox{\phantom{\rule{\n2}{\n3}}}}}
    },
  },
}

\begin{document}

\section{Section A}
\label{Sec:A}
\begin{frame}{Frame Title in Section A}
    \begin{ganttchart}[
    hgrid,
    vgrid={*{11}{draw = none}, dotted},
    time slot format = isodate-yearmonth,
    time slot unit = month,
    x unit = 0.65mm,
    y unit title = 3.0ex,
    y unit chart = 3.0ex,
  ]{2010-01}{2020-12}
  %
  \gantttitlecalendar{year} \\
  %
  \ganttbar[bar/.append style = {fill=red, hyperlink=Sec:B}]{%
    \hyperlink{Sec:B}{SecB}%
    }{2010-03}{2011-02} \\
  \ganttbar[bar/.append style = {fill=red, hyperlink=Sec:C}]{%
    \hyperlink{Sec:C}{SecC}%
    }{2016-03}{2020-02}
  %
\end{ganttchart}
\end{frame}

\section{Section B}
\label{Sec:B}
\begin{frame}{Frame Title in Section B}
\hyperref[Sec:A]{Back to Section A}
\end{frame}

\section{Section C}
\label{Sec:C}
\begin{frame}{Frame Title in Section C}
\hyperref[Sec:A]{Back to Section A}
\end{frame}

\end{document}
```

For the screenshot below, I uncommented the `\hypersetup{pdfborder={0 0 1}}` at the top so that you can see in gray the extent of each hyperlink:

![image.png](/image?hash=418810499f05c52e87a2ebdb15ba2e94fe2f84d62087575d8d74cd78b2b8edce)
Answer #2
samcarter
One could abuse the annotations from the [@frougon's fantastic answer](https://topanswers.xyz/tex?q=2018#a2270) (this will make the whole line clickable, not just the bar):

```
\documentclass{beamer}
\usepackage{pgfgantt}

%\hypersetup{pdfborder={0 0 1}} % don't use in beamer, just for debugging to see where the link is

\begin{document}

\section{Section A}
\label{Sec:A}
\begin{frame}{Frame Title in Section A}
    \begin{ganttchart}[
		hgrid,
		vgrid={*{11}{draw = none}, dotted},
		time slot format = isodate-yearmonth,
		time slot unit = month,
		x unit = 0.65mm,
		y unit title = 3.0ex,             
		y unit chart = 3.0ex,      
	]{2010-01}{2020-12}
	%
	\gantttitlecalendar{year} \\
	%	
	\ganttbar[bar/.append style = {
    fill = red,
    label=center:{\hyperlink{Sec:B}{\parbox{2\paperwidth}{\phantom{I}}}}
  }]{%
    \hyperlink{Sec:B}{SecB}% <-- Link to Sec B, see https://tex.stackexchange.com/questions/180571 (does not work)
    }{2010-03}{2011-02} \\
	\ganttbar[bar/.append style = {
    fill = red,
    label=center:{\hyperlink{Sec:C}{\parbox{2\paperwidth}{\phantom{I}}}}
  }]{%
    \hyperlink{Sec:C}{SecC}% <-- Link to Sec C, see https://tex.stackexchange.com/questions/180571 (does not work)
    }{2016-03}{2020-02}
	%	
\end{ganttchart}
\end{frame}

\section{Section B}
\label{Sec:B}
\begin{frame}{Frame Title in Section B}
\hyperref[Sec:A]{Back to Section A}
\end{frame}

\section{Section C}
\label{Sec:C}
\begin{frame}{Frame Title in Section C}
\hyperref[Sec:A]{Back to Section A}
\end{frame}

\end{document}
```

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.