wie zeichne ich mit TikZ in Beamer eine Treppenmatrix?

wie zeichne ich mit TikZ in Beamer eine Treppenmatrix?

Ich bin ein Neuling in Sachen Beamer und LaTeX. Ich möchte eine Treppenmatrix wie beigefügt zeichnen. Das sollte ziemlich einfach sein, aber ich weiß einfach nicht, wie ich das zeichnen soll. Bitte verwenden Sie nur tikZ (und Matrix) und keine anderen Bibliotheken. Vielen Dank ![Bildbeschreibung hier eingeben]1

Antwort1

Ziemlich minimal:

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\tikz[x=1em, y=1em, inner sep=1em/6]]
  \matrix [left delimiter={[}, right delimiter={]}] {
  \draw (0,0) \foreach \i [count=\j] in {1,2,1,3,1,2,2,1,1}{ 
    \ifnum\j>1-- ++(0,-1)\fi node [above right] (x-\j) {$x$} -- ++(\i,0)
  }
  (x-1 -| x-\j) node [left]  {possibly nonzero entries}
  (x-1 |- x-\j) node [right] {zero entries};
\\};
\end{document}

Bildbeschreibung hier eingeben

Antwort2

Mit TikZ werden mithilfe der Tikz-Knoten {NiceTabular}erstellt nicematrix.

\documentclass{article}
\usepackage{nicematrix,tikz}

\begin{document}

\begin{NiceTabular}{[*{14}c]}[margin=1em]
x \\
  & x &&   &   &&&   & \clap{possibly non zero entries} \\
  &   && x \\
  &   &&   & x \\
  &   &&   &   &&& x \\
  &   &&   &   &&&   & x \\
  &   &&   &   &&&   &   && x \\
  &   &&   \clap{zero entries}
           &   &&&   &   &&   && x \\
  &   &&   &   &&&   &   &&   &&   & x \\
\CodeAfter
  \tikz \draw (2-|1) -| (3-|2) -| (4-|4) -| (5-|5) 
            -| (6-|8) -| (7-|9) -| (8-|11) -| (9-|13) -| (10-|14) -- (10-|15) ; 
\end{NiceTabular}

\end{document}

Ausgabe des obigen Codes

Antwort3

Eine Möglichkeit:

\documentclass[tikz,border=2mm]{standalone}

\usetikzlibrary{matrix}

\begin{document}
\begin{tikzpicture}
\matrix (A) [matrix of nodes, left delimiter=[,right delimiter={]}]{
 x \\
 & x\hspace*{3mm}\\
 & & x \\
 & & & x\hspace*{6mm}\\
 & & & & x\\
 & & & & & x\hspace*{3mm}\\
 & & & & & & x\hspace*{3mm}\\
 & & & & & & & x\\
 & & & & & & & & x\\};
 \foreach \i [remember=\i as \j (initially 1)] in {2,...,9}
\draw (A-\j-\j.south west) -|(A-\i-\i.south west);
\draw (A-9-9.south west)--(A-9-9.south east);
\node[anchor=south west] at ([shift={(5mm,5mm)}]A.south west) {zero entries};
\node[anchor=north east] at ([shift={(-3mm,-3mm)}]A.north east) {possibly nonzero entries};
\end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen