Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)

share|improve this question
    
As Andrew Stacey pointed out below, one has to use biber as bibtex backend. Alternatively one can add an option backend=bibtex to the biblatex package call and use standard bibtex –  Benedikt Bauer Sep 13 '12 at 10:34

1 Answer 1

up vote 10 down vote accepted

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

share|improve this answer
    
NB One has to run biber on the file to generate the bibliography. Having never used biber before, I wasn't sure what to do but fortunately the log file told me! –  Loop Space Sep 13 '12 at 9:50
    
Your answer helped me a lot, but it looks like it isn't the whole story. As soon as I introduce some blocks, it seems as if it gets some wrong colours from somewhere. If you add some \begin{alertblock}{Alert Block Title \fullcite{Test}} Alert block test text \fullcite{Test} \end{alertblock}, the Author in the alertblock body will have the colour of the alertblock header text and not that of the body text. –  Benedikt Bauer Sep 13 '12 at 10:26
1  
Looking at the code, the alert block sets the local structure to alert before the title. It then does not reset it for the body of the text. So what you see is the "correct" behaviour! If you want different behaviour in alertblocks then you have to add \addtobeamertemplate{block alerted begin}{}{\setbeamercolor{local structure}{parent=structure}} to your preamble. –  Loop Space Sep 13 '12 at 11:00
    
Ok, but I have just seen that also your initial code does only part of the intended output. After setting the colour for author to "local structure", the author in the itemize item called local structure should appear in black text rather than in blue. –  Benedikt Bauer Sep 13 '12 at 11:28
    
@BenediktBauer So then I haven't understood what your desired outcome is. Do you want the author to appear as if it were normal text, meaning however normal text there would be rendered (so alerted if in an alert but normal if in normal)? –  Loop Space Sep 13 '12 at 11:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.