3

I'd like to produce a presentation with beamer. I use the AAUsidebar theme.

I want to use my own boxes that I defined with \newtcolorbox. But, I can't not modify the background colour of the title (colbacktitle), and the colour of the text (coltext). Perhaps other properties are wrong.

The MVE is :

\documentclass[9pt]{beamer}
\usetheme[shownavsym, left]{AAUsidebar}

% If you want to change the colors of the various elements in the theme, edit and uncomment the following lines
\definecolor{mygreen}{cmyk}{0.82,0.11,1,0.25}

\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor{itemize item}{fg=orange!20!black}
\setbeamertemplate{itemize item}[ball]
\setbeamertemplate{itemize subitem}[triangle]

\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[many]{tcolorbox}

\newtcolorbox{MyBox}[1][]{
    width=\textwidth,
    colframe=red,%beamer@barcolor, % color frame:   red!75!black,
    colback=orange!50, % color background of the box
    colbacktitle=black!50!white, %beamer@barcolor!100, %beamer@barcolor, % color background of the title box    blue!85!black
    colbacklower=orange, %LimeGreen!75!LightGreen,
%   colupper=mygreen , % color of the text in the upper part
%   collower=mygreen , %  color of the text in the lower part
    coltext=mygreen!50, % color of the text (upper et lower parts)
    coltitle=mygreen!50,%mygreen!50!black, % color of the title
%   fontupper=\bfseries, %text et font avant le texte
%   fontlower=\bfseries, %text et font avant le texte 
    fonttitle=\bfseries, %text et font avant le texte
    oversize,
    left=0ex,
    right=0ex,
    top=0pt,
    bottom=0pt,
    arc=6pt,
    outer arc=6pt,
    leftrule=0pt,
    rightrule=0pt,
    toprule=0pt,
    bottomrule=0pt,
%    breakable,
    enhanced,% jigsaw,
%   title filled=true, % or false
%   rounded corners=northwest , 
    drop fuzzy shadow=black!80!white, % orange,
    title= #1}

\begin{document}

\begin{frame}{Introduction}
  \begin{MyBox}{The title}
    \begin{enumerate}
\item my item 1
\item my item 2
\item my item 3
      \end{enumerate}
  \end{MyBox}
\end{frame}

\end{document}

What is wrong in my code ?

3

Your code is correct except for two little mistakes. The first one is that you declared mybox with one optional argument

\newtcolorbox{MyBox}[1][]{

which is empty by default. Your call to \begin{MyBox}{Title} leaves the title empty and considers Title part of your text. If you use \begin{MyBox}[Title] the title will be considered like this and printed as expected.

And the second one was to forget that beamer declares its own colors for enumerate, therefore, coltext is overwritten when you include an enumerate environment in you box. Normal text is written with coltext color, but not text in enumerate, itemize or description.

If you want to change all enumerate color text in all the document, add

\setbeamercolor{itemize/enumerate body}{fg=mygreen!50}

in your preamble. But if you just want to apply it into MyBox, insert it with before upper= in \MyBox declaration. This command will change how the body is typeset, but for the numbers or items you must redefine enumerate item or itemize item templates.

\documentclass[9pt]{beamer}
\usetheme[shownavsym, left]{AAUsidebar}

% If you want to change the colors of the various elements in the theme, edit and uncomment the following lines
\definecolor{mygreen}{cmyk}{0.82,0.11,1,0.25}

\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor{itemize item}{fg=orange!20!black}
\setbeamertemplate{itemize item}[ball]
\setbeamertemplate{itemize subitem}[triangle]

\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[many]{tcolorbox}

\newtcolorbox{MyBox}[1][]{
    width=\textwidth,
    colframe=red,%beamer@barcolor, % color frame:   red!75!black,
    colback=orange!50, % color background of the box
    colbacktitle=black!50!white, %beamer@barcolor!100, %beamer@barcolor, % color background of the title box    blue!85!black
    colbacklower=orange, %LimeGreen!75!LightGreen,
%   colupper=mygreen , % color of the text in the upper part
%   collower=mygreen , %  color of the text in the lower part
    coltext=mygreen!50, % color of the text (upper et lower parts)
    coltitle=mygreen!50,%mygreen!50!black, % color of the title
%   fontupper=\bfseries, %text et font avant le texte
%   fontlower=\bfseries, %text et font avant le texte 
    fonttitle=\bfseries, %text et font avant le texte
    oversize,
    left=0ex,
    right=0ex,
    top=0pt,
    bottom=0pt,
    arc=6pt,
    outer arc=6pt,
    leftrule=0pt,
    rightrule=0pt,
    toprule=0pt,
    bottomrule=0pt,
%    breakable,
    enhanced,% jigsaw,
%   title filled=true, % or false
%   rounded corners=northwest , 
    drop fuzzy shadow=black!80!white, % orange,
    title= #1,
    before upper={ \setbeamercolor{itemize/enumerate body}{fg=mygreen!50}}}

\begin{document}

\begin{frame}{Introduction}
  \begin{MyBox}[The title]

    \begin{enumerate}
\item my item 1
\item my item 2
\item my item 3
      \end{enumerate}      
      Some text outside enumerate but inside MyBox
        \end{MyBox}

  Some text outside the box

{\setbeamercolor{enumerate item}{fg=blue}
      \begin{enumerate}
      \item Some enumerate outside MyBox
      \end{enumerate}}

      \begin{enumerate}
      \item Some enumerate outside MyBox
      \end{enumerate}
\end{frame}

\end{document}

enter image description here

|improve this answer|||||
  • This is precisely what I was looking for; many thanks! To update enumerate item and itemize item templates as @Ignasi suggested, I updated before upper like this: before upper={ \setbeamercolor{itemize/enumerate body}{fg=mygreen} \setbeamercolor{enumerate item}{fg=mygreen} \setbeamercolor{itemize item}{fg=mygreen} – asl Nov 5 '14 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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