# Is it possible to use adjustbox and qtree in the same document?

Using the packages adjustbox and qtree simultaneously causes the error:

Package graphics Error: Division by 0. \includegraphics[width=0.3\textwidth]{myimage.bmp}

Minimal working example:

\documentclass{report}

\usepackage{adjustbox} %Lets table extend beyond margins
\usepackage{qtree} %Allows drawing of syntax etc trees '\Tree'

\begin{document}
\begin{figure}[hp]
\centering
\includegraphics[width=0.3\textwidth]{myimage.bmp}
\caption{My image}
\label{fig:figure1}
\end{figure}
\end{document}


Is it possible to use them both in the same document?

Edit: This is being compiled with XeLateX.

Edit2: This bug only occurs with .bmp, and not with .png files; changing file format is a fine workaround.

• Using the code with \includegraphics[width=0.3\textwidth]{example-image} everything is fine. You can test it... . I think its a problem with myimage.bmp. Mar 8 '17 at 16:19
• I'd be half-surprised to learn that this works without those two packages and solely graphicx loaded instead. Two thoughts: (1) use a different file format; (2) if sticking with bitmaps, you probably need to use the bmpsize package.
– jon
Mar 8 '17 at 19:55
• do you really mean that if you remove qtree from that document that it works? Mar 8 '17 at 20:46
• Well, as adjustbox loads graphicx (which is where the \includegraphics command comes from), the question becomes: does qtree conflict with graphicx? But I mean don't use bitmaps as a matter of general practice. I can't actually reproduce the problem, however, so I'm not suggesting it as the solution, just a possible workaround. (Tonight, I'll try again with another .bmp file.)
– jon
Mar 9 '17 at 18:41
• If you change myimage.bmp to example-image-a, does the example work? I have no idea where I'd get a BMP from. But there is certainly no essential conflict if adjustbox and qtree work with other image formats.
– cfr
Mar 9 '17 at 22:54

BMP images are not really supported. Maybe XeLaTeX has some support, but PDFLaTex definitifly hasn't. The "division by 0" error comes from graphics package (loaded by graphicx which in turn is loaded by adjustbox) and is caused most likely has the original width can not be extracted from the BMP file and is therefore 0. When using the width key I guess the original width is used in a division and then the error is caused.