1

Code

\documentclass{article}

\listfiles

\usepackage{multido}
\usepackage{pstricks}

\begin{document}

\begin{figure}
 \psset{unit = 0.36}
 \centering
  \begin{pspicture}(-1.7,-1.1)(31.9,21.95)
    \psline{->}(-1,0)(31,0)
    \uput[0](31,0){$T$}
    \psline{->}(0,-1)(0,21)
    \uput[90](0,21){$N$}
    \rput(-0.85,-0.93){\footnotesize$0$}
    \multido{\i = 1+2}{15}{\psline(\i,-0.15)(\i,0.15)}
    \multido{\i = 2+2}{15}{%
      \psline(\i,-0.3)(\i,0.3)
      \uput[270](\i,-0.3){\footnotesize$\i$}}
    \multido{\i = 1+2}{10}{\psline(-0.15,\i)(0.15,\i)}
    \multido{\iA = 10+10, \iB = 2+2}{10}{%
      \psline(-0.3,\iB)(0.3,\iB)
      \uput[180](-0.3,\iB){\footnotesize$\iA$}}
   {\psset{linewidth = 0.1\pslinewidth}
    \multido{\r = 0.2+0.2}{100}{\psline(0,\r)(30,\r)}
    \multido{\r = 0.2+0.2}{150}{\psline(\r,0)(\r,20)}}
   {\psset{linewidth = 0.5\pslinewidth}
    \multido{\i = 1+1}{20}{\psline(0,\i)(30,\i)}
    \multido{\i = 1+1}{30}{\psline(\i,0)(\i,20)}}
  \end{pspicture}
\end{figure}

\end{document}

Terminal

 *File List*
 article.cls    2020/04/10 v1.4m Standard LaTeX document class
  size10.clo    2020/04/10 v1.4m Standard LaTeX file (size option)
 multido.sty    2004/05/17 package wrapper for PSTricks `multido.tex', (HV/RN)
 multido.tex    2010/05/14 v1.42 `multido' (tvz,hv)
pstricks.sty    2020/06/11 v0.70 LaTeX wrapper for `PSTricks' (RN,HV)
   iftex.sty    2020/03/06 v1.0d TeX engine tests
  xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
   xetex.def    2020/08/26 v5.0i Graphics/color driver for xetex
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
 xkeyval.sty    2020/11/20 v2.8 package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
pstricks.tex    2020/09/18 v3.01 `PSTricks' (tvz,hv)
  pst-fp.tex    2020/09/18 v3.01 `PST-fp' (hv)
pstricks-xetex.def
l3backend-xetex.def    2021-02-18 L3 backend support: XeTeX
  ts1cmr.fd    2019/12/16 v2.5j Standard LaTeX font definitions

Output

With xelatex:

enter image description here

With latex + dvips + ps2pdf:

enter image description here

Question

Why is the output all wrong when compiling via xelatex and how do I fix it?

P.S. This happens to other documents with PSTricks code as well, where I have to compile via xelatex.

Logfile

This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020) (preloaded format=xelatex 2021.2.23)  25 FEB 2021 02:42
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**test.tex
(./test.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-18>
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option)
)
\c@part=\count175
\c@section=\count176
\c@subsection=\count177
\c@subsubsection=\count178
\c@paragraph=\count179
\c@subparagraph=\count180
\c@figure=\count181
\c@table=\count182
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
)
(/usr/local/texlive/2020/texmf-dist/tex/latex/multido/multido.sty
Package: multido 2004/05/17 package wrapper for PSTricks `multido.tex', (HV/RN)


(/usr/local/texlive/2020/texmf-dist/tex/generic/multido/multido.tex
 v1.42, 2010/05/14 <tvz>
\multido@count=\count183
\multidocount=\count184
\multido@stuff=\toks15
)
File: multido.tex 2010/05/14 v1.42 `multido' (tvz,hv)
)
(/usr/local/texlive/2020/texmf-dist/tex/latex/pstricks/pstricks.sty
Package: pstricks 2020/06/11 v0.70 LaTeX wrapper for `PSTricks' (RN,HV)

(/usr/local/texlive/2020/texmf-dist/tex/generic/iftex/iftex.sty
Package: iftex 2020/03/06 v1.0d TeX engine tests
)
(/usr/local/texlive/2020/texmf-dist/tex/latex/xcolor/xcolor.sty
Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK)

(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-cfg/color.cfg
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package xcolor Info: Driver file: xetex.def on input line 225.

(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-def/xetex.def
File: xetex.def 2020/08/26 v5.0i Graphics/color driver for xetex
)
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348.
Package xcolor Info: Model `RGB' extended on input line 1364.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371.
)
(/usr/local/texlive/2020/texmf-dist/tex/generic/xkeyval/pst-xkey.tex
File: pst-xkey.tex 2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)

(/usr/local/texlive/2020/texmf-dist/tex/latex/xkeyval/xkeyval.sty
Package: xkeyval 2020/11/20 v2.8 package option processing (HA)

(/usr/local/texlive/2020/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/xkeyval/xkvutils.tex
\XKV@toks=\toks16
\XKV@tempa@toks=\toks17

(/usr/local/texlive/2020/texmf-dist/tex/generic/xkeyval/keyval.tex))
\XKV@depth=\count185
File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
)))
(/usr/local/texlive/2020/texmf-dist/tex/generic/pstricks/pstricks.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pstricks/pst-fp.tex
`pst-fp' v0.05, 2010/01/17 (hv)
\pstFP@xs=\count186
\pstFP@xia=\count187
\pstFP@xib=\count188
\pstFP@xfa=\count189
\pstFP@xfb=\count190
\pstFP@rega=\count191
\pstFP@regb=\count192
\pstFP@regs=\count193
\pstFP@times=\count194
)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
\pgfutil@everybye=\toks18
\pgfutil@tempdima=\dimen139
\pgfutil@tempdimb=\dimen140

(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
\pgfkeys@pathtoks=\toks19
\pgfkeys@temptoks=\toks20

(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex
\pgfkeys@tmptoks=\toks21
))
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
Loading pgffor.code.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex
\pgf@x=\dimen141
\pgf@xa=\dimen142
\pgf@xb=\dimen143
\pgf@xc=\dimen144
\pgf@y=\dimen145
\pgf@ya=\dimen146
\pgf@yb=\dimen147
\pgf@yc=\dimen148
\c@pgf@counta=\count195
\c@pgf@countb=\count196
\c@pgf@countc=\count197
\c@pgf@countd=\count198
\pgfutil@tempcnta=\count199
\pgfutil@tempcntb=\count266
)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
\pgfmath@dimen=\dimen149
\pgfmath@count=\count267
\pgfmath@box=\box47
\pgfmath@toks=\toks22
\pgfmath@stack@operand=\toks23
\pgfmath@stack@operation=\toks24
)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex
\c@pgfmathroundto@lastzeros=\count268
))
\pgffor@iter=\dimen150
\pgffor@skip=\dimen151
\pgffor@stack=\toks25
\pgffor@toks=\toks26
)
\psLoopIndex=\count269

`PSTricks' v3.01  <2020/09/18> (tvz,hv)
\pst@dima=\dimen152
\pst@dimb=\dimen153
\pst@dimc=\dimen154
\pst@dimd=\dimen155
\pst@dimg=\dimen156
\pst@dimh=\dimen157
\pst@dimm=\dimen158
\pst@dimn=\dimen159
\pst@dimo=\dimen160
\pst@dimp=\dimen161
\pst@hbox=\box48
\pst@ibox=\box49
\pst@boxg=\box50
\pst@cnta=\count270
\pst@cntb=\count271
\pst@cntc=\count272
\pst@cntd=\count273
\pst@cntg=\count274
\pst@cnth=\count275
\pst@cntm=\count276
\pst@cntn=\count277
\pst@cnto=\count278
\pst@cntp=\count279
\@zero=\count280
\pst@toks=\toks27
(/usr/local/texlive/2020/texmf-dist/tex/xelatex/xetex-pstricks/pstricks.con
(/usr/local/texlive/2020/texmf-dist/tex/generic/pstricks/config/xdvipdfmx.cfg))
\psunit=\dimen162
\psxunit=\dimen163
\psyunit=\dimen164
\pst@C@@rType=\count281
\pslinewidth=\dimen165
\psk@startLW=\dimen166
\psk@endLW=\dimen167
\pst@customdefs=\toks28
\pslinearc=\dimen168
\pst@symbolStep=\dimen169
\pst@symbolWidth=\dimen170
\pst@symbolLinewidth=\dimen171
\everypsbox=\toks29
\psframesep=\dimen172
\pslabelsep=\dimen173
\sh@wgridXunit=\dimen174
\sh@wgridYunit=\dimen175
\pst@shift=\dimen176
(/usr/local/texlive/2020/texmf-dist/tex/xelatex/xetex-pstricks/pstricks.con
(/usr/local/texlive/2020/texmf-dist/tex/generic/pstricks/config/xdvipdfmx.cfg
Using PSTricks configuration for XeTeX+xdvipdfmx
)))
File: pstricks.tex 2020/09/18 v3.01 `PSTricks' (tvz,hv)
 (/usr/local/texlive/2020/texmf-dist/tex/generic/pstricks/pst-fp.tex)
