[Tex/LaTex] How to draw a Caesar Cipher diagram with tikz?

arrowscirclestikz-pgf

I just tried start rewrite code of circle like this
Draw a Clock using tkz-euclide,
but I haven't any idea how write frames and arrow over of circle code.
I want that show circle code how cipher/decrypt words using the for example Caesar cipher.
enter image description here

EDIT:
After advive in comments I rewrite example code to solve my problem. Now, I can draw arrow over a picture with number?

\documentclass{article}

\usepackage{chancery}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\tikzset{curved text/.style={
  decoration={text effects along path,
  text/.expanded=#1, text align = center,
  text effects/.cd, text along path, decorate}}
}
\begin{document}

\begin{tikzpicture}[x = 1em, y = 1em]
\draw circle [radius = 15] circle [radius = 12] circle [radius = 9]
  \foreach \i in {0,...,25}{ (\i*13.85:15) -- (\i*13.85:12) -- (\i*13.85:9) };
\node [align=center] {Caesar \\ Cipher};
\foreach [count=\a from 0] \text in {%
{X},
{Y},
{Z},
{A},
{B},
{C},
{D},
{E},
{F},
{G},
{H},
{I},
{J},
{K},
{L},
{M},
{N},
{O},
{P},
{Q},
{R},
{S},
{T},
{U},
{V},
{W}
}
\foreach \t [count=\r] in \text
  \path [curved text=\t, rotate=-\a*13.85]
    (90:15-\r) arc (90:13.85:15-\r);

\foreach [count=\b from 0] \text in {%
{A},
{B},
{C},
{D},
{E},
{F},
{G},
{H},
{I},
{J},
{K},
{L},
{M},
{N},
{O},
{P},
{Q},
{R},
{S},
{T},
{U},
{V},
{W},
{X},
{Y},
{Z}
}
\foreach \t [count=\r] in \text
  \path [curved text=\t, rotate=-\b*13.85]
    (90:12-\r) arc (90:13.85:12-\r);
\end{tikzpicture}

\end{document}

Best Answer

Something like this?

caeser code

\documentclass[tikz,border=2mm]{standalone}
\usepackage{libertine} % Change the font to your liking
\usepackage[T1]{fontenc}
\usetikzlibrary{decorations.text,arrows.meta,calc}

\tikzset{curved text/.style={decorate,
        decoration={text effects along path,
            text={#1}, text align=center,
            text effects/.cd, text along path}}}

\begin{document}
    \begin{tikzpicture}[x=1em,y=1em]
%   set up
    \pgfmathsetmacro\angdiv{360/26}
    \pgfmathtruncatemacro\caeser{7} % Input Caeser shift here! (positive for clockwise)
    \coordinate (n-0) at (90+\angdiv/2:7) {};
    \coordinate (m-0) at (90-\caeser*\angdiv+\angdiv/2:5) {};
%   draw Caeser diagram 
    \draw circle [radius=8] circle [radius=6.5] circle [radius=6]  circle [radius=4.5]
        \foreach \i in {0,...,25}{%
            ($({90-(\i-1/2)*\angdiv}:8)$) -- ($(({90-(\i-1/2)*\angdiv}:6.5)$)
            ($({90-(\i-1/2)*\angdiv}:4.5)$) -- ($(({90-(\i-1/2)*\angdiv}:6)$)
        };
    \foreach [count=\a from 0] \text in {A,B,...,Z}{
        \pgfmathtruncatemacro\b{\a+1}%
        \path [curved text=\text] (n-\a) arc [start angle=90-(\a-1/2)*\angdiv, delta angle=-\angdiv, radius=7] node (n-\b) {};
        \path [curved text=\text] (m-\a) arc [start angle=90-(\a+\caeser-1/2)*\angdiv, delta angle=-\angdiv, radius=5] node (m-\b) {}; % Inner circle
    }
%   draw arrows
    \draw [arrows={-Latex}]
 (65:9.5) to[bend left=20,edge label=$+3$] (40:9.5);
    \end{tikzpicture}
\end{document}

The thing you most likely need to change in this code is the Caeser shift, which you can do so in the line of \pgfmathtruncatemacro\caeser{7}. I have also indicated in the code exactly where it is. Note that a positive Caeser shift is a clockwise translation.


Extra: (not asked by OP)

This method is extendable to a Caeser wheel with 5 letters, for example. I've indicated the locations in the code to make the change to produce the given output.

enter image description here

\documentclass[tikz,border=2mm]{standalone}
\usepackage{libertine} % Change the font to your liking
\usepackage[T1]{fontenc}
\usetikzlibrary{decorations.text,arrows.meta,calc}

\tikzset{curved text/.style={decorate,
        decoration={text effects along path,
            text={#1}, text align=center,
            text effects/.cd, text along path}}}

\begin{document}
    \begin{tikzpicture}[x=1em,y=1em]
    %   set up
    \pgfmathsetmacro\angdiv{360/5} <-----------------
    \pgfmathtruncatemacro\caeser{2} % Input Caeser shift here! (positive for clockwise)
    \coordinate (n-0) at (90+\angdiv/2:7) {};
    \coordinate (m-0) at (90-\caeser*\angdiv+\angdiv/2:5) {};
    %   draw Caeser diagram 
    \draw circle [radius=8] circle [radius=6.5] circle [radius=6]  circle [radius=4.5]
    \foreach \i in {0,...,4}{% <-----------------------
        ($({90-(\i-1/2)*\angdiv}:8)$) -- ($(({90-(\i-1/2)*\angdiv}:6.5)$)
        ($({90-(\i-1/2)*\angdiv}:4.5)$) -- ($(({90-(\i-1/2)*\angdiv}:6)$)
    };
    \foreach [count=\a from 0] \text in {A,B,...,E}{% <------------------
        \pgfmathtruncatemacro\b{\a+1}%
        \path [curved text=\text] (n-\a) arc [start angle=90-(\a-1/2)*\angdiv, delta angle=-\angdiv, radius=7] node (n-\b) {};
        \path [curved text=\text] (m-\a) arc [start angle=90-(\a+\caeser-1/2)*\angdiv, delta angle=-\angdiv, radius=5] node (m-\b) {}; % Inner circle
    }
    %   draw arrows
    \draw [arrows={-Latex}]
    (65:9.5) to[bend left=20,edge label=$+3$] (40:9.5);
    \end{tikzpicture}
\end{document}