0% found this document useful (0 votes)
49 views44 pages

Tikz Coordinates 2019

The document discusses TikZ coordinates and graphics. It begins with an introduction to TikZ picture boxes and how to control their size and location. It then covers the basics of Cartesian coordinates and how to draw dots, circles, and lines between coordinates. It also introduces options for shifting, scaling, and rotating drawings. The document provides examples demonstrating these core TikZ concepts.

Uploaded by

salnasu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views44 pages

Tikz Coordinates 2019

The document discusses TikZ coordinates and graphics. It begins with an introduction to TikZ picture boxes and how to control their size and location. It then covers the basics of Cartesian coordinates and how to draw dots, circles, and lines between coordinates. It also introduces options for shifting, scaling, and rotating drawings. The document provides examples demonstrating these core TikZ concepts.

Uploaded by

salnasu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

TikZ coordinates: memoir

In-Sung Cho

TeX Study Group 2019


2019/11/16

공주대학교 문서작성워크숍 2019

한국텍학회 · 한국텍사용자그룹 (http://ktug.org)


Table of Contents

1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 tikz picture box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 picture box sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 box sizes: scale, xscale, and yscale . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 Coordinates: Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1 Cartesian coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 dots and circles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 xshift, yshift, and shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4 polar coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3 Relative coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.1 relative coordinates: current point and + and ++ . . . . . . . . . . . . . . . . . . . 14
3.2 turn: rotational relative coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4 Basic Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.1 lines and polygons: -- and cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2 lines: |- and -| . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.3 rectangles and grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.4 curves: controls and to . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.5 curves: plot coordinates: smooth and tension . . . . . . . . . . . . . . . . . . 21
5 Opacity and Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.1 filling and opacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.2 background layer: backgrounds library . . . . . . . . . . . . . . . . . . . . . . . . 24
5.3 more layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
ii
6 Coordinates Calculations: calc library . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.1 coordinate calculation: basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.2 projection to the axes: |- and -| . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
7 Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
7.1 nodes: basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
7.2 nodes: coloring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
7.3 node dots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
7.4 nodes: positioning texts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
7.5 nodes: scaling and rotating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
7.6 node coordinate system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
8 Built-in Absolute Nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
8.1 current bounding box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
8.2 current page box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
8.3 remember picture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
8.4 More Page Decorating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

iii
1 Introduction

1
Graphic basics:

imaginary pen
current point

path
stroke (or draw)
fill

2
Where to put pictures (with tikz)?

location and size

tex box – size


coordinates – location

move

3
tikz picture box
\tikz{<tikz codes>}
or
\begin{tikzpicture}
<tikz codes>
\end{tikzpicture}

tikz coordinates
absolute coordinates
relative coordinates

4
1.1 tikz picture box

%%\usepackage{tikz}
%%\begin{document}
% tikz picture box
\begin{tikzpicture}
<tikz codes>
\end{tikzpicture}

This is a tikz picture box.

This\begin{tikzpicture}
\draw (2,2) rectangle (5,5); % not from (0,0)
\end{tikzpicture}is a tikz picture box.

5
1.2 picture box sizes

% default What is this?


What is this?\par
It\begin{tikzpicture}
\draw (0,0) rectangle (1,1);
\draw (1,1) -- (2,2);
\end{tikzpicture}is a box. It is a box.

% [us as bounding box], \useasboundingbox


What is this?\par What is this?
It\begin{tikzpicture}
\draw [use as bounding box] (0,0) rectangle (1,1);
\draw (1,1) -- (2,2); It is a box.
\end{tikzpicture}is a box.

% [overlay]
What is this?\par
It\begin{tikzpicture}[overlay] What is this?
\draw [use as bounding box] (0,0) rectangle (1,1); Itis a box.
\draw (1,1) -- (2,2);
\end{tikzpicture}is a box.

See also trim left=1cm and trim right=1cm options.


6
1.3 box sizes: scale, xscale, and yscale

\begin{tikzpicture}
\draw (0,0) rectangle (1,1);
\draw (1,1) -- (2,2);
\end{tikzpicture}

\begin{tikzpicture}[scale=1.5] % scale
\draw (0,0) rectangle (1,1);
\draw [overlay] (1,1) -- (2,2); % overlay
\end{tikzpicture}

\begin{tikzpicture}[xscale=1.5] % xscale
\draw (0,0) rectangle (1,1);
\draw (1,1) -- (2,2);
\end{tikzpicture}

% xscale, yscale
\begin{tikzpicture}[xscale=1.5,yscale=.5]
\draw (0,0) rectangle (1,1);
\draw (1,1) -- (2,2);
\end{tikzpicture}

7
2 Coordinates: Basics

8
2.1 Cartesian coordinates
canvas coordinate system: (<x>,<y>)
example: (3,2), (3cm,20pt)

\begin{tikzpicture}
\draw[help lines] (0,0) grid (4,3);
\coordinate (A) at (0,0);
\coordinate (B) at (3,2);
\draw (A) -- (B);
\end{tikzpicture}

\begin{tikzpicture}[show background grid]


\draw (-1+2,0) coordinate (A)
(3cm+10pt,2cm-1mm) coordinate (B)
(2*3-6,2^3-10/2) coordinate (C);
\draw (A) -- (B);
\draw (C) -- (.2\paperwidth+1cm,0);
\end{tikzpicture}

9
2.2 dots and circles
\draw [<opt>] (<coor>) circle (<radius dim>);
\draw [fill,<opt>] (<coor>) circle (<radius dim>);
\draw [fill=<color>,<opt>] (<coor>) circle (<radius dim>);
% draw: line, fill: interior

\begin{tikzpicture}[show background grid]


\draw [help lines] (0,0) grid (3,2);
\draw (1,1) circle (1cm);
\draw (1,1) circle (8pt);
\draw (1,1) circle (2pt);
\end{tikzpicture}

% dot = (small filled) circle


\begin{tikzpicture}[show background grid]
\draw [blue] (1,1) circle (1cm);
\draw (1,1) circle (8pt);
\draw [fill] (1,1) circle (2pt);
\draw [fill=red] (3,0) circle (5pt); % black
\draw [fill,red] (4,0) circle (5pt); % draw=red
\filldraw [red] (4,1) circle (5pt);
\end{tikzpicture}

10
2.3 xshift, yshift, and shift

\begin{tikzpicture}[show background grid]


\draw (1,1) -- (3,2);
\draw [xshift=-1cm,dashed] (1,1) -- (3,2);
\draw [yshift=-1cm,dotted] (1,1) -- (3,2);
\end{tikzpicture}

\begin{tikzpicture}[show background grid]


\draw (1,1) -- (3,2);
\draw [dashed] ([xshift=1cm]1,1) -- (3,2);
\draw [dotted] ([xshift=-1cm]1,1) --
([yshift=-2cm]3,2);
\end{tikzpicture}

[shift={(<coor>)}]

\begin{tikzpicture}[show background grid]


\draw (1,1) -- (3,2);
\draw [dashed,shift={(1,-1)}] (1,1) -- (3,2);
\draw [dotted] ([shift={(-1,1)}]1,1) --
([yshift=1cm]3,2);
\end{tikzpicture}

11
2.4 polar coordinates
canvas polar coordinate system: (<angle>:<radius>)
canvas polar coordinate system: (<angle>:<x radius> and <y radius>)

\begin{tikzpicture}[show background grid]


\draw[help lines,use as bounding box](0,0)grid(4,3);
\draw (60:2) circle (2pt);
\draw [fill] (1,3) circle (1pt);
\draw [red] (1,3) -- (15:3);
\draw [dotted] (0,0) circle (2cm);
\end{tikzpicture}

\begin{tikzpicture}[show background grid]


\useasboundingbox (0,0) rectangle (4,3);
\draw [green,thick] (0,0) -- (2,1.732);
\draw [fill] (0,0)--(60:2cm and 1cm)circle(1pt);
\draw [green] (0,0) ellipse (2cm and 1cm);
\draw (60:2) circle (2pt);
\draw [dotted] (0,0) circle (2cm);
\end{tikzpicture}

12
3 Relative coordinates

13
3.1 relative coordinates: current point and + and ++

\begin{tikzpicture}
\draw [help lines] (0,0) grid (4,3);
\filldraw [red] (1,1) circle (2pt);
\draw [->] (1,1) (0,1) -- +(1,1) -- (1,1);
\filldraw (0,1) circle (2pt); % liftpen, moveto,
lineto
\end{tikzpicture}

\begin{tikzpicture}
\draw [help lines] (0,0) grid (4,3);
\filldraw [red] (1,1) circle (2pt);
\draw [->] (1,1) +(0,1) -- +(1,1) -- (1,1);
\end{tikzpicture}

\begin{tikzpicture}
\draw [help lines] (0,0) grid (4,3);
\filldraw [red] (1,1) circle (2pt);
\draw [->] (1,1) ++(0,1) -- +(1,1) -- (1,1);
\filldraw (1,2) circle (2pt);
\end{tikzpicture}

14
3.2 turn: rotational relative coordinates

\begin{tikzpicture}[show background grid]


\draw [dotted,gray] (2,0) arc (0:90:2);
\draw (0,0) -- (1,0) -- (60:2cm) -- +(1,.5);
\draw [ultra thick,red,opacity=.5]
(0,0) -- (1,0) -- ([turn]60:2cm) -- +(1,.5);
\end{tikzpicture}

15
4 Basic Graphics

16
4.1 lines and polygons: -- and cycle
\draw [<opt>] (coor1) -- (coor2);
\draw [<opt>] (coor1) -- (coor2) -- (coord3);
\draw [<opt>] (coor1) -- (coor2) -- (coord3) -- cycle;

% lines
\begin{tikzpicture}
\draw [help lines,dotted] (0,0) grid (4,3);
\draw (0,0) -- (2,0);
\draw [blue] (0,.5) -- (3,.5);
\draw [thick] (0,1) -- (4,1);
\draw [line width=2pt,red] (1,3) -- (4,0);
\end{tikzpicture}

% polygons: cycle
\begin{tikzpicture}
\draw [help lines,dotted] (0,0) grid (4,3);
\draw [red] (4,1) -- (1,3) -- (0,0) -- (4,2);
\draw [very thick,blue]
(2,0)--(0,2)--(3,3)--(2,0);
\draw [very thick]
(3,0)--(1,2)--(4,3)--cycle;
\end{tikzpicture}

17
4.2 lines: |- and -|
\draw [<opt>] (coor1) |- (coor2);
\draw [<opt>] (coor1) -| (coor2);

\begin{tikzpicture}
\draw [help lines,dotted] (0,0) grid (4,4);
\draw [->] (0,3) |- (3,1);
\draw [->,red] (1,2) -| (4,0);
\draw [->,blue]
(0,0)--(1,.5) -| (2.5,4) -| (4,3)--(2,2.5);
\end{tikzpicture}

18
4.3 rectangles and grid
\draw [<opt>] (coor1) rectange (coor2);
\draw [<opt>] (coor1) grid (coor2);
\draw [help lines] (coor1) grid (coor2);

\begin{tikzpicture}
\draw [help lines] (0,0) grid (4,3);
\draw [very thick] (0,0) rectangle (2,3);
\draw [very thick] (1,1) rectangle (4,2);
\end{tikzpicture}

\begin{tikzpicture}
\draw [step=.5cm,very thin] (0,0) grid (4,2);
\draw (0,0) grid (4,2);
\end{tikzpicture}

\begin{tikzpicture}
\draw [step=1mm,red,ultra thin] (0,0) grid (4,2);
\draw [step=.5cm] (0,0) grid (4,2);
\draw [thick] (0,0) grid (4,2);
\end{tikzpicture}

19
4.4 curves: controls and to

% .. controls (coor) and (coor) ..


\begin{tikzpicture}[show background grid]
\draw (0,0) -- (3,0);
\draw [dotted] (0,0) .. controls (1.5,1) .. (3,0);
\draw [dashed] (0,0) .. controls (1.5,2) .. (3,0);
\draw (0,0) .. controls (1,3) and (3,1) .. (4,3);
\end{tikzpicture}

% to [bend left= ,bend right= ]


\begin{tikzpicture}[show background grid]
\draw (0,2) to [bend right] (4,0);
\draw [blue] (0,0) to [bend left=45] (4,2);
\end{tikzpicture}

% to [out= ,in=]
\begin{tikzpicture}[show background grid]
\draw (0,0) to [out=90, in=180] (3,2);
\draw [blue] (1,2) to [out=-135,in=45 ] (4,0);
\end{tikzpicture}

20
4.5 curves: plot coordinates: smooth and tension

\begin{tikzpicture}[show background grid]


\draw plot coordinates {(0,0) (2,3) (3,1)}; %%
\draw [dashed,red] plot [smooth]
coordinates {(0,0) (2,3) (3,1)};
\draw [blue!40,thick] plot [smooth cycle]
coordinates {(2,1) (3,2) (4,0)};
\end{tikzpicture}

% ribbon
\begin{tikzpicture}
\draw [help lines,dotted] (0,0) grid (4,3);
\draw [yellow,line width=5.5mm]
plot [smooth] coordinates
{(0,0) (1.6,2) (1,3) (.4,2.3) (2,.2)};
\draw [dotted] plot coordinates
{(0,0) (1.6,2) (1,3) (.4,2.3) (2,.2)};
\draw [blue!40,thick]
plot [smooth,tension=1] coordinates
{(2,0) (3,1) (4,3)};
\end{tikzpicture}

21
5 Opacity and Layers

22
5.1 filling and opacity

\begin{tikzpicture}
\draw [help lines] (0,0) grid (4,3);
\draw [fill=yellow] (0,1) rectangle (4,2);
\draw (2,1.5) node {some text}; some text
\draw [red,line width=2mm] (0,3) -- (4,0);
\draw [fill=blue!30] (2,0) rectangle (3,3);
\end{tikzpicture}

\begin{tikzpicture}
\draw [help lines] (0,0) grid (4,3);
\draw [fill=yellow] (0,1) rectangle (4,2);
\draw (2,1.5) node {some text};
\draw [red,opacity=.3,line width=2mm] (0,3) -- (4,0);
some text
\draw [fill=blue,fill opacity=.3]
(2,0) rectangle (3,3);
\end{tikzpicture}

23
5.2 background layer: backgrounds library
\usetikzlibrary{backgrounds}
% scoping with [on background layer]

\begin{tikzpicture}
\draw [help lines] (0,0) grid (4,3);
\draw [fill=yellow] (0,1) rectangle (4,2);
\draw (2,1.5) node {some text};
\draw [red,line width=2mm] (0,3) -- (4,0); some text
\begin{scope}[on background layer]
\draw [fill=blue!30] (2,0) rectangle (3,3);
\end{scope}
\end{tikzpicture}

\begin{tikzpicture}
\draw [help lines] (0,0) grid (4,3);
\draw [fill=yellow] (0,1) rectangle (4,2);
\draw (2,1.5) node {some text};
\begin{scope}[on background layer]
\draw [red,line width=2mm] (0,3) -- (4,0);
some text
\draw [fill=blue,fill opacity=.3]
(2,0) rectangle (3,3);
\end{scope}
\end{tikzpicture}

24
5.3 more layers
% in preamble
\pgfdeclarelayer{background}
\pgfdeclarelayer{behind}
\pgfdeclarelayer{above}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,behind,main,above,foreground}
% usage: \begin{pgfonlayer}{behind}
% <tikz codes>
% \end{pgfonlayer}

