3

I want to draw the following figure using TikZ in LaTeX with the following requirements:

  1. Numbers are evenly distributed around the circle.
  2. I can control the size of the circle.
  3. The size of the numbers can also be modified.

Edit: after following the comments, I get something that works.

\documentclass{beamer}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\tikzstyle{every node}=[font=\large]
\def\numofpoints{9}
\def\labelpatt{{2,3,1,8,7,9,0,6,4,5}}

\node[circle,draw,minimum width=2cm] (bigc) {};
\foreach \x in {0,...,\numexpr\numofpoints-1\relax}
{
\node (l-\x) at (360/\numofpoints*\x+90:1.2cm)    
{\pgfmathparse{\labelpatt[\x]}$\pgfmathresult$};
}
\end{tikzpicture}

\end{document}

output

JACKY88
  • 2,197

2 Answers2

2

If PSTricks is allowed, you can use the following:

\documentclass{article}

\usepackage{pstricks}
\usepackage{xfp}

\newcommand*\Number[2]{\uput[#1](\radius;#1){\large #2}}
% The first argument sets how many degrees the number is moved relative to 0 (anticlockwise).
% The second argument is the number.

% The following is to automatically get the correct bounding box around the drawing.
\newcommand*\RadiusA{\fpeval{\radius+0.25}}
\newcommand*\RadiusB{\fpeval{\radius+0.45}}

% Radius of the circle.
\def\radius{2}

\begin{document}

\begin{pspicture}(-\RadiusA,-\RadiusB)(\RadiusA,\RadiusB)
  \pscircle(0,0){\radius}
  \Number{18}{1}
  \Number{54}{3}
  \Number{90}{2}
  \Number{126}{5}
  \Number{162}{4}
  \Number{198}{6}
  \Number{234}{0}
  \Number{270}{9}
  \Number{306}{7}
  \Number{344}{8}
\end{pspicture}

\end{document}

output

2

A TikZ approach where \deg, \p, \r, \f are variables:

enter image description here

Code

\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{fit,calc,arrows,positioning}
\begin{document}


\def\deg{36}              % phase angle  
\def\p{10}                % vertices
\def\r{1}                 % radius
\def\f{\small}            % tiny small large, Large, huge, Huge
\begin{center}
\begin{tikzpicture}[scale=1]
\draw [thick](0,0) circle (\r);
\foreach \t/\x in {1/0*\deg, 3/1*\deg, 2/2*\deg, 5/3*\deg, 4/4*\deg, 6/5*\deg,0/6*\deg, 9/7*\deg, 7/8*\deg,8/9*\deg}
{\draw[thick,->]  node[] (\t) at (\x:1) {};
\node[anchor=center] at (\x:{\r+0.2}) {\f$\t$};}
\end{tikzpicture}

\def\deg{36}              % phase angle  
\def\p{10}                % vertices
\def\r{1.5}               % radius
\def\f{\Huge}             % tiny small large, Large, huge, Huge
\begin{tikzpicture}[scale=2]
\draw [thick](0,0) circle (\r);
\foreach \t/\x in {1/0*\deg, 3/1*\deg, 2/2*\deg, 5/3*\deg, 4/4*\deg, 6/5*\deg,0/6*\deg, 9/7*\deg, 7/8*\deg,8/9*\deg}
{\draw[thick,->]  node[] (\t) at (\x:1) {};
\node[anchor=center] at (\x:{\r+0.2}) {\f$\t$};}
\end{tikzpicture}
\end{center}
\end{document}
Jesse
  • 29,686