1

There is a very nice new program in TL 2015 called texfot which filters out many of the messages printed on the screen when compiling latex files. Here is the man page for it

With TL 2015 installed, the command man texfot shows how to use it and all the options it supports.

The only problem is that it hangs on large files and only when used with make4ht. With small files, it does not hang. So the problem seems to be related to IO and buffering.

I spent long time trying to find when and why it hangs, and could only determine that it is at the stage when make4ht is processing its DVI file, and if the file is large, then the whole process hangs. It seems like a buffering issue between texfot and the program it is filtering. texfot is written in Perl which I know nothing about.

This problem is very easy to reproduce, I made a MWE below.

This below shows the command used when using pdflatex and it shows that texfot does not hang (this is the complete output of the compilation, much shorter than without using texfot!). No matter how large the pdf file, texfot does not hang:

texfot pdflatex foo2.tex
/usr/local/texlive/2015/bin/x86_64-linux/texfot: invoking: pdflatex foo2.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex)
Output written on foo2.pdf (431 pages, 894084 bytes).

Now I do the same thing, but use make4ht in place of pdflatex:

texfot /usr/local/texlive/2015/bin/x86_64-linux/make4ht -u -e ./main.mk4 foo2.tex
/usr/local/texlive/2015/bin/x86_64-linux/texfot: invoking: /usr/local/texlive/2015/bin/x86_64-linux/make4ht -u -e ./main.mk4 foo2.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=latex)
Output written on foo2.dvi (538 pages, 1894304 bytes).
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=latex)
Output written on foo2.dvi (538 pages, 1894304 bytes).
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=latex)
Output written on foo2.dvi (538 pages, 1894304 bytes).
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=latex)
Output written on foo2.dvi (538 pages, 1894304 bytes).

The above is where it hangs. I could wait hours and it never finishes. Without texfot it works right away.

The file main.mk4 used in the above call is

Make:add("dvisvgm","dvisvgm -n -c 1.25,1.25 -p 1- ${input}.idv")
Make:htlatex {packages = "\\RequirePackage[dvipdfmx]{graphicx}"}
local max_count = 5
local image_format = "${input}-${zeroes}${page}.${ext}"
local oneimage_format = "${input}.${ext}"

local function file_exists(fn)
  local f = io.open(fn,"r")
  if f ==  nil then return false else f:close() return true end
end

local function locate_file(par,ext, count)
  local count = count or 0
  par.ext = ext
  local zeroes = string.rep("0",count)
  par.zeroes = zeroes
  if count > max_count then 
        local one = oneimage_format % par
        if file_exists(one) then
            return one
        else
          return false, "max_count exceeded" 
        end
    end
  local fn = image_format % par
  if file_exists(fn) then 
    return fn
  else 
    return locate_file(par, ext, count+1)
  end
end

Make:htlatex{}
Make:htlatex{}
Make:htlatex{}
Make:tex4ht{}
Make:t4ht{}

Make:dvisvgm{}
Make:image("svg$",function(arg)
   arg.input = arg.source:gsub(".idv$","")
   local fn,msg = locate_file(arg, "svg")  
   if not fn then
     print("Image processing error: "..msg)
   else
     arg.filename = fn
     local cmd = "mv ${filename} ${output}" % arg
     print(cmd)
     os.execute(cmd)
   end
 end
)

I tried other options with texfot than the ones shown above, but nothing helped. It keeps hanging. This is a problem, since it is really a useful program and I like to use it for make4ht as well.

Here is the MWE used in the above (I adjusted the counter higher and and higher until the number of math equation got large enough to hang texfot)

\documentclass[12pt]{article}
\usepackage{pgffor}
\usepackage{blindtext}
\blindmathtrue
\begin{document}
\foreach \n in {0,...,200}{\blindmathpaper}
\end{document}

I am running TL 2015 on linux mint 64 bit. make4ht is now part of TL 2015 and should be installed on your system automatically.

If someone could find out why it hangs and if there is a work around, that will be great.

  • Have you tried omitting --tee /dev/null to see where it gets to? Sorry but I'm not downloading a 50M zip file of unknown code and letting it lose on my system ;). I know this has come up before. Can you think of a way this might be reproduced without requiring that? What about trying it with a large .tex file of documentation, for example, which people already have on their systems? (And presumably trust at least minimally.) – cfr Aug 1 '15 at 23:30
  • @cfr as I mentioned in my post, I tried many options. And yes, it hangs without --tee /dev/null . I do not know how to make a MWE since it hangs only when the file is large. i.e. has lots of math content. For small files, it does not hang. Please do not bother with this if the file size is too large for your system. I wish I could figure how to make a MWE. – Nasser Aug 1 '15 at 23:34
  • I realise it hangs with that option. But it must also produce a file of output which will stop somewhere. That might give you a clue. My suggestion was not to make an MWE but to see if you can reproduce using one of the large manuals which people already have installed. The files won't be too big for my system but I don't want to run code from an untrusted source when there is too much for me to look through. See Paul Gaborit's earlier comment. – cfr Aug 1 '15 at 23:43
  • 2
    I am pretty sure your mk4 file is wrong and that an cfg file is missing. I was able to compile the document using config files from tex.stackexchange.com/a/228943/2891. texfot really hangs, when you run it with --debug option, you can see that it hangs at dvisvgm. I don't really know why, it is written in Perl and I don't speak that :) but it was written by Karl Berry, so hopefully he can take a look at it on the mailing list – michal.h21 Aug 2 '15 at 9:34
  • @michal.h21 the mk4 file I show above is small version of the main one I have which is much larger. I did not think the full mk4 is needed. But I can put the main one I am using now. But it does not make any difference. It still hangs. Also the cfg is not really needed to show the problem. I tried to keep things simple, just to show the hang. – Nasser Aug 2 '15 at 9:36

Your Answer

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

Browse other questions tagged or ask your own question.