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
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.
pst2pdf <file>
. This creates two additional documents: one with only thepspicture
environments (<file>-pst.tex
) and one where these environments are replaced by\includegraphics
(<file>-pdf.tex
. The images are created in the subdirectoryimages
. The only problem is thatt4ht
doesn't take the macro\PrependGraphicsExtension
into account. The resaon why you have to insert the extension.pdf
by hand. Then runmake4ht <file>-pdf.tex
and eveything will be fine.pst2pdf
to createfile.pst.tex
and then I runmake4ht -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 apspicture
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.,,)make4ht
you should runfile-pdf.tex
, not thefile-pst.tex
.pst2pdf
. It seems that the intention is to runfile-pdf
through pdflatex sincelatex file-pdf
andhtlatex file-pdf
both fail saying that they can't findfile-fig-1
. I can fix this by changing the\includegraphics
commands to explicitly includefile-fig-1.svg
, for example. The other issue is that the scale of the generated image is too large except forsvg
. I can work around both of these issues in my intended application, but I was wondering ifpst2pdf
...