3

in the code below, when I place the arrow to the equation, it messes with the alignment of the elements of the equation that the arrows are referring to. Is it possible to maintain the alignment of the equation (as shown in the second equation) and still have the arrows pointing to them? Thanks for your help.

Here is my code:

\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathptmx}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc,,arrows,shapes,decorations.pathreplacing}
\tikzset{every picture/.style={remember picture}}

\begin{document}
We denote
\begin{equation}
\hat{x}^{-}_{k} \equiv \hat{x}(\tikz[baseline]{\node(d1){$k$}}\mid \tikz[baseline]{\node(d2){$k-1$}})
\end{equation}
\begin{tikzpicture}[remember picture,overlay]{
   \draw[blue,thick,<-,rounded corners] (d1) |- ++ (0.6cm,-1.5cm) node[anchor=west,text = black,] (label1) {\emph{what is the $kth~x$}};
   \draw[blue,thick,<-,rounded corners] (d2) |- ($(label1.west)-(-0.8cm,-0.6cm)$) node[anchor=west,text = black] {$given~\hat{x}_{k-1},~z_{k-1}$};}
\end{tikzpicture}
\vspace{1cm}

We denote
\begin{equation}
\hat{x}^{-}_{k} \equiv \hat{x}(k\mid k-1)
\end{equation}

\end{document} 
2

1 Answer 1

3

As you're loading the tikzmark library anyway, use its \subnode, with the whole equation in one node:

enter image description here

\documentclass{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{mathptmx}
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc,arrows,shapes,decorations.pathreplacing}
%\tikzset{every picture/.style={remember picture}}

\begin{document}
We denote
\begin{equation}
\tikz{\node{$\hat{x}^{-}_{k} \equiv \hat{x}(\subnode{d1}{$k$}\mid \subnode{d2}{$k-1$})$};}
\end{equation}
\begin{tikzpicture}[remember picture,overlay]{
   \draw[blue,thick,<-,rounded corners] (d1) |- ++ (0.6cm,-1.5cm) node[anchor=west,text = black,] (label1) {\emph{what is the $k$th $x$}};
   \draw[blue,thick,<-,rounded corners] (d2) |- ($(label1.west)-(-0.8cm,-0.6cm)$) node[anchor=west,text = black] {given $\hat{x}_{k-1},~z_{k-1}$};}
\end{tikzpicture}
\vspace{1cm}

We denote
\begin{equation}
\hat{x}^{-}_{k} \equiv \hat{x}(k\mid k-1)
\end{equation}

\end{document} 

You must log in to answer this question.

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