4 Answers
4

It seems you are using pdflatex to compile. Somehow, pstricks is not friendly with pdflatex. To compile documents that use pstricks, you should use either xelatex or latex->dvips->ps2pdf. To do so, you should run

xelatex yourtexfile.tex

from the command prompt. If you have an editor (which one you are using?), it will certianly have a button for this.

Or you may use the same pdflatex by adding pdf option to pstricks

\usepackage[svgnames,pdf]{pstricks}

But for this you should have the latest version of pstricks. The following code works for me with pdflatex (though I get 2 badboxes).

If you need more help to know how to use xelatex or latex->dvips->ps2pdf routes, please let us know with some details like which editor and tex distribution you are using.

Edit:

You can make xelatex work with texmaker. First install a latest version of texmaker (make it a fresh install). Then pull the dropdown menu (by clicking the arrow tip next to pdflatex as in picture). Scroll down to get xelatex ans select it. Now you should get the button saying xelatex instead of pdflatex.

the pdf option doesn't work in all cases ...
–
HerbertJan 14 '13 at 16:28

@Harish Kumar I do get a pdf output running xelatex from the command line. However, I do not get any output in my editor using the pdflatex code you posted. I have run this code in both Gummi and Texmaker, with the same bad result. I am not sure how to invoke xetex from within these systems.
–
PaulJan 14 '13 at 16:38

@Herbert True. But why? If pstricks works with pdflatex always and if the command names become less alien, I swear I will join pstricks gang also ;-). It has lot of goodies which I like but you know ... My humble request with you is -- please do something to get pstricks work with pdflatex always.
–
Harish KumarJan 14 '13 at 23:42

Maroon is not a predefined color, you need to load the xcolor package with the dvipsnames option. Adding the following line underneath the \usepackage[...]{geometry} should make it work: \usepackage[dvipsnames]{xcolor}.

Alternatively you can also add the svgnames/dvipsnames specification into the option of the documentclass, this will be passed on to the pstricks package, which will then hand it on to the xcolor package when it's loaded: \documentclass[12pt,svgnames]{article}
–
myrtilleJan 14 '13 at 14:39

Texmaker works very fine with PStricks codes. Use the following packages in the preamble:

\usepackage{pstricks-add}

\usepackage{auto-pst-pdf}

\usepackage{pst-pdf}

Before you run the file using Quick Build (usually F1 button), go to the Texmaker Options-> Configure Texmaker-> Quick Build and change the quick build command to "Latex+dvips+ps2pdf+viewpdf".

Now you are done. Oh but there may be one more problem cropping up. Something like "Enable Write 18" or "shell escape disabled". You can sort out that problem by the beautiful answer given in this link:
How can I enable write 18 on a MikTeX installation.

Now, how to write these PStricks codes ?? Do we have to remember all the commands ?? No !! not at all !! Its very easy to generate these codes automatically by drawing the figures using Latex Draw. You can get this amazing free software at this link: http://latexdraw.sourceforge.net/