[tex4ht] Image processing error: max_count exceeded error from make4ht

Michal Hoftich michal.h21 at gmail.com
Thu Dec 31 16:00:50 CET 2015


Hi Nasser,

On Thu, Dec 31, 2015 at 1:04 PM, Nasser M. Abbasi <nma at 12000.org> wrote:
>
> Hello;
>
> I am building a large latex file with lots of images included
 using includegraphics. Over 500 svg images.
> Question is:  How to fix this error? Do I need to change
> something in main.mk4?
>

it seems that page numbers in the idv file (dvi file which contains
images) don't equate to filenames generated by dvisvgm. It is strange,
as it seems that some pages in the idv file weren't processed, they
are maybe empty. It might be some problem with your configurations or
document.

Anyway, it was probably bad idea to depend on page numbers in the idv
file, as image names from idv file are numbered consequently and image
names used by tex4ht as well. So there is new version of the .mk4
file:

-------------
Make:add("dvisvgm","dvisvgm -v1 -n -c 1.15,1.15 -p 1- ${input}.idv")
Make:htlatex {packages = "\\RequirePackage[dvipdfmx]{graphicx}"}
local max_count = 5


local image_pattern

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 search_file(input, ext, count)
  local pattern = count > 0 and "%s-%0"..count.."i." or "%s."
  pattern = pattern .. ext
  local filename = string.format(pattern, input, 1)
  if file_exists(filename) then
    return pattern
  elseif count < 0 then return nil
  else
    return search_file(input, ext, count - 1)
  end
end

local img_count = 0
local function locate_file(par,ext)
  if  image_pattern then
    img_count = img_count + 1
    return string.format(image_pattern, par.input,  img_count)
  else
    image_pattern =  search_file(par.input, ext, max_count)
    if not image_pattern then
      print("Cannot locate output svg pattern")
      return nil
    end
    return locate_file(par, ext)
  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
)

------------


> ps. I am also getting
>
>     DVI error: undefined font number 35
>
> which I never saw before. But this is I do not think it is related
> to this max_count exceeded error. I think problem with dvisvgm.
>
> If I do not find what is causing this DVI error, will send separate
> email on it. I did not  want to mix the issues in one email.
>

OK,


Best regards,
Michal


More information about the tex4ht mailing list