Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\documentclass[12pt]{article}
\usepackage[paperheight=9in,paperwidth=13.24in,margin=0in]{geometry}
\usepackage{pstricks}
\usepackage{graphicx}
\begin{document}
\thispagestyle{empty}
\psset{unit=1in}
\begin{pspicture}(13.24in,9in)
\psframe[fillstyle=solid,fillcolor=Maroon](0,0)(13.24,9)

\end{pspicture}

\end{document}

I am following a tutorial outlined here: How can I design a book cover?

I am following the Robbers book.

Everything seems fine until I paste the \psframe[fillstyle=solid,fillcolor=Maroon](0,0)(13.24,9)

What could be the problem?

share|improve this question

4 Answers 4

up vote 3 down vote accepted

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).

\documentclass[12pt]{article}
\usepackage[paperheight=9in,paperwidth=13.24in,margin=0in]{geometry}
\usepackage[svgnames,pdf]{pstricks}
\usepackage{graphicx}
\begin{document}
\thispagestyle{empty}
\psset{unit=1in}
\noindent
\begin{pspicture}(13.24in,9in)
\psframe[fillstyle=solid,fillcolor=Maroon](0,0)(13.24,9)
\end{pspicture}
\end{document}

enter image description here

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.

enter image description here

enter image description here

Don't forget to remove pdf option from pstricks while using xelatex.

share|improve this answer
    
the pdf option doesn't work in all cases ... –  Herbert Jan 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. –  Paul Jan 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 Kumar Jan 14 '13 at 23:42
    
@HarishKumar One TeX.SX question example where [pdf] has problem. You might be aware of PSTricks using pdflatex at TUG 2010 and Basics of PSTricks at river-valley.tv where TUG Proc videos are available –  texenthusiast Jan 15 '13 at 0:21
1  
@HarishKumar: it needs an environment pspicture or postscript for the embedded PSTricks code. Then it will always work. –  Herbert Jan 15 '13 at 8:13

use

\usepackage[dvipsnames]{pstricks}


to activate the color names. And don't forget the \noindent

[...]
\psset{unit=1in}\noindent

\begin{pspicture}(13.24,9)
    
[...]
share|improve this answer

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}.

This sample works for me:

\documentclass[12pt]{article}
\usepackage[paperheight=9in,paperwidth=13.24in,margin=0in]{geometry}
\usepackage[dvipsnames]{xcolor}
\usepackage{pstricks}
\usepackage{graphicx}
\begin{document}
\thispagestyle{empty}
\psset{unit=1in}
\begin{pspicture}(13.24in,9in)
\psframe[fillstyle=solid,fillcolor=Maroon](0,0)(13.24,9)
\end{pspicture}

\end{document}
share|improve this answer
    
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} –  myrtille Jan 14 '13 at 14:39
    
The above code does not work for me. Here is the output of the log file pastebin.ubuntu.com/1530953 –  Paul Jan 14 '13 at 14:51
    
use xelatex or latex->dvips->ps2pdf –  Herbert Jan 14 '13 at 15:04
    
This is probably a stupid question, but how do I invoke xelatex? I have looked on the internet, but can not seem to find an answer. –  Paul Jan 14 '13 at 15:42
    
which editor do you use? –  Herbert Jan 14 '13 at 16:25

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

  1. \usepackage{pstricks-add}
  2. \usepackage{auto-pst-pdf}
  3. \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".

config

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.

I am providing a sample tex file for drawing a simple graph:

\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}
\usepackage{pst-pdf}
\begin{document}
\begin{figure}[h]
\begin{center}
\psscalebox{0.5 0.5} % Change this value to rescale the drawing.
{
\begin{pspicture}(0,-2.195)(7.73,2.195)
\psline[linecolor=black, linewidth=0.04, dotsize=0.07055cm 6.0]{-*}(3.2,1.805)(1.2,-0.595)
\psline[linecolor=black, linewidth=0.04, dotsize=0.07055cm 6.0]{-*}(3.2,1.805)(2.4,-1.395)
\psline[linecolor=black, linewidth=0.04, dotsize=0.07055cm 6.0]{-*}(3.2,1.805)(4.0,-1.395)
\psline[linecolor=black, linewidth=0.04, dotsize=0.07055cm 6.0]{*-*}(3.2,1.805)(5.6,-0.195)
\rput{66.6232}(2.6010673,-3.5480006){\psarc[linecolor=black, linewidth=0.04, linestyle=dashed, dash=0.17638889cm 0.10583334cm, dimen=outer](4.0,0.205){1.6}{208.56584}{270.0}}
\rput[bl](3.6,1.805){\Huge{$u$}}
\rput[bl](0.0,-1.395){\Large{ 1($\beta$)}}
\rput[bl](2.0,-2.195){\Large{ 2($\beta$)}}
\rput[bl](4.0,-2.195){\Large{ 3($\beta$)}}
\rput[bl](6.0,-0.595){\Large{ $n-1(\beta)$}}
\end{pspicture}
}
\end{center}
\caption{Graph of type - I matrix}\label{t1}
\end{figure}
\end{document}

The output in the pdf is :

Figure generated by PStricks code

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/

Thats all you need to know about using PStricks codes !!!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.