5

Problem : Draw the circle, but without the numbers and without indicative guidance arrow:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=3]
\draw (0,0) circle (1cm);
\end{tikzpicture}
\end{document}

enter image description here

  • 2
    \foreach command is a good start. – azetina Jan 17 '14 at 21:06
  • Without the letters also? – Sigur Jan 17 '14 at 21:13
  • 1
    For the arc only \draw (90:1cm) arc (90:-180:1cm); – Sigur Jan 17 '14 at 21:14
  • 5
    @Sigur I wonder if anyone has read the "specification" above the code and the image. :) – masu Jan 18 '14 at 13:03
10

You can use a combination of foreach and arc, and imagine that the shape is quite similar to a clock face:

screenshot

% arara: pdflatex

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\tikzset{>=stealth}
\begin{document}

\begin{tikzpicture}[scale=3]
\draw[->] (90:1cm) arc (90:-180:1cm);
% numbers
\foreach \i in {2,...,9}
{
    \pgfmathparse{90-(\i-1)*360/13};
    \node at (\pgfmathresult:1.2cm) {\i};
};
% letters
\foreach \i/\j in {10/T,11/J,12/Q,13/K,14/A}
{
    \pgfmathparse{90-(\i-1)*360/13};
    \node at (\pgfmathresult:1.2cm) {\j};
};
\end{tikzpicture}

\end{document}
| improve this answer | |
  • 1
    oops, the finishing point of the arrow is slightly off... I suppose it's good to leave something for the OP :) – cmhughes Jan 17 '14 at 21:35
8

enter image description here

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=3]
    %
    % Independent parameters
    \pgfmathsetmacro\dth{360/13}                            % angular increment
    \def\angleOffset{90}                                    % starting angle
    \def\dialR{1}                                           % dial radius
    \def\dialLabelOffset{.2}                                % label radial offset
    %
    % Dependent parameters
    \pgfmathsetmacro\angleTip{-10.5*\dth+\angleOffset}      % tip angle
    \pgfmathsetmacro\dialLabelR{\dialR+\dialLabelOffset}    % label radius
    %   
    % draw arc
    \draw[thick,->]
        (\angleOffset:\dialR) arc (\angleOffset:\angleTip:\dialR);
    %
    % write labels
    \foreach
    [
        var=\k,
        var=\dialLabel,
        evaluate=\k as \th using -\k*\dth+\angleOffset,
    ]
    in {0/A,1/2,2/3,3/4,4/5,5/6,6/7,7/8,8/9,9/T,10/J,11/Q,12/K}%
    { 
     \draw (\th:\dialLabelR) node {\dialLabel};
    }
\end{tikzpicture}
\end{document}
| improve this answer | |
6

enter image description here

The Asymptote version:

% dial.tex :
%
\documentclass{article}
\usepackage[inline]{asymptote}
\usepackage{lmodern}
\begin{document}
\begin{figure}
\begin{asy}
size(3cm);
import graph;
import fontsize; defaultpen(fontsize(9));
string L="A23456789TJQK"; int n=length(L); int k=find(L,"J");
real dphi=360/n;
real r=1;
draw(Arc(0N,r,90,90-(k+0.5)*dphi,CW),deepblue+0.8bp,Arrow(size=3));
pair p;
for(int i=0;i<n;++i){
  p=dir(90-i*dphi);
  label("$\mathsf{"+substr(L,i,1)+"}$",p,p);
}
\end{asy}
\end{figure}
\end{document}
%
% Process:
%
% pdflatex dial.tex
% asy dial-*.asy
% pdflatex dial.tex
| improve this answer | |
3

run with xelatex or with latex->dvips->ps2pdf:

\documentclass[pstricks,12pt]{standalone}
\usepackage{pstricks,multido}
\begin{document}

\psset{unit=2} \degrees[13] \SpecialCoor \sffamily
\begin{pspicture}(-2,-2)(2,2)
\psarcn{->}(0,0){1.5}{3}{-7}
\multido{\iA=2+-1,\iB=2+1}{8}{\rput(1.7;\iA){\iB}}
\pgfforeach \iA/\jA in {7/T,6/J,5/Q,4/K,3/A}{\rput(1.7;\iA){\jA}}
\end{pspicture}

\end{document}

enter image description here

| improve this answer | |
3

With \degrees[360]

\documentclass[pstricks,12pt]{standalone}
\usepackage{pst-node}
\psset{saveNodeCoors}

\begin{document}

\begin{pspicture}(-4,-4)(4,4)
\psforeach{\x}{A,2,3,4,5,6,7,8,9,T,J,Q,K}
{
    \pnodes(!3 -360 13 div \the\psLoopIndex\space mul 90 add PtoC){X\x}
    \uput[!N-X\x.y N-X\x.x Atan](X\x){\x}
}
\psarcn{->}(0,0){2.8}{(XA)}{(XQ)}
\end{pspicture}

\end{document}

enter image description here

With \degrees[13] and \psforeach

\documentclass[pstricks,12pt]{standalone}
\usepackage{pst-node}
\psset{saveNodeCoors}
\degrees[13]
\begin{document}
\makeatletter
\begin{pspicture}(-4,-4)(4,4)
\psforeach{\x}{A,2,3,4,5,6,7,8,9,T,J,Q,K}
{
    \pnodes(!3 \the\psLoopIndex\space neg \pst@angleunit 90 add PtoC){X\x}
    %\qdisk(X\x){1pt}
    \uput[!N-X\x.y N-X\x.x atan 1 \pst@angleunit div](X\x){\x}
    %\uput[!\the\psLoopIndex\space neg 90 1 \pst@angleunit div add ](X\x){\x}
}
\psarcn{->}(0,0){2.8}{(XA)}{(XQ)}
\end{pspicture}
\makeatother
\end{document}

With \degrees[13] and \foreach

\documentclass[pstricks,12pt]{standalone}
\usepackage{pst-node}
\usepackage{pgfmath}% don't forget this line!
\psset{saveNodeCoors}
\degrees[13]
\begin{document}
\makeatletter
\begin{pspicture}(-4,-4)(4,4)
\foreach \x [count=\xi from 0] in {A,2,3,4,5,6,7,8,9,T,J,Q,K}
{
    \pnodes(!3 \xi\space neg \pst@angleunit 90 add PtoC){X\x}
    \uput[!N-X\x.y N-X\x.x atan 1 \pst@angleunit div](X\x){\x}
}
\psarcn{->}(0,0){2.8}{(XA)}{(XQ)}
\end{pspicture}
\makeatother
\end{document}

Warning!

  • The following alternative approaches for labeling produce labels which are wrongly positioned.

    \uput[(X\x)](X\x){\x}% wrong position
    \uput[!\psGetNodeCenter{X\x} X\x.y X\x.x Atan](X\x){\x}% wrong position
    
  • \usepackage{pgfmath} must be loaded when using the looping index (via [count=\xi from 0]) of \foreach.

| improve this answer | |

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.