3

I am new to LaTex, and I don't know how to code something like this, can someone help me out? Thank you so much!

I am new to LaTeX, and I don't know how to type a thing like this, can you help me out? Thank you so much.

2 Answers 2

3

Something to start with:

\documentclass[border=1cm]{standalone}

\usepackage{tikz}

\begin{document}
    
    \begin{tikzpicture}
        
        %braces
        \draw [] (8.5,0) arc (-80:80:0.2cm and 0.5cm);
        \draw [rotate=180] (-0.5,-1) arc (-80:80:0.2cm and 0.5cm);

        
        %draw
        \foreach \x in {1,2.5,4,5.5}{
        \draw (\x,0) rectangle (\x+1,1);
        \node at (\x+1.25,0) {,};
        \draw (\x+1.5,0) rectangle (\x+2.5,1);
        }
    
        %nodes
        \foreach \x \y \z in {1/1/3,2.5/2.5/6,4/4/5,5.5/5.5/4}{
        \node [inner sep=0] (A) at (\x+0.5,0) {};
        \node [inner sep=0] (B) at (\x+0.5,-\y*0.2) {}; 
        \draw [->] (B) edge (A) node[below] {\tiny $\z$ choices};
            }
    
        \end{tikzpicture}
    
    \end{document}

enter image description here

1

With a TikZ matrix:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{matrix, positioning}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}
\matrix[matrix of nodes, 
    nodes in empty cells,
    inner sep=0pt,
    nodes={draw, very thick, minimum size = 16pt},
    column sep=6pt,
    left delimiter={(},
    right delimiter={)}]
    (mymatr)
    {&&&&\\};
\foreach \ind in {1,...,4}
    \node[font=\bfseries] at ([xshift=2pt]mymatr-1-\ind.south east) {,};
\foreach \ind \descr in {1/3,2/6,3/5,4/4}{
        \node[below=\ind*12pt of mymatr-1-\ind] (u\ind) {\descr\ chioces};
        \draw[-Stealth] (u\ind) -- (mymatr-1-\ind);
            }
    
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.