\begin{tikzpicture}
\draw [help lines] (0,0) grid (4,3);
\draw [fill=yellow] (0,1) rectangle (4,2);
\begin{pgfonlayer}{above}
\draw (2,1.5) node {some text};
\end{pgfonlayer}
\draw [red,line width=2mm] (0,3) -- (4,0);
some text
\begin{pgfonlayer}{behind}
\draw [fill=blue!30,fill]
(2,0) rectangle (3,3);
\end{pgfonlayer}
\end{tikzpicture}

25
6 Coordinates Calculations: calc library

\usetikzlibrary{calc}

26
6.1 coordinate calculation: basics

%% \usetikzlibrary{calc}
% general syntax for coordinates
([<opt>]$<coor calculation>$)

coordinate computation: \verb+<factor>*(coor)<modifier>+

*( 가 나올 때까지 <factor>를 계산하므로, *와 (를 띄어쓰면 안된다.

% linear combination
\begin{tikzpicture}[semithick,show background grid]
\draw [dotted,fill] (0,0) -- ([xshift=1cm]2,1);
\draw [dotted,fill] (0,0) -- (1,2);
C
\draw [fill] ($.4*(3,1)$) coordinate (A) circle (1pt);
B
\draw [fill] ($.7*(1,2)$) coordinate (B) circle (1pt);
\draw ($.4*(3,1)+.7*(1,2)$) coordinate (C); %
\draw (A) node [below right] {A} -- (0,0) -- (B);
\draw [dashed] (A) -- (C) -- (B) node [left] {B}; A
\draw (C) circle (1pt) node [right] {C};
\draw [fill] (1,2) circle (1pt) (3,1) circle (1pt);
\end{tikzpicture}

27
% affine combination
syntax: (<coor1>)!<t>!<angle>:(<coor2>)

•affine combination: (1 − t)x + ty, t ∈ R


•rotate by <angle> around (<coor1>)

\begin{tikzpicture}[semithick]
\draw [help lines] (0,0) grid (4,3);
\draw (0,0) -- (3,2);
\draw ($(0,0)!.7!(3,2)$) coordinate (A) circle (.5pt);
\draw [red] (A) -- (4,0); C
\draw ($(0,0)!.4!(3,2)$) coordinate (B) circle (.5pt);
\draw ($(0,0)!.4!60:(3,2)$) coordinate (C); B
\draw (C) circle (.5pt) node [above] {C};
\draw [dashed] (B) node [above] {B} -- (C) -- (0,0);
\end{tikzpicture}

\begin{tikzpicture}[semithick,show background grid]


\draw (1,1) -- (3,2);
\draw ($(1,1)!-.5!(3,2)$) coordinate (A);
\draw [red] (A) circle (.5pt) -- (4,0);
\end{tikzpicture}

28
6.2 projection to the axes: |- and -|

\begin{tikzpicture}[semithick]
\draw [help lines,dotted] (0,0) grid (4,3);
\draw [<->] (0,3) |- (4,0);
\draw (3,2) coordinate (A); A
\draw [fill] (A) circle (1pt) node [above right] {A};
\draw (A|-9,0) coordinate (X);
\draw (A-|0,7) coordinate (Y);
\draw [dashed] (A) -- (X);
\draw [dotted] (A) -- (Y);
\end{tikzpicture}

\begin{tikzpicture}[semithick]
\draw [help lines,dotted] (0,0) grid (4,3);
\draw [<->] (0,3) |- (4,0);
\draw (3,2) coordinate (A); A
\draw [fill] (A) circle (1pt) node [above right] {A};
\draw (A|-9,1) coordinate (X);
\draw (A-|.5,7) coordinate (Y);
\draw [dashed] (A) -- (X);
\draw [dotted] (A) -- (Y);
\end{tikzpicture}

29
7 Nodes

30
7.1 nodes: basics
A node is a small part of a picture (drawn after a path is completed).

% frequently used syntax


% mandatory: last { }
\draw (<coor>) node [<opt>] {<text>};
\node [<opt>] at (<coor>) {<text>};

position
shape: rectangle, draw=none (default)
empty text: {}

\begin{tikzpicture}[show background grid]


\draw (0,0) node {text};
\draw (1,1) node [draw] {text}; text
\node at (2,2) [draw,circle] {};
\end{tikzpicture}
text

31
nodes: basics
inner sep, inner xsep, inner ysep: initially .3333em
outer sep: no default
minimum size

\begin{tikzpicture}[show background grid]


\draw (0,0) node [draw] {X}; A
\draw (0,1) node [draw,inner sep=0pt] {Y};
\draw (1,2) node [draw,circle] {A}; Y b
\draw (1,1) node [draw,circle] {b};
\draw (2,2) node [draw,inner sep=0pt] {};
\end{tikzpicture} X

\begin{tikzpicture}[inner sep=0pt,show background grid]


\draw (0,0) node [draw,circle] {X}; A
\draw (1,2) node [draw,circle,minimum size=1.5em] {A};
\draw (1,1) node [draw,circle,minimum size=1.5em] {b};
b
\draw (1,0) node [draw,circle,minimum size=1.5em] {C};
\draw (2,2) node [draw,circle,minimum size=1.5em] {};
\draw (2,0) node [draw,circle,minimum size=1.5em] {XYZ}; X C XYZ
\end{tikzpicture}

32
7.2 nodes: coloring

\begin{tikzpicture}[inner sep=2pt,show background grid]


\draw (0,0) node [draw,red] {X}; A
\draw (1,2) node [draw,fill=green] {A};
\draw (1,1) node [draw,draw=blue] {b};
\draw (1,0) node [draw,text=blue] {C}; b
\draw (2,2) node [draw,circle,fill,minimum size=8pt] {};
\draw (2,0) node [draw,circle,blue,fill] {}; X C
\end{tikzpicture}

7.3 node dots

\begin{tikzpicture}[xscale=.5,inner sep=0pt]
\draw [help lines] (0,0) grid (3,3);
\draw (0,0) circle (3pt);
\draw [fill] (0,1) circle (3pt);
\draw [fill=red] (0,2) circle (3pt);
\draw (1,1) node [ circle,fill,minimum size=6pt] {};
\draw (1,0) node [draw,circle,fill,minimum size=6pt] {};
\draw (2,1) node [circle,fill=blue,minimum size=6pt] {};
\draw (2,0) node [draw,circle,minimum size=6pt] {};
\draw (2,2) node [draw,circle,fill=red,minimum size=6pt]
{};
\end{tikzpicture}

33
7.4 nodes: positioning texts

\begin{tikzpicture}[show background grid]


\draw (0,0) circle (1pt) node [above right] {A};
\draw (1,0) node {B}; left
\draw (2,0) node [centered] {C}; br
\foreach \xy in {(1,0),(2,0),(1,1),(2,2),(3,2)} above
{\draw \xy circle (1pt);}
\draw (1,1) node [above] {above};
\draw (2,2) node [left] {left};
A
B C
\draw (3,2) node [below right] {br};
\end{tikzpicture}

\begin{tikzpicture}[show background grid]


\foreach \xx in {(0,1),(0,2),(1,2),(3,1)} D
{\draw \xx circle (1pt);}
\draw (0,0) node {A} ; E
\draw (0,1) node [right] {B} ;
\draw (0,1) node [right=1cm] {C} ; B C
\draw (0,2) node [above] {D}
-- (1,2) node [below left] {E} A
-- (3,1) node [below=1cm] {F} ; F
\end{tikzpicture}

34
xshift and yshift

\begin{tikzpicture}[show background grid]


\draw (0,0) node [draw] {A} ; A
\draw (0,0) node [draw,xshift=10pt,red] {A} ;
\draw (0,0) node [draw,yshift=1cm,blue] {A} ;
AA
\end{tikzpicture}

7.5 nodes: scaling and rotating

text
\begin{tikzpicture}[show background grid]
\draw (0,0) node [draw] {text};
\draw (2,1) node [draw,scale=3] {text};
\end{tikzpicture}
text

t
tex
\begin{tikzpicture}[show background grid]
\draw (0,0) node [draw,red,rotate=90] {text};
\draw (2,1) node [draw,scale=3,rotate=-30] {text}; tex
\draw (3,2) node [scale=2,rotate=30,blue] {text};
\end{tikzpicture} t
text
35
7.6 node coordinate system

\draw (<coor>) node (<node name>) [<opt>] {<text>};


% (<node name>) can be used as a coordinate
% in the form (<node name>.<angle>)

\begin{tikzpicture}[show background grid]


\path (0,0) node (A) {} (2,1) node (B) {};
\draw (A) -- (B);
\path (1,0) node (C) [draw] {};
\path (3,1) node (D) [draw] {};
\draw (C) -- (D);
\draw [blue] (A.center) to [bend left]
(B.center) -- (1,2) -- (3,2);
\end{tikzpicture}

\begin{tikzpicture}[thick,show background grid]


\path [green] (0,0) node (A) [draw,circle,minimum
size=2cm] {};
\draw [red] (A.center) -- (A.south west);
\draw [blue] (A.center) -- (A.60);
\draw [densely dashed] (2,0) -- (A.-150);
\draw [densely dotted] (2,1) -- (A); % to the center
\end{tikzpicture}

36
8 Built-in Absolute Nodes

37
8.1 current bounding box

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis facilisis sem. Nullam
nec mi et neque pharetra sollicitudin. Praesent imperdiet mi nec ante. Donec ullamcorper, felis
non sodales commodo, lectus velit ultrices augue, a dignissim nibh lectus placerat pede. Vivamus
nunc nunc, molestie ut, ultricies vel, semper in, velit. Ut porttitor. Praesent in sapien. Lorem
ipsum dolor sit amet, consectetuer adipiscing elit. Duis fringilla tristique neque. Sed interdum
libero ut metus. Pellentesque placerat. Nam rutrum augue a leo. Morbi sed elit sit amet ante
lobortis sollicitudin. Praesent blandit blandit mauris. Praesent lectus tellus, aliquet aliquam,
luctus a, egestas a, turpis. Mauris lacinia lorem sit amet ipsum. Nunc quis urna dictum turpis
accumsan semper.

\begin{tikzpicture}
%% \usepackage{blindtext}
%% \usetikzlibrary{calc,backgrounds}
\node at (0,0) {\parbox{.98\linewidth}{\blindtext}};
\coordinate (SW) at (current bounding box.south west);
\coordinate (NW) at (current bounding box.north west);
\coordinate (SE) at (current bounding box.south east);
\coordinate (NE) at (current bounding box.north east);
\begin{scope}[on background layer]
\path [fill=yellow!50] (SW) rectangle (NE);
\end{scope}
\draw [red,line width=2pt] ($(SE)!.5!(SW)$) -| ($(SE)!2cm!(NE)$);
\end{tikzpicture}

38
8.2 current page box
DO NOT FORGET [remember picture, overlay]
And you NEED to compile twice.
Everything on the current page before the picture will be hidden by the picture.

\clearpage
(text not shown: covered by the picture)

\begin{tikzpicture}[remember picture, overlay,opacity=.3]


\path (current page.south west) coordinate (SW)
(current page.south east) coordinate (SE)
(current page.north west) coordinate (NW)
(current page.north east) coordinate (NE);
\begin{scope}[on background layer]
\fill [draw,black,fill=blue!20] (SE) rectangle (NW); \end{scope}
\draw (NW) circle (5pt) circle (1cm) circle (2cm);
\draw (SE) circle (5cm) circle (4cm) circle (3cm) circle (2cm) circle (5pt);
\end{tikzpicture}

\subsection{current page box}

DO NOT FORGET \texttt{[remember picture, overlay]}\par


And you NEED to compile twice.\par
Everything on the current page before the picture will be hidden by the picture.

39
아리랑 아리랑 홀로 아리랑
아리랑 고개를 넘어가 보자
8.3 remember picture 가다가 힘들면 쉬어가더라도
손잡고 가보자 같이 가보자

저 멀리 동해바다 외로운 섬 금강산 맑은물은 동해로 흐르고 백두산 두만강에서 배타고 떠나라
오늘도 거센 바람 불어 오겠지 설악산 맑은물도 동해가는데 한라산 제주에서 배타고 간다
조그만 얼굴로 바람 맞으니 우리네 마음들은 어디로 가는가 가다가 홀로 섬에 닻을 내리고
독도야 간밤에 잘 잤느냐 언제쯤 우리는 하나가 될까 떠오르는 아침해를 맞이해보자


독도\tikz[remember picture,overlay]{\node(A){};}야 간밤에...
언제쯤 우리는 하나가 될까\tikz[remember picture,overlay]{\node(B){};}
홀로 섬\tikz[remember picture,overlay]{\node(C){};}에...

아 리
\begin{tikzpicture}[remember picture,overlay,font={\sffamily \scriptsize}]

홀 로
\draw (current page.north east) node (Z) [below left,fill=green!50,rounded corners]
{\parbox{.2\linewidth}{아리랑...같이 가보자}};
\end{tikzpicture}

\begin{tikzpicture}[remember picture,overlay]
\draw [->,red] (A.center) to [out=-30,in=60] (C.center);
\draw [->,dashed] (B.center) to [out=0,in=180] (Z.180);
\draw (current page.center) node [rotate=30,scale=4,opacity=.3,blue]
{ \bfseries 홀로 아리랑 };
\end{tikzpicture}

40
8.4 More Page Decorating
Practices:

• 김강수, 판면, oblivoir, TikZ, 공주대학교 문서작성 워크숍 2017.


• 이주호, 공주대학교 문서작성 워크숍 포스터, 2017, 2018.

See also:
• Martin Scharrer, tikzpagenodes
• 허혁재, memtikzpagenodes

9 References
• Till Tantau, The TikZ and PGF Packages: Manual for version 3.1.4b (https://github.com/
pgf-tikz/pgf).
• 조인성, 그림과 함수 플로팅 (http://wiki.ktug.org/wiki/wiki.php/LaTeXWorkshop/2018#
s-4).

41

You might also like