2

I am trying to install make4ht on a system running MiKTex. The recommended instructions https://d800fotos.wordpress.com/2015/01/19/create-e-books-from-latex-tex-files-ebook-aus-latex-tex-dateien-erstellen/ are specific to TexLive and so I am looking for some help getting this setup. I believe the root of the problem is either that MiKTeX doesn't have texmf directory or I can't figure out how to run the files themselves.

Instruction summary: I downloaded the zip files and unpacked them in the recommended directory structure:

.../texmf/scripts/lua/make4ht/[root zip extracted]

.../texmf/tex/latex/tex4ebook/[root zip extracted]

I added .../texmf/ to the roots of MikTex settings and when I click apply I see a MiKTeX maintenance dialog box scan the files.

Next to make make4ht runnable (as per the answer below) - C:\Program Files\MiKTeX 2.9\miktex\bin\x64\make4ht.bat only contains

texlua "F:\...\texmf\scripts\lua\make4ht\make4ht" %*

Sample Tex File: eqntests.tex

\documentclass{report}  
\usepackage{amsmath}
\begin{document}
        \begin{equation}
            \text{C~=~}{\frac{a}{b}}
        \end{equation}
\end{document}

To compile my tex file using make4ht I run

FOR /R %%A IN (*.tex) DO ("make4ht.bat" "%%~nxA")

But I get an error message as described: [string "Make:htlatex{}..."]:1: attempt to index global 'Make' (a nil value) .../texmf/scripts/lua/make4ht/mkutils.lua:281: assertion failed!

I appear to be missing the Make program. What required program provides the Make command?

EngBIRD
  • 3,985
  • @EngBIRD this Make is part of make4ht and it is defined in make4ht-lib.lua file. is this file missing? – michal.h21 Feb 01 '15 at 18:52
  • @michal.h21 It is indeed present. ...\texmf\scripts\lua\make4ht\make4ht-lib.lua do I need to create a build bat file for all *.lua files? – EngBIRD Feb 01 '15 at 22:10
  • @EngBIRD no, is is needed only for make4ht. does kpsewhich make4ht-lib.lua find anything? (if you run it from different directory than make4ht is installed) – michal.h21 Feb 01 '15 at 22:24
  • @michal.h21 Yes, the kpsewhich call successfully reports the full file path. And I can confirm that I have run kpsewhich from different drives and it always reports the same file path. – EngBIRD Feb 01 '15 at 23:33
  • @EngBIRD I changed module declaration make4ht-lib, maybe it could help (it used method which is deprecated in Lua 5.2). you can try to upgrade make4ht – michal.h21 Feb 01 '15 at 23:41
  • @michal.h21 Excellent. This works and I can compile my document. No svg file produced though and the png file looks even lower resolution than the first instance, but definitely one step closer! – EngBIRD Feb 01 '15 at 23:54
  • @EngBIRD fine :) if you don't get svg, update your previous question with your mk4 and config files, as well with possible error messages from compilation – michal.h21 Feb 02 '15 at 07:29

1 Answers1

3

I just added installation instructions to make4ht readme, I will copy Windows instructions here:

See a guide by Volker Gottwald on how to install make4ht and tex4ebook`.

Create a batch file for make4ht somewhere in the path:

texlua "C:\full\path\to\make4ht" %*                                         

you can find directories in the path with

path                                                                        

command, or you can create new directory and add it to the path.

Note for Miktex users: you may need to create texmf directory first. See this answer on TeX.sx.

michal.h21
  • 50,697
  • Thanks for the answer: I can't quite tell if my implementation of your solution was unsuccessful or if I have missed an important underlying requirement. I get an error message as described: [string "Make:htlatex{}..."]:1: attempt to index global 'Make' (a nil value) .../texmf/scripts/lua/make4ht/mkutils.lua:281: assertion failed! – EngBIRD Jan 31 '15 at 23:09
  • @EngBIRD: Make your problem description so that other can reproduce the problem. Add the exact call you are using, show the minimal document etc. – Ulrike Fischer Feb 01 '15 at 10:08
  • @UlrikeFischer I updated my question to make it reproducible (on both of my computers), but I honestly think that the solution posted above should have worked - and would have if my computer had the required prerequisites. I.e. whatever program gives Make as I think the error I posted just indicates that Make is missing. – EngBIRD Feb 01 '15 at 16:02
  • I don't get this error, but I get always latex: Not enough room in an internal buffer.. @michal.h21: Is there any way to see the actual latex call a "make4ht file" call is doing? – Ulrike Fischer Feb 01 '15 at 17:38
  • @UlrikeFischer I've added latex call print. and also slightly modified some parameters which looked suspicious anw which were different than htlatex uses – michal.h21 Feb 01 '15 at 18:49
  • without having made extensive tests: the latex call line looks very long and I guess miktex doesn't like this. Wouldn't it be better to put all this code in in a file and to use then latex \input{4htparams}\input{filename} – Ulrike Fischer Feb 01 '15 at 20:12
  • @UlrikeFischer it is copied from htlatex command. Does htlatex produce this error as well? – michal.h21 Feb 01 '15 at 20:15
  • htlatex works ok, but the call is not completly identical: e.g. jobname is missing and the quoting is different. I will have to do some tests to find what exactly is causing the error. – Ulrike Fischer Feb 01 '15 at 21:08
  • @UlrikeFischer maybe the quoting is the problem. but is strange as make4ht with TL in Windows doesn't have any problems – michal.h21 Feb 01 '15 at 21:12
  • Well the (single) quotes are certainly the problem - imho they are rather dubiuos as they don't have an official status in windows batch files. And on the command line you would ! I can't find '.with texlive too. – Ulrike Fischer Feb 01 '15 at 21:51
  • @UlrikeFischer I've found that there are no quotes around LaTeX commands in htlatex.bat, so I removed them on Windows. – michal.h21 Feb 01 '15 at 22:21