PGF TikZ - Graphics for LaTeX - A tutorial
26 pages
English

PGF TikZ - Graphics for LaTeX - A tutorial

-

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
26 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

APGF/TikZ - Graphics for LT XEA tutorialMeik HellmundUni Leipzig, Mathematisches InstitutM. Hellmund (Leipzig) PGF/TikZ 1 / 22PGF and TikZI According to its author, Till Tantau (Lub eck), PGF/TikZ stands for\Portable Graphics Format" and \TikZ ist kein Zeichenprogramm".I PGF: internal engine; TikZ: frontendAI nicely integrated into LT X and BeamerEI works for PostScript output (dvips) as well asfor PDF generation (pdflatex, dvipdfmx)I DVI previewer are not always able to show the graphics correctly.Look at the PS or PDF output!I TikZ is cool for 2D pictures. For 3D graphics I prefer other tools, e.g.Asymptote.M. Hellmund (Leipzig) PGF/TikZ 2 / 22nusepackageftikzgnusetikzlibraryfarrows,shapes,trees,..g % loads some tikz extensionsI Use \tikz ... ; for simple inline commands:The code \tikz \draw (0pt,0pt) -- (20pt,6pt); yields and\tikz \fill[orange] (0,0) circle (1ex); provides .I Use \begin{tikzpicture}...\end{tikzpicture} for larger pictures:\begin{tikzpicture}\draw[style=dashed] (2,.5) circle (0.5);\draw[fill=green!50] (1,1)ellipse (.5 and 1);\draw[fill=blue] (0,0) rectangle (1,1);\draw[style=thick](3,.5) -- +(30:1) arc(30:80:1) -- cycle;\end{tikzpicture}M. Hellmund (Leipzig) PGF/TikZ 3 / 22I Coordinate system starts at lower left corner of canvasI Canvas is made large enough to hold the pictureI Tip: make boundary of canvas visible,if necessary, move the picture box around using\hspace*{..}, \vspace*{..}I Unit of length: 1 cm, ...

Informations

Publié par
Nombre de lectures 250
Langue English

Extrait

