{{short description|Graphics languages}} {{DISPLAYTITLE:PGF/Ti''k''Z}} {{Infobox software | name = PGF/TikZ ("PGF and {{nowrap|Ti''k''Z")}} | author = Till Tantau | developer = Till Tantau, Christian Feuersänger | screenshot = Neighbourhood definition2.svg | screenshot alt = Example of graphics created with Ti''k''Z | caption = Example of graphics created with Ti''k''Z | programming language = TeX, Lua | genre = Vector graphics languages | license = Dual license: GNU General Public License or LaTeX Project Public License | website = {{official url}} | latest release version = {{wikidata|property|reference|P348}} | latest release date = {{start date and age|{{wikidata|qualifier|P348|P577}}}} | operating_system = Multiplatform (TeX) }}

'''PGF/Ti''k''Z''' is a pair of languages for producing vector graphics (e.g., technical illustrations and drawings) from a geometric/algebraic description, with standard features including the drawing of points, lines, arrows, paths, circles, ellipses and polygons. PGF is a lower-level language, while Ti''k''Z is a set of higher-level macros that use PGF. The top-level PGF and Ti''k''Z commands are invoked as TeX macros, but in contrast with PSTricks, the PGF/Ti''k''Z graphics themselves are described in a language that resembles MetaPost. {{ill|Till Tantau|de}} is the designer of the PGF and Ti''k''Z languages. He is also the main developer of the only known interpreter for PGF and Ti''k''Z, which is written in TeX. PGF is an acronym for "Portable Graphics Format". Ti''k''Z was introduced in version 0.95 of PGF, and it is a recursive acronym for "Ti''k''Z ist ''kein'' Zeichenprogramm" (German for "Ti''k''Z is ''not'' a drawing program").

