如何更改目录中的链接颜色?

如何更改目录中的链接颜色?

我目前正在将我雇主的 PowerPoint 幻灯片调整为 Beamer。我对目录幻灯片上的字体颜色感到困惑。不幸的是,颜色没有显示在幻灯片上,但可能是链接颜色。我怎样才能获得正确的颜色?

一个工作示例:

\documentclass{beamer}

\definecolor{new_red}{RGB}{240, 50, 5}
\definecolor{new_gray}{RGB}{85, 85, 85}

\setbeamercolor*{section in toc}{fg=new_gray, bg=white}
\setbeamercolor*{subsection in toc}{fg=new_gray, bg=white}

\setbeamertemplate{section in toc}[sections numbered]

\begin{document}

\begin{frame}
\tableofcontents
\end{frame}

\section{Section}

\begin{frame}
\end{frame}

\subsection{Subsection}

\begin{frame}
\end{frame}

\section{Section}

\begin{frame}
\end{frame}

\subsection{Subsection}

\begin{frame}
\end{frame}

\subsection{Subsection}

\begin{frame}
\end{frame}

\end{document}

在此示例中,它按预期工作:目录中的字体颜色为灰色。但在以下示例中,情况并非如此。

首先是类文件:

\ProvidesClass{mybeamer}

% General settings

\PassOptionsToPackage{english}{babel}
\PassOptionsToPackage{table}{xcolor}
\PassOptionsToPackage{bookmarks,colorlinks}{hyperref}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{beamer}}
\ProcessOptions\relax
\LoadClass{beamer}
\RequirePackage[T1]{fontenc}
\RequirePackage{babel}
\RequirePackage{graphicx}
\RequirePackage{tabularx}
\RequirePackage{tikz}
\RequirePackage[scaled]{helvet}

% Colour settings

\definecolor{my_red}{RGB}{240, 50, 5}
\definecolor{my_gray}{RGB}{85, 85, 85}

\setbeamercolor*{alerted text}{fg=my_red, bg=white}
\setbeamercolor*{caption}{fg=my_gray, bg=white}
\setbeamercolor*{caption name}{fg=my_gray, bg=white}
\setbeamercolor*{description item}{fg=my_gray, bg=white}
\setbeamercolor*{footline}{fg=my_gray, bg=white}
\setbeamercolor*{frametitle}{fg=my_red, bg=white}
\setbeamercolor*{item}{fg=my_gray, bg=white}
\setbeamercolor*{normal text}{fg=my_gray, bg=white}
\setbeamercolor*{section in toc}{fg=my_gray, bg=white} % Why don't you work? Link colour must be adapted
\setbeamercolor*{subsection in toc}{fg=my_gray, bg=white} % Why don't you work? Link colour must be adapted
\setbeamercolor*{separation line}{fg=my_gray, bg=white}
\setbeamercolor*{structure}{fg=my_gray, bg=white} % might be redundant to item list et al.
\setbeamercolor*{subitem}{fg=my_gray, bg=white}
\setbeamercolor*{subsubitem}{fg=my_gray, bg=white}
\setbeamercolor*{title}{fg=my_red, bg=white}

% Font settings

\setbeamerfont*{author}{size=\normalsize, series=\bfseries}
\setbeamerfont*{frametitle}{size=\large, series=\bfseries}
\setbeamerfont*{subtitle}{size=\Large, series=\bfseries}
\setbeamerfont*{title}{size=\huge, series=\bfseries}

% Inner theme

\setbeamertemplate{itemize items}[square]
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{headline}{}
\setbeamertemplate{navigation symbols}{}

% Outer theme

% Title page
\defbeamertemplate*{title page}{my}
{
    \thispagestyle{empty}

    {% Logo
        \begin{tikzpicture}[remember picture,overlay]
        \node[anchor=north west, xshift=0.7cm, yshift=-0.7cm] at (current page.north west)
        {
            \includegraphics[width=0.4\linewidth]{my_Markenzusatz_EN_1C}
        };
        \end{tikzpicture}

        \begin{tikzpicture}[remember picture,overlay]
        \node[anchor=north west, xshift=-3.3cm, yshift=-0.35cm] at (current page.north east)
        {
            \includegraphics[width=0.25\linewidth]{my_Wort_Bildmarke_RGB}
        };
        \end{tikzpicture}
     }

    { % Title
        \usebeamerfont{title}
        \usebeamercolor[fg]{title}

        \begin{tikzpicture}[remember picture,overlay]
        \node[anchor=west, xshift=1cm] at (current page.west)
        {
            \begin{beamercolorbox}{}
                \inserttitle 
            \end{beamercolorbox}
        };
        \end{tikzpicture}
    }

    { % Author
        \usebeamerfont{author}
        \usebeamercolor{normal text}

        \begin{tikzpicture}[remember picture,overlay]
        \node[anchor=west, xshift=1cm, yshift=-2.5cm] at (current page.west)
        {
            \begin{beamercolorbox}{}
                \insertauthor
            \end{beamercolorbox}
        };
        \end{tikzpicture}
    }

    { % Date
        \usebeamerfont{author}
        \usebeamercolor{normal text}

        \begin{tikzpicture}[remember picture,overlay]
        \node[anchor=west, xshift=1cm, yshift=-3.5cm] at (current page.west)
        {
            \begin{beamercolorbox}{}
                \insertdate
            \end{beamercolorbox}
        };
        \end{tikzpicture}
    }
}

% Frame title
\defbeamertemplate*{frametitle}{my}
{
    \usebeamerfont*{frametitle}
    \usebeamercolor[fg]{frametitle}

    \begin{tikzpicture}[remember picture,overlay]
    \node[anchor=north west, xshift=0.7cm, yshift=-0.7cm] at (current page.north west)
    {
        \begin{beamercolorbox}[wd=8cm]{}
            \insertframetitle
        \end{beamercolorbox}
    };
    \end{tikzpicture}

    \begin{tikzpicture}[remember picture, overlay]
    \node[anchor=north west, xshift=-2.75cm, yshift=-0.35cm] at (current page.north east)
    {
        \includegraphics[width=0.2\linewidth, height=\paperheight, keepaspectratio]{my_Wort_Bildmarke_RGB}
    };
    \end{tikzpicture}
}

% Frame title continuations
\defbeamertemplate*{frametitle continuation}{my}{\insertcontinuationcountroman}

% Footer
\newcommand{\my@footline}{\centering \insertframenumber/\inserttotalframenumber}

\defbeamertemplate*{footline}{my}
{
    \begin{beamercolorbox}[leftskip=15pt,rightskip=15pt,ht=2.5ex,dp=1ex]{footline}
    \usebeamerfont{footline}\my@footline\par
    \vspace{2ex}
    \end{beamercolorbox}    
}

现在是一个示例文件:

\documentclass{mybeamer}

    \begin{document}

    \begin{frame}
    \tableofcontents
    \end{frame}

    \section{Section}

    \begin{frame}
    \end{frame}

    \subsection{Subsection}

    \begin{frame}
    \end{frame}

    \section{Section}

    \begin{frame}
    \end{frame}

    \subsection{Subsection}

    \begin{frame}
    \end{frame}

    \subsection{Subsection}

    \begin{frame}
    \end{frame}

    \end{document}

答案1

我已经评论了这一行

\PassOptionsToPackage{bookmarks,colorlinks}{hyperref}

目前还好。然后它就正常工作了。可能,我会在 URL 前端遇到问题。但那是另一场战斗了。

相关内容