File: pst-fp.tex 2020/09/18 v3.01 `PST-fp' (hv)

>>> Loading XeTeX special macros
(/usr/local/texlive/2020/texmf-dist/tex/generic/pstricks/pstricks-xetex.def))
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-xetex.def
File: l3backend-xetex.def 2021-02-18 L3 backend support: XeTeX

(|extractbb --version)
\c__kernel_sys_dvipdfmx_version_int=\count282
\l__color_backend_stack_int=\count283
\g__graphics_track_int=\count284
\l__pdf_internal_box=\box51
\g__pdf_backend_object_int=\count285
\g__pdf_backend_annotation_int=\count286
\g__pdf_backend_link_int=\count287
) (./test.aux)
\openout1 = `test.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 8.
LaTeX Font Info:    Trying to load font information for TS1+cmr on input line 8
.

(/usr/local/texlive/2020/texmf-dist/tex/latex/base/ts1cmr.fd
File: ts1cmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions
)
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for TU/lmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <7> on input line 15.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <5> on input line 15.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <8> on input line 18.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <6> on input line 18.
 [1] (./test.aux)

 *File List*
 article.cls    2020/04/10 v1.4m Standard LaTeX document class
  size10.clo    2020/04/10 v1.4m Standard LaTeX file (size option)
 multido.sty    2004/05/17 package wrapper for PSTricks `multido.tex', (HV/RN)
 multido.tex    2010/05/14 v1.42 `multido' (tvz,hv)
pstricks.sty    2020/06/11 v0.70 LaTeX wrapper for `PSTricks' (RN,HV)
   iftex.sty    2020/03/06 v1.0d TeX engine tests
  xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
   xetex.def    2020/08/26 v5.0i Graphics/color driver for xetex
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
 xkeyval.sty    2020/11/20 v2.8 package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
pstricks.tex    2020/09/18 v3.01 `PSTricks' (tvz,hv)
  pst-fp.tex    2020/09/18 v3.01 `PST-fp' (hv)
pstricks-xetex.def
l3backend-xetex.def    2021-02-18 L3 backend support: XeTeX
  ts1cmr.fd    2019/12/16 v2.5j Standard LaTeX font definitions
 ***********

 ) 
Here is how much of TeX's memory you used:
 7894 strings out of 476939
 147049 string characters out of 5822580
 577468 words of memory out of 5000000
 27824 multiletter control sequences out of 15000+600000
 405269 words of font info for 35 fonts, out of 8000000 for 9000
 1348 hyphenation exceptions out of 8191
 60i,5n,66p,385b,386s stack positions out of 5000i,500n,10000p,200000b,80000s

Output written on test.pdf (1 page).
8
  • 1
    Works for me. Can you run it with \listfiles and post the output, please? – Phelype Oleinik Feb 25 at 1:26
  • @PhelypeOleinik Added to question. – Svend Tveskæg Feb 25 at 1:33
  • 1
    Hm... Weird, the file list is exactly the same as mine, yet the output is different... Can I see the .log file (not the terminal output), please? – Phelype Oleinik Feb 25 at 1:41
  • Also added now. – Svend Tveskæg Feb 25 at 1:44
  • 2
    @Svend What version of gs are you using? For gs-9.53.3, you have to use xdvipdfmx in the new pretest of the TeX Live 2021. I have confirmed that this example works fine on XeTeX with gs-9.53.3 and with the new xdvipdfmx. BTW, PSTricks on XeTeX is a limited subset of the full PSTricks on dvi + dvips. There are fairly many PSTricks examples which do not work on XeTeX. – Akira Kakuto Feb 25 at 2:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.