4

How can I draw the following diagram in LaTeX? But instead of the black dots in vertices, I want to put the numbers.

enter image description here

1
  • Welcome to TeX.SE. For my humble opinion your image has been created with xy package looking the tips of the arrows. It is possible to create also using tikz-cd.
    – Sebastiano
    Feb 5, 2020 at 17:52

1 Answer 1

15

Welcome! This is sort of a repeating question, and here is a repeating answer. The arrows really follow a circle.

\documentclass[border=3mm,tikz]{standalone}
\usetikzlibrary{arrows.meta,bending,calc,intersections}
\begin{document}
\begin{tikzpicture}[nodes={circle},
 pics/circular arc/.style args={from #1 to #2}{code={
 \path[name path=arc] 
  let \p1=(#1),\p2=(#2),\n1={Mod(720+atan2(\y1,\x1),360)},
  \n2={Mod(720+atan2(\y2,\x2),360)},
    \n3={ifthenelse(abs(\n1-\n2)<180,\n2,\n2+360)}
  in (\n1:\pgfkeysvalueof{/tikz/circular diagram/radius}) arc(\n1:\n3:\pgfkeysvalueof{/tikz/circular diagram/radius});
 \draw[pic actions,
    name intersections={of=#1 and arc,by=arcstart},
    name intersections={of=#2 and arc,by=arcend}] 
    let \p1=(arcstart),\p2=(arcend),\n1={Mod(720+atan2(\y1,\x1),360)},
     \n2={Mod(720+atan2(\y2,\x2),360)},
     \n3={ifthenelse(abs(\n1-\n2)<180,\n2,\n2+360)}
  in (\n1:\pgfkeysvalueof{/tikz/circular diagram/radius}) 
  arc(\n1:\n3:\pgfkeysvalueof{/tikz/circular diagram/radius}) 
  node[auto,midway,swap]{$\pgfkeysvalueof{/tikz/circular diagram/label}$};
 }},
pics/circular diagram/.style={code={
\foreach \XX/\ZZ [count=\YY starting from 1] in {#1}
{\xdef\mydim{\YY}};
\path foreach \XX/\ZZ [count=\YY starting from 0] in {#1}
{({\pgfkeysvalueof{/tikz/circular diagram/offset angle}+\YY*360/\mydim}:%
\pgfkeysvalueof{/tikz/circular diagram/radius}) node[name path=aux-\YY]
(aux-\YY) {$\XX$} };
\path[circular diagram/parc] foreach \XX/\ZZ 
[count=\YYY starting from 0,evaluate=\YYY as \YY using {int(mod(\YYY+1,\mydim))}]
in {#1}
{pic[circular diagram/label=\ZZ]{circular arc=from {aux-\YYY} to aux-\YY} 
};}},circular diagram/.cd,offset angle/.initial=0,radius/.initial=1,
parc/.style={thick,-{Stealth[bend]}},
arcs/.code={\tikzset{circular diagram/parc/.append style={#1}}},
label/.initial={}
]
\path 
 pic[rotate=90,circular diagram/.cd,radius=4,arcs={{Stealth[bend]}-}]{
    circular diagram={1/\alpha_n,n/\alpha_{n-1},n-1/\alpha_{n-2},%
    \rotatebox{-50}{$\dots$}/\alpha_i,i/\alpha_{i-1},\rotatebox{50}{$\dots$}/\alpha_3,3/\alpha_2,2/\alpha_1}}
    ;
\end{tikzpicture}
\end{document}

enter image description here

4
  • Thanks for the answer. I am writing a paper and using \documentclass{book}. So I changed your documentclass to it and add \usepackage{tikz}. If I open a new page and compile it, it works. But if I write this code in my tex, I obtain this diagram but not in the middle. It appears the right side of the page. I dont know how I can fix it.
    – sm.s
    Feb 6, 2020 at 13:19
  • 3
    @sm.s You probably want to wrap the diagram into \begin{figure}[htb] \centering ... \end{figure}.
    – user194703
    Feb 6, 2020 at 15:05
  • 1
    Great! Now it works! I need one more thing. I want to make this diagram smaller. How could I do it?
    – sm.s
    Feb 6, 2020 at 15:51
  • 2
    @sm.s The radius is set to 4 with radius=4. You can choose a smaller radius.
    – user194703
    Feb 6, 2020 at 15:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .