PSTricks is a set of macros that allow the inclusion of PostScript drawings directly inside TeX or LaTeX code. It was originally written by Timothy Van Zandt and has been maintained in recent years by Denis Girou, Sebastian Rahtz and Herbert Voss.
Basic usage
PSTricks example (scaled)
There is a wide array of commands available for making graphics. Coordinates in PSTricks are always represented in round parenthesis as the following example (scaled) illustrates:
\begin{pspicture}(5,5)
%% Triangle in red:
\psline[linecolor=red](1,1)(5,1)(1,4)(1,1)
%% Bezier curve in green:
\pscurve[linecolor=green,linewidth=2pt,%
showpoints=true](5,5)(3,2)(4,4)(2,3)
%% Circle in blue with radius 1:
\pscircle[linecolor=blue,linestyle=dashed](3,2.5){1}
\end{pspicture}
Extensions
Plotting
sin(
x) with
pstplot
PSTricks commands are low level, so many LaTeX packages have been made in order to ease the creation of several kinds of graphics that are commonly used on mathematical typesetting.
pstplot provides commands for creating function graphs.
Consider the following example:
\begin{pspicture*}(7,2)(7,2)
\psaxes[labels=none](0,0)(7,2)(7,2) % sets up axis
\psplot[linecolor=blue, linewidth=1.5pt]% % plots the sinewave
{7}{7}{x 0.01745329252 div sin} % notice the RPN expression
\uput[45](3.1415926,0){$\pi$} % these are the labels
\uput[90](1.570796,0){$\pi/2$} % \uput is a box positioned at [angle]
\uput[90](1.570796,0){$\pi/2$} % relative to (x,y) coordinate
\uput[135](3.1415926,0){$\pi$} % and putting { content } on the box
\psline[linewidth=1pt,linecolor=red,linestyle=dotted]% % red dotted lines
(1.57079632,1)(1.57079632,0)
\psline[linewidth=1pt,linecolor=red,linestyle=dotted]%
(1.57079632,1)(1.57079632,0)
\end{pspicture*}
The previous example also illustrate that TeX commands can be used as elements into the pictures. Since PostScript uses RPN style for mathematical operations, the argument to pstplot must be supplied in the same form. An alternative is to use the optional argument algebraic, then the formula can be described as an algebraic expression.
pstricksadd extends pstplot enabling also polar graphs and allowing the use algebraic notation for plots instead of RPN.
pstmath provides trigonometric functions in radians (since PostScript defaults to using degrees) and hyperbolic trigonometric functions.
pst3dplot is used for creating 3D graphics like the following:
Hyperbolic paraboloid drawn using PSTricks package pst3dplot
multido provides basic loop functionality for programming graphs with repeating elements:
Plotting a graph while varying parameters with multido
psteucl is a beta extension for easy creation of geometrical drawings.
Circumcircle of a triangle, illustrated with psteucl
There are many other extensions, for drawing Circuit diagrams, barcodes, graphs, trees, visualizing data, etc.
Compatibility
PSTricks is only fully compatible with TeX systems using PostScript intermediates, including but not limited to eTeX and others. However, it is not compatible with the widely used pdfTeX engine in PDF mode. As pdfTeX is the default engine in most current installations, users of PSTricks must either force pdfTeX to DVI mode or use autopstpdf. PGF/TikZ is an alternative to PSTricks that is compatible with pdfTeX.
Software which supports PSTricks output
See also
Further reading

Herbert Voss; PSTricks – Grafik für TeX und LaTeX, 6th edition, DANTE and Lehmanns.media, 1008 pages, Heidelberg and Berlin 2010, ISBN 9783865414038.

Herbert Voss; PSTricks – Graphics for TeX and LaTeX, 1st edition, UIT, 916 pages, Cambridge 2011, ISBN 9781906860134.; review in TUGboat
External links

Official website

PSTricks documentation.

PSTricks examples.

LaTeXDraw, a free and open source graphical editor generating PSTricks code, written in Java.

JPicEdt, another free and open source graphical editor generating PSTricks code, written in Java.

LaTeXPiX, a freeware graphical editor generating (amongst others) PSTricks code, written for Windows OS.


Macro packages



Alternative TeX engines



Distributions



Community



Related



This article was sourced from Creative Commons AttributionShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, EGovernment Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a nonprofit organization.