[Tex/LaTex] Create alphabet tracing worksheet

alphabettikz-pgfxetex

I want to reproduce these pages in order to teach children all the letters of the alphabet,
I wonder if I could produce it in Latex instead of ordering a notebook
on the internet ?

Many thanks for your help.

Wanted worksheet

Best Answer

Starting from here I added the lower-case characters. Looking at the question it seems to me that the dashed red line is not always in the middle. Rather, e.g. in the case of the letter A it seems to be where the horizontal line of the A is. One can account for this in a straight-forward way: when defining the pics, add a coordinate at the vertical position, called (-mid) in the following. If you call the pic A, pic(A){A}, then the coordinate will have the name (A-mid). This allows us to place the red line differently depending on the specifics of the character.

\documentclass[tikz,border=3mm]{standalone}
 \pgfdeclarelayer{background} 
 \pgfdeclarelayer{behind} 
 \pgfdeclarelayer{foreground} 
 \pgfsetlayers{behind,background,main,foreground}
% from https://tex.stackexchange.com/a/460842/121799
\tikzset{pics/.cd,
  A/.style={code={\draw[pic actions] 
  (0,-0.5) -- (0.3,0.4) -- (0.6,-0.5);
  \draw[pic actions](0.1,1/3-0.45) -- coordinate(-mid)
  (0.5,1/3-0.45);
  \path (0.7,0);}},
  B/.style={code={\draw[pic actions] (0,-0.45) -- (0,0.45)
  to[out=0,in=0,looseness=2.5]  (0,0) coordinate(-mid)  to[out=0,in=0,looseness=3] cycle;}},
  C/.style={code={\draw[pic actions]
   (0,0) to[out=90,in=110,looseness=2]  (0.5,0.25);
   \draw[pic actions](0,0) coordinate(-mid) to[out=-90,in=-110,looseness=2]  (0.5,-0.25);
   \path (0.7,0);}},
  D/.style={code={\draw[pic actions] (0,-0.45) -- coordinate[pos=0.5](-mid) (0,0.45) 
  to[out=0,in=0,looseness=2.25]   cycle;
  \path (0.7,0);}},
  E/.style={code={\draw[pic actions] 
  (0.5,-0.45) --(0,-0.45) -- (0,0.45)  -- (0.5,0.45);
  \draw[pic actions] (0,0) -- coordinate(-mid) (0.5,0);
  \path (0.7,0);}},
  F/.style={code={\draw[pic actions] 
  (0,-0.45) -- (0,0.45)  -- (0.5,0.45);
  \draw[pic actions] (0,0) -- coordinate(-mid) (0.5,0);
  \path (0.7,0);}},
  G/.style={code={\draw[pic actions]
   (0,0) to[out=90,in=110,looseness=2]  (0.5,0.25);
   \draw[pic actions] (0,0) coordinate(-mid) to[out=-90,in=-110,looseness=2]  
   (0.5,-0.25);
   \draw[pic actions] (0.54,-0.25) to (0.3,-0.25);
   \path (0.7,0);}},
  H/.style={code={\draw[pic actions] 
  (0,-0.5) -- (0,0.5);  
  \draw[pic actions] (0.5,-0.5) -- (0.5,0.5);
  \draw[pic actions] (0,0) -- coordinate(-mid) (0.5,0);
  \path (0.7,0);}},
  I/.style={code={\draw[pic actions] (0,-0.45) -- coordinate[pos=0.5](-mid) (0,0.45);
  \path (0.25,0);}},
  J/.style={code={\draw[pic actions] 
  (0.2,0.45) -- coordinate[pos=0.5](-mid) (0.2,-0.35) to[out=-90,in=0]
  (0.1,-0.45) to[out=180,in=-90] (0,-0.35);
  \path (0.45,0);}},
  K/.style={code={\draw[pic actions] 
  (0,-0.45) -- (0,0.45); 
  \draw[pic actions] (0.4,0.45) -- (0.02,0)coordinate(-mid) --  (0.4,-0.45);
  \path (0.6,0);}},
  L/.style={code={\draw[pic actions] 
  (0,0.5) -- coordinate[pos=0.5](-mid) (0,-0.45) -- (0.4,-0.45);
  \path (0.6,0);}},
  M/.style={code={\draw[pic actions] (0,-0.45) -- coordinate[pos=0.5](-mid) (0,0.45) -- 
  (0.3,0.25) -- (0.6,0.45) -- (0.6,-0.45);
  \path (0.8,0);}},
  N/.style={code={\draw[pic actions] (0,-0.45) -- coordinate[pos=0.5](-mid) (0,0.45) -- (0.6,-0.4) --
  (0.6,0.45);
  \path (0.8,0);}},
  O/.style={code={\draw[pic actions] (0.3,0)coordinate(-mid) circle(0.3 and 0.48);
  \path (0.8,0);}},
  P/.style={code={\draw[pic actions] (0,-0.45) -- coordinate[pos=0.5](-mid)(0,0.45) 
  to[out=0,in=0,looseness=2.5]  (0,0);
  \path (0.6,0);}},
  Q/.style={code={\draw[pic actions] 
  (0.3,0) coordinate[pos=0.5](-mid) circle(0.3 and 0.48);
  \draw[pic actions](0.35,-0.25) -- (0.6,-0.45);
  \path (0.8,0);}},
  R/.style={code={\draw[pic actions] 
  (0,-0.45) -- coordinate[pos=0.5](-mid) (0,0.45) 
  to[out=0,in=0,looseness=2.5]  (0.05,0) -- (0.4,-0.45);
  \path (0.6,0);}},
  S/.style={code={\draw[pic actions] (0.5,0.4)  
  to[out=160,in=165,looseness=2]  (0.3,0)  coordinate(-mid)
  to[out=-15,in=-20,looseness=2] (0.1,-0.4);
  \path (0.65,0);}},
  T/.style={code={\draw[pic actions] (0.35,-0.45) -- coordinate[pos=0.5](-mid) (0.35,0.45) (0,0.45) -- (0.7,0.45);
  \path (0.85,0);}},
  U/.style={code={\draw[pic actions] (0,0.5) -- (0,0)coordinate(-mid) to[out=-90,in=-90,looseness=2.5]
  (0.6,0) -- (0.6,0.5);
  \path (0.8,0);}},
  V/.style={code={\draw[pic actions] (0,0.5) -- coordinate[pos=0.5](-mid) (0.3,-0.4) -- (0.6,0.5);
  \path (0.8,0);}},
  W/.style={code={\draw[pic actions] (0,0.45) -- coordinate[pos=0.5](-mid) (0.3,-0.4) -- (0.45,-0.1)
  -- (0.6,-0.4) -- (0.9,0.45);
  \path (1.1,0);}},
  X/.style={code={\draw[pic actions] 
  (0,0.45) -- coordinate[pos=0.5](-mid) (0.6,-0.45);
   \draw[pic actions] (0.6,0.45)
  -- (0,-0.45);
  \path (0.8,0);}},
  Y/.style={code={\draw[pic actions] 
  (0,0.45) -- (0.3,0) coordinate(-mid);  
  \draw[pic actions] (0.6,0.45)
  -- (0,-0.45);
  \path (0.8,0);}},
  Z/.style={code={\draw[pic actions] (0,0.45) --(0.6,0.45) 
  -- coordinate[pos=0.5](-mid) (0,-0.45)  
  -- (0.6,-0.45);
  \path (0.8,0);}},
  space/.style={code={\path (0,0) (0.2,0);}},
  a/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
    \draw[pic actions] (0.4,-0.5) -- (0.4,0) coordinate(-mid);}},
  b/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
    \draw[pic actions] (0,-0.5) -- coordinate[pos=0.5](-mid)(0,0.5);}},
  c/.style={code={\draw[pic actions] (0.2,-0.25)+ (40:0.2 and 0.25) arc[start angle=40,
    end angle=320,x radius=0.2,y radius=0.25];
    \path (0.2,0) coordinate(-mid);}},
  d/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
    \draw[pic actions] (0.4,-0.5) -- coordinate[pos=0.5](-mid)(0.4,0.5);}},
  e/.style={code={\draw[pic actions] (0,-0.25) -- (0.4,-0.25) arc[start angle=0,
    end angle=320,x radius=0.2,y radius=0.25];
    \path (0.2,0) coordinate(-mid);}},
  f/.style={code={\draw[pic actions] (0.2,-0.5)
  -- (0.2,0.3) arc[start angle=180,end angle=0,radius=0.15];
  \draw[pic actions] (0,0) -- (0.4,0) coordinate[pos=0.5](-mid);}},
  g/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
    \draw[pic actions] (0.4,0) coordinate(-mid)-- (0.4,-0.6)
    arc[start angle=0,end angle=-140,radius=0.2];}},
  h/.style={code={\draw[pic actions] (0,-0.5)--(0,0.4);
    \draw[pic actions] (0,-0.2) arc[start angle=180,end angle=0,radius=0.2]
     coordinate[pos=0.5](-mid)-- (0.4,-0.5);}},
  i/.style={code={\draw[pic actions] (0,-0.5) -- (0,0.1)coordinate(-mid); 
  \fill (0,0.25) circle[radius=0.05];}},
  j/.style={code={\draw[pic actions] (0,-0.6) arc[start angle=180,end angle=360,
  radius=0.1] -- (0.2,0.1)coordinate(-mid); 
  \fill (0.2,0.25) circle[radius=0.05];}},
  k/.style={code={\draw[pic actions] (0,-0.5) -- (0,0.4);
  \draw[pic actions](0.2,-0.5) -- (0,-0.05)coordinate(-mid) -- (0.2,0.4);}},
  l/.style={code={\draw[pic actions] (0,-0.5) -- coordinate[pos=0.5](-mid) (0,0.4);}},
  m/.style={code={\draw[pic actions] (0,-0.5) -- (0,0) coordinate(-mid);
   \draw[pic actions] (0,-0.2) arc[start angle=180,end angle=0,radius=0.2]
     -- (0.4,-0.5);
     \draw[pic actions] (0.4,-0.2) arc[start angle=180,end angle=0,radius=0.2] -- (0.8,-0.5);}},
  n/.style={code={\draw[pic actions] (0,-0.5) -- (0,0) coordinate(-mid);
   \draw[pic actions] (0,-0.2) arc[start angle=180,end angle=0,radius=0.2]
     -- (0.4,-0.5);}},
  o/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
  \path (0,0) coordinate(-mid);}},
  p/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
  \draw[pic actions] (0,0) coordinate(-mid) -- (0,-0.8);}},
  q/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
  \draw[pic actions] (0.4,0) coordinate(-mid) -- (0.4,-0.8);}},
  r/.style={code={\draw[pic actions] (0,-0.5) -- (0,0)coordinate(-mid);
  \draw (0,-0.1) arc[start angle=140,end angle=40,radius=0.2]; }},
  s/.style={code={\draw[pic actions] (0,-0.5) -- (0.2,-0.5)
  arc[start angle=-90,end angle=45,radius=0.125] 
  -- ++ (135:0.2) coordinate[pos=0.5](-mid)
  arc[start angle=225,end angle=90,radius=0.125] -- ++ (0.1,0) ;}},
  t/.style={code={\draw[pic actions] (0.2,-0.5) -- (0.2,0.3);
  \draw[pic actions] (0,0) -- (0.4,0) coordinate[pos=0.5](-mid);}},
  u/.style={code={\draw[pic actions] (0.4,-0.5) -- (0.4,0) coordinate(-mid);
   \draw[pic actions] (0,0) -- (0,-0.3) arc[start angle=180,end angle=360,radius=0.2];}},
  v/.style={code={\draw[pic actions] (0,0) coordinate(-mid) 
  -- (0.25,-0.5) -- (0.5,0); }},
  w/.style={code={\draw[pic actions] (0,0) coordinate(-mid) 
  -- (0.2,-0.5) -- (0.3,-0.3) -- (0.4,-0.5) -- (0.6,0);}},
  x/.style={code={\draw[pic actions] (0,0) coordinate(-mid) -- (0.4,-0.5);
  \draw[pic actions] (0,-0.5) -- (0.4,0); }},
  y/.style={code={\draw[pic actions] (0,0) coordinate(-mid)  -- (0.25,-0.5);
   \draw[pic actions] (0.5,0) -- (0.125,-0.75);}},
  z/.style={code={\draw[pic actions] (0,0) coordinate(-mid) -- (0.3,0) -- (0,-0.5) -- (0.3,-0.5);}},
}
\begin{document}
\begin{tikzpicture}
\begin{scope}[local bounding box=letters]
 \foreach \X [count=\Y] in {A,...,Z}
 {\draw[thick,blue] (0,-\Y-0.25) -- ++ (5,0) (0,-\Y+0.25) -- ++ (5,0);
  \path[thick] (0.5,-\Y) pic[scale=0.5](\X){\X} foreach \Z in {1,...,4}
  {(\Z+0.5,-\Y) pic[scale=0.5,dash pattern=on 1.5pt off 1.2pt]{\X}};
 \begin{pgfonlayer}{background}
  \draw[red,dashed] (0,-\Y|-\X-mid) -- ++ (5,0);
 \end{pgfonlayer}
  }
 \foreach \X [count=\Y] in {a,...,z}
 {\draw[thick,blue] (6,-\Y-0.25) -- ++ (5,0) (6,-\Y+0.25) -- ++ (5,0);
  \path[thick] (6.5,-\Y) pic[scale=0.5](\X){\X} foreach \Z in {1,...,4}
  {(\Z+6.5,-\Y) pic[scale=0.5,dash pattern=on 1.5pt off 1.2pt]{\X}};
 \begin{pgfonlayer}{background}
  \draw[red,dashed] (6,-\Y|-\X-mid) -- ++ (5,0);
 \end{pgfonlayer}
  }  