==Overview== The PGF/Ti''k''Z interpreter can be used from the popular LaTeX and ConTeXt macro packages, and also directly from the original TeX.<ref name="manual">{{cite web |title=The Ti''k''Z and PGF Packages: Manual |url=https://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf |website=CTAN.org |access-date=2019-06-17}}</ref>{{rp|116}} Since TeX itself is not concerned with graphics, the interpreter supports multiple TeX output backends: dvips, dvipdfm/dvipdfmx/xdvipdfmx, TeX4ht, and pdftex's internal PDF output driver.<ref name="manual"/>{{rp|117–120}} Unlike PSTricks, PGF can thus directly produce either PostScript or PDF output, but it cannot use some of the more advanced PostScript programming features that PSTricks can use due to the "least common denominator" effect.<ref>{{cite web|page=17|title=The Ti''k''Z and PGF Packages: Manual for version 2.10|url=https://www.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf|website=CTAN.org|author=Till Tantau|date=20 February 2008|access-date=6 May 2010|url-status=dead|archive-url=https://web.archive.org/web/20110109090729/https://www.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf|archive-date=9 January 2011}}</ref> PGF/Ti''k''Z comes with an extensive documentation; the version 3.1.4a of the manual has over 1300 pages.<ref name="manual"/>

The standard LaTeX <code>picture</code> environment can also be used as a front end for PGF by using the <code>pgfpict2e</code> package.<ref name="manual"/>{{rp|27}}

The project has been under constant development since 2005.<ref>{{cite web |url=https://github.com/pgf-tikz/pgf/commits/master |title=Commits – pgf-tikz/pgf |website=GitHub.com |access-date=2019-06-17}}</ref> Most of the development until 2018 was done by Till Tantau and since then Henri Menke has been the main contributor.<ref>{{cite web |url=https://github.com/pgf-tikz/pgf/graphs/contributors |title=Contributors to pgf-tikz/pgf |website=GitHub.com |access-date=2019-06-17}}</ref> Version 3.0.0 was released on 20 December 2013.<ref name="version 3">{{cite web| url=https://sourceforge.net/projects/pgf/files/pgf/version%203.0.0 |title=PGF and TikZ – Graphic systems for TeX – Browse /pgf/version 3.0.0 |website=SourceForge.net |date=2013-12-20 |access-date=2019-06-17}}</ref> One of the major new features of this version was graph drawing using the <code>graphdrawing</code> package, which however requires LuaTeX.<ref>{{cite journal | doi = 10.7155/jgaa.00301 | title=Graph Drawing in TikZ | journal=Journal of Graph Algorithms and Applications | date=2013 | volume=17 | issue=4 | pages=495–513 | first=Till | last=Tantau| doi-access=free }} See also the older [https://www.tcs.uni-luebeck.de/downloads/mitarbeiter/tantau/2012-gd-presentation.pdf GD 2012 presentation] by Tantau.</ref> This version also added a new data visualization method and support for direct SVG output via the new dvisvgm driver.<ref name="version 3"/>

==Export== Several graphical editors can produce output for PGF/Ti''k''Z, such as the KDE program Cirkuit<ref>{{cite web |url=https://wwwu.uni-klu.ac.at/magostin/cirkuit.html |title=Cirkuit |first=Matteo |last=Agostinelli |date=31 December 2011 |website=uni-klu.ac.at |access-date=2019-06-17 |archive-date=2019-06-14 |archive-url=https://web.archive.org/web/20190614212447/http://wwwu.uni-klu.ac.at/magostin/cirkuit.html |url-status=dead }}</ref> and the math drawing program GeoGebra.<ref>{{cite web |title=Export to LaTeX (PGF, PSTricks) and Asymptote – GeoGebra Manual |url=https://wiki.geogebra.org/en/Export_to_LaTeX_(PGF,_PSTricks)_and_Asymptote |website=wiki.geogebra.org |access-date=2019-06-17}}</ref> Export to Ti''k''Z is also available as extensions for Inkscape,<ref>{{cite web |url=https://github.com/kjellmf/svg2tikz |title=svg2tikz: An Inkscape extension for exporting SVG paths as TikZ/PGF paths |website=GitHub.com |access-date=2019-06-17}}</ref> Blender,<ref>{{cite web |url=https://github.com/kjellmf/blend2tikz |title=blend2tikz: Export Blender (2.4x) curves to TikZ format for use with TeX |website=GitHub.com |access-date=2019-06-17}}</ref> MATLAB,<ref>{{cite web |url=https://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz |title=matlab2tikz – File Exchange – MATLAB Central |first=Nico |last=Schlömer |website=MathWorks.com |access-date=2019-06-17}}</ref> matplotlib,<ref>{{cite web |url=https://github.com/nschloe/tikzplotlib |title=tikzplotlib: Convert matplotlib figures to TikZ/PGFplots for smooth integration into LaTeX |first=Nico |last=Schlömer |website=GitHub.com |access-date=2019-06-17}}</ref> Gnuplot,<ref>{{cite web |url=http://www.gnuplot.info/docs_5.2/Gnuplot_5.2.pdf |title=gnuplot 5.2: An Interactive Plotting Program |editor1-first=Thomas |editor1-last=Williams |editor2-first=Colin |editor2-last=Kelley |date=October 2018 |website=gnuplot.info |access-date=2019-06-17}}</ref> Julia,<ref>{{cite web|url=https://docs.juliaplots.org/latest/backends/ |title=Julia plotting backends|website=docs.juliaplots.org|first=Thomas |last=Breloff|access-date=2024-02-27}}</ref> and R.<ref>{{cite web |url=https://cran.r-project.org/package=tikzDevice |title=tikzDevice: R Graphics Output in LaTeX Format |website=cran.r-project.org |access-date=2019-06-17}}</ref> The circuit-macros package<ref>{{cite web |url=https://ctan.org/pkg/circuit-macros/ |title=circuit-macros – M4 macros for electric circuit diagrams |access-date=15 April 2020 |website=CTAN.org}}</ref> of m4 macros exports circuit diagrams to Ti''k''Z using the <code>dpic -g</code> command line option.<ref>{{cite web |url=https://ece.uwaterloo.ca/~aplevich/dpic/README/ |title=dpic README |first=Dwight |last=Aplevich |date=3 January 2020 |website=ece.uwaterloo.ca |access-date=15 April 2020 |archive-date=19 April 2012 |archive-url=https://web.archive.org/web/20120419140256/https://ece.uwaterloo.ca/~aplevich/dpic/README |url-status=dead }}</ref> The dot2tex program can convert files in the DOT graph description language to PGF/Ti''k''Z.<ref>{{cite web |title=dot2tex – A Graphviz to LaTeX converter |url=https://dot2tex.readthedocs.io/ |website=dot2tex.readthedocs.io |date=2019-11-01}}</ref>

==Libraries== Ti''k''Z features libraries for easy drawing of many kinds of diagrams, such as the following (alphabetized by library name):<ref name="manual"/>

{{Div col|colwidth=22em}} * 3D drawing{{snd}}<code>3d</code> * Finite automata and Turing machines{{snd}}<code>automata</code> * Coordinate system calculations{{snd}}<code>calc</code> * Calendars{{snd}}<code>calendar</code> * Chains: nodes typically connected by edges and arranged in rows and columns{{snd}}<code>chain</code> * Logic circuit and electrical circuit diagrams{{snd}}<code>circuits.logic</code> and <code>circuits.ee</code> * Entity–relationship diagrams{{snd}}<code>er</code> * Polygon folding diagrams{{snd}}<code>folding</code> * Graph drawing with automatic layout options{{snd}}<code>graphdrawing</code> * L-system drawings{{snd}}<code>lindenmayersystems</code> * Sequences of basic math operations{{snd}}<code>math</code> * Matrices{{snd}}<code>matrix</code> * Mind maps{{snd}}<code>mindmap</code> * Three-point perspective drawings{{snd}}<code>perspective</code> * Petri nets{{snd}}<code>petri</code> * Quantum circuits{{snd}}<code>quantikz</code> * RDF semantic annotations (only in SVG output){{snd}}<code>rdf</code> * Special shapes and symbols{{snd}}<code>shapes.geometric</code> and <code>shapes.symbols</code> * Magnification of part of a graphic in an inset{{snd}}<code>spy</code> * Paths in SVG syntax{{snd}}<code>svg.path</code> * Trees{{snd}}<code>trees</code> * Turtle graphics{{snd}}<code>turtle</code> * Zooming and panning graphics{{snd}}<code>views</code> {{Div col end}}

==Gallery== The following images were created with Ti''k''Z and show some examples of the range of graphic types that can be produced. The link in each caption points to the source code for the image.

<gallery> File:Periodic-table-of-chemical-elements.svg|[https://www.texample.net/tikz/examples/periodic-table-of-chemical-elements/ Periodic table of chemical elements] (libraries used: <code>calc</code>, <code>shapes</code>) File:Rooty-helix.svg|[https://www.texample.net/tikz/examples/rooty-helix/ Rooty helix] (library used: <code>calc</code>) File:LighthouseMap.pdf|[https://github.com/vitalyrepin/Modern2013/tree/master/LightHouseMap Mind map of ''To the Lighthouse''] (libraries used: <code>mindmap</code>, <code>shapes.misc</code>) File:Lda-gauss-variance-big.svg|[https://github.com/MartinThoma/LaTeX-examples/tree/master/tikz/lda-gauss-variance-big Plot of two normal distributed variables with big variance] (libraries used: <code>arrows</code>, <code>positioning</code>) File:Hypersurface-3.svg|[https://github.com/MartinThoma/LaTeX-examples/tree/master/tikz/hypersurface-3 Hypersurface rendering] (libraries used: <code>arrows</code>, <code>calc</code>, <code>decorations.markings</code>, <code>intersections</code>, <code>positioning</code>) File:Bayesian-gaussian-mixture-vb.svg|Bayesian Gaussian mixture model (libraries used: <code>arrows</code>, <code>backgrounds</code>, <code>calc</code>, <code>fit</code>, <code>matrix</code>, <code>patterns</code>, <code>plotmarks</code>, <code>shadows</code>) File:Capacitor equivalent circuits.svg|Capacitor equivalent circuits (library used: <code>arrows</code>) File:Batezbestekoak frogak eskema 001.pdf|Diagram showing different types of mean-tests (libraries used: <code>arrows</code>, <code>shapes</code>) File:3d-gradient-colored.svg|[https://github.com/MartinThoma/LaTeX-examples/tree/master/tikz/3d-gradient-colored Gradient plot of a function] (library used: <code>arrows.meta</code>) File:Csv-2d-gaussian-multivarate-distributions.svg|[https://github.com/MartinThoma/LaTeX-examples/tree/master/tikz/csv-2d-gaussian-multivarate-distributions Multivariate Gaussian distributions] (libraries used: <code>arrows</code>, <code>positioning</code>) File:Feed-forward-perceptron.svg|[https://github.com/MartinThoma/LaTeX-examples/tree/master/tikz/feed-forward-perceptron Feed-forward perceptron] (libraries used: <code>arrows</code>, <code>arrows.meta</code>) File:Shield of the Trinity with the Four Relations.svg|Shield of the trinity with the four relations (libraries used: <code>graphdrawing</code>, <code>graphs</code>, <code>quotes</code>) File:English Length Units Graph.svg|English length units graph File:Graph homomorphism into C5.svg|Graph homomorphism into C5 (library used: <code>calc</code>) File:Krausz-Partition 2.png|Subgraphs of the Krausz partition of a given line graph File:Adjacencylist array of linkedlists undirectedgraph.svg|Adjacencylist of a graph implemented as array of linked lists (libraries used: <code>arrows</code>, <code>calc</code>, <code>positioning</code>, <code>shapes.multipart</code>) </gallery>

==See also== {{Portal|Free and open-source software}} * Asymptote (vector graphics language)

==References== {{Reflist}}

==Further reading== {{Refbegin}} * {{citation |first1=Andrew |last1=Mertz |first2=William |last2=Slough |title=Graphics with PGF and Ti''k''Z |journal=The PracTeX Journal |date=2007 |number=1 |url=https://www.tug.org/pracjourn/2007-1/mertz/ |issn=1556-6994}} [https://web.archive.org/web/20130715015214/http://river-valley.tv/graphics-with-pgf-and-tikz Conference talk video] (version archived by archive.org; the previous site is unavailable) based on an earlier version of that paper. * {{citation |first=Claudio |last=Beccari |title=Graphics in LaTeX |journal=The PracTeX Journal |date=2007 |number=1 |url=https://www.tug.org/pracjourn/2007-1/beccari/ |issn=1556-6994}} Comparison of several graphics systems in LaTeX. * {{cite book |first=Marc |last=van Dongen |title=LaTeX and Friends |year=2012 |series=X.media.publishing book series |location=Heidelberg; New York |publisher=Springer-Verlag |isbn=978-3-642-23815-4 |oclc=746835167 |doi=10.1007/978-3-642-23816-1|s2cid=26652686 }} According to [https://www.tug.org/books/reviews/tb102reviews-ltxfriends.html a 2011 review of the book in TUGboat]: "It contains a detailed introduction to the TikZ suite—probably one of the best existing descriptions of this highly useful package." {{Refend}}

==External links== {{Wikibooks|1=LaTeX|2=PGF/TikZ}} {{Commons category|TikZ graphics}} * [https://www.ctan.org/tex-archive/graphics/pgf/ PGF/Ti''k''Z] on CTAN * [https://pgf-tikz.github.io/pgf/pgfmanual.pdf PGF/Ti''k''Z manual] * [https://www.texample.net/tikz/examples/ PGF/Ti''k''Z gallery at TeXample.net]

{{LaTeX navbox}} {{TeX navbox}} {{Mindmaps}} {{Vector graphics markup languages}}

{{DEFAULTSORT:Pgf Tikz}} Category:Cross-platform free software Category:Free TeX software Category:Graph description languages Category:Graph drawing software Category:Object-oriented programming languages Category:TeX SourceForge projects Category:Vector graphics markup languages