1

Could you help me I have been looking for how to make a diagram similar to this image. Thanks.

enter image description here

David Carlisle
  • 757,742

1 Answers1

1

Welcome to TeX.SE!!!

You can create a macro that draws the arcs above and below the vertical bars. If you want only one macro for both kind of arcs you need to change the axis locally, i.e. y=#3 cm in my example, where the argument #3 can take only values 1/-1.

A complete solution could be:

\documentclass[tikz,border=1cm]{standalone}
\newcommand{\myarc}[3] % start, end, 1/-1 (up, down) 
{
  \pgfmathsetmacro\l{int(#2-#1+1)} % label
  \draw[y=#3 cm,red] (#1-0.2,0.5) to[out=30*#3,in=150*#3] node[midway,yshift=#3*0.25cm] {$\l$} (#2+0.2,0.5) ;
}

\begin{document} \begin{tikzpicture}[line cap=round] % vertical bars \foreach\i in {1,...,16} \draw[thick] (\i,-0.5) --++ (0,1); % top arcs \myarc {2} {5}{1} \myarc {6} {9}{1} \myarc{11}{14}{1} \myarc{15}{16}{1} % bottom arcs \myarc {3} {6}{-1} \myarc {8}{11}{-1} \myarc{13}{15}{-1} \end{tikzpicture} \end{document}

enter image description here

Juan Castaño
  • 28,426
  • Gracias por su valiosa ayuda, de echo el que estor intentando es este código,

    \begin{eqnarray} X_m : 0, 1, \underbrace{ 1, \overbrace{ 1, }^{\textcolor{blue}{2|{X_4}}} }{\textcolor{blue}{2|{X_3}}} \overbrace{ 1, }^{\textcolor{blue}{2|{X_4}}} \underbrace{ 1, 1, }{\textcolor{blue}{2|{X_6}}} \underbrace{ 1, 1, }{\textcolor{blue}{2|{X_{8}}}} 1, 1, .... \end{eqnarray}

    – Enrique Torres Miguel Sep 09 '22 at 19:07
  • Pero no logro que la llave superior de X_4 cubra a los dos números, sin afectar a las llaves inferiores. – Enrique Torres Miguel Sep 09 '22 at 19:13
  • @EnriqueTorresMiguel. Quizás mejor si planteas una nueva pregunta, pones ese código y explicas tu problema. – Juan Castaño Sep 10 '22 at 07:04