bugtex4ht - Bugs: bug #257, \includegraphics fails with...

Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #257: \includegraphics fails with LuaLaTeX backend

Submitted by:  Michal Hoftich <michal_h21>
Submitted on:  Tue Jul 14 20:11:00 2015  
Category: NonePriority: 5 - Normal
Severity: 5 - NormalStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Closed

Wed Aug 5 22:37:18 2015, comment #5:

ok, thanks. i (finally) installed the change and updated tex live.
don't have the energy to talk to latex people about dvips.def, so closing i guess ... if you have any time to report the issue to them, please do.

Karl Berry <karl>
Project Administrator
Wed Jul 29 22:36:30 2015, comment #4:

There are two separate issues:

1. LuaLaTeX is failing to include png and other bitmap formats in dvi mode. These formats aren't normally supported by dvi, but only warning should be printed, as in the case of normal LaTeX. This should be fixed in graphicx's driver for LuaLaTeX.

2. As tex4ht uses own dvi driver which supports additional picture types, it should provide support for them. We could provide own graphicx configuration file, but it seems like too heavyweight solution to me . Or we can use similar configurations :)

Michal Hoftich <michal_h21>
Project Member
Wed Jul 29 20:42:41 2015, comment #3:

why shouldn't the problems be fixed in the latex drivers? what makes any of this htlatex-specific? just trying to understand.

Karl Berry <karl>
Project Administrator
Wed Jul 29 19:23:44 2015, comment #2:

It fixes also problem with image size detection for bitmap images with other engines, so while it is hack to fix lualatex support, it also enhances experience with standard htlatex, otherwise the user needs to either use different backend for graphichx with tex4ht, or provide similar configurations in the .cfg file.

With this change, only .xbb files need to be created for images and then their correct dimensions are used in the html.

Michal Hoftich <michal_h21>
Project Member
Sun Jul 19 22:29:20 2015, comment #1:

as you say, evidently the problem has nothing to do with tex4ht.

shouldn't those rules be added to latex's dvips.def, or something in latex be changed so that dvilualatex uses a different driver that can do the right thing?

Karl Berry <karl>
Project Administrator
Tue Jul 14 20:11:00 2015, original submission:

This is an crosspost from http://tex.stackexchange.com/q/255220/2891. The problem shows when we try to include some image in format which is not supported in dvi mode:



It turns out that graphicx package tries to find the bounding box of the image. It tries that by reading the image data. But because images are binary, this cause LuaLaTeX to complain about incorrect utf8 value. It easily exceeds 100 errors and the document fails to compile.

David Carlisle proposed a solution using \DeclareGraphicsRule:


with this code, images aren't parsed for the bounding box, but .xbb files are used instead. They can be created using

ebb -x imagename

This solution fixes also behavior with normal LaTeX, as bounding boxes weren't loaded with it as well.

More details are provided in my answer to the question on TeX.sx

Patch for literate sources is attached.

Michal Hoftich <michal_h21>
Project Member


Attached Files
file #215:  graphicx.patch added by michal_h21 (412B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by karl (Posted a comment)
  • -unavailable- added by michal_h21 (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    2 latest changes follow.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed Aug 5 22:37:18 2015karlOpen/ClosedOpen=>Closed
    Tue Jul 14 20:11:00 2015michal_h21Attached File-=>Added graphicx.patch, #215
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup+gray