1

According to Amazon's Kindle Publishing Guidelines, I need to add xmlns:mbp="http://www.kreutzfeldt.de/mmc/mbp" to the <html> tag in my html file.

I have tried many variants of the following:

\documentclass{article}
  \input{tex4ht.sty}
  \Preamble{xhtml}
\begin{document}
    \Configure{PROLOG}{HTML+,HTML,@HTML}
%    \Configure{HTML+}{\HCode{plus-html test}}
%    \Configure{@HTML}{\HCode{at-html test}}
%    \Configure{HTML}{\HCode{naked-html test}}
    \Configure{*XML-STYLESHEET}{\HCode{xmlss test}}
    \Configure{@HEAD}{\HCode{head test} }
    \HCode{<meta name="parameter" content="content">}
    \Configure{TITLE+}{This is my title}
  \EndPreamble

Content
\end{document}

Most of these succeed in inserting something in the <head> section, but nothing goes into the <html> tag. \Configure{PROLOG} doesn't seem to make much if any difference. When I don't comment out the \Configure{HTML} line, I get an error:

! Argument of \Configure has an extra }.
<inserted text> 
                \par 
l.16 \end{document}

Obviously, I can insert this by hand, but it seems as though tex4ht is set up to do this. <rant> of all the poorly-documented features of tex4ht, the stuff having to do with \Configure{PROLOG} seems to be the worst I've run into so far.</rant>

2 Answers 2

2

\Configure{HTML} has two parameters, you have only one in your example, so this may be source of the error. Note that there is \Configure{@HTML} for inserting code into <html ...>. xml:lang with correct language code is inserted by default, so you will need to provide it by yourself. And lastly, you don't need to use \Configure{PROLOG}.

Simple .cfg file:

\Preamble{xhtml}
\Configure{@HTML}{xml:lang="en" xmlns:mbp="http://www.kreutzfeldt.de/mmc/mbp" \Hnewline}
\begin{document}
\EndPreamble

results in:

<html xml:lang="cs" xml:lang="en" xmlns:mbp="http://www.kreutzfeldt.de/mmc/mbp"
xmlns="http://www.w3.org/1999/xhtml"
> 
2
  • AHA! That is what those numbers were in the documentation... the number of additional arguments! Also see my comment to @Martin.
    – Nat Kuhn
    Sep 21, 2014 at 18:46
  • @NatKuhn yes, these numbers are number of arguments :)
    – michal.h21
    Sep 21, 2014 at 18:53
1

The \Configure statements should be placed before \begin{document} in order to make tex4ht process them correctly, e.g. something like so:

\documentclass{article}
\input{tex4ht.sty}
\Preamble{xhtml}
\Configure{HTML}
  {\HCode{<html xmlns="http://www.w3.org/1999/xhtml" xmlns:mbp="http://www.kreutzfeldt.de/mmc/mbp">}}
  {\HCode{</html>}}
\Configure{@HEAD}{\HCode{<meta name="parameter" content="content">}}
\Configure{TITLE+}{This is my title}

\begin{document}
  \EndPreamble
  Content
\end{document}
1
  • For some reason, every time I had tried to put these \Configure commands before the \begin{document, I had gotten "Undefined control sequence" errors... here, it seems to work. Anyway, thanks!
    – Nat Kuhn
    Sep 21, 2014 at 18:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .