2

I have a directory where I have the following .tex file:

\documentclass[fontsize=16pt, paper=letter]{scrartcl}
\usepackage{lmodern}
\usepackage[T1]{fontenc}

\usepackage{amsmath}

\begin{document}

\title{A test \LaTeX to HTML page}
\maketitle

\section{Section One}

Hello world. Here is some mathematics:
    \begin{equation}
        x + y = 3
    \end{equation}

\end{document}

Then, I run a python script with the following commands:

import subprocess

subprocess.call(["make4ht", "A:/test_tex_sources/test_article.tex"])

When this command is called, the following error is reached:

) (a:/texlive/2015/texmf-dist/tex/generic/tex4ht/tex4ht.sty
--- needs --- tex4ht A:/test_tex_sources/test_article ---

A:/test_tex_sources/test_article.tmp: Forbidden to open for writing
! I can't write on file `A:/test_tex_sources/test_article.tmp'.
l.966           \immediate\openout15=\jobname.tmp

(Press Enter to retry, or Control-Z to exit; default file extension is `.tex')
Please type another output file name:

On the other hand, if I provide the following python script:

import subprocess

subprocess.call(["make4ht", "test_article.tex"])

everything works okay! In addition, if I run the following through command line, and not Python:

make4ht "A:/test_tex_sources/test_article.tex"

then again, everything works okay.

Why is that?

2

This is a bug in make4ht, it constructs wrong -jobname for LaTeX when a full path to document is specified. The command call to LaTeX is following:

latex -jobname=$input "tex4ht.sty loading,\input $tex_file"

in your sample, it is

latex -jobname=A:/test_tex_sources/test_article "tex4ht.sty loading,\input A:/test_tex_sources/test_article.tex"

correct call would be

latex -jobname=test_article "tex4ht.sty loading,\input A:/test_tex_sources/test_article.tex"

so jobname should be without directory path

I've fixed make4ht sources, so you can use the development version until I post fix the update to CTAN

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.