.MHlelmundL(iezpig)
PGF/TikZ - Graphics for LATEX A tutorial
Meik Hellmund
Uni Leipzig, Mathematisches Institut
GP/FTikZ1/22
PGF and TikZ
IAccording to its author,Till TantauofrnasdZkts/FiTckbePG),¨u(L “Portable Graphics Format”and“TikZ ist kein Zeichenprogramm”. IPGF: internal engine; TikZ: frontend Inicely integrated into LATEX and Beamer Iworks for PostScript output (dvips) as well as for PDF generation (pdflatex, dvipdfmx) IDVI previewer are not always able to show the graphics correctly. Look at the PS or PDF output! I 3D graphics I prefer other tools, e.g. ForTikZ is cool for 2D pictures. Asymptote.
.MHellmundL(eipzig)GPF/TikZ2/22
e=thstylraw[);\d(+03)5--3(.,ci]k)-:1800:(3rc)a:1zkit{dne\;elcyc-](1,1)elgreen!50na1d;)d\ilsp(e5.lu=b(0e]w[rallfielgn1,1(r)0,atceiptcru}e.MeHllumnd(Leipzig)PGF/T3Zki22/
\usepackage{tikz} \usetikzlibrary{,see..hapes,trarrows,s}% loads some tikz extensions
IUse\tikz ... ;for simple inline commands: The code\tikz \draw (0pt,0pt) -- (20pt,6pt);yields and \tikz \fill[orange] (0,0) circle (1ex);provides . IUseer}ciutkipz{tnd\e..}.retuicpzkit{nigeb\for larger pictures:
\beaw[fill=0.5);\drc)rilc(ede(],25.e=ylshdara\dstw[tcip}eru{nigzkit
ICoordinate system starts at lower left corner of canvas ICanvas is made large enough to hold the picture I boundary of canvas visible,Tip: make if necessary, move the picture box around using \hspace*{..}, \vspace*{..} IUnit of length:1 cm, other units are possible I use units, use theTip: don’tscaleoption oftikzpicture
\usetikzlibrary{backgrounds} ... \vspace*{-2.3cm}\hspace{8cm}% \begin{tikzpicture}[scale=.8, show background rectangle] \draw (2,2) circle (1); \draw (1mm, 10pt) -- (4em, 1); \end{tikzpicture}
(A solution in the spirit of LAwould be the use of a multicolumn environment or ofTEX minipages. But sometimes the\hspace/vspacehack is faster and more flexible.)
M.HellmundL(iezpig)GP/FiTZk4/22
\,1(1-()-h=dtt]4pil,wiwenhtapard[le;c-cy1,-)--3(,2)2ellmM.H/522iTZk
IBasic elements arepathsandnodes. IA path is a series of straight and curved line segments. IPaths can bedrawn, filledor used forclippingof subsequent drawings: \path[draw] (1,1) -- (2,2) -- (3,1);
Paths
\path[clip, draw] (1,1)--(2,2)--(3,1)--cycle; \path[fill=blue!50] (2, 1.7) circle (.8);
IAbbreviations: \draw = \path[draw], \fill = \path[fill], \clip = \path[clip] \filldraw = \path[fill,draw], \shade = \path[shade], ...
\path[fill=green] (1,1) -- (2,2) -- (3,1) -- cycle;
\path[draw, fill=green!20] (1,1)--(2,2)--(3,1)--cycle;
Leipund(PGF/zig)
Shading \path[shade,draw] (1,1) -- (2,2)--(3,1)--cycle; \shade[left color=red] (1,1)--(2,2)--(3,1)--cycle; \shade[top color=red, bottom color=green] (0,0) rectangle (2,1); \shade[draw,shading=radial, inner color=blue] (0,0) rectangle (2,1); \shade[shading=ball, ball color=blue] (0,0) rectangle (2,1); \shade[shading=ball, ball color=blue] (0,0) circle (.3); \shade[shading=ball, ball color=white] (1,0) circle (.3); \shade[shading=ball, ball color=black] (2,0) circle (.3); M. Hellmund (Leipzig) PGF/TikZ 6 / 22
Simple shapes
Polar coordinates:
M.HellmundL(iezpgi)
\draw (0, 0) rectangle (2, 1);
\draw[color=red] (0, 0) circle (.5);
\draw (0, 0) ellipse (.7 and 0.5);
\draw[color=red] (0,0) -- (40:1); \draw[color=blue] (0,0) -- (160:1); \draw[thick] (0,0) -- (90:1); \draw[color=green] (40:1) arc (40:160:1);
GPF/TikZ7/22
.HMlmeld(un.().,1(1;0)3,..)0,0(]slortnocinewaw[l=2ptidthopaltnre\)rditnoze´Bireic(tncibugearoitptoenetthopni,thtcdnortlotheseconectiontoridsegnahcyllaudranghe,tntoilprooctnrtstfehoionrecthedisinttartepSI2ro1yficoltroncbtsinponewtteewtnospoiopathftherves.ICukZTiF/PGg)ziipLe
\draw[line width=8pt] (0, 0) .. controls(1, 0) and (1, 1) .. (0, 1);
Curved lines
22/8
I
Another way is to specify directions at start and target:
\begin{tikzpicture}[scale=.7] \draw[line width=4pt] (0,0)
.MHlemlnudL(eipzig)
to to
PGF/
[out=90, in=180] [out=-90, in=90]
TikZ
(3,2) (8,-2);
9/22
Arrows, dash patterns
.MHlemlnudL(eipzig)
\draw[->]
\draw[dotted, >->>]
\draw[|<->|]
\draw[dashed, o-)]
(0,0) -- (1,0);
(0,0) -- (1,0);
(0,0) -- (1,0);
(0,0) -- (1,0);
\draw[loosely dashed] (0,0) -- (1,0);
\draw[densely dotted] (0,0) -- (1,0);
\draw[->] (0,0) .. controls (.2,-.2) .. (1, 0);
GP/FiTkZ10/22
Clipping and scope
IAfter a\clipcommand, all subsequent drawings are clipped, only the parts inside the clipping region are drawn. IUse thescopeenvironment to restrict the effect of clipping:
M.HellmundL(iepzig)
\begin{tikzpicture} \draw (-2, 1.5) rectangle (2, -1.5); \begin{scope} \clip (-0.5, 0) circle (1); \clip ( 0.5, 0) circle (1); \fill[color=gray] (-2,1.5) rectangle (2,-1.5); \end{scope} \draw (-0.5, 0) circle (1); \draw ( 0.5, 0) circle (1); \end{tikzpicture}
GP/FiTZk11/22
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents