1

I understand that each \item within an itemize does not honor the text color because it is within its own group.

Anyhow, I have a program that generates for me a bunch of boxes, one of which is "active".

MWE:

\documentclass{beamer}

\newcommand\MyBoxInactive[1]{
\begin{minipage}[b][.20\textheight][t]{.20\textwidth}\color{gray}#1\end{minipage}
}
\newcommand\MyBoxActive[1]{
\colorbox{yellow}{\begin{minipage}[b][.20\textheight][t]{.20\textwidth}#1\end{minipage}}
}

\begin{document}

\begin{frame}{Title}
\MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
\MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
\MyBoxActive{\begin{itemize}\item item1\item item 2\end{itemize}}
\MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
\MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
\MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
\MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
\MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
\end{frame}

\end{document}

enter image description here

How can I set the other boxes font to be gray?

(preferably without changing the content, just as going to each \item and setting is gray, because these slides are generated by several processes, and another process is the one that chooses the active box ...)

  • Why don't you use transparent rather than changing the colour by force? Or create an overlay-sensitive analogue of uncover or alt or whatever your need similar to the transparency option. You don't need a hack and a hack is going to be much more work than using the facilities Beamer offers, I suspect. At least, start with what Beamer can do before you resort to a hack. – cfr Jul 21 '15 at 0:59
  • The thing is my use case is a little more complex than what I am exhibiting here. I only used animations for the purpose of the MWE. I have a program that generates frames with four quadrants, one of which is highlighted and the rest is inactive. I am aware of animations and \setbeamercovered, and I have used animations for this MWE, but this is for something for which animation is not really feasible ... – Ricardo Cruz Jul 21 '15 at 1:24
  • So? It is just a style. You can apply a transparency-like effect (which can be anything) to every slide in the frame, to only some, to whatever. But if you don't want the overlay stuff, it is simpler - you just need to use Beamer's colours with no transitions to worry about. But you need to use Beamer's colour framework for it to work properly - just setting colours the non-Beamer way won't work properly. – cfr Jul 21 '15 at 1:27
  • A manual workaround: \begin{itemize}\only<1>{\color{gray}} \item Item 1 \item Item 2 \end{itemize} – Gonzalo Medina Jul 21 '15 at 1:32
  • @GonzaloMedina A broader solution would be more helpful, because the content is produced by several processes. – Ricardo Cruz Jul 21 '15 at 1:47
2

Something like this?

active/inactive

This is not the 'right' way to do it but it involves minimal disruption to existing code. In particular, the frame content need not be altered.

\documentclass{beamer}
\newcommand\MyBoxInactive[1]{%
  \begin{minipage}[b][.20\textheight][t]{.20\textwidth}%
    \setbeamercolor{normal text}{fg=gray}\usebeamercolor[fg]{normal text}%
    \setbeamercolor{structure}{fg=gray}\usebeamercolor[fg]{structure}%
    #1
  \end{minipage}}
\newcommand\MyBoxActive[1]{%
  \colorbox{yellow}{%
    \begin{minipage}[b][.20\textheight][t]{.20\textwidth}#1\end{minipage}}}

\begin{document}

  \begin{frame}{Title}
    \MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
    \MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
    \MyBoxActive{\begin{itemize}\item item1\item item 2\end{itemize}}
    \MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
    \MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
    \MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
    \MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
    \MyBoxInactive{\begin{itemize}\item item1\item item 2\end{itemize}}
  \end{frame}

\end{document}
  • Brilliant! It is exactly what I wanted! :) – Ricardo Cruz Jul 23 '15 at 13:30
0

How about using TikZ to define your boxes? Something along these lines:

\documentclass[t]{beamer}
\setbeamersize{text margin left=0.5em, text margin right=0.5em}
\setbeamertemplate{frametitle}{\color{black}\bfseries\insertframetitle\par\vskip-6pt\hrulefill}
\usepackage{tikz}
\usetikzlibrary{positioning}

\tikzset{
    invisible/.style={opacity=0.3},
    visible on/.style={alt={#1{}{invisible}}},
    alt/.code args={<#1>#2#3}{%
      \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
    },
  }

\newcommand\FourQuad[4]{%
\begin{tikzpicture}[remember picture,overlay]
\node[minimum height=.4\textheight,text width=0.45\textwidth,anchor=north west,visible on=<1>,alt=<1>{fill=yellow}{}]
  (col1a)
  at ([shift={(10pt,.4\textheight)}]current page.west) 
  {#1};
\node[minimum height=.4\textheight,text width=0.45\textwidth,right=4pt of col1a,visible on=<2>,alt=<2>{fill=yellow}{}] 
  {#2};
\node[minimum height=.4\textheight,text width=0.45\textwidth,below=10 pt of col1a.south west,anchor=north west,visible on=<3>,alt=<3>{fill=yellow}{}]
  (col1b)
  {#3};
\node[minimum height=.4\textheight,text width=0.45\textwidth,right=4pt of col1b,visible on=<4->,alt=<4>{fill=yellow}{}] 
  {#4};
\end{tikzpicture}%
}

\begin{document}

\begin{frame}
\frametitle{A frame divided in two sides}
\FourQuad{First contents and some more text text text text more text text text text more text text text text more text text text text more text text text text more text text text text more text text text text}%
{A few items:
\begin{itemize}
\item Item 1
\item Item 2
\end{itemize}
And that's almost it!}%
{A few items:
\begin{enumerate}
\item Item 1
\item Item 2
\end{enumerate}
And that's it!}%
{First contents and some more text text text text more text text text text more text text text text more text text text text more text text text text more text text text text more text text text text}

\end{frame}

\end{document}

The resulting slides:

enter image description here

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.