4

This question already has an answer here:

    \documentclass{beamer}
   \usepackage[T1]{fontenc}
    %-----
   \usepackage{amsmath,amssymb,amsfonts} %math
    \usepackage{color}
    \usetheme{Madrid}

   \begin{document}

   \begin{frame}{}
   \begin{exampleblock}{theorem}
   test
   \end{exampleblock}
  \begin{alertblock}{proposition}
   \end{alertblock}
   \begin{block}{Definition}

  \end{block}
  \begin{block}{lemma}

  \end{block}    
   \end{frame}

 \end{document}

enter image description here Thank you!

My goal is to get the block wich has the title definition with a new color like brown.

marked as duplicate by CarLaTeX, Torbjørn T., Werner beamer Jan 5 '18 at 21:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • As said before, you don't need \usepackage{graphicx} \usepackage{color} – user36296 Jan 5 '18 at 17:55
  • Add \setbeamercolor{block title}{fg=black,bg=orange!50!white} \setbeamercolor{block body}{fg=orange, bg=orange!30!white} to your document and replace the colour to your taste. BTW: tex.stackexchange.com/a/408639/36296 automatically creates a similar block – user36296 Jan 5 '18 at 18:16
4

Beamer has a build in environment for definitions. It's colour is the same as for a normal block, but you can make them different by changing the block colour before and after a definition. Same for theorem, lemma etc.

\documentclass{beamer}

%\usepackage{graphicx}
%\usepackage{color} 

\usetheme{Madrid}

% Definition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{studentbrown}{RGB}{124,71,50}

\BeforeBeginEnvironment{definition}{%
    \setbeamercolor{block title}{fg=white,bg=studentbrown}
    \setbeamercolor{block body}{fg=black, bg=studentbrown!20!white}
}
\AfterEndEnvironment{definition}{
        \setbeamercolor{block title}{use=structure,fg=white,bg=structure.fg!75!black}
        \setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!10!bg}
}

% Theorem %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\BeforeBeginEnvironment{theorem}{
    \setbeamercolor{block title}{use=example text,fg=white,bg=example text.fg!75!black}
    \setbeamercolor{block body}{parent=normal text,use=block title example,bg=block title example.bg!10!bg}
}
\AfterEndEnvironment{theorem}{
        \setbeamercolor{block title}{use=structure,fg=white,bg=structure.fg!75!black}
        \setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!10!bg}
}

% Proposition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtheorem{proposition}{Proposition}
\BeforeBeginEnvironment{proposition}{
        \setbeamercolor{block title}{use=alerted text,fg=white,bg=alerted text.fg!75!black}
        \setbeamercolor{block body}{parent=normal text,use=block title alerted,bg=block title alerted.bg!10!bg}
}
\AfterEndEnvironment{proposition}{
        \setbeamercolor{block title}{use=structure,fg=white,bg=structure.fg!75!black}
        \setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!10!bg}
}

\begin{document}

\begin{frame}

\begin{theorem}
test
\end{theorem}

\begin{proposition}
test
\end{proposition}

\begin{definition}
test
\end{definition}

\begin{lemma}
test
\end{lemma}    

\end{frame}

\end{document} 

enter image description here

  • @Student ?????? – user36296 Jan 5 '18 at 18:39
  • I have edited my question in order to understand me and thank you for your help – Student Jan 5 '18 at 19:38
  • @Student Please see my edit – user36296 Jan 5 '18 at 20:02
  • @Student Compiles fine for me. Can you make a MWE? – user36296 Jan 6 '18 at 17:38
  • @Student minimal working example (MWE) I also changed studentbrown to Orange and it compiles fine. – user36296 Jan 6 '18 at 17:47

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