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?
2 Answers
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:
- \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.
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 :

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 byauto-pst-pdf. And, of course, the exported code of latexdraw doesn't really looks nice! – May 30 '14 at 09: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 09:03
.texfile and open with Texmaker. Now configure TexmakerQuickBuildasOptions-->Configure-->QuickBuild-->Latex+dvips+ps2pdf+ViewPDF(preferable mostly due to speed) orXeLaTeX+ViewPDFwithOKconfirmation, then You can run PSTricks code usingQuickBuildand view pdf. – texenthusiast Feb 06 '14 at 17:56