This post contains some notes I don’t want to forget when using TikZ. I will keep updating its contents as time goes by.

- In English
- TikZ @ LaTeX Wikibook – Useful basic TikZ guide.
- VisualTikZ.
- TikZ and PGF Resources and Examples.
- TikZiT – a simple GUI editor that helps drawing with TikZ.

- Graphics in LaTeX using TikZ, by Zofia Walczak, published in TUGboat 29:1, 2008.
- tkz-euclide manual.
- A TikZ tutorial: Generating graphics in the spirit of TeX, by Andrew Mertz and William Slough, published in TUGboat 30:2, 2009, see also the video recording of their talk at TUG 2009 on Youtube.
- Graph Theory in LaTeX.
- tkz-graph – Draw graph-theory graphs.

- In Vietnamese

```
...
\begin{tikzpicture}[scale=0.5, every node/.style={transform shape}]
% draw your picture here
\end{tikzpicture}
...
```

Simply use `[anchor=base, baseline]`

option, for example,

```
...
\usetikzlibrary{shapes}
...
A rectangle looks like \tikz [anchor=base, baseline, inner sep=0] \node[draw, rectangle, minimum height=2mm] {};
...
```

More details can be found here.

More details can be found here.

```
...
\tikzset{
rec1/.pic={
% draw your rec1 picture here
},
rec2/.pic={
% draw your rec2 picture here
}
% and so on
}
...
% now we can reuse pictures
\begin{tikzpicture}
\pic[color=red]{rec1};
\end{tikzpicture}
...
```

I got it from here. Just put here to remember how to draw a tree with TikZ. More examples can be found here.

```
% A simple Tree
% Author: Stefan Kottwitz
% https://www.packtpub.com/hardware-and-creative/latex-cookbook
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[sibling distance=10em,
every node/.style = {shape=rectangle, rounded corners,
draw, align=center,
top color=white, bottom color=blue!20}]]
\node {Formulas}
child { node {single-line} }
child { node {multi-line}
child { node {aligned at}
child { node {relation sign} }
child { node {several places} }
child { node {center} } }
child { node {first left,\\centered,\\last right} } };
\end{tikzpicture}
\end{document}
```

Simply specify that the node is a `text`

node, like

```
...
node[text width=1cm,align=center] {0,1,2\\3,4,5};
...
```

An example taken from here.

```
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix [matrix of nodes,row sep=-\pgflinewidth,column 2/.style={nodes={rectangle,draw,minimum width=3em}}]
{
0 & 6 \\ 1 & 3 \\ };
\end{tikzpicture}
\end{document}
```

Back to top

Powered by Jekyll

The content on this site is shared under a CC BY-SA 4.0 license, unless otherwise noted Last Modified: November 20, 2020

Powered by Jekyll

The content on this site is shared under a CC BY-SA 4.0 license, unless otherwise noted Last Modified: November 20, 2020