PGF/TikZ
PGF/TikZ 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 TikZ is a set of higher-level macros that use PGF. The top-level PGF and TikZ commands are invoked as TeX macros, but in contrast with PSTricks, the PGF/TikZ graphics themselves are described in a language that resembles MetaPost. Till Tantau is the designer of the PGF and TikZ languages. He is also the main developer of the only known interpreter for PGF and TikZ, which is written in TeX. PGF is an acronym for "Portable Graphics Format". TikZ was introduced in version 0.95 of PGF, and it is a recursive acronym for "TikZ ist kein Zeichenprogramm" (German for "TikZ is not a drawing program").
Example of graphics created with TikZ. Note the slightly translucent top layer. | |
Original author(s) | Till Tantau |
---|---|
Developer(s) | Till Tantau, Christian Feuersänger |
Stable release | 3.1.8[1]
/ 25 December 2020 |
Repository | |
Written in | TeX, Lua |
Operating system | Multiplatform (TeX) |
Type | Vector graphics languages |
License | Dual License: GNU General Public License or LaTeX Project Public License |
Website | github |
Overview
The PGF/TikZ interpreter can be used from the popular LaTeX and ConTeXt macro packages, and also directly from the original TeX.[2]: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.[2]: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.[3] PGF/TikZ comes with an extensive documentation; the version 3.1.4a of the manual has over 1300 pages.[2]
The standard LaTeX picture
environment can also be used as a front end for PGF — by merely using the pgfpict2e
package.[2]:27
The project has been under constant development since 2005.[4] Most of the development is done by Till Tantau.[5] Version 3.0.0 was released on 20 December 2013.[6] One of the major new features of this version was graph drawing using the graphdrawing
package, which however requires LuaTeX.[7] This version also added a new data visualization method and support for direct SVG output via the new dvisvgm driver.[6]
Export
Several graphical editors can produce output for PGF/TikZ, such as the KDE program Cirkuit[8] and the math drawing program GeoGebra.[9] Export to TikZ is also available as extensions for Inkscape,[10] Blender,[11] MATLAB,[12] matplotlib,[13] Gnuplot,[14] and R.[15] The circuit-macros package[16] of m4 macros exports circuit diagrams to TikZ using the dpic -g
command line option.[17] The dot2tex program can convert files in the DOT graph description language to PGF/TikZ.[18]
Libraries
TikZ features libraries for easy drawing of many kinds of diagrams, such as the following (alphabetized by library name):[2]
- 3D drawing –
3d
- Finite automata and Turing machines –
automata
- Coordinate system calculations –
calc
- Calendars –
calendar
- Chains: nodes typically connected by edges and arranged in rows and columns –
chain
- Logic circuit and electrical circuit diagrams –
circuits.logic
andcircuits.ee
- Entity–relationship diagrams –
er
- Polygon folding diagrams –
folding
- Graph drawing with automatic layout options –
graphdrawing
- L-system drawings –
lindenmayersystems
- Sequences of basic math operations –
math
- Matrices –
matrix
- Mind maps –
mindmap
- Three-point perspective drawings –
perspective
- Petri nets –
petri
- RDF semantic annotations (only in SVG output) –
rdf
- Special shapes and symbols –
shapes.geometric
andshapes.symbols
- Magnification of part of a graphic in an inset –
spy
- Paths in SVG syntax –
svg.path
- Trees –
trees
- Turtle graphics –
turtle
- Zooming and panning graphics –
views
Gallery
The following images were created with TikZ 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.
- Rooty helix (library used:
calc
) - Hypersurface rendering (libraries used:
arrows
,calc
,decorations.markings
,intersections
,positioning
) - Bayesian Gaussian mixture model (libraries used:
arrows
,backgrounds
,calc
,fit
,matrix
,patterns
,plotmarks
,shadows
) - Capacitor equivalent circuits (library used:
arrows
) - Diagram showing different types of mean-tests (libraries used:
arrows
,shapes
) - Gradient plot of a function (library used:
arrows.meta
) - Shield of the trinity with the four relations (libraries used:
graphdrawing
,graphs
,quotes
) - English length units graph
- Graph homomorphism into C5 (library used:
calc
) - Subgraphs of the Krausz partition of a given line graph
- Adjacencylist of a graph implemented as array of linked lists (libraries used:
arrows
,calc
,positioning
,shapes.multipart
)
See also
References
- "Release 3.1.8". 25 December 2020. Retrieved 15 January 2021.
- "The TikZ and PGF Packages: Manual" (PDF). CTAN.org. Retrieved 2019-06-17.
- Till Tantau (20 February 2008). "The TikZ and PGF Packages: Manual for version 2.10" (PDF). CTAN.org. p. 17. Archived from the original (PDF) on 9 January 2011. Retrieved 6 May 2010.
- "Commits – pgf-tikz/pgf". GitHub.com. Retrieved 2019-06-17.
- "Contributors to pgf-tikz/pgf". GitHub.com. Retrieved 2019-06-17.
- "PGF and TikZ – Graphic systems for TeX – Browse /pgf/version 3.0.0". SourceForge.net. 2013-12-20. Retrieved 2019-06-17.
- Tantau, Till (2013). "Graph Drawing in TikZ". Journal of Graph Algorithms and Applications. 17 (4): 495–513. doi:10.7155/jgaa.00301. See also the older GD 2012 presentation by Tantau.
- Agostinelli, Matteo (31 December 2011). "Cirkuit". uni-klu.ac.at. Retrieved 2019-06-17.
- "Export to LaTeX (PGF, PSTricks) and Asymptote – GeoGebra Manual". wiki.geogebra.org. Retrieved 2019-06-17.
- "svg2tikz: An Inkscape extension for exporting SVG paths as TikZ/PGF paths". GitHub.com. Retrieved 2019-06-17.
- "blend2tikz: Export Blender (2.4x) curves to TikZ format for use with TeX". GitHub.com. Retrieved 2019-06-17.
- Schlömer, Nico. "matlab2tikz – File Exchange – MATLAB Central". MathWorks.com. Retrieved 2019-06-17.
- Schlömer, Nico. "tikzplotlib: Convert matplotlib figures to TikZ/PGFplots for smooth integration into LaTeX". GitHub.com. Retrieved 2019-06-17.
- Williams, Thomas; Kelley, Colin, eds. (October 2018). "gnuplot 5.2: An Interactive Plotting Program" (PDF). gnuplot.info. Retrieved 2019-06-17.
- "tikzDevice: R Graphics Output in LaTeX Format". cran.r-project.org. Retrieved 2019-06-17.
- "circuit-macros – M4 macros for electric circuit diagrams". CTAN.org. Retrieved 15 April 2020.
- Aplevich, Dwight (3 January 2020). "dpic README". ece.uwaterloo.ca. Retrieved 15 April 2020.
- "dot2tex – A Graphviz to LaTeX converter". dot2tex.readthedocs.io. 2019-11-01.
Further reading
- Mertz, Andrew; Slough, William (2007), "Graphics with PGF and TikZ", The PracTeX Journal (1), ISSN 1556-6994 Conference talk video (version archived by archive.org; the previous site is unavailable) based on an earlier version of that paper.
- Beccari, Claudio (2007), "Graphics in LaTeX", The PracTeX Journal (1), ISSN 1556-6994 Comparison of several graphics systems in LaTeX.
- van Dongen, Marc (2012). LaTeX and Friends. X.media.publishing book series. Heidelberg; New York: Springer-Verlag. doi:10.1007/978-3-642-23816-1. ISBN 978-3-642-23815-4. OCLC 746835167. S2CID 26652686. According to 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."
External links
The Wikibook LaTeX has a page on the topic of: PGF/TikZ |
Wikimedia Commons has media related to TikZ diagrams. |
- PGF/TikZ on CTAN
- PGF/TikZ manual on CTAN
- PGF/TikZ gallery at TeXample.net
- LaTeXPiX. A freeware graphical editor generating (amongst others) PGF code, written for Microsoft Windows. Last updated 2009-12-28.
- TikzEdt. Combined wysiwyg/text editor designed for editing Tikz code, open source, written for Microsoft Windows and .NET 4.0. Runs also on Linux using Mono. Beta version 0.2.3 released in June 2013.
- TpX. Graphical editor that can generate PGF code and convert graphics in other formats into pgf. Freeware, written for Microsoft Windows. Version 1.5 released on 2008-12-07.
- KtikZ. Tikz code editor with instantaneous preview. Open source, written for Microsoft Windows, Ubuntu and Debian. Last updated on 2010-08-26.
- GraTeX Free visual graph creator for LaTeX (PGF & TikZ) written in Java for MS Windows, Linux, MacOS. Uploaded on 2012-06-10.