2

I am trying to compile a LaTeX document to HTML using tex4ht, using the MiKTeX's tex4ht and Texmaker. I am trying to do this using a user command:

C:\MiKTeX\miktex\bin\x64\tex4ht.exe htlatex %.tex

The my file compiles fine to PDF, but using this user command gives the following error:

Process started

---------------------------- tex4ht.c (2010-12-16-08:39 Windows MiKTeX) C:\MiKTeX\miktex\bin\x64\tex4ht.exe htlatex helloworld.tex

--- warning --- Can't find/open file `helloworld.dvi' --- error --- Can't find/open file `helloworld.dvi'

Process exited with error(s)

The file I am using is a simple Hello World, and is saved as helloworld.tex

\documentclass{article}
\begin{document}
Hello World!
\end{document}

I have looked at this question, which says that it is an error, but a file should have been produced, but I cannot find any output. Also the code suggested there gives me the same problem.

Lastly, I looked at the tex4ht troubleshooting site which says a filter should be installed, but doesn't say how.

Anybody know this problem. Or can tell me how I can use tex4ht on miktex.

EDIT:

Using htlatex directly gives:

C:\test>htlatex test.tex

======================================================================
htlatex: Cannot start MiKTeX package manager.
htlatex: Data: Invalid syntax
======================================================================
htlatex: The Windows command script file could not be found.
htlatex: Data: scripts/tex4ht/htlatex.bat

1 Answer 1

5

tex4ht.exe is postprocesor which takes dvi file with tex4ht instructions and translate it to the html file. you should compile your tex file directly with htlatex script.


edit: if there is no htlatex.bat script in miktex, you can create new one:

latex %5 \makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode %2.a.b.c.\input  %1
latex %5 \makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode %2.a.b.c.\input  %1
latex %5 \makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode %2.a.b.c.\input  %1
tex4ht %1  -i/tex4ht/ht-fonts/%3 -ewin32/tex4ht.env
t4ht %1 %4 -ewin32/tex4ht.env

this script is from texlive, I hope it will work also with miktex

8
  • thanks for your comment, I tried that, I'll add to my question what I got there. Jun 17, 2012 at 12:45
  • I mean your answer Jun 17, 2012 at 12:52
  • I've put that in C:\MiKTEX\scripts\tex4ht but it gives the same results, using htlatex.bat in the command says it is not a recognised command. Jun 17, 2012 at 13:09
  • try to put it in the same directory as your tex file
    – michal.h21
    Jun 17, 2012 at 13:13
  • Ok I can run the .bat and load the file, now it says tex4ht.sty is not found. Any idea's? Jun 17, 2012 at 13:24

You must log in to answer this question.

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