5

This is my code:

\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}  

Why does this arrow from "Radikand" to inside of the base of the \sqrt go to the wrong place?

kgklj

1
  • \sqrt[x][{y} uses \mathpalette. This typesets the contents four times but only leaves the correct instance in the document. This might break your code here. Jan 12, 2017 at 15:08

1 Answer 1

6

For some reason, your custom \tikzmark REALLY doesn't like being inside \sqrt. Using \sbox causes \tikzmark to execute outside \sqrt but be displayed inside. The change to tikzpicture outside the equation* isn't really necessary, but does reduce the number of \pgfsyspdfmark entries in the aux file.

\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


If you are going to be doing this a lot, you might find the \mathtikzmark macro below useful.

\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}  

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .