1

I try to use PSTricks to draw a figure that should look like the following

expected output

which is done by the following code (actually this comes from an arXiv physics paper 1410.4540):

\documentclass[margin=10pt]{standalone}
\usepackage{amsmath}
\usepackage{pst-all}

\begin{document}

$\displaystyle
    \pspicture[shift=-0.95](-0.2,-0.35)(1.2,1.75)
    \small
        %%%%% Small oval:
        \psarc[linewidth=0.9pt,linecolor=black,border=0pt] (0.8,0.7){0.4}{120}{240}
        \psarc[linewidth=0.9pt,linecolor=black,arrows=<-,arrowscale=1.4,
            arrowinset=0.15] (0.8,0.7){0.4}{165}{240}
        \psarc[linewidth=0.9pt,linecolor=black,border=0pt] (0.4,0.7){0.4}{-60}{60}
        \psarc[linewidth=0.9pt,linecolor=black,arrows=->,arrowscale=1.4,
            arrowinset=0.15] (0.4,0.7){0.4}{-60}{15}
        %%%%% Lines:
        \psset{linewidth=0.9pt,linecolor=black,arrowscale=1.5,arrowinset=0.15}
        \psline(0.6,1.05)(0.6,1.55)
        \psline{->}(0.6,1.05)(0.6,1.45)
        \psline(0.6,-0.15)(0.6,0.35)
        \psline{->}(0.6,-0.15)(0.6,0.25)
        %%%%% Labels:
        \rput[bl]{0}(0.07,0.55){$a$}
        \rput[bl]{0}(0.94,0.55){$b$}
        \rput[bl]{0}(0.26,1.25){$c$}
        \rput[bl]{0}(0.24,-0.05){$c'$}
        \scriptsize
        \rput[bl]{0}(0.7,1.05){$\mu$}
        \rput[bl]{0}(0.7,0.15){$\mu'$}
    \endpspicture       
$

\end{document}

However, when I compile this code with XeLaTeX using VS Code (with LaTeX-Workshop extension), only the letters are produced; the lines and curves are all missing:

actual output; lines and curved are missing

How to solve this problem?


Additional info: I installed MacTeX (2021.0328) via Homebrew (brew install --cask mactex-no-gui).

EDIT: According to @user187802's answer, I change the LaTeX-Workshop (v.8.23.0) configuration as :

"latex-workshop.latex.recipes": [
    {
        "name": "xelatex",
        "tools": [
            "xelatex"
        ]
    },
],
"latex-workshop.latex.tools": [
    {
        "name": "xelatex",
        "command":"xelatex",
        "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "--shell-escape",
            "-output-driver=\"xdvipdfmx -i dvipdfmx-unsafe.cfg -q -E\"",
            "%DOC%"
        ]
    },
],

But then I get the errors (the file name is braid.tex):

This is XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021) (preloaded format=xelatex)
 \write18 enabled.
