Could you help me I have been looking for how to make a diagram similar to this image. Thanks.
- 757,742
-
2the site works best if you ask a tex question. Show the code you tried and if you get an error someone will debug. Also are those vertical lines, or 1s ? – David Carlisle Sep 07 '22 at 07:38
-
1Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Sep 07 '22 at 07:57
-
I don't know if the round braces are important to you. If square or curly braces would be acceptable, you could look at this question or this question. – Sandy G Sep 09 '22 at 13:42
1 Answers
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}
- 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

