这是我的代码:
\documentclass[11pt]{amsart}
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
\geometry{a4paper} % ... or a4paper or a5paper or ...
\usepackage{tikz}
\newcommand{\tikzmark}[2]{%
\tikz[remember picture,baseline=(#1.base)]
\node[text=black,anchor=center,inner sep=2pt] (#1) {#2};}
\begin{document}
\begin{equation*}
\begin{aligned}
\tikzmark{wexponent}{Wurzelexponent} && \\[1em]
\sqrt[{\tikzmark{nwex}{n}}]{\tikzmark{aradi}{a}} & = \tikzmark{xwter}{x} \\[1em] %radikand will nicht pfeilen-----------------
\tikzmark{radikand}{Radikand} && \tikzmark{wterm}{Wurzelterm}\\[1em]
(-2)^2 & =\sqrt[2]4\neq -2
\end{aligned}
\phantom{\hspace{88.5mm}}
\tikz[overlay,remember picture]{\draw[blue,thick,->] (wexponent.south) to [bend left=0] node[anchor=south]{$ $}(nwex.north);}
\tikz[overlay,remember picture]{\draw[blue,thick,->] (radikand.north) to [bend left=0] node[anchor=south]{$ $}(aradi.south);}
\tikz[overlay,remember picture]{\draw[blue,thick,->] (wterm.north) to [bend left=0] node[anchor=south]{$ $}(xwter.east);}
\end{equation*}
\end{document}
为什么这支从“Radikand”射向底座内部的箭头会\sqrt
射到错误的地方?
答案1
由于某种原因,您的自定义\tikzmark
确实不喜欢在里面\sqrt
。使用\sbox
会导致\tikzmark
在外面执行\sqrt
但显示在里面。更改为tikzpicture
外面并不是真正必要的,但确实减少了辅助文件中的条目equation*
数。\pgfsyspdfmark
\documentclass[11pt]{amsart}
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
\geometry{a4paper} % ... or a4paper or a5paper or ...
\usepackage{tikz}
\newcommand{\tikzmark}[2]{%
\tikz[remember picture,baseline=(#1.base)]%
{\node[text=black,anchor=center,inner sep=2pt] (#1) {#2};}}
\begin{document}
\begin{equation*}
\begin{aligned}
\tikzmark{wexponent}{Wurzelexponent} && \\[1em]
\sbox1{\tikzmark{aradi}{a}}%
\sqrt[{\tikzmark{nwex}{n}}]{\usebox1} & = \tikzmark{xwter}{x} \\[1em] %radikand will nicht pfeilen-----------------
\tikzmark{radikand}{Radikand} && \tikzmark{wterm}{Wurzelterm}\\[1em]
(-2)^2 & =\sqrt[2]4\neq -2
\end{aligned}
\phantom{\hspace{88.5mm}}
\end{equation*}
\begin{tikzpicture}[overlay,remember picture]
\draw[blue,thick,->] (wexponent.south) to [bend left=0] (nwex.north);
\draw[blue,thick,->] (radikand.north) to [bend left=0] (aradi.south);
\draw[blue,thick,->] (wterm.north) to [bend left=0] (xwter.east);
\end{tikzpicture}
\end{document}
如果您经常这样做,您可能会发现\mathtikzmark
下面的宏很有用。
\documentclass[11pt]{amsart}
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
\geometry{a4paper} % ... or a4paper or a5paper or ...
\usepackage{tikz}
\newcommand{\tikzmark}[2]{%
\tikz[remember picture,baseline=(#1.base)]%
{\node[text=black,anchor=center,inner sep=2pt] (#1) {#2};}}
\usepackage{mathstyle}
\makeatletter
\newcommand{\mathtikzmark}[2]{%
\tikz[remember picture,baseline=(#1.base)]%
{\node[text=black,anchor=center,inner sep=2pt] (#1) {$\m@th\currentmathstyle#2$};}}
\makeatother
\begin{document}
\begin{equation*}
\begin{aligned}
\tikzmark{wexponent}{Wurzelexponent} && \\[1em]
\sbox1{\tikzmark{aradi}{$a$}}%
\sqrt[{\mathtikzmark{nwex}{n}}]{\usebox1} & = \mathtikzmark{xwter}{x} \\[1em] %radikand will nicht pfeilen-----------------
\tikzmark{radikand}{Radikand} && \tikzmark{wterm}{Wurzelterm}\\[1em]
(-2)^2 & =\sqrt[2]4\neq -2
\end{aligned}
\phantom{\hspace{88.5mm}}
\end{equation*}
\begin{tikzpicture}[overlay,remember picture]
\draw[blue,thick,->] (wexponent.south) to [bend left=0] (nwex.north);
\draw[blue,thick,->] (radikand.north) to [bend left=0] (aradi.south);
\draw[blue,thick,->] (wterm.north) to [bend left=0] (xwter.east);
\end{tikzpicture}
\end{document}