TransWikia.com

Does matrix works with Beamer?

TeX - LaTeX Asked on May 4, 2021

I’m trying to include this matrix in my beamer directly, so the new code is something like

(documentclass[border=5pt]{standalone}
  usepackage{tikz}
        usetikzlibrary{matrix,decorations.pathreplacing, calc, positioning,fit}
        begin{document}
begin{frame}

[code]
end{frame}

end{document})

But it didn’t work, any idea why?

   documentclass[border=5pt]{standalone}
    usepackage{tikz}
    usetikzlibrary{matrix,decorations.pathreplacing, calc, positioning,fit}
    begin{document}
    %%code
    begin{tikzpicture}[>=stealth,thick,baseline]
    matrix [matrix of math nodes,left delimiter=(,right delimiter=)](A){ 
    a_{1,1} & a_{1,2} & dots  & a_{1,j} & dots & a_{1,n}
    a_{2,1} & a_{2,2} & dots  & a_{2,j} & dots & a_{2,n}  
    vdots  & vdots  &  & vdots  &  & vdots
    a_{i,1} & a_{i,2} & dots  & a_{i,j} & dots & a_{i,n}
    vdots  & vdots  &  & vdots  &  & vdots
    a_{n,1} & a_{n,2} & dots  & a_{n,j} & dots & a_{n,n}
   };

   node[
     fit=(A-4-6)(A-4-6),
     inner xsep=20pt,inner ysep=0,
     label=right: $i$-ième ligne
    ](L) {};

   node[
     fit=(A-6-4)(A-6-4),
     inner xsep=20pt,inner ysep=20pt,
     label=below: $j$-ième colonne
     ](C) {};

    draw[->](L.east)-- ([xshift=12pt]A-4-6.east);
    draw[->](C.south)-- (A-6-4);

    end{tikzpicture}

    end{document}

One Answer

For me your code work if I use ampersand replacement=&:

documentclass{beamer}
    usepackage{tikz}
    usetikzlibrary{matrix,decorations.pathreplacing, calc, positioning,fit}
    begin{document}
    %%code
begin{frame}
    begin{tikzpicture}[>=stealth,thick,baseline]
    matrix [matrix of math nodes,left delimiter=(,right delimiter=),ampersand replacement=&](A){ 
    a_{1,1} & a_{1,2} & dots  & a_{1,j} & dots & a_{1,n}
    a_{2,1} & a_{2,2} & dots  & a_{2,j} & dots & a_{2,n}  
    vdots  & vdots  &  & vdots  &  & vdots
    a_{i,1} & a_{i,2} & dots  & a_{i,j} & dots & a_{i,n}
    vdots  & vdots  &  & vdots  &  & vdots
    a_{n,1} & a_{n,2} & dots  & a_{n,j} & dots & a_{n,n}
   };

   node[
     fit=(A-4-6)(A-4-6),
     inner xsep=20pt,inner ysep=0,
     label=right: $i$-ième ligne
    ](L) {};

   node[
     fit=(A-6-4)(A-6-4),
     inner xsep=20pt,inner ysep=20pt,
     label=below: $j$-ième colonne
     ](C) {};

    draw[->](L.east)-- ([xshift=12pt]A-4-6.east);
    draw[->](C.south)-- (A-6-4);

    end{tikzpicture}
end{frame}
    end{document}

matrix in beamer

Correct answer by vi pa on May 4, 2021

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