要逐项提醒列表中的项目,我通常使用<alert@+>
。例如,
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{itemize}[<alert@+>]
\item one
\item two
\item three
\end{itemize}
\end{frame}
\end{document}
我们可以在每一步中在项目周围画一个框,而不是用警报。就像这样<boxaround@+>
。
答案1
基于https://tex.stackexchange.com/a/107209/36296你可以做类似的事情:
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{xparse}
\tikzset{
invisible/.style={opacity=0,text opacity=0},
visible on/.style={alt=#1{}{invisible}},
alt/.code args={<#1>#2#3}{%
\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
},
}
\tikzset{
background fill/.style={fill=#1},
background fill/.default={white},
fill on/.style={alt=#1{}{background fill}},
}
\tikzset{
background draw/.style={draw=#1},
background draw/.default={white},
draw on/.style={alt=#1{}{background draw}},
}
\tikzset{
background filldraw/.style args={#1 filled by #2}{draw=#1, fill=#2},
background filldraw/.default=white filled by white,
filldraw on/.style={alt=#1{}{background filldraw}},
}
\pgfkeys{/highlight/.cd,
above right offset/.initial={0.015,0.065},
above right offset/.get=\aboverightoffset,
above right offset/.store in=\aboverightoffset,
below left offset/.initial={-0.015,-0.1},
below left offset/.get=\belowleftoffset,
below left offset/.store in=\belowleftoffset,
}
\tikzset{highlighting/.style={
append after command={
\pgfextra{
\path[rounded corners,
background filldraw=red filled by red!30,% border+filling
filldraw on=<#1>, % overlay specification
overlay] ($(\tikzlastnode.south west)+(\belowleftoffset)$) % to have some offset
rectangle ($(\tikzlastnode.north east)+(\aboverightoffset)$);
}
}
}
}
\NewDocumentCommand{\highlight}{O{} m}{%
\pgfkeys{/highlight/.cd,#1}
\tikz[baseline=(A.base)]
\node[highlighting=.,
inner sep=0pt] (A) {\textcolor{black}{#2}};%
}
\begin{document}
\begin{frame}{Itemize with styles}
\begin{itemize}[<alert@+>]
\item \highlight{one}
\item \highlight{two}
\item \highlight{three}
\end{itemize}
\end{frame}
\end{document}
编辑:
使用该库的简化版本overlay-beamer-styles
:
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{xparse}
\usetikzlibrary{overlay-beamer-styles}
\pgfkeys{/highlight/.cd,
above right offset/.initial={0.015,0.065},
above right offset/.get=\aboverightoffset,
above right offset/.store in=\aboverightoffset,
below left offset/.initial={-0.015,-0.1},
below left offset/.get=\belowleftoffset,
below left offset/.store in=\belowleftoffset,
}
\tikzset{highlighting/.style={
append after command={
\pgfextra{
\path[rounded corners,
background filldraw=red filled by red!30,% border+filling
filldraw on=<#1>, % overlay specification
overlay] ($(\tikzlastnode.south west)+(\belowleftoffset)$) % to have some offset
rectangle ($(\tikzlastnode.north east)+(\aboverightoffset)$);
}
}
}
}
\NewDocumentCommand{\highlight}{O{} m}{%
\pgfkeys{/highlight/.cd,#1}
\tikz[baseline=(A.base)]
\node[highlighting=.,
inner sep=0pt] (A) {\textcolor{black}{#2}};%
}
\begin{document}
\begin{frame}{Itemize with styles}
\begin{itemize}[<alert@+>]
\item \highlight{one}
\item \highlight{two}
\item \highlight{three}
\end{itemize}
\end{frame}
\end{document}