I'm preparing a TeX document including PDF figures as an HTML document. The solution to this question works fairly well:

PDF image files and `htlatex`

However it does not handle image filenames with "(" or ")" characters, is there a way to include these in an HTML document?

1 Answer 1


The filenames needs to be escaped, because the special characters, such as "(" or ")" may cause problems in the conversion step, which is executed by system shell. Something like this happens on Linux:

System call: convert he(ll)o.pdf he(ll)o.png
sh: -c: line 0: syntax error near unexpected token ,,("
sh: -c: line 0: `convert he(ll)o.pdf he(ll)o.png'




Fixed configuration file:

         {\Needs{"convert '\csname Gin@base\endcsname.pdf'  
                               '\csname Gin@base\endcsname.png'"}%  
          \Picture[pict]{\csname Gin@base\endcsname.png}%  
          \special{t4ht+@File: \csname Gin@base\endcsname.png}

And the result:

enter image description here

  • Follow up query: Is this able to take PDFs in other directories? e.g., with \includegraphics{{"/home/tomkelly/directory/image".pdf}}
    – Tom Kelly
    Commented May 11, 2017 at 15:42

You must log in to answer this question.

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