指向 \sqrt 内的 \tikzmark 节点的箭头超出页面范围

指向 \sqrt 内的 \tikzmark 节点的箭头超出页面范围

这是我的代码:

\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射到错误的地方?

kgklj

答案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}  

demo


如果您经常这样做,您可能会发现\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}  

相关内容