The blank images are caused by the pdfpages
package, respective eso-pic
, which is called by pdfpages
. eso-pic
is used for placing objects at arbitrary places on the page, it uses picture
mode for this task. Unfortunately, the picture
is converted to image by tex4ht
, even when it's empty.
There is also another problem: \includepdf
command doesn't work. So we have two issues to fix. First one can be fixed by preventing the eso-pic
package from loading, the second one with some patches for pdfpages
.
Here is modified version of your TeX file:
\documentclass[12pt,reqno]{amsart}
\makeatletter
\ifdefined\HCode
\@nameuse{:dontusepackage}{eso-pic}
\newif\ifESO@texcoord
\newcommand\AddToShipoutPicture{\@ifstar{}{}}
\let\AddToShipoutPictureBG\AddToShipoutPicture
\let\AddToShipoutPictureFG\AddToShipoutPicture
\fi
\usepackage{pdfpages}
\makeatother
\begin{document}
$$
\begin{pmatrix} x \\ y \\ u(x,y) \end{pmatrix} \in \Lambda \subseteq
\mathrm{dom}(a) \cap \mathrm{dom}(b) \cap \mathrm{dom}(c)
$$
\includepdf[pages={1,2,3}]{pdfsample.pdf}
\includegraphics[page=1]{pdfsample.pdf}
\end{document}
The important code is:
\ifdefined\HCode
\@nameuse{:dontusepackage}{eso-pic}
\newif\ifESO@texcoord
\newcommand\AddToShipoutPicture{\@ifstar{}{}}
\let\AddToShipoutPictureBG\AddToShipoutPicture
\let\AddToShipoutPictureFG\AddToShipoutPicture
\fi
It prevents eso-pic
from loading and some basic macros used by pdfpages
are defined. For pdfpages
configuration, we can create pdfpages.4ht
configuration file:
\let\pdf@page\relax
\define@key{Gin}{page}[]{\edef\pdf@page{\the\numexpr #1-1\relax}}
\def\AM@findfile#1{%
\AM@findfile@i{#1}{pdf}%
\AM@findfile@ii{#1}%
}
\catcode`\:=12
\renewcommand\AM@output[1]{%
\@for\@pages:=\AM@pagestemp\do{\includegraphics[page=\@pages]{\AM@currentdocname}}
}
\catcode`\:=11
\AtBeginDocument{
\Configure{graphics*}
{pdf}
{
\ifx\pdf@page\relax\def\pdf@page{0}\fi
\def\current@pdf@file{\Gin@base.pdf[\pdf@page]}
\def\current@png@file{\Gin@base-\pdf@page.png}%
\expandafter\Needs\expandafter{"convert \current@pdf@file\space %\csname Gin@base\endcsname.pdf
\current@png@file"}%
\Picture[pict]{\current@png@file}%
\special{t4ht+@File: \csname current@png@file\endcsname}
\let\pdf@page\relax
}
}
\Hinput{pdfpages}
\endinput
In this file, first of all we declare page
option for \includegraphics
command, because it isn't defined in the DVI
mode:
\let\pdf@page\relax
\define@key{Gin}{page}[]{\edef\pdf@page{\the\numexpr #1-1\relax}}
We then can request inclusion of particular pages:
\renewcommand\AM@output[1]{%
\@for\@pages:=\AM@pagestemp\do{\includegraphics[page=\@pages]{\AM@currentdocname}}
}
\@for
is internal LaTeX command which can be used for looping over comma separated lists. In this case we loop over \AM@pagestemp
, where requested pages are stored.
Finally, we need to add support for PDF images for tex4ht
:
\AtBeginDocument{
\Configure{graphics*}
{pdf}
{
\ifx\pdf@page\relax\def\pdf@page{0}\fi
\def\current@pdf@file{\Gin@base.pdf[\pdf@page]}
\def\current@png@file{\Gin@base-\pdf@page.png}%
\expandafter\Needs\expandafter{"convert \current@pdf@file\space %\csname Gin@base\endcsname.pdf
\current@png@file"}%
\Picture[pict]{\current@png@file}%
\special{t4ht+@File: \csname current@png@file\endcsname}
\let\pdf@page\relax
}
}
\pdf@page
contains the requested page, this macro is stored by \includegraphics
page
option. We can convert particular pdf page using Imagemagick's convert
command in the form:
convert filename.pdf[page number] filename.png
The converted image is then included using \Picture
command. \special
is used to register the output file in tex4ht
, so it can be copied to the destination directory, for example.
pdfpages
package. do you include PDF files in your document? – michal.h21 Dec 2 '16 at 21:48