我想在投影仪框架内放置一个框来突出显示算法的状态。例如,下面显示的状态。我如何在它周围绘制这样的突出显示框?
\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}
答案1
该hf-tikz
包提供了一种突出显示公式(部分)的简单方法:
\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}
答案2
我可以建议一个替代方案吗?利用beamer
的\alert
:
\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}