Making drawings with text

The traditional approach of making a drawing goes back to when we discovered we could use our hands to draw. A direct link from our brain to a canvas through a rock, pen, finger or what ever can make drawing.

This is an analog approach since no drawing will be the same when we attempt to reproduce it again using the same method to create it.

There is however a way to perform an exact copy of the drawing and the drawing generation procedure. It requires the combination of programming and the notion of vector drawing. Basically we use math to describe nodes, lines, surfaces and what not.

Latex and Tikz example figure

Latex and the Tikz package help out in this task.

A good online Latex compiler can be found here:

So what’s this all supposed be? Latex, Tikz, compile, text.

Latex is a sort of compiler, it reads text that are commands, normal text, … and generates a document in pdf. Tikz is a package add-on that connected to Latex allows it to understand drawing like commands.

Code to paste to the online compiler is from

% 3D Cone
% Author: Gene Ressler. Adapted to TikZ by Kjell Magne Fauske.
% See for more details.
% The following code is generated by Sketch. I have edited it a bit
% to make it easier to read.
\tikzstyle{conefill} = [fill=blue!20,fill opacity=0.8]
\tikzstyle{ann} = [fill=white,font=\footnotesize,inner sep=1pt]
\tikzstyle{ghostfill} = [fill=white]
\tikzstyle{ghostdraw} = [draw=black!50]
\draw[arrows=->,line width=.4pt](.274,-.5)--(0,0)--(0,2.86);
\draw[arrows=-,line width=.4pt](0,0)--(-1.369,-.1);
\draw[arrows=->,line width=.4pt](-1.369,-.1)--(-2.1,-.153);
\draw[arrows=<-,line width=.4pt](.42,-.767)--(.274,-.5);
\node[ann] at (-.456,2.307) {$r_0$};
\node[ann] at (-.685,2.637) {$r_1$};
\node[ann] at (1.643,.987) {$h$};
\path (.42,-.767) node[below] {$x$}
(0,2.86) node[above] {$y$}
(-2.1,-.153) node[left] {$z$};
% Second version of the cone
\filldraw[fill=red,fill opacity=0.5](-.516,1.45)--(-.775,-.424)--(.274,-.5)
\fill(-.775,-.424) circle (2pt);
\fill(.274,-.5) circle (2pt);
\fill(-.516,1.45) circle (2pt);
\fill(.183,1.4) circle (2pt);
(.913,1.8) node[right] {$i\hbox{$=$}0$}
(1.369,.1) node[right] {$i\hbox{$=$}1$};
(-.645,.513) node[left] {$j$}
(.228,.45) node[right] {$j\hbox{$+$}1$};
\draw (-.209,.482)+(-60:.25) [yscale=1.3,->] arc(-60:240:.25);
(-.516,1.45) node [above] {$P_{00}$}
(-.775,-.424) node [below] {$P_{10}$}
(.183,1.4) node [above] {$P_{01}$}
(.274,-.5) node [below] {$P_{11}$};

I used this code since it was available online to show that you can search the web find the image you desire and get the code, from there you can generate a pdf or even export to svg. You can even pick the code and adapt it to your needs.

Now you can start making your own images with just a note pad! So let’s star drawing… To start go here to find more examples:

To make the svg file import the generated pdf to Inkscape.