TransWikia.com

hf-tikz: no shape found

TeX - LaTeX Asked by pelegs on July 7, 2021

I’m trying to have two separate frames, each highlighting only the rows or the columns in a matrix, using hf-tikz in beamer:

begin{frame}
  frametitle{Matrices}
  begin{equation*}
    begin{pmatrix}
      tikzmarkin<1>{r1}tikzmarkin<2>{c1}1 & tikzmarkin<2>{c2}2 & tikzmarkin<2>{c3}3 & tikzmarkin<2>{c4}4tikzmarkend{r1}
      tikzmarkin<1>{r2}5 & 6 & 7 & 8tikzmarkend{r2}
      tikzmarkin<1>{r3}9 & 10 & 11 & 12tikzmarkend{r3}
      tikzmarkin<1>{r4}13tikzmarkend{c1}& 14tikzmarkend{c2}& 15tikzmarkend{c3}& 16tikzmarkend{r4}tikzmarkend{c4}
    end{pmatrix}
  end{equation*}    

  begin{tikzpicture}[overlay, remember picture]
    onslide<1>node[left of=r1] {1st row};
    onslide<1>node[left of=r2] {2nd row};
    onslide<1>node[left of=r3] {3rd row};
    onslide<1>node[left of=r4] {4th row};

    onslide<2>node[above of=c1] {1st column};
    onslide<2>node[above of=c2] {2nd column};
    onslide<2>node[above of=c3] {3rd column};
    onslide<2>node[above of=c4] {4th column};
  end{tikzpicture}
end{frame}

However when I run the code, it gives the following error:

! Package pgf Error: No shape named `c1' is known.

even though the nodes c1-c4 are clearly defined, and no such error happens for the nodes r1-r4.

I would appreciate any help solving this issue.

Edit: I suspect it has something to do with the [beamer] option to hf-tikz, since when I change tikzmarkin<1>{r1} to tikzmarkin<2>{r1} it complains about not finding the node r1.

Is there any way of having the c1-c4 nodes defined for both slides 1 and 2, but only shown on slide 2?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP