enter image description hereI.[ I am trying to create this equation. The arrows are pointing at the subscripts! I managed to write it but it is not quite right as you can see.

  • 1
    Welcome to TeX.SX! Could you please show us what you tried? So instead of doing it all over, we can focus on fixing what isn't right. Sep 7, 2018 at 13:55

2 Answers 2


You can use this homemade tikzmark:


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


  Z_{\tikzmark{z1}1\tikzmark{z2}2} = X_{\tikzmark{x111}1\tikzmark{x112}1} Y_{\tikzmark{y121}1\tikzmark{y122}2}
  + X_{\tikzmark{x121}1\tikzmark{x122}2}Y_{\tikzmark{y221}2\tikzmark{y222}2}

\begin{tikzpicture}[remember picture,overlay]
  -- ([shift={(2pt,-12pt)}]z1)
  -- node[midway, below] {$\scriptstyle 12$} ([shift={(2pt,-12pt)}]z2)
  -- ([shift={(2pt,-2pt)}]z2);

  -- ([shift={(2pt,-24pt)}]x111)
  -- node[midway, below] {$\scriptstyle 12$} ([shift={(2pt,-24pt)}]y122)
  -- ([shift={(2pt,-2pt)}]y122);

  -- ([shift={(2pt,-12pt)}]x112)
  -- node[midway, below] {$\scriptstyle 11$} ([shift={(2pt,-12pt)}]y121)
  -- ([shift={(2pt,-2pt)}]y121);

  -- ([shift={(2pt,-24pt)}]x121)
  -- node[midway, below] {$\scriptstyle 12$} ([shift={(2pt,-24pt)}]y222)
  -- ([shift={(2pt,-2pt)}]y222);

  -- ([shift={(2pt,-12pt)}]x122)
  -- node[midway, below] {$\scriptstyle 22$} ([shift={(2pt,-12pt)}]y221)
  -- ([shift={(2pt,-2pt)}]y221);


I tried the standard tikzmark tikz library but it did not work, so I tried the trick from this answer and it worked:

enter image description here


A short code with pstricks:

\usepackage{pst-node, auto-pst-pdf}


    \[ \begin{postscript}
%% Nodes
  Z_{\rnode[b]{Z1}{1}\rnode[b]{Z2}{2}} = X_{\rnode[b]{a}{1}\rnode[b]{b}{1}}Y_{\rnode[b]{c}{1} \rnode[b]{d}{2}} + X_{\rnode[b]{e}{1} \rnode[b]{f}{2}}X Y_{\rnode[b]{g}{2} \rnode[b]{h}{2}}
%% Connections
\psset{angle=-90, linejoin=1, arm=4.5mm, arrows=<->, arrowinset=0.1, nodesep=2pt, labelsep=1.5pt}
\ncbar[offsetA=-1pt, offsetB=-1.5pt]{Z1}{Z2}\nbput{12}
    \end{postscript} \]%


enter image description here

You must log in to answer this question.

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