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.
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.
To fill the area between two curves with random points, you can plot the average of the two functions and jitter the markers using random noise with a range that's equal to the distance between the curves.
To demonstrate, here's what the plot for the random dots looks like without the noise component:
In this case, the distance between the two curves is constant, so the noise can be generated using a uniform distribution centered halfway between the curves with a range equal to the offset between the curves:
To get a denser pattern, simply increase the number of samples:
The same approach works for more complicated functions:
However, things get more complicated when you have two curves that aren't a constant distant apart: In that case, the density of the random dots will not be constant throughout the domain:
To achieve a constant density, you'll need to adjust the horizontal distribution of the random points. So instead of the points being a noisy function of x
, we'll use a parametric equation ( x(t), 0.5*a(x(t)) + 0.5*b(x(t)) + U(a(x(t)), b(x(t)))
.
The horizontal distance between two adjacent points has to be inversely proportional to the distance between the two bounding curves (since you need more points to fill a wider band).
To find the horizontal positions for the points that fulfill that requirements, you can use the antiderivative of the inverse of the difference of the two bounding curves.
In this case, for example, you would need the antiderivative of f(x) = 1/(a(x)-b(x)) = 1 / (2*(x/4)^2+1)
. I think I should be able to do this by hand, but I cheated and used Wolfram Alpha. The required function is F(x) = 2 sqrt(2) (atan(x/(2 sqrt(2))))
. In order to stretch this function over the plot domain, you can normalize it using the factor x_max/F(x_max)
. The function for the horizontal positions of the points is thus
F*(t) = 2 sqrt(2) (atan(t/(2*sqrt(2)))) * 5 / 2.99
Using this to plot the random dots without the noise component, we get:
Adding the noise:
Code for the two parallel lines:
\documentclass[tikz, border=5mm]{standalone}
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}[
declare function={a(\x)=0.75*\x-2;},
declare function={b(\x)=0.75*\x-1;}
]
\begin{axis}[
domain=0:5,
axis lines=middle,
axis equal image,
xtick=\empty, ytick=\empty,
enlargelimits=true,
clip mode=individual, clip=false
]
\addplot [red, only marks, mark=*, samples=300, mark size=0.75]
{0.5*(a(x)+b(x)) + 0.5*rand*(a(x)-b(x))};
\addplot [thick] {a(x)};
\addplot [thick] {b(x)};
\end{axis}
\end{tikzpicture}
\end{document}
Code for the parabolas:
\documentclass[tikz, border=5mm]{standalone}
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}[
declare function={a(\x)=-(0.5*\x-1.5)^2+1;},
declare function={b(\x)=-(0.5*\x-1.5)^2;},
]
\begin{axis}[
domain=1:5,
axis lines=middle,
axis equal image,
xtick=\empty, ytick=\empty,
enlargelimits=true,
clip mode=individual, clip=false
]
\addplot [red, only marks, mark=*, samples=300, mark size=0.75]
{0.5*(a(x)+b(x)) + 0.5*rand*(a(x)-b(x))};
\addplot [thick] {a(x)};
\addplot [thick] {b(x)};
\end{axis}
\end{tikzpicture}
\end{document}
Code for the funnel:
\documentclass[tikz, border=5mm]{standalone}
\usepackage{pgfplots}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}[
declare function={a(\x)=(\x/4)^2;},
declare function={b(\x)=-(\x/4)^2-1;},
declare function={f(\x) = 2*sqrt(2)*rad(atan(\x/(2*sqrt(2))))*5/2.99;}
]
\begin{axis}[
domain=0:5, xmin=0,
axis lines=middle,
axis equal image,
xtick=\empty, ytick=\empty,
enlargelimits=true,
clip mode=individual, clip=false
]
\addplot [red, only marks, mark=*, samples=500, mark size=0.75]
(f(x), {0.5*(a(x)+b(x)) + rand * ( a(f(x)) - b(f(x))) / 2});
\addplot [thick] {a(x)};
\addplot [thick] {b(x)};
\end{axis}
\end{tikzpicture}
\end{document}
Original answer:
You can use a plot
to draw random dots that lie inside the band:
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\draw [-latex, thick] (0, 0) -- (0, 6) node [above] {\Large{$e$}};
\draw [-latex, thick] (0, 3) -- (6, 3) node [right] {\Large{$\widehat{Y}$}};
\draw [thick] (0, 0.5) -- (5, 4);
\draw [thick] (0, 1.75) -- (5, 5.25);
\draw plot [only marks, mark=*, mark size=0.5, domain=0:5, samples=700] (\x,{rnd*1.25+3.5/5*\x+0.5});
\end{tikzpicture}
\end{document}
For UTF-8 encoding:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc} % for UTF8 codepage in Windows
\usepackage[russian]{babel} % need for russian hyphenation and some typographic rules
\begin{document}
\[
\textrm{текст на русском}
\]
\end{document}
For 1 byte codepage in Windows:
\documentclass[12pt,a4paper]{article}
\usepackage[cp1251]{inputenc} % for 1-byte russian codepage in Windows
\usepackage[russian]{babel} % need for russian hyphenation and some typographic rules
\begin{document}
\[
\textrm{текст на русском}
\]
\end{document}
With obsolete package mathtext
it is possible write in russian in math mode without any additional commands:
\documentclass[12pt,a4paper]{article}
\usepackage{mathtext} % must be before codepage and localization
\usepackage[cp1251]{inputenc} % for 1-byte russian codepage in Windows
\usepackage[russian]{babel} % need for russian hyphenation and some typographic rules
\begin{document}
\[
\alpha,\,\beta\quad текст\ на\ русском
\]
\end{document}
And russian letters by command in latin:
\documentclass[12pt,a4paper]{article}
\usepackage[OT1,T2A]{fontenc}
\begin{document}
\[
\textrm{\cyrb\CYRB\cyrshch\cyryu\cyryo\cyrery\cyrie\cyry\cyrm\cyrya\cyrishrt\CYRISHRT}
\]
\end{document}
You can find full list of commands for russian (and other сyrillic) letters in this document: The Cyrillic font encodings: T2A, T2B, T2C,and X2.
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 theA
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 picA
,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.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)
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.
If you change
scale=0.5
to a smaller value, the letters will become smaller, and so on.