1

I wrote for a beamer this in my code:

\documentclass[11pt]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usetheme{Dresden}
\definecolor{studentblue}{RGB}{37,34,140}
\BeforeBeginEnvironment{definition}{
    \setbeamercolor{block title}{fg=white,bg=studentblue}
    \setbeamercolor{block body}{fg=black, bg=studentblue!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}
}
\begin{document}
\begin{frame}
\begin{definition}
test
\end{definition}
\end{frame}
\end{document}

to obtain a block with these colours and with "Definition" as title of the block. I want to change the word in the title, I thought it was sufficient to change the word after \BeforeBeginEnvironment and \AfterEndEnvironment between the curly brackets but it isn't. What should I do? Thanks

2
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – TobiBS Sep 19 '20 at 14:37
  • of course, my fault. – FRANCESCO Sep 19 '20 at 15:07
1

Not sure why, but it seems necessary to explicitly load Italian for translator to work.

\documentclass[11pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}

\usetheme{Dresden}

\uselanguage{Italian}
\languagealias{italian}{Italian}

\definecolor{studentblue}{RGB}{37,34,140}

\BeforeBeginEnvironment{definition}{%
    \setbeamercolor{block title}{fg=white,bg=studentblue}%
    \setbeamercolor{block body}{fg=black, bg=studentblue!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}%
}
\begin{document}
\begin{frame}
\begin{definition}
test
\end{definition}
\end{frame}
\end{document}

enter image description here

3
  • Unfortunately it doesn't work. However, I don't only need to put the word "Definizione" but a general word, is it possible? – FRANCESCO Sep 20 '20 at 9:28
  • @FRANCESCO why don’t use directly the block environment? – egreg Sep 20 '20 at 21:13
  • Because with this environment I can put a structure with blue for the title and light blue for the text, in that case "text", while using block it has no coloured backround – FRANCESCO Sep 21 '20 at 7:23

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.