beamer add tag
JeT
**Context**

Switching often my content between `beamer` and `article`, I needed an `\newcommand` to  have a visual (in a `tcolorbox`) in article of what's in a frame environment in beamer. 

Great answers to that https://topanswers.xyz/tex?q=1089

I integrate it in my workflow and it works great.

I'd like now to extend this functionality to other `environment` like `definition`, `example` given that these environments can already be included in a `frame environment` as above (so a `tcolorbox` in a `tcolorbox`).

I messed around with `\RenewDocumentEnvironment` but I cannot adapt it due to the obscure (to me) option `s{d<>ooG{}G{}`. I checked `23.2 Producing tcolorbox Environments and Commands` here https://ctan.crest.fr/tex-archive/macros/latex/contrib/tcolorbox/tcolorbox.pdf but I need a bit of help.

The idea will be to have a visual help to build the course and see if `definitions`, `example`, `frames` are well balanced among the text. Once it's done, I can swith-off the option (via `pgfkeys`, @marmot it works !) to have a final document.
 
 
**MWE**


```
\documentclass[11pt]{article}
\usepackage{xcolor}
\usepackage[envcountsect]{beamerarticle}
\usepackage{tcolorbox}

\usepackage{xparse}
\RenewDocumentEnvironment{frame}{d<>ooG{}G{}}
  {%
    \begin{tcolorbox}[
 colback=red!20,
 colframe=red!60,
 arc=4mm,
 title={#4 \emph{#5}},
 coltitle=red!50!black, 
 fonttitle=\bfseries\scshape,
 detach title,
 before upper={\tcbtitle\par}
 ]%
  }
  {\end{tcolorbox}}

\begin{document}

\begin{frame}
	{Title of the frame}
	{Subtitle of the frame}
	\begin{definition}[My definition]
		My long definition that can take multiple lines, 
	\end{definition}
	
	\begin{itemize}
		\item first
		\item Second
		\item third
	\end{itemize}
	
	\begin{example}[My example]
		My long example that can take multiple lines, 
	\end{example}
	
\end{frame}

\end{document}
```
Top Answer
samcarter
You can wrap all definition that should only be made in article  in `\mode<article>{...}`. So to e.g. change the definition of `definition`:

```
\mode<article>{%
	\renewtcolorbox{definition}[1][]{%
    	colback=red!5!white, 
        colframe=red!75!black,
        fonttitle=\bfseries, 
        colbacktitle=red!85!black,
  		title={#1}
    }%
}%
```

Unrelated to your question, but you don't need to load `xcolor`, beamerarticle automatically loads it.

```
\documentclass[11pt]{article}
%\documentclass{beamer}
%\usepackage{xcolor}
\usepackage[envcountsect]{beamerarticle}
\usepackage{tcolorbox}

\usepackage{xparse}
\mode<article>{
\RenewDocumentEnvironment{frame}{d<>ooG{}G{}}
  {%
    \begin{tcolorbox}[
 colback=red!20,
 colframe=red!60,
 arc=4mm,
 title={#4 \emph{#5}},
 coltitle=red!50!black, 
 fonttitle=\bfseries\scshape,
 detach title,
 before upper={\tcbtitle\par}
 ]%
  }
  {\end{tcolorbox}}
  
\renewtcolorbox{definition}[1][]{%
	colback=red!5!white,
    colframe=red!75!black,
    fonttitle=\bfseries, 
    colbacktitle=red!85!black,
    title={#1}
  }
}

\begin{document}

\begin{frame}
	{Title of the frame}
	{Subtitle of the frame}
	\begin{definition}[My definition]
		My long definition that can take multiple lines, 
	\end{definition}
	
	\begin{itemize}
		\item first
		\item Second
		\item third
	\end{itemize}
	
	\begin{example}[My example]
		My long example that can take multiple lines, 
	\end{example}
	
\end{frame}

\end{document}
```


![Screen Shot 2020-10-13 at 13.33.33.png](/image?hash=5ffc3ff037189bc2d4cb6b8e463393be447e278fc3df7c309ce54fa1dbb1d566)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.