\end{scope}
\begin{pgfonlayer}{behind}
 \path[left color=cyan!10,right color=cyan!30] 
    (letters.south west) rectangle (letters.north east);
\end{pgfonlayer}
 \draw[line width=2mm,blue!30] ([xshift=-3mm,yshift=3mm]letters.north west) 
 -- ([xshift=-3mm,yshift=-3mm]letters.south west);
\end{tikzpicture}
\end{document}

enter image description here

enter image description here

It is fairly obvious that there is significant room for improvement in these characters. The aim was to create some pics which are recognizable as characters, not to design a fancy new font. In the bright side, apart from adding the ink-shaped arrow heads (which explains that the pics contain more \draw commands than what appears necessary), the letter paths can even be used for in decorations, and perhaps even more importantly subjected to nonlinear transformations, so one could project them on some 3d curved surface such as a sphere, cylinder and so on.

Here is a trivial example (with the above preamble)

\begin{tikzpicture}
\path pic[xslant=0.1,thick,line cap=round]{f};
\end{tikzpicture}

enter image description here

Original answer (in case the vertical position of the red line is wrong in the upper part): This does the uppercase letters since someone was kind enough to provide them. From these you learn how one can do lower-case ones.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{backgrounds}
% from https://tex.stackexchange.com/a/460842/121799
\tikzset{pics/.cd,
  A/.style={code={\draw[pic actions] 
  (0,-0.55) -- (0.3,0.4) -- (0.6,-0.55);
  \draw[pic actions](0.1,1/3-0.45) --
  (0.5,1/3-0.45);
  \path (0.7,0);}},
  B/.style={code={\draw[pic actions] (0,-0.45) -- (0,0.45)
  to[out=0,in=0,looseness=2.5]  (0,0)  to[out=0,in=0,looseness=3] cycle;}},
  C/.style={code={\draw[pic actions]
   (0,0) to[out=90,in=110,looseness=2]  (0.5,0.25);
   \draw[pic actions](0,0) to[out=-90,in=-110,looseness=2]  (0.5,-0.25);
   \path (0.7,0);}},
  D/.style={code={\draw[pic actions] (0,-0.45) -- (0,0.45) 
  to[out=0,in=0,looseness=2.25]   cycle;
  \path (0.7,0);}},
  E/.style={code={\draw[pic actions] 
  (0.5,-0.45) --(0,-0.45) -- (0,0.45)  -- (0.5,0.45);
  \draw[pic actions] (0,0) -- (0.5,0);
  \path (0.7,0);}},
  F/.style={code={\draw[pic actions] 
  (0,-0.45) -- (0,0.45)  -- (0.5,0.45);
  \draw[pic actions] (0,0) -- (0.5,0);
  \path (0.7,0);}},
  G/.style={code={\draw[pic actions]
   (0,0) to[out=90,in=110,looseness=2]  (0.5,0.25);
   \draw[pic actions] (0,0) to[out=-90,in=-110,looseness=2]  
   (0.5,-0.25);
   \draw[pic actions] (0.54,-0.25) to (0.3,-0.25);
   \path (0.7,0);}},
  H/.style={code={\draw[pic actions] 
  (0,-0.5) -- (0,0.5);  
  \draw[pic actions] (0.5,-0.5) -- (0.5,0.5);
  \draw[pic actions] (0,0) -- (0.5,0);
  \path (0.7,0);}},
  I/.style={code={\draw[pic actions] (0,-0.45) -- (0,0.45);
  \path (0.25,0);}},
  J/.style={code={\draw[pic actions] (0.2,0.45) -- (0.2,-0.35) to[out=-90,in=0]
  (0.1,-0.45) to[out=180,in=-90] (0,-0.35);
  \path (0.45,0);}},
  K/.style={code={\draw[pic actions] 
  (0,-0.45) -- (0,0.45); 
  \draw[pic actions] (0.4,0.45) -- (0.02,0) --  (0.4,-0.45);
  \path (0.6,0);}},
  L/.style={code={\draw[pic actions] 
  (0,0.5) -- (0,-0.45) -- (0.4,-0.45);
  \path (0.6,0);}},
  M/.style={code={\draw[pic actions] (0,-0.45) -- (0,0.45) -- 
  (0.3,0.25) -- (0.6,0.45) -- (0.6,-0.45);
  \path (0.8,0);}},
  N/.style={code={\draw[pic actions] (0,-0.45) -- (0,0.45) -- (0.6,-0.4) --
  (0.6,0.45);
  \path (0.8,0);}},
  O/.style={code={\draw[pic actions] (0.3,0) circle(0.3 and 0.48);
  \path (0.8,0);}},
  P/.style={code={\draw[pic actions] (0,-0.45) -- (0,0.45) 
  to[out=0,in=0,looseness=2.5]  (0,0);
  \path (0.6,0);}},
  Q/.style={code={\draw[pic actions] 
  (0.3,0) circle(0.3 and 0.48);
  \draw[pic actions](0.35,-0.25) -- (0.6,-0.45);
  \path (0.8,0);}},
  R/.style={code={\draw[pic actions] 
  (0,-0.45) -- (0,0.45) 
  to[out=0,in=0,looseness=2.5]  (0.05,0) -- (0.4,-0.45);
  \path (0.6,0);}},
  S/.style={code={\draw[pic actions] (0.5,0.4)  
  to[out=160,in=165,looseness=2]  (0.3,0)  
  to[out=-15,in=-20,looseness=2] (0.1,-0.4);
  \path (0.65,0);}},
  T/.style={code={\draw[pic actions] (0.35,-0.45) -- (0.35,0.45) (0,0.45) -- (0.7,0.45);
  \path (0.85,0);}},
  U/.style={code={\draw[pic actions] (0,0.5) -- (0,0) to[out=-90,in=-90,looseness=2.5]
  (0.6,0) -- (0.6,0.5);
  \path (0.8,0);}},
  V/.style={code={\draw[pic actions] (0,0.5) -- (0.3,-0.4) -- (0.6,0.5);
  \path (0.8,0);}},
  W/.style={code={\draw[pic actions] (0,0.45) -- (0.3,-0.4) -- (0.45,-0.1)
  -- (0.6,-0.4) -- (0.9,0.45);
  \path (1.1,0);}},
  X/.style={code={\draw[pic actions] 
  (0,0.45) -- (0.6,-0.45);
   \draw[pic actions] (0.6,0.45)
  -- (0,-0.45);
  \path (0.8,0);}},
  Y/.style={code={\draw[pic actions] 
  (0,0.45) -- (0.3,0);  
  \draw[pic actions] (0.6,0.45)
  -- (0,-0.45);
  \path (0.8,0);}},
  Z/.style={code={\draw[pic actions] (0,0.45) --(0.6,0.45) -- (0,-0.45)  
  -- (0.6,-0.45);
  \path (0.8,0);}},
  space/.style={code={\path (0,0) (0.2,0);}},
}
\begin{document}
\begin{tikzpicture}
\begin{scope}[local bounding box=letters]
 \foreach \X [count=\Y]in {A,...,Z}
 {\draw[thick,blue] (0,-\Y-0.25) -- ++ (5,0) (0,-\Y+0.25) -- ++ (5,0);
  \draw[red,dashed] (0,-\Y) -- ++ (5,0);
  \path[thick] (0.5,-\Y) pic[scale=0.5]{\X} foreach \Z in {1,...,4}
  {(\Z+0.5,-\Y) pic[scale=0.5,densely dashed]{\X}};}
\end{scope}
\begin{scope}[on background layer]
 \path[left color=cyan!10,right color=cyan!30] 
    (letters.south west) rectangle (letters.north east);
 \draw[line width=2mm,blue!30] ([xshift=-3mm,yshift=3mm]letters.north west) 
 -- ([xshift=-3mm,yshift=-3mm]letters.south west);
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

enter image description here

If you change scale=0.5 to a smaller value, the letters will become smaller, and so on.

Related Question