我想链接 TikZ 图片中的公式元素...但是箭头指向的位置不正确...
\documentclass[t]{beamer}
\setbeamertemplate{navigation symbols}{}
%\usepackage{times}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{color}
\usepackage{tcolorbox}
\usetikzlibrary{overlay-beamer-styles} %<-added
\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}
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{tcolorbox}%\onslide<3>
\begin{align*}
\onslide<1->{\sin A &= \frac{\tikznode{Lab1}{\text{Side opposite to }\angle A}}{\text{Hypotenuse}}\\}
\onslide<1->{&= \frac{BC}{AC}\\}
\onslide<1->{\sin A &= \frac{7}{25}}
\end{align*}
\end{tcolorbox}
\end{column}
%
\begin{column}{0.5\textwidth} %%<--- here
\begin{tcolorbox}%\onslide<2->
\begin{center}
\begin{tikzpicture}[scale=1.0]
%\tkzInit[xmax=4, ymax=6]
%\tkzAxeXY
%\tkzGrid
%\tkzClip
%
\tkzDefPoint(0,4){A}
\tkzDefPoint(0,0){B}
\tkzDefPoint(2,0){C}
\tkzDrawSegment(A,B)
\tkzDrawSegment(A,C)
\tkzDrawSegment(B,C)
\tkzLabelPoints[below](B,C)
\tkzLabelPoints[above](A)
\tkzMarkRightAngle[size=0.4](A,B,C)
\tkzLabelSegment[below,pos=.5,alias=lab1](B,C){7 cm}
\tkzLabelSegment[sloped](B,A){24 cm}
%\tkzLabelSegment[right,pos=.5,red](B,C){25 cm}
\tkzLabelSegment[sloped](C,A){25 cm}
\tkzMarkAngle[size=0.5](A,C,B)
\tkzMarkAngle[size=0.6](B,A,C)
%\tkzMarkAngle[size=0.5,mark=|](C,B,A)
\end{tikzpicture}
\end{center}
\end{tcolorbox}
\end{column}
\begin{tikzpicture}[overlay,remember picture]
\draw[latex-latex,visible on=<1->,brown,thick] (Lab1) to[out=135,in=-90] (lab1);
\end{tikzpicture}
\end{columns}
\end{frame}
\end{document}
答案1
您需要remember picture
在选项中tikzpicture
绘制图表,否则节点名称/位置在外部是未知的tikzpicture
。
\documentclass[t]{beamer}
\setbeamertemplate{navigation symbols}{}
%\usepackage{times}
\usepackage{tkz-euclide} % loads tikz which loads xcolor, so tikz and color packages aren't needed
\usetkzobj{all}
\usepackage{tcolorbox}
\usetikzlibrary{overlay-beamer-styles} %<-added
\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}
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{tcolorbox}%\onslide<3>
\begin{align*}
\onslide<1->{\sin A &= \frac{\tikznode{Lab1}{\text{Side opposite to }\angle A}}{\text{Hypotenuse}}\\}
\onslide<1->{&= \frac{BC}{AC}\\}
\onslide<1->{\sin A &= \frac{7}{25}}
\end{align*}
\end{tcolorbox}
\end{column}
%
\begin{column}{0.5\textwidth} %%<--- here
\begin{tcolorbox}%\onslide<2->
\begin{center}
\begin{tikzpicture}[scale=1.0,remember picture] % <-- added remember picture
%\tkzInit[xmax=4, ymax=6]
%\tkzAxeXY
%\tkzGrid
%\tkzClip
%
\tkzDefPoint(0,4){A}
\tkzDefPoint(0,0){B}
\tkzDefPoint(2,0){C}
\tkzDrawSegment(A,B)
\tkzDrawSegment(A,C)
\tkzDrawSegment(B,C)
\tkzLabelPoints[below](B,C)
\tkzLabelPoints[above](A)
\tkzMarkRightAngle[size=0.4](A,B,C)
\tkzLabelSegment[below,pos=.5,alias=lab1](B,C){7 cm}
\tkzLabelSegment[sloped](B,A){24 cm}
%\tkzLabelSegment[right,pos=.5,red](B,C){25 cm}
\tkzLabelSegment[sloped](C,A){25 cm}
\tkzMarkAngle[size=0.5](A,C,B)
\tkzMarkAngle[size=0.6](B,A,C)
%\tkzMarkAngle[size=0.5,mark=|](C,B,A)
\end{tikzpicture}
\end{center}
\end{tcolorbox}
\end{column}
\begin{tikzpicture}[overlay,remember picture]
\draw[latex-latex,visible on=<1->,brown,thick] (Lab1) to[out=45,in=-120,looseness=1.6] (lab1);
\end{tikzpicture}
\end{columns}
\end{frame}
\end{document}