1

I would like to understand

\Preamble{xhtml}
  \Configure{graphics*}  
         {pdf}  
         {\Needs{"convert \csname Gin@base\endcsname.pdf  
                               \csname Gin@base\endcsname.png"}%  
          \Picture[pict]{\csname Gin@base\endcsname.png}%  
          \special{t4ht+@File: \csname Gin@base\endcsname.png}
         }  
\begin{document}
\EndPreamble

First of all, what does \Preamble{xhtml} mean? what is the difference to \Preamble{html}? What other kinds of preambles exist?

I tried the same with \begin{document} before the \Configure{graphics*}. What difference does this make? Somewhere I found a \makeatletter in a config file.

Also, I would interpret the \configure{graphics*} as applying what is inside the second {} as what is applied to pdf-files, included via \includegraphics, right? Could someone give me a hint on the details?

Finally, where can i place the cfg-file above so that it applies to all latex files I write on my system??

  • You can highlight code in your post using back-ticks. To highlight code-blocks, either indent them by four spaces or use the {} on the gui. – Andrew Oct 17 '16 at 21:24
  • The \Preamble commands you ask about are for producing xhtml and html, respectively. These are used when you run your document through htlatex. TeX4ht is complicated and not particularly well documented. A good starting point to learn how to use it is the tutorial. – Andrew Oct 17 '16 at 21:31
  • @andrew Thank you, ... when I use htlatex file.tex mycfg,html it works fine, but also if i use htlatex file.tex mycfg,xhtml... is sthis possible?? – user2609605 Oct 17 '16 at 22:20
  • @andrew next question: how can I make the config file available globally? Is there a place where to put it? Currently it is with the tex-files. – user2609605 Oct 17 '16 at 22:22
  • From memory, if you,put the file into the usual tex search space then tex4htmshould find it. The search path depends on the operating system. I am not near my computer at the moment but for me I think it's something like /usr/local/texlive/local. For more info ,see for example, tex.stackexchange.com/questions/1137/… – Andrew Oct 18 '16 at 2:24
2

There is a subtle difference between html and xhtml options, some tags aren't closed in html option, for example. html is used by default, but I would always use xhtml, html seems obsolete to me.

It usually doesn't matter if you put your configurations before or after \begin{document}. In some cases you may get error missing \begin{document}, in this case you should put the configuration which causes this issue after begin{document}. I must admit that I don't recall which configuration can cause that, but I am sure that I approached this issue.

Each \Configure graphics may take different number of arguments, it depends on how it was declared. \Configure{graphics*} takes two arguments, the first one is included format, which is configured, the second is code which should be executed to include that image. It usually contains code to make conversion between different image formats, command to include the resulting image in the list of files used by tex4ht and finally command to include the final picture in the document. Some documentation can be found here.

Command

 \Needs{"convert \csname Gin@base\endcsname.pdf  
                           \csname Gin@base\endcsname.png"}

declares that command convert should be executed. \csname Gin@base\endcsname contains the image name. As this command contains @ characters in it's name, you can either enable it using \makeatletter and the you can just use \Gin@base, or you can use this \Csname ... \endcsname construct. In this case you don't need to use \makeatletter.

 \Picture[pict]{\csname Gin@base\endcsname.png}%  

is used to include the image in the document and

 \special{t4ht+@File: \csname Gin@base\endcsname.png}

declares the image file as used. It is important if use different output directory for your document, the image wouldn't be copied if you don't use this construct.

Regarding config file place, you can put it in you local TEXMF tree, somewhere in the /tex/latex directory, it would be something like /home/michal/texmt/tex/latex/mytex4htconfigs/mycongig.cfg on my system.

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.