3

AI am trying to use the following to create a box (preferably with no title) in a beamer presentation. Unfortunately, it does not work! How should I modify it to make it work. FYI: it works for a document type that's an article.

\documentclass[pdf]{beamer}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\begin{document} 
\begin{tcolorbox}[
  colback=Magenta!5!white,
  colframe=Magenta!75!black,
  title={\centering Homework}]
The math problem should be here...
\end{tcolorbox}
\end{document}
2
  • In your question you write "preferrably with no title" but your code contains a title. Could you please clarify on that?
    – leandriis
    Commented Jul 6, 2019 at 20:04
  • That was my mistake. I commented out the title command. Thanks for the answer! :)
    – rose
    Commented Jul 6, 2019 at 20:07

1 Answer 1

5

As the beamer class already loads the xcolor package, your code results in the following error message: Option clash for package xcolor.. To overcome this, I have removed \usepackage[dvipsnames]{xcolor} and replaced it by the class option [xcolor={dvisnames}]. I have also enclosed the tcolorbox in a frame environment.

enter image description here

\documentclass[xcolor={dvipsnames}]{beamer}
\usepackage{tikz,lipsum,lmodern}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{frame} 
\begin{tcolorbox}[
  colback=Magenta!5!white,
  colframe=Magenta!75!black,
  title={\centering Homework}]
The math problem should be here...
\end{tcolorbox}
\end{frame}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .