# Using PSTricks with TeXmaker

I want to do some drawings using LaTeX. I use TeXmaker. What the commands that I need to set up to start using the PSTricks?

• Nothing special: load pstricks or/and any package of the family in your preamble, and compile With latex -> dvi -> ps. If your version of pdflatex is (relatively) recent, you even can compile with pdflatew --enable-write18 and obtain a pdf file. – Bernard Feb 6 '14 at 16:42
• Instead of using F1 button, you will just have to press F2, F4, F8 if I remember correctly. – ajeh Feb 6 '14 at 17:11
• For demo purpose: Download any PSTricks example .tex file and open with Texmaker. Now configure Texmaker QuickBuild as Options-->Configure-->QuickBuild-->Latex+dvips+ps2pdf+ViewPDF (preferable mostly due to speed) or XeLaTeX+ViewPDF with OK confirmation, then You can run PSTricks code using QuickBuild and view pdf. – texenthusiast Feb 6 '14 at 17:56

in TeXmaker choose "QuickBuild" (http://www.xm1math.net/texmaker/doc.html#SECTION22), which is by default the latex->dvips->ps2pdf route (http://www.xm1math.net/texmaker/texmakertop_big.png).

You can change the behaviour with options->Settings->QuickBuild

An alternative you can also run PSTricks documents with xelatex, which should be available by the menu of Texmaker.

Use the following packages in the preamble:

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

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{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 :

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 !!!

• it makes no sense to load pst-pdf. It is already done by auto-pst-pdf. And, of course, the exported code of latexdraw doesn't really looks nice! – user2478 May 30 '14 at 9:00
• Oh I didn't try without the pst-pdf package. I got all these after searching in internet. Thanks for letting me know that I can do the same with auto-pst-pdf only. I have tried it just now. And yes, the code of latexdraw doesn't look nice but I found it comfortable as a beginner. – Debashish May 30 '14 at 9:03