# Error while running PSTricks

When I am running PSTricks an error is coming like - File pstrick.sty no found. How can I get rid of this and can run my code

• the file is pstricks not pstrick fix the typo in your source file and then latex will find the file. – David Carlisle Nov 14 '17 at 17:05
• I have changed that – Vaibhav Nov 14 '17 at 17:13
• Remove all auxiliary files generated by the last latex run. – TeXnician Nov 14 '17 at 17:15
• is your main file called pstricks.tex? don't do that, call it something (anything) else. – David Carlisle Nov 14 '17 at 17:28
• yes call your file myfile.tex or some such, if you call it pstricks.tex then your document will load itself instead of loading the real pstricks code (which is in a file called pstricks.tex) – David Carlisle Nov 14 '17 at 19:45

You mention two unrelated errors.

If you save this file as pstricks.tex

\documentclass{article}

\usepackage{pstrick}

\begin{document}

zz
\end{document}


then you get the error

! LaTeX Error: File pstrick.sty' not found.


as there is no pstrick package.

If you correct that typo so that the file looks like

\documentclass{article}

\usepackage{pstricks}

\begin{document}

zz
\end{document}


Then you get the error

(./pstricks.tex

! LaTeX Error: Two \documentclass or \documentstyle commands.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.1 \documentclass{
article}
?


the problem here is that the pstricks package pstricks.sty is just a small latex wrapper that inputs pstricks.tex that should be all the core pstricks code but your document is in the input path so as shown by the (./pstricks.tex just before the error, so pstricks.sty just re-inputs your docuemnt and so you get an error when \docuemntclass is seen a second time.

Just rename the file to any other name say pstricks-test.tex make sure you delete the existing pstricks.tex then it will run without error:

This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
(./pstricks-test.tex
LaTeX2e <2017-04-15>
Babel <3.14> and hyphenation patterns for 84 language(s) loaded.
(/home/davidc/texmf/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/home/davidc/texmf/tex/latex/base/size10.clo))
(/usr/local/texlive/2017/texmf-dist/tex/latex/pstricks/pstricks.sty
(/usr/local/texlive/2017/texmf-dist/tex/generic/iftex/iftex.sty)
(/home/davidc/texmf/tex/latex/tools/shellesc.sty)
(/usr/local/texlive/2017/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2017/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(./dvips.def))
(/usr/local/texlive/2017/texmf-dist/tex/generic/xkeyval/pst-xkey.tex
(/usr/local/texlive/2017/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2017/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2017/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/local/texlive/2017/texmf-dist/tex/generic/xkeyval/keyval.tex)))))
(/usr/local/texlive/2017/texmf-dist/tex/generic/pstricks/pstricks.tex
(/usr/local/texlive/2017/texmf-dist/tex/generic/pstricks/pst-fp.tex
pst-fp' v0.05, 2010/01/17 (hv))
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2017/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
))
PSTricks' v2.77  <2017/10/04> (tvz)
(/usr/local/texlive/2017/texmf-dist/tex/generic/pstricks/pstricks.con))
(/usr/local/texlive/2017/texmf-dist/tex/generic/pstricks/pst-fp.tex))
(./pstricks-test.aux) [1] (./pstricks-test.aux) )
Output written on pstricks-test.dvi (1 page, 764 bytes).
Transcript written on pstricks-test.log.
`