使用文本块和 tikz 在 beamer 中绘制箭头

使用文本块和 tikz 在 beamer 中绘制箭头

我想使用箭头来引起对不同方程式中元素的注意。包含信息的框可以放在不同的位置,因此我使用textblock来自textpos。我使用tikz箭头,并标识了箭头的位置。但是,箭头并没有像预期的那样从文本块中的文本指向相应方程中的项,如下面的 MWE 中所示。我该如何正确放置箭头?

\documentclass[t]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetheme{Boadilla}
\usecolortheme{default}
\usepackage[absolute,overlay]{textpos}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{hyperref}

\begin{document}

\begin{frame}
    \frametitle{Two equations}
    \begin{itemize}
        \item This is the first equation
        \begin{equation*}
        a + \dfrac{a}{b} + \dfrac{b}{c} = 
        \tikz[baseline]{
            \node[anchor=base] (e1) {\fcolorbox{red}{white}{$\sqrt{\dfrac{b}{a+b+c}}$}};
        }
        \end{equation*}     
        \item This is the second equation
        \begin{equation*}
        a + \dfrac{a}{b} + \dfrac{b}{c} = 
        \tikz[baseline]{
            \node[anchor=base] (e2) {\fcolorbox{red}{white}{$\log\left({\dfrac{b}{a+b+c}}\right)$}};
        }
        \end{equation*}
    \end{itemize}

    \begin{textblock}{4}(12,3)%
        \begin{scriptsize}
        Term in 1st equation
        \tikz \node (b1) {};
        \end{scriptsize}%
    \end{textblock}

    \begin{textblock}{3.5}(4,12)%
        \begin{scriptsize}
        Term in 2nd equation
        \tikz \node (b2) {};
        \end{scriptsize}%
    \end{textblock}
    
\begin{tikzpicture}
    \draw [->] (b1) -- (e1);
    \draw [->] (b2) -- (e2);
\end{tikzpicture}
        
\end{frame}

\end{document}

输出

答案1

在此处输入图片描述

\documentclass[t]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetheme{Boadilla}
\usecolortheme{default}
\usepackage[absolute,overlay]{textpos}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{hyperref}

\begin{document}

\begin{frame}
    \frametitle{Two equations}
    \begin{itemize}
        \item This is the first equation
        \begin{equation*}
        a + \dfrac{a}{b} + \dfrac{b}{c} = 
        \tikz[baseline, remember picture]{
            \node[anchor= base] (e1) {\fcolorbox{red}{white}{$\sqrt{\dfrac{b}{a+b+c}}$}};
        }
        \end{equation*}     
        \item This is the second equation
        \begin{equation*}
        a + \dfrac{a}{b} + \dfrac{b}{c} = 
        \tikz[baseline, remember picture]{
            \node[anchor=base] (e2) {\fcolorbox{red}{white}{$\log\left({\dfrac{b}{a+b+c}}\right)$}};
        }
        \end{equation*}
    \end{itemize}

    \begin{textblock}{4}(12,3)%
        \begin{scriptsize}
        \tikz[remember picture]{ \node (b1) {Term in 1st equation};}
        \end{scriptsize}%
    \end{textblock}

    \begin{textblock}{3.5}(4,12)%
        \begin{scriptsize}
        \tikz[remember picture]{ \node (b2) { Term in 2nd equation};}
        \end{scriptsize}%
    \end{textblock}
    
\begin{tikzpicture}[remember picture, overlay]
    \draw [->] (b1.south) -- (e1);
    \draw [->] (b2.east) -- (e2);
\end{tikzpicture}
        
\end{frame}

\end{document}

相关内容