这是includegraphics 不会在电子书转换时剪辑图片
在我的上一个主题中,有人向我展示了一个脚本,它使用外部 ImageMagic 程序将图像分成两部分并将它们放入文档中。但我为此使用了 dpfloat 包,但它与 Tex4ht 配合得不好。
问题如下图所示:
我不知道这是什么原因造成的,但我认为这是一个 dpfloat 问题。所以,我有两种方法:让 dpfloat 工作(我不知道怎么做???)或摆脱它。我可以摆脱 dpfloat,因为我已经从 ImageMagick 中分割了图片。只需要将它们作为普通图片推入,可能使用较小的边距使它们出血。但是当我尝试这样做时,Tex4Ht 在两侧插入相同(左)一半的图片。我尝试自己做,但我不明白它是如何工作的。
我的文件(如果需要):
mypic.4ht:
\NewConfigure{twosidepic}{2}
\renewcommandx\twosidepic[2][2]{%
\ifvmode\IgnorePar\fi\EndP%
\a:twosidepic%
\begin{figure}%
\def\my@ext{.jpg}
\ifx\Ginput@path\@undefined
\let\Ginput@path\input@path
\fi
\let\input@path\Ginput@path%
\@iffileonpath{#1\my@ext}{
\typeout{file found: \@filef@und}%
\expandafter\filename@parse\expandafter{\@filef@und}
\edef\base@name{\filename@area\filename@base}
\openin15=\base@name-00\my@ext\relax
\ifeof15
\Needs{"convert \base@name\my@ext" -crop 50\%x100\% +repage \base@name-\%02d\my@ext""}
\else
\includegraphics{\base@name-00\my@ext}%
\includegraphics{\base@name-01\my@ext}%
\fi
}{\typeout{Image not found}}
\caption*{#2}%
\end{figure}%
\b:twosidepic\par%
}
mypic.sty:
\ProvidesPackage{mypic}
\usepackage{graphicx}
\usepackage{dpfloat}
\usepackage{xargs}
\usepackage[font=Large,labelfont=Large]{caption}
\graphicspath{{"graphics/"}}
\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\newcommandx{\spic}[3][1=0,2]{
\clearpage
\noindent\begin{minipage}[t][\dimexpr\textheight-6pt\relax][c]{\textwidth}
\centering\includegraphics[angle=#1, width=\textwidth]{#3}
%\caption*{#2}
\end{minipage}
\clearpage
}
\newcommandx{\pic}[3][1=0,2]{
\begingroup
\clearpage
\newpage
\vspace*{3in}
\centering{\Large #2}
\newpage
\begin{minipage}[t][\dimexpr\textheight-6pt\relax][c]{\textwidth}
\center{\includegraphics[angle=#1, width=\textwidth]{#3}}
%\caption*{#2}
\end{minipage}
\clearpage
\endgroup
}
\newcommandx{\lpic}[3][1=0, 2=]{
\newpage
% \clearpage
\begin{sidewaysfigure}[ht]
\center{\includegraphics[angle=#1, width=0.8\textheight]{#3}}
\caption*{#2}
\end{sidewaysfigure}
}
\newcommandx{\twosidepic}[2][2]{
\clearpage
\begingroup
\sbox0{\includegraphics{#1}}
\begin{figure}[p]% will be the left-side figure
\begin{leftfullpage}
\noindent\begin{minipage}[t][\textheight][c]{\paperwidth}
\hspace*{-2\leftmargin}
\includegraphics[trim=0 0 {.5\wd0} 0,width=\dimexpr\paperwidth\relax,clip]{#1}
\captionsetup{font = Large, labelfont=Large, singlelinecheck = false, format= hang, justification=raggedleft, labelsep=space}
\caption*{}
\end{minipage}
\end{leftfullpage}
\end{figure}
\begin{figure}[p]
\begin{fullpage}
\noindent\begin{minipage}[t][\textheight][c]{\paperwidth}
\hspace*{-2\leftmargin}
\includegraphics[trim={.5\wd0} 0 0 0,width=\dimexpr\paperwidth\relax,clip]{#1}
\captionsetup{font = Large, labelfont=Large, singlelinecheck = false, format= hang, labelsep=space, justification=centering} %justification=justified
\caption*{#2}
\end{minipage}
\end{fullpage}
\end{figure}
\endgroup
}
\addto\captionsenglish{\renewcommand{\figurename}{}}
\newcommand\trimimage[1]{%
}
\endinput
我的文档.tex:
\documentclass[12pt, twodise]{book}
\usepackage[polish, russian, english]{babel}
\usepackage[babel,autostyle=true]{csquotes}
\MakeOuterQuote{"}
\selectlanguage{english}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage{indentfirst}
\usepackage{needspace}
\usepackage{comment}
\usepackage[inner=0.75in, outer=0.75in, top=0.75in, bottom=0.75in, paperwidth=6in, paperheight=9in]{geometry}% inner=0.875in
%\usepackage{changepage}
\usepackage{anyfontsize}
\usepackage{epigraph}
\usepackage{afterpage}
\usepackage[figuresright]{rotating}
\usepackage{lettrine}
\usepackage{yfonts}
\usepackage{nopageno}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{mypic}
\setlength{\parskip}{1em} % changes vertical space between paragraphs
\setlength\parindent{0pt} % sets indent to zero
\newcommand\blankpage{
\null
%\thispagestyle{empty}
%\addtocounter{page}{-1}
\newpage
}
\newcommand{\tmpx}{}
\newcommand\tmp[1]{\renewcommand{\tmpx}{#1}}
\fancypagestyle{capt}{\fancyfoot[R]{\tmpx}}
% \pagestyle{fancy}
\fancyhf{}
\fancypagestyle{alim}{\fancyhf{}\renewcommand{\headrulewidth}{0pt}\fancyfoot[C]{\arabic{page}}}
\begin{document}
\pic{1}
\blankpage
\twosidepic{2}
%\end{comment}
\end{document}