2

I try to configure the below xml structure through TeX4Ht

<fig id="fig_ch1_001">
<label>Figure 1.1</label>
<caption><title>Sample Text</title></caption>
<graphic xlink:href="demo.eps"/>
</fig>

MWE

\documentclass{book}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\includegraphics{demo.eps}
\caption{Sample Text}
\end{figure}
\end{document}

CFG

\ConfigureEnv{figure}{\ifvmode\IgnorePar\fi \EndP\HCode{<fig id="fig_ch\thechapter_\thefigure">}%
                      \HtmlParOff\bgroup \Configure{float}{\ShowPar}{}{}}
                     {\egroup\IgnorePar\EndP\HCode{</fig>}\ShowPar\par\HtmlParOn}
                     {}{}


\Configure{caption}{\HCode{<label>}}
                   {}
                   {\HCode{</label><caption><title>}}
                   {\HCode{</title></caption>}}%

\makeatletter
\Configure{IMG}
  {\HCode{<graphic xlink:href="\Gin@base\Gin@ext}}
  {}
  {"}
  {\HCode{"/>}}
  {}
\makeatother

I getting the correct output for figure environment and caption but in the image part, i am getting the wrong output as expected (i tried to modify in the \Configure{graphics}).

How to configure IMG part with the exact figure name `' ?

if we change `IMG' it will affect the equation image conversion?

  • the eps file is converted to png. do you want to use the generated png, or rather stick with original eps? – michal.h21 May 12 '17 at 10:02
  • @michal no need to convert png, we need to retain as eps for later usage. – vctu May 12 '17 at 11:03
3

Try the following configuration:

\makeatletter
\newcommand\usegraphics{%
  \HCode{<graphic xling:href="\Gin@base\Gin@ext" ></graphic>}%
  \special{t4ht+@File: \Gin@base\Gin@ext}%
}
\Configure{graphics}{\usegraphics}{}{}
\Configure{graphics*}{png}{\usegraphics}
\Configure{graphics*}{jpg}{\usegraphics}
\Configure{graphics*}{gif}{\usegraphics}
\makeatother

This configuration will <graphic> element at every \includegraphics, it won't do any conversions of the required image. You need to use \Configure{graphics*}{extension} for each graphic format you want to support.

This is the result:

   <fig id="fig_ch0_0">

<a 
 id="x1-21"></a>

<graphic xling:href="demo.eps" ></graphic>
<label>Figure 1</label><caption><title>Sample Text</title></caption>

   </fig>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.