World Library  
Flag as Inappropriate
Email this Article


Article Id: WHEBN0002177009
Reproduction Date:

Title: PSTricks  
Author: World Heritage Encyclopedia
Language: English
Subject: PdfTeX, Asymptote (vector graphics language), TeX, CircuiTikZ, XyMTeX
Publisher: World Heritage Encyclopedia


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:

   %% Triangle in red:
   %% Bezier curve in green:
   %% Circle in blue with radius 1:


Plotting sin(x) with pst-plot

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.

pst-plot provides commands for creating function graphs.

Consider the following example:

   \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

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 pst-plot 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.

pstricks-add extends pst-plot enabling also polar graphs and allowing the use algebraic notation for plots instead of RPN.

pst-math provides trigonometric functions in radians (since PostScript defaults to using degrees) and hyperbolic trigonometric functions.

pst-3dplot is used for creating 3D graphics like the following:

Hyperbolic paraboloid drawn using PSTricks package pst-3dplot

multido provides basic loop functionality for programming graphs with repeating elements:

Plotting a graph while varying parameters with multido

pst-eucl is a beta extension for easy creation of geometrical drawings.

Circumcircle of a triangle, illustrated with pst-eucl

There are many other extensions, for drawing Circuit diagrams, barcodes, graphs, trees, visualizing data, etc.


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 auto-pst-pdf. 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, 1008 pages, Heidelberg and Berlin 2010, ISBN 978-3-86541-403-8.
  • Herbert Voss; PSTricks – Graphics for TeX and LaTeX, 1st edition, UIT, 916 pages, Cambridge 2011, ISBN 978-1-906860-13-4.; 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.
This article was sourced from Creative Commons Attribution-ShareAlike 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, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government 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 non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Hawaii eBook Library are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.