Samuel Ireson

Learning TikZ - Episode 4

Wed Mar 06 2024
3 min read

We'll walk through how I made a figure to visualise the local normal form in TikZ

Contents

Introduction

TikZ is a LaTeX library which allows you to draw diagrams, figures, graphs, and anything else which you can think up. It’s my go-to for drawing complex diagrams because of it’s reliance on declarative nature. Also, the implementation of the commands is very neat, and natural.

Setup

The minimal setup for creating a TikZ figure is as follows,

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
    % TikZ goes here.
\end{document}

which will output a .pdf file, with minimal dimensions. You can include the graphics generated in a master file with the \includegraphics{} command.

Figure

It is a fact that any holomorphic map between two Riemann surfaces can be expressed locally in the form z↦znz \mapsto z^n. This is fairly fundamental to the theory of Riemann surfaces, and there are many opportunities for good diagrams here. We won’t use many different techniques than in the previous episodes, so check them out first.

We will be considering the map z↦z3z \mapsto z^3, although we really want to be able to set the diagram up in a way that will allow us to change this value with ease. To begin with, we define the end state of the map with,

\draw[rounded corners] (-3,-3) to (3,-3) to (3,3) to (-3,3) node[above left]{$ \mathbb{C} $} to cycle;
\filldraw[dashed, fill=gray!50, fill opacity=0.5] (0,0) circle (0.6);
\filldraw[dashed, fill=gray!50, fill opacity=0.5] (2,0) circle (0.6);
\fill (0,0) circle (0.05) node[below] {$ 0 $};
\fill (2,0) circle (0.05) node[below] {$ \omega $};
\draw[dotted] (0,0) to (2,0);

Rounded space

You may note that all of the values of this section are fairly hard coded, and the dynamicism of this figure will come in the next section. To start this, let’s draw a similar space for the domain of the map, and define an origin.

\begin{scope}[xshift=-8cm]
	\draw[rounded corners] (-3,-3) to (3,-3) to (3,3) to (-3,3) node[above left]{$ \mathbb{C} $} to cycle;
	\fill (0,0) circle (0.05) node[below] {$ 0 $};
\end{scope}

Space with highlighted areas in codomain

If we define the value of nn in z↦znz \mapsto z^n, before starting the tikzpicture environment, as follows,

\def\n{3}

then we can draw the points of interest in the domain with,

\foreach \j in {1,2,...,\n}{
		\fill ({\j*(360/\n)}:2) circle (0.05) node[below]{$ z _{\j} $};
	}

Important points in the domain

We can also easily modify this for loop to draw additional lines between the origin and these points, along with open neighbourhoods surround them.

\foreach \j in {1,2,...,\n}{
		\filldraw[dashed, fill=gray!50, fill opacity=0.5] ({\j*(360/\n)}:2) circle (0.6);
		\draw[dotted] (0,0) to ({\j*(360/\n)}:2);
		\fill ({\j*(360/\n)}:2) circle (0.05) node[below]{$ z _{\j} $};
	}

Open sets and labels around the important points.

All that remains for the finished figure, is to add an arrow between the domain and the codomain, which is most easily achieved by adding some nodes, one outside of the scope environment,

\node (b) at (0,3){};

and one inside,

\node (t) at (0,-3){};

with an arrow between them

\draw[->] (t) to node[left]{$ z \mapsto z^{\n} $} (b);

Arrow between spaces

So maybe you’re wondering why we bothered introducing the variable \n in the first place. This is for two reason. Firstly, there are so many occasions where hard coded values will make changing diagrams a real pain. Putting yourself in a position where you’re forced to manually change a number of values corresponding to the same measure is masochistic. Secondly, we’ve not made one diagram, we’ve made a diagram which can be altered and personalised if we need it again. For example, if we wanted to give an example of the case where z↦z6z \mapsto z^6, all we need to change is the value of \n,

\def\n{6}

A change to the variable

Conclusion

Another good diagram completed. We’ll make use of easy diagram alterations more going forwards, and maybe explore some of the helpful TikZ libraries there are available.

Related posts