[Tex/LaTex] Highlighting equation with arrow

amsmatharrowsequationsnodestikz-pgf

I want to create an equation with highlighting as shown bellow.

desired format
But using following code:

\documentclass[10pt,a4paper]{article}  
\usepackage[utf8]{inputenc}  
\usepackage{amsmath}  
\usepackage{amsfonts}  
\usepackage{amssymb}   
\usepackage{graphicx}
\usepackage{tikz}  
\usetikzlibrary{arrows,shapes,trees,positioning}  
\author{Apurba Paul}  
\begin{document}
\newcommand{\tikzmark}[1]{\tikz[baseline,remember picture] \node (#1) {};} 
\tikzset{square arrow/.style={to path={-- ++(-10,-.25) -| (\tikztotarget)}}}  

\begin{gather*}  
  y=\left[\frac{a}{\tikzmark{a}b}\frac{c}{\tikzmark{b}d}\right]\\  
  \tikz[remember picture]{\node(c){1'st part};}\qquad
  \tikz[remember picture]{\node(d){2'nd picture};}
  \tikz{\draw[->](a.south)to (c.north);}
  \tikz{\draw[->](b.south)to (d.north);}   
\end{gather*}  
\end{document}

But I am getting this enter image description here

Best Answer

Add the options remember picture and overlay to the connecting drawing commands:

\documentclass[10pt,a4paper]{article}  
\usepackage[utf8]{inputenc}  
\usepackage{amsmath}  
\usepackage{amsfonts}  
\usepackage{amssymb}   
\usepackage{graphicx}
\usepackage{tikz}  
\usetikzlibrary{arrows,shapes,trees,positioning}  
\author{Apurba Paul}  
\begin{document}

\newcommand{\tikzmark}[1]{\tikz[baseline,remember picture] \coordinate (#1) {};}

\tikzset{
  square arrow/.style={
    to path={-- ++(-10,-.25) -| (\tikztotarget)}
  }
}

\begin{gather*}  
  y=\left[\frac{a}{\tikzmark{a}b}\frac{c}{\tikzmark{b}d}\right]\\[2ex]
  \tikz[remember picture]{\node(c){1'st part};}\qquad
  \tikz[remember picture]{\node(d){2'nd picture};}
  \tikz[remember picture,overlay]{
    \draw[->] (a.south)++(.25em,-.3ex) to (c.north) ;
    \draw[->] (b.south)++(.25em,-.3ex) to (d.north) ;
  }  
\end{gather*}  
\end{document}

enter image description here