1

I notice strange interaction between the hvfloat package and the cellspace and mathtools packages.

It happens when I want to split an image (png or pdf) on two pages via the command \hvFloat[doublePage]{...}{...}{...}{...}.

If neither cellspace nor mathtools is loaded, there is no problem, the image, whether it is in png or pdf format, is well and truly split in two:

enter image description here enter image description here

However, if either mathtools or cellspace package is loaded, hvfloat no longer works properly. The images are no longer split in two, a thin black band appears on the first page, and one half of the image appears shifted on the second page:

enter image description here enter image description here

Are these packages incompatible?

Here is my MWE:

\documentclass[twoside]{article}
\usepackage[a4paper, inner=2cm, outer=3cm]{geometry}
\usepackage{graphicx, lipsum, hvfloat}

% hvfloat will not work properly if any of these packages is loaded: % \usepackage{cellspace} % \usepackage{mathtools}

\begin{document} \lipsum[1-15]

\hvFloat[doublePage, bindCorr=inner]% {figure}% {\includegraphics[width=32cm]{Test.pdf}}% {First image.}% {fig1}

\lipsum[1-15]

\hvFloat[doublePage, bindCorr=inner]% {figure}% {\includegraphics[width=32cm]{Test.png}}% {Second image.}% {fig2}

\lipsum[1-15] \end{document}

For the png and pdf images used in the MWE, they are simply black rectangles of 32 cm wide and 16 cm high. The pdf image Test.pdf can simply be produced as follows:

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\filldraw (0,0) rectangle (32,16);
\end{tikzpicture}
\end{document}

And here is the png image Test.png:
enter image description here

B Legrand
  • 521
  • 3
    both packages load calc, and hvfloat uses \global\setlength{\@dblfptop}{0\p@} which is wrong and doesn't work with calc. see e.g. https://tex.stackexchange.com/a/297189/2388. That is a clear bug in hvfloat and should be reported. – Ulrike Fischer Apr 27 '22 at 20:20
  • @UlrikeFischer Thanks for your answer, indeed, by making the appropriate substitutions in the package code, everything works. I have contacted the author of the package. – B Legrand Apr 30 '22 at 08:32
  • 2
    I'll fix it as soon as possible ... – user187802 Apr 30 '22 at 10:19

0 Answers0