[Tex/LaTex] Beamer – Undefined Color: “local structure”

beamerbiblatexcolor

I have some question concerning the \setbeamercolor{<element>}{local structure} in beamer:

In presentations I use to give full bibliographic references directly on the concerning slide via the \fullcite command of biblatex. The colorscheme of the references can be manipulated for example by \setbeamercolor{bibliography entry author}{<color definition>}. My problem is that I use citations in different elements with different colorization — for example on the pure white background and in blocks with dark background and bright text colour. Therefore I want the colours of the bibliography elements to change according to the colorscheme in which they are used.

As far as I understand the beameruserguide this is exactly the use case for which the "local structure" style element is designed. If I set the colour of some element to "local structure" it works as intended and changes the colour according to the parent element (compare example code below). However, at the same time I get a Package xcolor Error: Undefined colorlocal structure'.` error, which makes me think that this seems to be not the right way to use this local structure thing.

Does anyone know how to get this in a clean manner without errors for every citation?

\begin{filecontents}{test.bib}
    @ARTICLE{Test,
      author = {Any Author},
      title = {A title},
      journal = {Random Journal},
      year = {1989},
      volume = {23},
      pages = {13-23}
    }
\end{filecontents}

\documentclass{beamer}
\usepackage[]{biblatex}

\bibliography{test}

\begin{document}
\begin{frame}
    \begin{itemize}
        \item default color:\\
        \fullcite{Test}\\
        \item default color alerted:\\
        \alert{\fullcite{Test}}\\
    \end{itemize}
    \setbeamercolor{bibliography entry author}{fg=local structure}
    Set color for author entry to "local structure"\\
    \begin{itemize}
        \item local structure:\\
        \fullcite{Test}\\
        \item local structure alerted:\\
        \alert{\fullcite{Test}}
    \end{itemize}
\end{frame}
\end{document}

My TeX system:
Texlive2012
pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012)
beamer.cls 2011/09/12 development version 3.21 A class for typesetting pre
sentations (rcs-revision 70f9d8411e54)

Best Answer

From the comments, it is clear that I misunderstood the desired aim. I'll leave the original answer here but also move the solution from the comments to here.

If a beamer object has an assigned (beamer) colour and you wish to make that colour "whatever the surrounding text has" then the best way to achieve this is to make that assigned beamer colour empty (my guess is that this is the same for fonts, but I haven't tested that). Then when beamer tries to use that (beamer) colour, nothing happens (including no complaints). In this case, the beamer colours assigned to bibliographic entries are bibliography entry author and title, location, and note. So to blank them all, do:

\setbeamercolor{bibliography entry author}{fg=,bg=}
\setbeamercolor{bibliography entry title}{fg=,bg=}
\setbeamercolor{bibliography entry location}{fg=,bg=}
\setbeamercolor{bibliography entry note}{fg=,bg=}

(I hope I got them all.) The bibliographic entry will then be typeset in the same colour as the surrounding text, whatever colour that happens to be.


Original Answer

The problem is that beamer colours are not quite colours but more advanced objects. So when a command is expecting a colour, you can't give it a beamer colour: it won't know how to handle it. To get the colours from a beamer colour, you use <colour name>.fg or <colour name>.bg. So you could write your definition command as:

\setbeamercolor{bibliography entry author}{fg=local structure.fg,bg=local structure.bg}

except that that doesn't work! This complains because local structure is an even more complicated object and, at that point, has no colours defined. One option is to use the parent syntax:

\setbeamercolor{bibliography entry author}{parent=local structure}

This compiles, but doesn't provide the right colours. That's because beamer is lazy and when a beamer colour is changed, its actual colours are not necessarily updated straight away. So it is entirely possible that when bibliography entry author is computed, the colours in local structure are still the old ones.

Fortunately, the beamer authors thought of this. This is where the use key comes in. This ensures that the specified colours are up to date before the new colour is computed.

So to get complete inheritance, the following works:

\setbeamercolor{bibliography entry author}{use=local structure, fg=local structure.fg,bg=local structure.bg}

(Assuming, that is, that I've understood what the desired outcome should be!)

\begin{filecontents}{test.bib}
    @ARTICLE{Test,
      author = {Any Author},
      title = {A title},
      journal = {Random Journal},
      year = {1989},
      volume = {23},
      pages = {13-23}
    }
\end{filecontents}

\documentclass{beamer}
\usepackage[]{biblatex}

\bibliography{test}

\begin{document}
\begin{frame}
    \begin{itemize}
        \item default color:\\
        \fullcite{Test}\\
        \item default color alerted:\\
        \alert{\fullcite{Test}}\\
    \end{itemize}
    \setbeamercolor{bibliography entry author}{use=local structure, fg=local structure.fg,bg=local structure.bg}
    Set color for author entry to "local structure"\\
    \begin{itemize}
        \item local structure:\\
        \fullcite{Test}\\
        \item local structure alerted:\\
        \alert{\fullcite{Test}}
    \end{itemize}
\end{frame}
\end{document}

Result:

alerted bibliography entry