1

I'm trying to convert a LaTeX document into HTML (or rather, I'm trying to output HTML instead of, say, PDF - is this the right way to say this?)

I used the advice of https://tex.stackexchange.com/a/39458 and tried writing this:

htlatex book.tex html "" -dhtml "--interaction=nonstopmode"

This actually worked great until I got the following error:

System call: copy figs/Correlation_examples.png html.
The syntax of the command is incorrect.

I fiddled around with the copy command for a minute and then realized that the problem is that the forward slash (which is fine on Unix) needs to be a backwards slash on Windows (i.e., instead of figs/ it needs to be figs\)

So on the one hand this should be a simple fix, but on other hand I'm having trouble finding which file to modify to make the fix.

My question: Is there a way around this on MiKTeX on Windows? I think that htlatex (and mk4tex, etc, etc) all appear to be compiled executables so I don't think it's possible to modify htlatex.exe myself (short of re-compiling/re-building MikTeX, of course).

  • Follow-on question: If I did want to report this as a bug, where do I do that? MiKTeX has a GitHub page, but I don't see the normal button for 'Issues' on said page. – MikeTheTall Apr 14 '17 at 18:59
  • I can't reproduce the error. Make a complete example. – Ulrike Fischer Apr 14 '17 at 19:58
  • Thank you for trying, @UlrikeFischer! I'm trying to build "Think Stats 2", by Allen Downey. The full repo is here: github.com/AllenDowney/ThinkStats2 . I want to apologize for not having a much smaller, much more reasonable repo case. I'm not the author and don't normally write LaTeX myself. – MikeTheTall Apr 14 '17 at 22:21
  • To add some insight: the problem is that some image is in a subdir, and it's not able to use the windows "copy.exe" command with the slashes tilting the wrong way. Hopefully this might help find a repro case? – MikeTheTall Apr 14 '17 at 22:23
1

I am not on Windows and don't use Miktex, so I cannot test this issue. Nevertheless, I think that I can answer some of your questions:

  • htlatex and similar scripts aren't binary executables, they are only batch scripts which call LaTeX with special configuration for tex4ht three times, and then it calls tex4ht and t4ht binaries, which are responsible for the actual conversion and calling commands. You can't modify the way how file copy works from these scripts.
  • you can configure command which are used for image conversion, copying etc. in the tex4ht.env file. It is located in texmf-dist/tex4ht/base/win32/tex4ht.env in the TeX distribution root. You can copy this file to the directory in which is your document and find the following lines:

    % t4ht -d%%2                                                              
    Mmove %%1 %%2%%3                                                                                                                                      
    Ccopy %%1 %%2%%3
    

The line starting with Ccopy defines the command which is used for file copying. You can replace copy with some command which supports forward slashes and which can copy the source file to the correct subdirectory of the destination directory. I hope that such command exists for Windows.

  • as an alternative, you can use make4ht, which is alternative command for tex4ht invocation. It should correctly copy the files to destination directory even on Windows. Try the following command:

    make4ht -u -d html book.tex
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.