3

I want to put a box to highlight a state from an algorithm inside beamer frame. For example, the state shown below. How can I draw a such highlight box around it?

\documentclass[xcolor=table,10pt,aspectratio=169]{beamer}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[noend]{algpseudocode}

\begin{document}

\begin{frame}{Test}
\begin{algorithmic}
\Procedure{Test}{$a, b$}
    \State $a + b$
\EndProcedure
\end{algorithmic}
\end{frame}

\end{document}

2 Answers 2

1

The hf-tikz package provides an easy way to highlight (parts of) a formula:

\documentclass[xcolor=table,10pt,aspectratio=169]{beamer}

%\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
%\usepackage{amsmath,amssymb,amsthm}
\usepackage[noend]{algpseudocode}

\usepackage[beamer]{hf-tikz}

\begin{document}

\begin{frame}
\frametitle{Test}
\begin{algorithmic}
\Procedure{Test}{$a, b$}
    \State $\tikzmarkin<2>{a}a + b\tikzmarkend{a}$
\EndProcedure
\end{algorithmic}
\end{frame}

\end{document}

enter image description here

0

May I suggest an alternative? Make use of beamer's \alert:

enter image description here

\documentclass{beamer}

\usepackage[noend]{algpseudocode}

\begin{document}

\begin{frame}{Test}
  \begin{algorithmic}
  \Procedure{Test}{$a, b$}
    \State \alert<2>{$a + b$}
  \EndProcedure
  \end{algorithmic}
\end{frame}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .