Python in Physics
OSU logo
The content of this page is undergoing revision and will be moved to another site soon.
Technical Drawing

Table of Contents

PSTricks, LaTeX and Python

  • PSTricks and LaTeX can be used to create eps figures annotated with LaTeX mathematical labels. Python programs are used to incorporate pstricks code into a blank latex document and then create and eps figure by invoking the latex processor. The mathematical labels are then an integral part of the picture and will scale properly. The Python program creates objects, such as resistors and op amps, each of which consists of a basic shape and points to be used as positions for connections or labels. The shapes can be scaled, rotated and positioned anywhere, and the connection and label points transform as well. Each object then has as a set of attributes: path (the actual drawing of the object in pstricks code); important points for connections to other objects; common positions for labels (center, upper left, etc.). Connections between specific locations on two objects are made by creating a line between the appropriate positional attributes. The library of basic shapes consists primarily of electronic components and common functions, but any shape, such as a lens or a locomotive can be created.
  • Examples (Beware of large blocks of code labeled as comments by bracketing """ """ pairs.):
  • This works on Linux and Windows platforms. You must be familiar with both LaTeX and Python.
  • If you want to use the modules and programs email Bill Hetherington.