TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I appear to have htlatex and htxelatex already installed on my computer. However when I try to run them, it comes up with the message, 'I can't write on file 'texput.log''

I am trying to convert a LaTeX file to HTML.

This is on Windows, with MiKTeX.

share|improve this question
What OS and TeX distributon are you using? How are you invoking htlatex (from an editor? from the command line?) – Alan Munn Dec 27 '11 at 18:25
I am using Miktex 2.9 I don't know what an OS distribution is. I am clicking on the start button in the bottom left hand corner and typing in htlatex into the Search programmes and files box. When htlatex comes up I click on it and another box with a black background appears with a lot of text concluding with the statement 'I can't write on file 'texput.log'' – XYZ Dec 27 '11 at 18:39
TeX4ht is also included in the TeXLive a standard distribution of TeX and friends for Unix and Unix like systems. It looks like you are using Windows operating system as MiKTeX is the standard distribution of TeX and friends for Windows(even though I believe it can be installed on Linux). It appears at least on the first glance that there is some kind permission problem but I do not know anything about Windows. – Predrag Punosevac Dec 27 '11 at 21:45
perhaps you don't have "write permission" for the directory/folder you are working in; I would check the Properties tab to begin with. BTW, OS = Operating System. – prettygully Dec 27 '11 at 21:48
I'll assume that you are working on Windows, for your comments. I think that you have to invoke htlatex from the command line (the black background window). So, in order to use it you have to open a command window, by typing cmd in the same search bar. And then you can type htlatex C:\path\to\your\file\name.tex. That will create the HTML for you. – adn Dec 28 '11 at 2:54

This may help you. I made a batch script that I use when working with htlatex. You can copy and paste it into a file, and save it with .bat extension, e.g., html.bat.

  1. You need to open a command prompt, you can type in the search bar cmd, or press WndLogo + R and write cmd to execute the command prompt. The command prompt is an application in which you can run different commands. In the top of the window you will see the current directory. For example, C:\Windows\system32\cmd.exe. You can check this tutorial for more information.
  2. Then you just need to move to the directory in which you have your file, using cd path. For example, if you have your LaTeX documents in a folder in the C drive called My Latex, you can move to that folder using cd "C:\My Latex". Note that you have to surround the path with quotes due to the spaces on it.
  3. You can execute the script using html.bat file.tex. That will create a html directory in which you can find your file. (This assumes you have your file in the same directory as your .tex file. However, you can place the script in a folder and add that folder to your environment variables. Then you will be able to call it from anywhere.)
    • If you don't want to use the script you can simple execute htlatex file.tex html "" -dSomeDir "--interaction=nonstopmode". The html option sets the type of output, -dSomeDir sets the output directory to SomeDir (although it is not mandatory, it is a good idea as htlatex produces several files), and the nonstopmode tells the compiler not to stop if it can avoided.

The script looks like this:

@echo off
if [%1]==[] goto usage
set name=%~n1
if exist .\html goto exists
mkdir html
goto process
echo y | del .\html\*

htlatex %name%.tex html "" -dhtml "--interaction=nonstopmode"

del %name%.4tc > nul
del %name%.4ct > nul
del %name%.tmp > nul
del %name%.xref > nul
del %name%.idv > nul
del %name%.lg > nul
del %name%.html > nul
del %name%.css > nul
goto end


echo Usage: %0 file.tex
echo *** Caution *** If there is a html directory it will be deleted.
share|improve this answer
It'd be nice if someone could provide a mac-equivalent for this script. That'd be a Unix Shell script. – Far Zin Mar 24 '14 at 9:30

You have to open a command line window. I do not have an access to a Windows computer at the moment, so I do not know if there is a better way to do it, but I seem to remember that if you click on Start, then navigate to the Programs menu (the way to do it seems to depend on your Windows version), then under Accessories there is something like "DOS Prompt" or "Command Prompt". When the command prompt window opens, you have to change to the directory (or folder) that contains your file (cd "\Documents And Something\XYZ's Documents\whatever\folder\it\is\in"), and run htlatex myfile.tex. That will work if htlatex is in your PATH. If it is not, you have to type the full path to htlatex instead, something like

"C:\the\full path\to\htlatex.exe" myfile.tex

Hopefully someone with better knowledge of Windows will be able to edit this or provide a better answer.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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