我理解,每个\item
组内的文本itemize
均不尊重文本颜色,因为它位于其自己的组内。
无论如何,我有一个程序可以为我生成一堆盒子,其中一个是“活动的”。
梅威瑟:
\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}
我怎样才能将其他框的字体设置为灰色?
(最好不要改变内容,就像进入每个\item并设置都是灰色的,因为这些幻灯片是由几个过程生成的,另一个过程是选择活动框的过程......)
答案1
像这样吗?
这不是“正确”的做法,但它对现有代码的破坏最小。特别是,框架内容不需要改变。
\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}
答案2
如何使用 TikZ 来定义你的框?大致如下:
\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}
最终的幻灯片如下: