编写以下非常简单的程序时,我遇到了一些问题。我习惯用纯 TeX 编写,在这种情况下,我尝试使用 PSTricks 制作图片,并首先使用 \pspicture 调整其大小。该程序是:
\input pstricks
\pspicture (0,0)(5,5)
\endpspicture
\bye
但是当我使用 TeX 进行编译时,遇到了以下错误:
Command Line: tex.exe --src --interaction=errorstopmode "figura.tex"
Startup Folder: C:\Users\MT\Documents\TeX
This is TeXk, Version 3.14159265 (TeX Live 2015/W32TeX) (preloaded format=tex)
Source specials enabled.
(./figura.tex (c:/texlive/texmf-dist/tex/generic/pstricks/pstricks.tex
we are running tex and have to define some LaTeX commands ...
(c:/texlive/texmf-dist/tex/generic/xkeyval/pst-xkey.tex
2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
(c:/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(c:/texlive/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(c:/texlive/texmf-dist/tex/generic/xkeyval/keyval.tex))
2014/12/03 v2.7a key=value parser (HA)
(c:/texlive/texmf-dist/tex/generic/xkeyval/xkvtxhdr.tex
2005/02/22 v1.1 xkeyval TeX header (HA))))
(c:/texlive/texmf-dist/tex/generic/pstricks/pst-fp.tex
`pst-fp' v0.05, 2010/01/17 (hv))
(c:/texlive/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
(c:/texlive/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex))
(c:/texlive/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(c:/texlive/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex))
(c:/texlive/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
(c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex)
(c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex
(c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex)
(c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code
.tex)
(c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex)
(c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.te
x) (c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex)
(c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex)
(c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex)
(c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics
.code.tex))) (c:/texlive/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
))
`PSTricks' v2.64b <2015/14/11> (tvz)
(c:/texlive/texmf-dist/tex/generic/pstricks/pstricks.con))
! Undefined control sequence.
\endpspicture ...z@ \box \pst@hbox \else \fboxsep
=0pt \fbox {\rule [-\pst@s...
l.5 \endpspicture
? x
No pages of output.
Transcript written on figura.log.
_____________________________________________________________________
TeX Compilation Report (Pages: 0)
Errors: 1 Warnings: 0 Bad Boxes: 0
_____________________________________________________________________
有什么问题?
答案1
pstricks.tex
让我们看看在 TeX Live 2014 结尾处找到的相关代码(带[...]
I 的代码不重要)
\def\endpspicture{%
[...]
\if@star\setbox\pst@hbox=\hbox{\clipbox@@\z@}\fi%
\leavevmode\box\pst@hbox%
\endgroup%
\psset[pstricks]{shift=0}% reset value
}
TeX Live 2015 中同样如此
\def\endpspicture{%
[...]
\if@star\setbox\pst@hbox=\hbox{\clipbox@@\z@}\fi
\leavevmode\ifdim\overfullrule=\z@\box\pst@hbox\else
\fboxsep=0pt
\fbox{\rule[-\pst@shift]{0pt}{\ht\pst@hbox}\rule{\wd\pst@hbox}{0pt}}\fi
\endgroup%
\psset[pstricks]{shift=0}% reset value
}
这是 TeX Live 2016 的版本
\def\endpspicture{%
[...]
\if@star\setbox\pst@hbox=\hbox{\clipbox@@\z@}\fi
\leavevmode
\ifdim\overfullrule=\z@
\box\pst@hbox
\else
\expandafter\ifx\csname @latexerr\endcsname\relax
\box\pst@hbox
\else % do we have LaTeX?
\fboxsep=0pt
\fbox{\rule[-\pst@shift]{0pt}{\ht\pst@hbox}\rule{\wd\pst@hbox}{0pt}}%
\fi
\fi
\endgroup
\psset[pstricks]{shift=0}% reset value
}
您可以清楚地看到,如果\overfullrule
设置为大于 0pt 的值(这是纯 TeX 中的默认值),则在使用 TeX Live 2015 时会执行一些 LaTeX 代码。
解决方案:更新您的 TeX 发行版。
如果不可能,请设置\overfullrule
为 0pt
\input pstricks
\overfullrule=0pt
\pspicture (0,0)(5,5)
\endpspicture
\bye
或者,
\input pstricks
\catcode`@=11
\def\fboxsep#1\fi{\box\pst@hbox\fi}
\catcode`@=12
\pspicture (0,0)(5,5)
\endpspicture
\bye