entering extended mode
(/path/to/braid.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-18> (/usr/local/texlive/2021/texmf-dist/tex/latex/standalone/standalone.cls
Document Class: standalone 2018/03/26 v1.3a Class to compile TeX sub-files standalone
(/usr/local/texlive/2021/texmf-dist/tex/latex/tools/shellesc.sty) (/usr/local/texlive/2021/texmf-dist/tex/generic/iftex/ifluatex.sty (/usr/local/texlive/2021/texmf-dist/tex/generic/iftex/iftex.sty)) (/usr/local/texlive/2021/texmf-dist/tex/latex/xkeyval/xkeyval.sty (/usr/local/texlive/2021/texmf-dist/tex/generic/xkeyval/xkeyval.tex (/usr/local/texlive/2021/texmf-dist/tex/generic/xkeyval/xkvutils.tex (/usr/local/texlive/2021/texmf-dist/tex/generic/xkeyval/keyval.tex)))) (/usr/local/texlive/2021/texmf-dist/tex/latex/standalone/standalone.cfg) (/usr/local/texlive/2021/texmf-dist/tex/latex/base/article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(/usr/local/texlive/2021/texmf-dist/tex/latex/base/size10.clo))) (/usr/local/texlive/2021/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2021/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2021/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2021/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/local/texlive/2021/texmf-dist/tex/latex/pstricks/pst-all.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/pstricks/pstricks.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2021/texmf-dist/tex/latex/graphics-def/xetex.def)) (/usr/local/texlive/2021/texmf-dist/tex/generic/xkeyval/pst-xkey.tex) (/usr/local/texlive/2021/texmf-dist/tex/generic/pstricks/pstricks.tex (/usr/local/texlive/2021/texmf-dist/tex/generic/pstricks/pst-fp.tex `pst-fp' v0.05, 2010/01/17 (hv)) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex)) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex)) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex
Loading pgffor.code.tex
(/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex))) (/usr/local/texlive/2021/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)))
`PSTricks' v3.01  <2020/09/18> (tvz,hv)
(/usr/local/texlive/2021/texmf-dist/tex/xelatex/xetex-pstricks/pstricks.con (/usr/local/texlive/2021/texmf-dist/tex/generic/pstricks/config/xdvipdfmx.cfg)) (/usr/local/texlive/2021/texmf-dist/tex/xelatex/xetex-pstricks/pstricks.con (/usr/local/texlive/2021/texmf-dist/tex/generic/pstricks/config/xdvipdfmx.cfg
Using PSTricks configuration for XeTeX+xdvipdfmx
))) (/usr/local/texlive/2021/texmf-dist/tex/generic/pstricks/pst-fp.tex)
>>> Loading XeTeX special macros
(/usr/local/texlive/2021/texmf-dist/tex/generic/pstricks/pstricks-xetex.def)) (/usr/local/texlive/2021/texmf-dist/tex/latex/pst-plot/pst-plot.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/xkeyval/pst-xkey.sty) (/usr/local/texlive/2021/texmf-dist/tex/latex/multido/multido.sty (/usr/local/texlive/2021/texmf-dist/tex/generic/multido/multido.tex  v1.42, 2010/05/14 <tvz>)) (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-plot/pst-plot.tex (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-tools/pst-tools.tex `PST-tools' v0.10, 2020/03/24 (hv)) (/usr/local/texlive/2021/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-node/pst-node.tex  v1.42a, 2020/04/01) (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-arrow/pst-arrow.tex `pst-arrow' v0.01, 2016/09/01 (dr,hv)) (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-3d/pst-3d.tex `PST-3d' v1.11, 2010/02/14 (tvz)) (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-math/pst-math.tex `pst-math' v0.64 , (CJ,hv)) `pstricks-add' v3.89a, 2020/02/12 (dr,hv))  v1.92, 2019/05/16 (tvz,hv))) (/usr/local/texlive/2021/texmf-dist/tex/latex/pst-node/pst-node.sty (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-node/pst-node.tex)) (/usr/local/texlive/2021/texmf-dist/tex/latex/pst-tree/pst-tree.sty (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-tree/pst-tree.tex  v1.13, 2017/02/18(tvz,dg,hv))) (/usr/local/texlive/2021/texmf-dist/tex/latex/pst-grad/pst-grad.sty (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-grad/pst-grad.tex `pst-grad' v1.06, 2006/11/27 (tvz,dg,hv))) (/usr/local/texlive/2021/texmf-dist/tex/latex/pst-coil/pst-coil.sty (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-coil/pst-coil.tex  v1.06, 2006/11/27 (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-node/pst-node.tex))) (/usr/local/texlive/2021/texmf-dist/tex/latex/pst-text/pst-text.sty (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-text/pst-text.tex  v1.01, 2018/12/22(tvz,hv))) (/usr/local/texlive/2021/texmf-dist/tex/latex/pst-3d/pst-3d.sty (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-3d/pst-3d.tex)) (/usr/local/texlive/2021/texmf-dist/tex/latex/pst-eps/pst-eps.sty (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-eps/pst-eps.tex  v1.00, 2006/11/04)) (/usr/local/texlive/2021/texmf-dist/tex/latex/pst-fill/pst-fill.sty (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-fill/pst-fill.tex `PST-Fill' v1.01, 2007/03/10 (tvz,dg,hv))) (/usr/local/texlive/2021/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/pst-math/pst-math.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/pst-calculate/pst-calculate.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/l3packages/xparse/xparse.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/l3kernel/expl3.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/l3backend/l3backend-xetex.def (|extractbb --version))) (/usr/local/texlive/2021/texmf-dist/tex/latex/l3packages/xparse/xparse-2020-10-01.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/l3packages/xparse/xparse-generic.tex))) (/usr/local/texlive/2021/texmf-dist/tex/latex/siunitx/siunitx.sty (/usr/local/texlive/2021/texmf-dist/tex/latex/tools/array.sty) (/usr/local/texlive/2021/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty) (/usr/local/texlive/2021/texmf-dist/tex/latex/translator/translator.sty))) (/usr/local/texlive/2021/texmf-dist/tex/generic/xstring/xstring.sty (/usr/local/texlive/2021/texmf-dist/tex/generic/xstring/xstring.tex)) (/usr/local/texlive/2021/texmf-dist/tex/generic/pst-math/pst-math.tex)) (/usr/local/texlive/2021/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex)))
No file braid.aux.
(/usr/local/texlive/2021/texmf-dist/tex/latex/base/ts1cmr.fd) (/usr/local/texlive/2021/texmf-dist/tex/latex/siunitx/siunitx-abbreviations.cfg) (/usr/local/texlive/2021/texmf-dist/tex/latex/translator/translator-basic-dictionary-English.dict) [1] (./braid.aux)sh: /usr/local/texlive/2021/bin/universal-darwin/xdvipdfmx -i dvipdfmx-unsafe.cfg -q -E: No such file or directory
 )
(see the transcript file for additional information)
Error 32512 (driver return code) generating output;
file braid.pdf may not be valid.
SyncTeX written on braid.synctex.gz.
Transcript written on braid.log.

3
  • Does it work if you replace xelatex with lualatex? Commented Mar 10, 2022 at 9:52
  • @MarcelKrüger No. It raises lots of "Undefined control sequence" error. Commented Mar 10, 2022 at 10:57
  • You might be able to fix that by updating MacTeX, it shouldn't happen on a current system. Commented Mar 10, 2022 at 17:44

2 Answers 2

1

it makes more sense to install macTeX without brew:
https://tug.org/mactex/

it looks like that you are missing Ghostscript or do not use the correct call of xelatex

xelatex -synctex=1 -interaction=nonstopmode --shell-escape -output-driver="xdvipdfmx -i dvipdfmx-unsafe.cfg -q -E" %.tex

however, you can also use lualatex if you have an up-to-date system .

2
  • It works by directly running the command you provide in terminal; but how to get the correct output by modifying the recipe in VS Code? I tried naively modifying the "args" in the recipe, but it does not work. Commented Mar 10, 2022 at 9:00
  • I never used VS Code. I use TeXShop or alternatively TeXstudio
    – user187802
    Commented Mar 10, 2022 at 9:39
1

Using pstricks with xelatex and recent versions of Ghostscript requires a special set of options on the command line:

xelatex -output-driver="xdvipdfmx -i dvipdfmx-unsafe.cfg -q -E" -synctex=1 file.tex
1
  • That is already mentioned in the other answer ...
    – user187802
    Commented Mar 10, 2022 at 17:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .