3

I'm quite green when it comes to pstricks and I have problems with a 3D-output using the package pst-magneticfields.

The sample code for 3D in the manual (page 12) is shown below (The preamble was not included so I added what I thought I required):

\documentclass{standalone}
\usepackage{pst-magneticfield}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{pstricks-add}
\begin{document}


\psset{unit=0.7cm}
\newpsstyle{grille}{subgriddiv=0,gridcolor=blue!50,griddots=10}
\newpsstyle{cadre}{linecolor=yellow!50}

\begin{pspicture}(-7,-6)(7,6)
    \psmagneticfieldThreeD[N=8,R=2,L=8,pointsB=1200,linecolor=blue,pointsS=2000](-7,-6)(7,6)
\end{pspicture}


\end{document}

The output and how it was supposed to look is illustrated below:

enter image description here

What I get (above)

What I want (below)

enter image description here

The manual mentions the package "pst-3d" and an option "viewpoint", but adding it with or without the option has no effect. The log seems to mention that the package is already loaded.

I am compiling using xetex (which I am also unfamiliar with) using TeXstudio for mac.

  • xelatex can not handle the 3d view. – user2478 Dec 18 '17 at 8:21
2

I have the same problem as you xelatex under MiKTeX.

HOWEVER: if you compile with pdflatex, loading the auto-pst-pdf package, and adding the -shell-escape switch to pdflatex, it works fine:

\documentclass{standalone}
\usepackage{pst-magneticfield}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{pstricks-add, auto-pst-pdf}

\begin{document}


\psset{unit=0.7cm}
\newpsstyle{grille}{subgriddiv=0,gridcolor=blue!50,griddots=10}
\newpsstyle{cadre}{linecolor=yellow!50}

\begin{pspicture}(-7,-6)(7,6)
    \psmagneticfieldThreeD[N=8,R=2,L=8,pointsB=1200,linecolor=blue,pointsS=2000](-7,-6)(7,6)
\end{pspicture}

\end{document}

enter image description here

  • you are absolutely correct. This is by far the best solution as I now dont have to switch back and forth from pdflatex and xetex. Thank you – fluxmodel Aug 26 '16 at 16:50
  • @Bernard this simply produces a long white block output for me. I have added -shell-escape to the argument list for pdflatex, but it still will not work. Can you offer any help? – lmsavk Mar 20 '18 at 2:21
  • @Bernard I should add that I end up with two .pdfs in my directory, one with the filename and -autopp appended to the end. This file opens fine with a pdf viewer, but the regular filename.pdf will not... – lmsavk Mar 20 '18 at 2:34

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.