运行 PSTricks 时出错

运行 PSTricks 时出错

当我运行 PSTricks 时,出现错误,如 - File pstrick.sty no found。我该如何摆脱这个问题并运行我的代码

答案1

您提到了两个不相关的错误。

如果将此文件另存为pstricks.tex

\documentclass{article}

\usepackage{pstrick}

\begin{document}

zz
\end{document}

然后你得到错误

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

因为没有pstrick包裹。

如果你纠正了这个拼写错误,那么文件看起来就像

\documentclass{article}

\usepackage{pstricks}

\begin{document}

zz
\end{document}

然后你得到错误

(./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}
? 

这里的问题是,pstricks 包pstricks.sty只是一个小型的乳胶包装器,输入pstricks.tex应该是所有核心 pstricks 代码,但您的文档在输入路径中,如(./pstricks.tex错误之前所示,所以只需重新输入您的文档,所以当第二次看到pstricks.sty时你会收到一个错误。\docuemntclass

只需将文件重命名为其他任何名称,pstricks-test.tex确保删除现有的 pstricks.tex,然后它将运行而不会出现错误:

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.

相关内容