超链接未出现在所需位置

超链接未出现在所需位置

超链接应该出现在标签上,但它却远离标签文本。我该如何纠正它?任何想法或意见都非常感谢。

在此处输入图片描述

注意:我无法改变现有代码的结构,任何更新都需要在相同的代码中完成。

\documentclass[11pt, aspectratio=169]{beamer}
\usepackage{graphicx}
\usepackage{pgfplots, pgfplotstable}
\usepackage{tikz}

\newtoks\coords

\newcommand{\analysis}[8]{
    \centering
    \def\barcoords{#8}

    \pgfmathsetmacro{\numOfBars}{{\barcoords}[0]}
    \pgfmathsetmacro{\noOfCoords}{{\barcoords}[1]}

    \begin{tikzpicture}[scale=0.6]
        \begin{axis}[
            width=#1cm,
            height=#2cm,
            bar width=#3pt,
            tick style={draw=none},
            axis x line*=bottom,
            axis y line*=left,
            grid=both,
            grid style=dashed,
            major grid style={draw=none, opacity=1, dotted},
            minor x tick num=1,
            xticklabels={#5},
            xticklabel style={text width=#4cm, font=\small, align=center, rotate=50, anchor=east},
            xtick=data,
            ybar,
            ymin=0,
            ymax=100,
            area legend,
            yticklabel={$\pgfmathprintnumber{\tick}\%$},
            ylabel={#6},
            nodes near coords={\pgfmathprintnumber\pgfplotspointmeta\%},
            nodes near coords style={font=\scriptsize},
            nodes near coords align={vertical},
            legend style={at={(0.5,-0.35)}, draw=none, anchor=north, legend columns=-1, column sep=0.2cm},
            ymajorgrids=true,
        ]

        \colorlet{Color1}{blue!30}
        \colorlet{Color2}{green!50}

        \foreach \i in {1,...,\numOfBars}{
            \coords{}

            \foreach \x in {0,...,\inteval{\noOfCoords-1}}{
                \pgfmathsetmacro{\eachpoint}{{\barcoords}[\i+1][\x]}
                \global\coords\expandafter{\expanded{\the\coords(\x+1,\eachpoint)}}
            }

            \edef\plotting{
                \noexpand\addplot[
                    draw=none,
                    fill=Color\i
                ] coordinates {
                    \the\coords 
                };
                \noexpand
            }

            \plotting

            \renewcommand{\coords}{} 
        }
        \legend{#7}
        \end{axis}
    \end{tikzpicture}
}

\begin{document}

\begin{frame}{Frame 1}
    \analysis
        {25}
        {9}
        {18}
        {2.8}
        {{\hyperlink{type1}{Type 1}}, {\hyperlink{type2}{Type 2}}, {\hyperlink{type3}{Type 3}}, {\hyperlink{type4}{Type 4}}, {\hyperlink{type5}{Type 5}}, {\hyperlink{type6}{Type 6}}, {type 7}, {type 8}, {type 9}, {type 10}, {type 11}}
        {}
        {2022, 2023}
        {
            {2},
            {11},
            {65, 69, 55, 39, 42, 57, 65, 67, 52, 66, 76},
            {68, 70, 55, 35, 40, 47, 60, 58, 46, 70, 72}
        }
\end{frame}

\hypertarget{type1}{\begin{frame}{Type 1}
    Text here
\end{frame}}

\hypertarget{type2}{\begin{frame}{Type 2}
    Text here
\end{frame}}

\hypertarget{type3}{\begin{frame}{Type 3}
    Text here
\end{frame}}

\hypertarget{type4}{\begin{frame}{Type 4}
    Text here
\end{frame}}

\hypertarget{type5}{\begin{frame}{Type 5}
    Text here
\end{frame}}

\hypertarget{type6}{\begin{frame}{Type 6}
    Text here
\end{frame}}

\section{Introduction}

\end{document}

相关内容