3

To alert item by item in a list, I normally use <alert@+>. For instance,

\documentclass{beamer}
\begin{document}
    \begin{frame}
        \begin{itemize}[<alert@+>]
            \item one
            \item two
            \item three
        \end{itemize}
    \end{frame}
\end{document}

Instead of alert, can we draw a box around the item at each step? Like <boxaround@+>.

2

Based on https://tex.stackexchange.com/a/107209/36296 you could do something like:

\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}

enter image description here


EDIT:

A simplified version using the overlay-beamer-styles library:

\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}
  • How can we include the bullet symbol into the box? – Say OL Jan 4 '17 at 12:10
  • @SayOL By using something like (50*\belowleftoffset). But I;m afraid, this will not make you happy, because the box is drawn over the itemize symbol - so you will have to remove the background colour to make it visible again. – user36296 Jan 4 '17 at 12:25

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.