2

The latex file

\documentclass{article}
\usepackage{pst-all,pst-3dplot}

\begin{document}

\begin{pspicture*}(-4,-4)(4,4)
   \psplotThreeD[linecolor=blue, plotstyle=curve, drawStyle=yLines,
                yPlotpoints=30, xPlotpoints=30, linewidth=1pt](-4,1)(-4,1){
                  x dup mul y dup mul add 1.01 exp}
   \pstThreeDCoor[linewidth=1pt, xMin=-4,xMax=4,yMin=-4,yMax=4,zMin=-2,zMax=6]
  \end{pspicture*}

\end{document}

produces the image

enter image description here

As Michael.h21 pointed out in Problem with pstricks and htlatex/tex4ht, there are issues in converting pstricks images when using TeX4ht, which are mostly solved by telling TeX4ht to use dvisvgm. Unfortunately, this doesn't solve the problem in this case: using

make4ht -c config.cfg <file>

with the configuration file

% We are generating HTML + MathML code
\Preamble{xhtml,mathml}

% Output HTML5 doctype instead of the default for HTML4
\Configure{DOCTYPE}{\HCode{<!doctype html>\Hnewline}}

% Custom page opening
\Configure{HTML}{\HCode{<html lang="en">\Hnewline}}{\HCode{\Hnewline</html>}}

\ConfigureEnv{psmatrix}{\Picture*{}}{\EndPicture}{}{}
\Configure{Picture}{.svg}

\begin{document}
\EndPreamble

results in a web page with the image pushed about three pages south and a lot of blank space above it, which is not at all related to Taylor Swift.

Is there a generic fix for this, probably extending Michael's earlier idea? One answer would be to use tikz, for example, instead of pstricks but if possible I'd prefer to keep using pstricks because I have many images like this.

7
  • It seems that the svg file has wrong height. It might be possible to use some tool to resize it to the correct size.
    – michal.h21
    Mar 23, 2017 at 16:38
  • you can run pst2pdf <file>. This creates two additional documents: one with only the pspicture environments (<file>-pst.tex) and one where these environments are replaced by \includegraphics (<file>-pdf.tex. The images are created in the subdirectory images. The only problem is that t4ht doesn't take the macro \PrependGraphicsExtension into account. The resaon why you have to insert the extension .pdf by hand. Then run make4ht <file>-pdf.tex and eveything will be fine.
    – user2478
    Mar 24, 2017 at 10:52
  • @Herbert Perhaps I am going something wrong but this just produces a blank html file for me when I run pst2pdf to create file.pst.tex and then I run make4ht -c file.cfg file-pst. Assuming that it is just me, do you have any idea how likely this approach is to work if I have a "random" latex file that contains a pspicture environment? The project that I am working on, in principle, needs to apply to arbitrary latex input (and, before I found this example I thought that it was doing OK.,,)
    – user30471
    Mar 24, 2017 at 13:56
  • With make4ht you should run file-pdf.tex, not the file-pst.tex.
    – user2478
    Mar 24, 2017 at 14:08
  • Thanks @Herbert. I am still having problems getting this to work. I have checked and I have all of the dependencies for pst2pdf. It seems that the intention is to run file-pdf through pdflatex since latex file-pdf andhtlatex file-pdf both fail saying that they can't find file-fig-1. I can fix this by changing the \includegraphics commands to explicitly include file-fig-1.svg, for example. The other issue is that the scale of the generated image is too large except for svg. I can work around both of these issues in my intended application, but I was wondering if pst2pdf...
    – user30471
    Mar 24, 2017 at 20:58

0

You must log in to answer this question.