TikZ — Vector Maps in LaTeX: Scientific Papers, Theses, and Overleaf

2026-06-169 min read
TikZLaTeXvectoracademicOverleaf

TikZ is a vector graphics package for LaTeX, developed by Till Tantau at Lübeck University and first released in 2007. The name expands to "TikZ ist kein Zeichenprogramm" (TikZ is not a drawing program) — wordplay in the spirit of GNU's not Unix. It is not an editor and not a separate format: TikZ is a syntactic layer over PGF (Portable Graphics Format) for generating vector drawings from text commands inside a LaTeX document. A Nevsky Avenue map in TikZ is a file with \draw (0,0) -- (1,1); commands that compiles together with the article text and embeds into the PDF as part of the final publication. For scientific papers in IEEE, Springer, Elsevier, theses, and educational materials TikZ remains the gold standard: code looks like regular text, easy to version in git, opens in any editor.

Map generation of Vienna city center
Vienna inner city, 200×200 m fragment. The TikZ version of this map is about 800 \draw command lines, compiling to a fully vector PDF.

History: Till Tantau and the PGF evolution

In 2002 German mathematician and computer scientist Till Tantau began developing PGF (Portable Graphics Format) — a low-level library for generating graphics in LaTeX. The main goal — portability: the same code should work with LaTeX backends pdflatex, latex+dvips, latex+dvipdfm, xelatex, lualatex. Before PGF each of these compilers required different syntax (PostScript inserts for dvips, PDF literals for pdflatex). PGF unified the API through the back-end driver concept.

In 2007 Tantau released TikZ — a high-level user syntax on top of PGF. If PGF is something like graphics assembly, TikZ is a high-level language: the \draw command with many options, coordinate systems (cartesian, polar, label-based), line styles, fills, shadows. The ability emerged to write readable code for plots, diagrams, schemas, maps without knowing low-level internals of PostScript or PDF.

Between 2007 and 2024 TikZ evolved through 24 minor releases, current version 3.1.10 (January 2025). The community developed hundreds of extensions (TikZ libraries): tikz-3dplot for 3D graphics, tikz-cd for commutative diagrams in category theory, pgfplots for scientific plots with axes, tikz-network for network diagrams, tikz-qtree for trees. For maps particularly useful: tikz-cd-tools, tkz-euclide (geometric constructions), pgfplotstable (CSV data import).

The main hub for the TikZ community is texample.net, a collection of thousands of examples with sources. The canonical book — "The TikZ and PGF Packages: Manual for Version 3.x" by Tantau, more than 1300 pages of official documentation. The CTAN repository is the main distribution channel. License — LaTeX Project Public License (LPPL), free for any use.

What's inside TikZ code

TikZ is plain text, usually embedded in a LaTeX document via the \begin{tikzpicture}...\end{tikzpicture} environment. A minimal quarter map:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[scale=0.5]
  % Buildings
  \fill[gray!30] (0,0) rectangle (2,1);
  \fill[gray!30] (3,0) rectangle (4,2);
  % Road
  \draw[ultra thick, yellow] (-1,1.5) -- (5,1.5);
  % Park
  \fill[green!40] (1,3) circle (1);
  % Label
  \node at (2,3) {\small Gorky Park};
\end{tikzpicture}
\end{document}

Structure. \begin{tikzpicture}[scale=0.5] opens a local graphics context with overall scaling. \fill draws a filled figure with color gray!30 (30% gray), \draw — outlined. Coordinates are regular numbers in current units (by default cm). The -- command draws a straight line, to[bend left] a curve, circle a circle, rectangle a rectangle. Text is added via \node, supporting any LaTeX formatting commands inside.

The coordinate system is flexible. Cartesian — (1, 2) — 1 cm right, 2 cm up. Polar — (60:3) — 3 cm at 60° angle. Named — \coordinate (A) at (0,0); then \draw (A) -- (B);. Calc syntax from the \usetikzlibrary{calc} library — ($ (A) + (1,0) $) — coordinate arithmetic. This is especially valuable for generated maps: each road is parameterized via coordinates, easily reused.

Styles are set via [] options in any command or via \tikzset{...}. E.g. \tikzset{road/.style={ultra thick, blue, line cap=round}}, then in the code \draw[road] (A) -- (B);. This is an analog of CSS classes for graphics — improves readability and makes style changes a single edit.

TikZ pipeline: osm2cdr to .tex to pdflatex to PDF

Who needs TikZ: five roles

Research scientist. A university professor or researcher writes an article for Computers & Geosciences or Transportation Research. The journal requires TikZ or EPS vector graphics, not raster (a typical requirement of academic publishers). A Moscow district map exported as TikZ from osm2cdr is included in the article's .tex via \input{moscow-map.tex} and compiles with all text — no separate PNG files, no pre-press color profile problems.

PhD candidate. A 300+ page thesis with dozens of maps. TikZ sources in a git repository, every scale or color change is one line of code. Five years later when the thesis becomes a monograph, the sources open in any editor and compile again — no proprietary programs.

Conference speaker. A Beamer (LaTeX framework for slides) presentation with embedded TikZ maps. Slides and maps in one .tex file, all in one PDF, no external artifacts. On a projector vector graphics look crisp at any resolution.

Teacher. An urban studies or geography textbook: a city center map fragment as illustration. TikZ allows adding overlay — arrows, district highlights, public transport schemas — directly in code, without opening a graphic editor.

Open access journal publisher. For Open Journal Systems-based journals with typical "upload .tex and .pdf" workflow, TikZ maps are preferable to JPEG: smaller size, higher quality, easier pre-print edits.

Software for TikZ: five programs

Overleaf. Free for basic use, $15/month for Pro. Cloud LaTeX editor in the browser, no local installation. TikZ compiles automatically on every save, preview updates in real time. Collaboration on a document — multiple authors simultaneously. overleaf.com

TeXstudio. Free, GPL. Windows/macOS/Linux. A full LaTeX IDE with TikZ syntax highlighting, code completion, compilation error inspector. The most popular desktop LaTeX editor. texstudio.org

VS Code with LaTeX Workshop. Free. The LaTeX Workshop extension for VS Code (over 2 million installs) turns a universal editor into a full LaTeX + TikZ IDE. Convenient for those already working in VS Code. marketplace.visualstudio.com

LyX. Free. A visual LaTeX editor: write in WYSIWYG mode, LyX generates LaTeX code under the hood. TikZ inserts are added via special insert blocks. Suitable for those who don't like writing markup by hand. lyx.org

MiKTeX. Free. Not an editor but a LaTeX distribution for Windows. Includes pdflatex, xelatex, lualatex compilers plus the TikZ package. Used together with TeXstudio or VS Code. For macOS the analog is MacTeX, for Linux — TeX Live. miktex.org

Map generation of London city center
London City, 200×200 m. This map in TikZ source occupies about 50 KB — text fully editable in any IDE.

Pitfalls and tips

Compilation time. A large district map in TikZ is tens of thousands of \draw commands. pdflatex can spend 30–120 seconds compiling such a document. Solutions: use \tikzset{external/optimize=true} to cache individual tikzpictures to .pdf files (compiled once, reused), or split the map into layers via TikZ overlays.

pgfplots dependency. If the map uses numeric axes (e.g. a lat/lon coordinate grid with labels), the additional pgfplots package is needed. It is heavy — increases compilation time and dependency size. For simple maps without axes basic TikZ suffices.

CMU vs Times fonts. LaTeX by default uses Computer Modern Roman (CMU) — Donald Knuth's fonts. IEEE journals require Times or Arial. Add \usepackage{newtxtext, newtxmath} for Times or \usepackage{helvet} for Helvetica. Fonts in TikZ labels automatically inherit from document settings.

Coordinate space. TikZ by default works in centimeters, range ±32767 cm (about 1 km each direction). For very large maps exceeding this limit will overflow. Solution: scale everything into [0, 30] cm coordinate space before export, preserving aspect ratio.

pdflatex vs xelatex vs lualatex compatibility. Basic TikZ works in all three compilers. xelatex — best choice for documents with non-Latin scripts (Cyrillic, Chinese). lualatex — best for performance on large maps (multithreading support). pdflatex — the default standard, suits most cases.

Layer Z-order. TikZ draws commands in order of appearance: what comes later renders on top. For a map this means: first water, then green, then buildings, then roads, then labels. If the order is broken, roads will obscure buildings.

Source size. TikZ code for a full Moscow map can grow to a 50 MB text file. It compiles, but slowly. For production documents simplifying geometry is recommended: reduce polyline point counts, merge nearby buildings, remove details under 1 mm.

How to get a TikZ map via osm2cdr.ru

osm2cdr.ru supports direct TikZ export. Step 1: open osm2cdr.ru, choose TikZ format. Step 2: draw the needed area. For an article or presentation 200–500 m fits; for an atlas 1–3 km. Step 3: set detail level — for a scientific article 3–4 out of 6 is recommended (balance of detail/compile time). Step 4: run export, download the .tex or .tikz file. Step 5: include in your LaTeX document:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\input{moscow-map.tex}
\end{document}

Step 6: compile: pdflatex document.tex. After 30–60 seconds get a PDF with the embedded vector map.

For Overleaf: upload your document's .tex file and moscow-map.tex as assets, then the \input command will work automatically. Compile button → finished PDF in the browser.

Sources

← All articles