按照 stackexchange 上一些帖子的说明,我使用以下代码生成了方程式的附加图像。但是,我还想用蓝色突出显示方括号内的项。此外,我想用高亮显示注释方程式右侧的第一个项,即 (1-delta)。这是我第一次使用 tikz 包,我为此苦苦挣扎。我已经查看了示例http://www.texample.net/tikz/examples/beamer-arrows。但由于我才刚刚开始,所以我不能做太多的事情。
如果有人能在这里帮助我提供代码及其解释,我将非常感激。
\documentclass[xcolor=dvipsnames]{beamer}
\usetheme{Madrid}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{tikzmark, positioning, arrows,shapes}
\begin{document}
\begin{frame}{Household}
with the law of motion of capital,
\begin{equation}
\label{capmot}
K_{t+1}^p= (1-\delta)K_t^P + I_t^P\tikzmark{pdt}{\left[1 - \dfrac{\chi}{2}\left(\dfrac{I_t^P}{I_{t-1}^P} -1 \right)^2 \right]}
\end{equation}
\begin{tikzpicture}[
remember picture,
overlay,
expl/.style={draw=orange,fill=orange!30,rounded corners,text width=3cm},
arrow/.style={red!80!black,ultra thick,->,>=latex}
]
\node<2->[fill=blue!20,anchor=base,expl]
(pdtex)
at (6,3.5cm)
{Investment Adjustment Cost};
\draw<2->[arrow]
(pdtex.west) to[out=180,in=180] ([yshift=0.5ex]{pic cs:pdt});
\end{tikzpicture}
\end{frame}
\end{document}
PS 我要求注释在点击时逐一出现。
答案1
这是建议。要将颜色更改为蓝色,您可以\alert
在告诉 beamer 使用蓝色后使用。我还通过使用标注和更精确的突出显示来\alert
更改添加框的方式。\tikznode
\documentclass[xcolor=dvipsnames]{beamer}
\usetheme{Madrid}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{tikzmark, positioning, arrows,shapes}
\usetikzlibrary{shapes.callouts,shadows.blur,positioning}
\usetikzlibrary{overlay-beamer-styles}
\setbeamercolor{alerted text}{fg=blue}
\newcommand{\tikznode}[2]{\relax
\ifmmode%
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};
\else
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
\fi}
\begin{document}
\begin{frame}{Household}
with the law of motion of capital,
\begin{equation}
\label{capmot}
K_{t+1}^p= \alert<2>{\tikznode{del}{(1-\delta)}}K_t^P +
I_t^P\alert<3>{\tikznode{pdt}{\left[1 -
\dfrac{\chi}{2}\left(\dfrac{I_t^P}{I_{t-1}^P} -1 \right)^2 \right]}}
\end{equation}
\begin{tikzpicture}[
remember picture,
overlay,
expl/.style={draw=orange,fill=orange!30,rounded corners,text width=3cm},
arrow/.style={red!80!black,ultra thick,->,>=latex}
]
\node[alt={<2>{drop shadow,opacity=0.8,text opacity=1}{invisible}},
visible on=<2>,
align=center, fill=blue!20, align=center,
rounded corners,draw,rectangle callout,
anchor=pointer,callout relative pointer={(-300:1cm)}]
at (del) {Depreciation};
\node[alt={<3>{drop shadow,opacity=0.8,text opacity=1}{invisible}},
visible on=<3>,
align=center, fill=blue!20, align=center,
rounded corners,draw,rectangle callout,
anchor=pointer,callout relative pointer={(230:1cm)}]
at (pdt.north) {Investment Adjustment Cost};
\end{tikzpicture}
\end{frame}
\end{document}