Creating Diagrams Using Macros
The pstricks package (alternate site) allows you to create complex diagrams & drawings in LaTeX documents. It uses a LaTeX syntax for defining the diagram and the PostScript language for rendering the diagram. It is very powerful, but can be a bit tedious. I usually print the grid from the example below, draw a rough sketch and convert to the appropriate commands.
If you are using pdflatex to produce PDF files directly, the pgf package (alternate site) provides similar capabilities to pstricks. To use this package simply download the package files and place in a folder called pgf under texinputs. Examples are provided in the user manual which comes with the package.
To install pstricks on your system:
- Go to the pstricks dvips folder (alternate site), and download all the files. Note that Windows may try to give them a different filename extension, in which case you will have to rename them. Make a folder called pstricks under the existing c:\texmf\dvips folder.
- Go to the pstricks generic folder (alternate site), and download all the files. Note that Windows may try to give them a different filename extension, in which case you will have to rename them. Make a folder called pstricks under the existing c:\usr\latex\texinputs folder which you made on installation, and store the files there.
- Go to the pstricks latex folder (alternate site), and download all the files. Note that Windows may try to give them a different filename extension, in which case you will have to rename them. Store the files in the c:\usr\latex\texinputs\pstricks folder as in the previous step.
- Select "Start-Programs-MiKTeX-MiKTeX Options" and press "Refresh Now" to update the filename database.
- Download the data files noise.dat and impresp.dat. These files are data files for the example, which are plotted. Download the source pstdemo.tex
- Compile pstdemo.tex to a PostScript file, and view with GhostView.
You may be interested in further PSTricks documentation, available from this link.