jolars / moloch

A LaTeX Beamer theme, forked from the metropolis theme
https://ctan.org/pkg/moloch
Creative Commons Attribution Share Alike 4.0 International
91 stars 6 forks source link

Incompatibility with beamertheme-tcolorbox #28

Closed Enivex closed 4 weeks ago

Enivex commented 4 weeks ago

Trying to load \useinnertheme{tcolorbox} after moloch results in

Package xcolor: Undefined color `block title.bg'.
Package xcolor: Undefined color `normal text.bg'.

This works with metropolis

samcarter commented 4 weeks ago

You can work around the problem by loading another colour theme first:

\documentclass{beamer}

\usecolortheme{orchid}
\usetheme{moloch}
\molochset{block=fill}
\useinnertheme{tcolorbox}

\begin{document}

\begin{frame}
  \begin{block}{title}
  content...
  \end{block}
\end{frame}

\end{document}
Enivex commented 4 weeks ago

@samcarter

Thanks, that indeed works. I like having rounded corners on my theorem boxes.

jolars commented 4 weeks ago

Hm, I see. Do you have a minimal working example?

I can only reproduce this when first loading some other color theme, then moloch, then the innertheme from tcolorbox (like in @samcarter's example). I get this:

.../beamertheme-tcolorbox/beamerinnerthemetcolorbox.sty|118 error|  (Package xcolor)  Undefined color `structure.fg'. See the xcolor package documentation for explanation. ...                                               
.../beamertheme-tcolorbox/beamerinnerthemetcolorbox.sty|118 error|  (Package xcolor)  Undefined color `structure.fg'. See the xcolor package documentation for explanation. ...                                               

when compiling this:

\documentclass{beamer}

\usecolortheme{orchid}
\usetheme{moloch}
\useinnertheme{tcolorbox}

\begin{document}

\begin{frame}[c]
  \begin{tcolorbox}
    This is a \textbf{tcolorbox}.
  \end{tcolorbox}
\end{frame}

\end{document}

But with

\usetheme{moloch}
\usecolortheme{orchid}
\useinnertheme{tcolorbox}

it compiles just fine.

Enivex commented 4 weeks ago

Does it compile fine without the "\usecolortheme{orchid}"?

jolars commented 4 weeks ago

Yes, this works fine:

\documentclass{beamer}

\usetheme{moloch}
\useinnertheme{tcolorbox}

\begin{document}

\begin{frame}[c]
  \begin{tcolorbox}
    This is a \textbf{tcolorbox}.
  \end{tcolorbox}
\end{frame}

\end{document}

What versions of tcolorbox, moloch, and beamer are you on?

Enivex commented 4 weeks ago

Your example works @jolars , but the following does not

\documentclass{beamer}

\usetheme[block=fill]{moloch}
\useinnertheme{tcolorbox}

\begin{document}

\begin{frame}[c]
    \begin{theorem}
        Hello
    \end{theorem}
\end{frame}

\end{document}
samcarter commented 4 weeks ago

Yes, this works fine:

\documentclass{beamer}

\usetheme{moloch}
\useinnertheme{tcolorbox}

\begin{document}

\begin{frame}[c]
  \begin{tcolorbox}
    This is a \textbf{tcolorbox}.
  \end{tcolorbox}
\end{frame}

\end{document}

What versions of tcolorbox, moloch, and beamer are you on?

You need the block=fill option for moloch.

samcarter commented 4 weeks ago

@samcarter

Thanks, that indeed works. I like having rounded corners on my theorem boxes.

\documentclass{beamer}

\usecolortheme{orchid}
\usetheme{moloch}
\molochset{block=fill}
\useinnertheme[rounded]{tcolorbox}

\begin{document}

\begin{frame}
  \begin{block}{title}
  content...
  \end{block}
\end{frame}

\end{document}
Enivex commented 4 weeks ago

Yes, I'm aware how to achieve that

(I use shaded=false too, since I think the gradient transition does not look good)

samcarter commented 4 weeks ago

Yes, I'm aware how to achieve that

(I use shaded=false too, since I think the gradient transition does not look good)

In this case I don't understand what "I like having rounded corners on my theorem boxes." meant

Enivex commented 4 weeks ago

It was just an explanation for why I wanted to use the tcolorbox inner theme instead of the moloch one

samcarter commented 4 weeks ago

It was just an explanation for why I wanted to use the tcolorbox inner theme instead of the moloch one

Ah!

samcarter commented 4 weeks ago

Minimal non-working example:

\documentclass{beamer}

\usetheme{moloch}
\molochset{block=fill}
\setbeamertemplate{blocks}[rounded]

\begin{document}

\begin{frame}
  \begin{block}{title}
  content...
  \end{block}
\end{frame}

\end{document}

... so looking in the code, the difference between moloch and other colour themes, seems to be the use=block title

Something like

\documentclass{beamer}

\usetheme{moloch}

\makeatletter
\renewcommand{\moloch@block@fill}{
  \setbeamercolor{block title}{%
    bg=normal text.bg!80!fg
  }
  \setbeamercolor{block body}{%
    use=block title,bg=block title.bg!50!normal text.bg
  }
  \setbeamercolor{block title alerted}{%
    bg=block title.bg,
  }
  \setbeamercolor{block title example}{%
    bg=block title.bg,
  }
}
\makeatother

\molochset{block=fill}
\setbeamertemplate{blocks}[rounded]

\begin{document}

\begin{frame}
  \begin{block}{title}
  content...
  \end{block}
\end{frame}

\end{document}

would compile.

jolars commented 4 weeks ago

Thanks @samcarter, I implemented your proposed change. I'm not sure if there's anything else that needs to be done (?), but the failing cases here seem to work fine now.

samcarter commented 4 weeks ago

Thanks @samcarter, I implemented your proposed change. I'm not sure if there's anything else that needs to be done (?), but the failing cases here seem to work fine now.

Great! I don't think anything else needs to be done.