2

I am currently adapting my employer's PowerPoint slides to beamer. I am struggling with the font colour on the table of contents slide. Unfortunately, the colour does not show on the slide but presumably the link colour. How can I get the colour right?

A working example:

\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}

In this example it works out as intended: The font colour in the toc is gray. But in the following example it does not.

First the class file:

\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}    
}

Now an example file:

\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}
  • Does this question help: http://tex.stackexchange.com/questions/8011/changing-color-and-bullets-in-beamers-table-of-contents – Seamus Dec 18 '15 at 10:53
  • Thank you for sharing. Alas, it does not help, because only the enumeration (and bullets) are changed in colour (caused by \setbeamercolor*{section in toc}{fg=new_gray, bg=white}). The font colour is not affected. – user94223 Dec 18 '15 at 10:59
  • 1
    Can you please post a complete MWE? Because if I insert your code snipped into a simple test document it seems to work as expected: `\documentclass{beamer}

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

    \begin{document}

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

    \section{test} \frame{a}

    \section{test1} \frame{b}

    \end{document}`

    – samcarter_is_at_topanswers.xyz Dec 18 '15 at 13:10
  • Thank you for posting a working example! At the same time, much of your code does not seem to be relevant to the question you're asking here. Please limit the example to only the code required for your issue to appear. You can have a look at this guide for how to prune your code for this purpose. – Seamus Dec 18 '15 at 13:37
  • I really tried to work out a minimal example but it never works out. The font colour DOES change at a certain point. But why??? I'll work on it. – user94223 Dec 18 '15 at 13:58
  • If you do not mind to have all links in gray, try \PassOptionsToPackage{bookmarks,colorlinks,linkcolor=my_gray}{hyperref} – samcarter_is_at_topanswers.xyz Dec 18 '15 at 16:00

1 Answers1

2

I have commented the line

\PassOptionsToPackage{bookmarks,colorlinks}{hyperref}

for now. Then it works. Probably, I am going to run into problems at the url front. But that's for another battle.