2

I tried to compile the code below with

mk4ht htlatex file.tex 'xhtml, charset = utf-8 pmathml' '-cunihtf-utf8-cvalidate'

Formulas and text are transcribed, but not graphics. How to solve this problem?

\documentclass[a4paper,11pt]{article}
\usepackage{etex}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mathtools,amsmath,amsfonts,amssymb,amsthm,mathrsfs,nccmath}
\usepackage{pstricks-add}
\usepackage[frenchb]{babel}
\begin{document}
\psset{xunit=4cm,yunit=2cm,algebraic=true,arrowscale=1.2}
\begin{pspicture}(-1.5,-3)(2.5,2.5) 
\psgrid[gridwidth=0.6pt,subgriddiv=0,gridlabels=0,gridcolor=lightgray,
xunit=0.25,yunit=0.5](-6,-6)(10,5)
\psaxes[linewidth=1pt,Dx=1,Dy=1,labels=none,ticksize=-3pt
0pt]{->} (0,0)(-1.5,-3)(2.5,2.5)
\psxTick[ticksize=-3pt](1.25){\frac{5}{4}}
\psxTick[ticksize=-3pt](0.666666666666){\frac{2}{3}}
\begin{psclip}
{\psframe[linestyle=none](-1.5,-3)(2.5,2.5)}
{\psplot[linewidth=0.8pt,plotpoints=2000]{0}{1.25}{6*x-3}}%
{\psplot[linewidth=0.8pt,plotpoints=2000]{0}{1.25}{1-(2-3*x)^2}}%
\end{psclip}
\psline[linestyle=dashed,dash=3pt 2pt]
(0,1)(0.666666666666,1)  (0.666666666666,0)
\uput[dl](0,0){O}
\uput[d](1,0){I}
\uput[l](0,1){J}
\uput[ur](1.25,-2){$\mathscr{C}_{f}$}
\uput[ur](0.75,1){$\mathscr{C}_{g}$}
\uput[d](2.42,0){$x$}
\uput[l](0,2.35){$y$}
\end{pspicture}
\end{document}
1
  • 1
    Please see the answer of tex.stackexchange.com/questions/124682/…. Capture the content inside pspicture environment to another file and generate the PDF and later an image. Call this image in the original file using includegraphics command.
    – Jagath
    Jul 23, 2013 at 14:42

1 Answer 1

4

It seems that default conversion method used by tex4ht to convert pictures to image formats has issues with PSTricks, resp. PostScript specials. The default result:

enter image description here

The conversion is done by processing the dvi file with some dvi processor such as dvipng or dvisvgm. Default procedure is to call dvips and then Ghostscript to convert the postscript file to png. We can modify the process fortunately, using make4ht build files. Save the following as file.mk4 (it should have the same basename as your TeX file):

if mode == "draft" then
  Make:htlatex{}
else
  Make:htlatex{}
  Make:htlatex{}
  Make:htlatex{}
end

 Make:image("svg$",
   "dvisvgm -n -o ${output}  -p ${page} ${source}")

compile the document using

make4ht -u file.tex "svg,pmathml"

(yes, it is an equivalent of your mk4ht call). The svg option requests to use svg as image format for converted pictures,

Make:image("svg$",
   "dvisvgm -n -o ${output}  -p ${page} ${source}")

configures the image conversion itself.

The result:

enter image description here

You must log in to answer this question.

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