PGF/TikZ: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
added Template:Mindmaps, which includes this article
added headings; moved a paragraph; cleaned up references; removed red links; removed links from 'See also' section that are already in article body, per WP:NOTSEEALSO; added 'Libraries' section
Line 16: Line 16:
}}
}}


'''PGF/Ti''k''Z''' is a pair of languages for producing [[vector graphics]] from a geometric/algebraic description. 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]]. [[Till Tantau]] is the designer of these languages, and 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").
'''PGF/Ti''k''Z''' is a pair of languages for producing [[vector graphics]] from a geometric/algebraic description. 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]]. Till Tantau is the designer of the PGF and Ti''k''Z languages, and 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]]. Since TeX itself is not concerned with graphics, the interpreter supports multiple TeX output backends: [[dvips]], [[dvipdfm]]/[[dvipdfmx]]/[[XeTeX|xdvipdfmx]], [[TeX4ht]], and [[pdftex]]'s internal [[PDF]] output driver. 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 Tik Z and PGF Packages: Manual for version 2.10|url=http://www.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf|format=PDF|author=Till Tantau|date=20 February 2008|accessdate=6 May 2010|deadurl=yes|archiveurl=https://web.archive.org/web/20110109090729/http://www.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf|archivedate=9 January 2011|df=}}</ref> PGF/Ti''k''Z comes with extensive documentation. The version 3.0.0 manual has 1165 pages.
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=http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf |website=[[CTAN]].org |accessdate=2019-06-17}}</ref>{{rp|116}} Since TeX itself is not concerned with graphics, the interpreter supports multiple TeX output backends: [[dvips]], [[dvipdfm]]/[[dvipdfmx]]/[[XeTeX|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=http://www.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf|format=PDF|author=Till Tantau|date=20 February 2008|accessdate=6 May 2010|deadurl=yes|archiveurl=https://web.archive.org/web/20110109090729/http://www.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf|archivedate=9 January 2011|df=}}</ref> PGF/Ti''k''Z comes with extensive documentation; the version 3.1.3 manual has over 1200 pages.<ref name="manual"/>


The standard LaTeX <code>picture</code> environment can also be used as a front end for PGF merely by using the <code>pgfpict2e</code> package.
The standard LaTeX <code>picture</code> environment can also be used as a front end for PGF merely 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 |accessdate=2019-06-17}}</ref> Most of the development is done by Till Tantau.<ref>{{cite web |url=https://github.com/pgf-tikz/pgf/graphs/contributors |title=Contributors to pgf-tikz/pgf |website=[[GitHub]].com |accessdate=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 |accessdate=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}} See also the older [http://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"/>
Several graphical editors can produce output for PGF/Ti''k''Z like the [[KDE]] program [[Cirkuit]],<ref>{{cite web | url = http://wwwu.uni-klu.ac.at/magostin/cirkuit.html | title = Cirkuit | first = Matteo | last = Agostinelli }}</ref> and the math drawing program [[GeoGebra]]. Export to Ti''k''Z is also available as extensions for [[Inkscape]],<ref>{{cite web | url = https://github.com/kjellmf/svg2tikz| title = Inkscape to TikZ exporter }}</ref> [[Blender (software)|Blender]],<ref>https://github.com/kjellmf/blend2tikz</ref> [[MATLAB]],<ref>{{cite web | url = http://www.mathworks.com/matlabcentral/fileexchange/22022 | title = matlab2tikz | first = Nico | last = Schlömer }}</ref> [[matplotlib]],<ref>{{ cite web | url = https://github.com/nschloe/matplotlib2tikz | title = matplotlib2tikz | first = Nico | last = Schlömer }}</ref> [[Gnuplot]]<ref>{{ cite web | url = http://www.gnuplot.info/docs_5.2/Gnuplot_5.2.pdf | format = PDF | title = gnuplot 5.2: An Interactive Plotting Program | editor1-first = Thomas | editor1-last = Williams | editor2-first = Colin | editor2-last = Kelley | year = 2017 }}</ref> and [[R (programming language)|R]].<ref>{{cite web | url = https://cran.r-project.org/package=tikzDevice | title = tikzDevice: R Graphics Output in LaTeX Format }}</ref>


==Export==
The project has been under constant development since 2005. Most of the development is done by [[Till Tantau]].<ref>{{cite web | url = http://www.texample.net/tikz/builds/ | title = TikZ and PGF builds | work = TeXample.net }}</ref> Version 3.0.0 was released on 2013-12-20.<ref>{{cite web | url = http://pgf.sourceforge.net/ | title = PGF Web Page }}</ref> One of the major new features is [[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}}; see also the older [http://www.tcs.uni-luebeck.de/downloads/mitarbeiter/tantau/2012-gd-presentation.pdf GD 2012 presentation]</ref> This version also added a new data visualization method and support for direct [[SVG]] output via the new [[dvisvgm]] driver.<ref>https://sourceforge.net/projects/pgf/files/pgf/version%203.0.0/</ref>
Several graphical editors can produce output for PGF/Ti''k''Z, such as the [[KDE]] program Cirkuit<ref>{{cite web |url=http://wwwu.uni-klu.ac.at/magostin/cirkuit.html | title=Cirkuit |first=Matteo |last=Agostinelli |date=31 December 2011 |website=uni-klu.ac.at |accessdate=2019-06-17}}</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 |accessdate=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 |accessdate=2019-06-17}}</ref> [[Blender (software)|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 |accessdate=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 |accessdate=2019-06-17}}</ref> [[matplotlib]],<ref>{{cite web |url=https://github.com/nschloe/matplotlib2tikz |title=matplotlib2tikz: Convert matplotlib figures to TikZ/PGFplots for smooth integration into LaTeX |first=Nico |last=Schlömer |website=[[GitHub]].com |accessdate=2019-06-17}}</ref> [[Gnuplot]]<ref>{{cite web |url=http://www.gnuplot.info/docs_5.2/Gnuplot_5.2.pdf |format=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 |accessdate=2019-06-17}}</ref> and [[R (programming language)|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 |accessdate=2019-06-17}}</ref>

==Libraries==
Ti''k''Z features [[Library (computing)|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 projection|3D drawing]]{{snd}}<code>3d</code>
* [[Finite automata]] and [[Turing machine]]s{{snd}}<code>automata</code>
* [[Coordinate system]] calculations{{snd}}<code>calc</code>
* [[Calendar]]s{{snd}}<code>calendar</code>
* Chains: [[Node (computer science)|node]]s typically connected by edges and arranged in rows and columns{{snd}}<code>chain</code>
* [[Logic circuit]] and electrical [[circuit diagram]]s{{snd}}<code>circuits.logic</code> and <code>circuits.ee</code>
* [[Entity–relationship diagram]]s{{snd}}<code>er</code>
* [[Polygon folding]] diagrams{{snd}}<code>folding</code>
* [[L-system]] drawings{{snd}}<code>lindenmayersystems</code>
* Sequences of basic math [[Operation (mathematics)|operation]]s{{snd}}<code>math</code>
* [[Matrix (mathematics)|Matrices]]{{snd}}<code>matrix</code>
* [[Mind map]]s{{snd}}<code>mindmap</code>
* [[Three-point perspective]] drawings{{snd}}<code>perspective</code>
* [[Petri net]]s{{snd}}<code>petri</code>
* [[Resource Description Framework|RDF]] [[semantic annotation]]s (only in [[SVG]] output){{snd}}<code>rdf</code>
* Special [[shape]]s and [[symbol]]s{{snd}}<code>shapes.geometric</code> and <code>shapes.symbols</code>
* [[Magnification]] of part of a graphic in an inset{{snd}}<code>spy</code>
* [[Vector graphics|Paths]] in [[SVG]] syntax{{snd}}<code>svg.path</code>
* [[Tree structure|Tree]]s{{snd}}<code>trees</code>
* [[Turtle graphics]]{{snd}}<code>turtle</code>
* [[Digital zoom|Zooming]] and [[Panning (camera)|panning]] graphics{{snd}}<code>views</code>
{{Div col end}}


==See also==
==See also==
{{Portal|Free and open-source software}}
{{Portal|Free and open-source software}}
* [[Asymptote (vector graphics language)]]
* [[Asymptote (vector graphics language)]]
* [[PSTricks]]
* [[MetaPost]]
* [[GeoGebra]], free dynamic mathematics program with PGF/Ti''k''Z export


==References==
==References==
Line 38: Line 64:
==Further reading==
==Further reading==
{{Refbegin}}
{{Refbegin}}
* Andrew Mertz and William Slough, ''Graphics with PGF and TikZ'', PracTeX Journal, 2007 (1), [http://www.tug.org/pracjourn/2007-1/mertz/ abstract], [http://www.tug.org/pracjourn/2007-1/mertz/mertz.pdf full text]. [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.
* {{cite |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.
* Claudio Beccari, ''[http://www.tug.org/pracjourn/2007-1/beccari/beccari.pdf Graphics in LaTeX]'' (Comparison of several graphics systems in LaTeX), PracTeX Journal, 2007 (1)
* {{cite |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|author=Marc van Dongen|title=LaTeX and Friends|year=2012|publisher=Springer|isbn=978-3-642-23816-1}} According to [http://www.tug.org/books/reviews/tb102reviews-ltxfriends.html a 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."
* {{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}} According to [http://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}}
{{Refend}}


Line 46: Line 72:
{{Wikibooks|1=LaTeX|2=PGF/TikZ}}
{{Wikibooks|1=LaTeX|2=PGF/TikZ}}
{{Commons category|TikZ diagrams}}
{{Commons category|TikZ diagrams}}
* [http://www.ctan.org/tex-archive/graphics/pgf/ PGF/Ti''k''Z on CTAN]
* [http://www.ctan.org/tex-archive/graphics/pgf/ PGF/Ti''k''Z] on [[CTAN]]
* [http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf PGF/Ti''k''Z manual] on [[CTAN]]
* {{SourceForge|pgf|PGF}}
* [http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf PGF/Ti''k''Z manual]
* [http://www.texample.net/tikz/examples/ PGF/Ti''k''Z gallery at TeXample.net]
* [http://www.texample.net/tikz/examples/ PGF/Ti''k''Z gallery at TeXample.net]
* [http://www.ctan.org/pkg/latexpix LaTeXPiX]. A freeware graphical editor generating (amongst others) PGF code, written for [[Microsoft Windows]]. Last updated 2009-12-28.
* [http://www.ctan.org/pkg/latexpix LaTeXPiX]. A freeware graphical editor generating (amongst others) PGF code, written for [[Microsoft Windows]]. Last updated 2009-12-28.

Revision as of 18:44, 17 June 2019

PGF/TikZ ("PGF and TikZ")
Original author(s)Till Tantau
Developer(s)Till Tantau, Christian Feuersänger
Stable release
3.1.3 / May 13, 2019; 4 years ago (2019-05-13)
Repository
Written inTeX, Lua
Operating systemMultiplatform (TeX)
TypeVector graphics languages
LicenseDual License: GNU General Public License or LaTeX Project Public License
Websitegithub.com/pgf-tikz/pgf

PGF/TikZ is a pair of languages for producing vector graphics from a geometric/algebraic description. 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, and 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").

Overview

The PGF/TikZ interpreter can be used from the popular LaTeX and ConTeXt macro packages, and also directly from the original TeX.[1]: 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.[1]: 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.[2] PGF/TikZ comes with extensive documentation; the version 3.1.3 manual has over 1200 pages.[1]

The standard LaTeX picture environment can also be used as a front end for PGF merely by using the pgfpict2e package.[1]: 27 

The project has been under constant development since 2005.[3] Most of the development is done by Till Tantau.[4] Version 3.0.0 was released on 20 December 2013.[5] One of the major new features of this version was graph drawing using the graphdrawing package, which however requires LuaTeX.[6] This version also added a new data visualization method and support for direct SVG output via the new dvisvgm driver.[5]

Export

Several graphical editors can produce output for PGF/TikZ, such as the KDE program Cirkuit[7] and the math drawing program GeoGebra.[8] Export to TikZ is also available as extensions for Inkscape,[9] Blender,[10] MATLAB,[11] matplotlib,[12] Gnuplot[13] and R.[14]

Libraries

TikZ features libraries for easy drawing of many kinds of diagrams, such as the following (alphabetized by library name):[1]

See also

References

  1. ^ a b c d e "The TikZ and PGF Packages: Manual" (PDF). CTAN.org. Retrieved 2019-06-17.
  2. ^ Till Tantau (20 February 2008). "The TikZ and PGF Packages: Manual for version 2.10" (PDF). p. 17. Archived from the original (PDF) on 9 January 2011. Retrieved 6 May 2010. {{cite web}}: Unknown parameter |deadurl= ignored (|url-status= suggested) (help)
  3. ^ "Commits – pgf-tikz/pgf". GitHub.com. Retrieved 2019-06-17.
  4. ^ "Contributors to pgf-tikz/pgf". GitHub.com. Retrieved 2019-06-17.
  5. ^ a b "PGF and TikZ – Graphic systems for TeX – Browse /pgf/version 3.0.0". SourceForge.net. 2013-12-20. Retrieved 2019-06-17.
  6. ^ 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.
  7. ^ Agostinelli, Matteo (31 December 2011). "Cirkuit". uni-klu.ac.at. Retrieved 2019-06-17.
  8. ^ "Export to LaTeX (PGF, PSTricks) and Asymptote – GeoGebra Manual". wiki.geogebra.org. Retrieved 2019-06-17.
  9. ^ "svg2tikz: An Inkscape extension for exporting SVG paths as TikZ/PGF paths". GitHub.com. Retrieved 2019-06-17.
  10. ^ "blend2tikz: Export Blender (2.4x) curves to TikZ format for use with TeX". GitHub.com. Retrieved 2019-06-17.
  11. ^ Schlömer, Nico. "matlab2tikz – File Exchange – MATLAB Central". MathWorks.com. Retrieved 2019-06-17.
  12. ^ Schlömer, Nico. "matplotlib2tikz: Convert matplotlib figures to TikZ/PGFplots for smooth integration into LaTeX". GitHub.com. Retrieved 2019-06-17.
  13. ^ Williams, Thomas; Kelley, Colin, eds. (October 2018). "gnuplot 5.2: An Interactive Plotting Program" (PDF). gnuplot.info. Retrieved 2019-06-17.
  14. ^ "tikzDevice: R Graphics Output in LaTeX Format". cran.r-project.org. Retrieved 2019-06-17.

Further reading

External links