2

In a file found on this page I found the following graphic. What I need is to change the numbers by letters A, B, C, D ...


\documentclass[tikz,border=7pt]{standalone}
\begin{document}
    \begin{tikzpicture}[
        every node/.style={fill=red,circle, text=white, inner sep=0, minimum size=14},
        every path/.style={draw=white,double=black, very thick}
        ]
        \foreach \i in {-1,0,1}
        \foreach[evaluate={\k=int(5-3*\j+\i)}] \j in {-1,0,1}
        \path (\i,\j)  node (\k) {\k};
        \foreach[count=\i, evaluate={\k=int(9+\i)}] \a in {45,0,-45,-90}
        \path (\a:3) node (\k) {\k};
    \draw (1) to (2) to (3) to[out=0,in=135] (11);
    \draw (4) to (5) to (6) to (11);
    \draw (7) to (8) to (9) to[out=0,in=-135] (11);

    \draw (1) to (4) to (7) to[out=-90,in=135] (13);
    \draw (2) to (5) to (8) to (13);
    \draw (3) to (6) to (9) to[out=-90,in=45] (13);

    \draw (7) to[out=135,in=135, distance=100] (2) (2) to (6) (6) to[out=-45,in=90] (12);
    \draw (1) to (5) to (9) to (12);
    \draw (3) to[out=135,in=135, distance=100] (4) (4) to (8) (8) to[out=-45,in=180] (12);

    \draw (1) to[out=-135,in=-135, distance=100] (8) (8) to (6) (6) to[out=45,in=-90] (10);
    \draw (7) to (5) to (3) to (10);
    \draw (9) to[out=-135,in=-135, distance=100] (4) (4) to (2) (2) to[out=45,in=180] (10);

    \draw[bend left=17] (10) to (11) (11) to (12) (12) to (13);

\end{tikzpicture}

\end{document}

enter image description here

Werner
  • 603,163
  • Do you need something like this: https://tex.stackexchange.com/questions/118283/transforming-numbers-to-alph-numbers? – Luis Turcio Jun 14 '21 at 16:37

2 Answers2

5

You can define a \Letter command that prints uppercase letters corresponding to integers in the range 1–26, using the internal \@Alph.

\documentclass[tikz,border=7pt]{standalone}

\makeatletter \newcommand{\Letter}[1]{@Alph{#1}} \makeatother

\begin{document} \begin{tikzpicture}[ every node/.style={fill=red,circle, text=white, inner sep=0, minimum size=14}, every path/.style={draw=white,double=black, very thick} ] \foreach \i in {-1,0,1} \foreach[evaluate={\k=int(5-3*\j+\i)}] \j in {-1,0,1} \path (\i,\j) node (\k) {\Letter{\k}}; \foreach[count=\i, evaluate={\k=int(9+\i)}] \a in {45,0,-45,-90} \path (\a:3) node (\k) {\Letter{\k}};

    \draw (1) to (2) to (3) to[out=0,in=135] (11);
    \draw (4) to (5) to (6) to (11);
    \draw (7) to (8) to (9) to[out=0,in=-135] (11);

    \draw (1) to (4) to (7) to[out=-90,in=135] (13);
    \draw (2) to (5) to (8) to (13);
    \draw (3) to (6) to (9) to[out=-90,in=45] (13);

    \draw (7) to[out=135,in=135, distance=100] (2) (2) to (6) (6) to[out=-45,in=90] (12);
    \draw (1) to (5) to (9) to (12);
    \draw (3) to[out=135,in=135, distance=100] (4) (4) to (8) (8) to[out=-45,in=180] (12);

    \draw (1) to[out=-135,in=-135, distance=100] (8) (8) to (6) (6) to[out=45,in=-90] (10);
    \draw (7) to (5) to (3) to (10);
    \draw (9) to[out=-135,in=-135, distance=100] (4) (4) to (2) (2) to[out=45,in=180] (10);

    \draw[bend left=17] (10) to (11) (11) to (12) (12) to (13);

\end{tikzpicture}

\end{document}

enter image description here

egreg
  • 1,121,712
3

I am basing my answer on this answer to a similar(?) question: https://tex.stackexchange.com/a/398430/118712

You can define the variable \k as a counter and then output the alphabetic value using \Alph{}.

\documentclass[tikz,border=7pt]{standalone}
\newcounter{ccount}

\begin{document} \begin{tikzpicture}[ every node/.style={fill=red,circle, text=white, inner sep=0, minimum size=14}, every path/.style={draw=white,double=black, very thick} ] \foreach \i in {-1,0,1} \foreach[evaluate={\k=int(5-3*\j+\i)}] \j in {-1,0,1} \setcounter{ccount}{\k} \path (\i,\j) node (\k) {\Alph{ccount}}; \foreach[count=\i, evaluate={\k=int(9+\i)}] \a in {45,0,-45,-90} \setcounter{ccount}{\k} \path (\a:3) node (\k) {\Alph{ccount}};

    \draw (1) to (2) to (3) to[out=0,in=135] (11);
    \draw (4) to (5) to (6) to (11);
    \draw (7) to (8) to (9) to[out=0,in=-135] (11);

    \draw (1) to (4) to (7) to[out=-90,in=135] (13);
    \draw (2) to (5) to (8) to (13);
    \draw (3) to (6) to (9) to[out=-90,in=45] (13);

    \draw (7) to[out=135,in=135, distance=100] (2) (2) to (6) (6) to[out=-45,in=90] (12);
    \draw (1) to (5) to (9) to (12);
    \draw (3) to[out=135,in=135, distance=100] (4) (4) to (8) (8) to[out=-45,in=180] (12);

    \draw (1) to[out=-135,in=-135, distance=100] (8) (8) to (6) (6) to[out=45,in=-90] (10);
    \draw (7) to (5) to (3) to (10);
    \draw (9) to[out=-135,in=-135, distance=100] (4) (4) to (2) (2) to[out=45,in=180] (10);

    \draw[bend left=17] (10) to (11) (11) to (12) (12) to (13);

\end{tikzpicture}

\end{document}

enter image description here

Markus G.
  • 2,735