我有以下 LaTeX 代码:
\documentclass[serif]{beamer}
\mode<presentation> {
\usetheme{Warsaw}
}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[sc]{mathpazo}
\linespread{1.05} % Palladio needs more leading (space between lines)
\usepackage[T1]{fontenc}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\begin{document}
\begin{frame}
\frametitle{Probability}
\tikz[overlay,remember picture]{\only<2>{\node[right=10,gray,draw,fill=white,text width=130,align=left] at (5,0) {Update the probability $s_n$};}}
\end{frame}
\end{document}
我需要加载\usetikzlibrary{automata,positioning}
。当我这样做时,命令\tikz[overlay,remember picture]{\only<2>{\node[right=10,gray,draw,fill=white,text width=130,align=left] at (5,0) {Update the probability $s_n$};}}
不会产生任何效果。换句话说,加载包后矩形消失了。你知道为什么吗?
在加载包之前我得到:
但加载包后我得到:
答案1
考虑到@Benjamin 的评论right=10pt
,代码需要如下:
\documentclass{beamer}
\mode<presentation>{%
\usetheme{Warsaw}
\usefonttheme{serif} %[serif] is deprecated
}%
\usepackage{tikz}
\usetikzlibrary{automata,positioning}
\usetikzlibrary{calc}
\usepackage[sc]{mathpazo}
\linespread{1.05} % Palladio needs more leading (space between lines)
\usepackage[T1]{fontenc}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\begin{document}
\begin{frame}
\frametitle{Probability}
\tikz[overlay,remember picture]{\only<2>{\node[right=10pt,gray,draw,fill=white,text width=130,align=left] at (5,0) {Update the probability $s_n$};}}
\end{frame}
\end{document}
此外,serif
-option 已被弃用,因此代码使用更合适的\usefonttheme{serif}
。