[tex4ht] help on syntax add a \Configure{@HEAD}

Nasser M. Abbasi nma at 12000.org
Wed Jan 8 14:43:22 CET 2014


I've always had hard time adding HTML code to my .cfg file
as I am not sure what the syntax is supposed to be in
terms of when to use \Hnewline and if I need to escape
some characters and such.

I am now trying to add an additional mathjax configuration
item. The HTML itself is shown at mathjax web site below

http://docs.mathjax.org/en/latest/configuration.html

Here it is
------------------
<script type="text/x-mathjax-config">
   MathJax.Hub.Config({
     extensions: ["tex2jax.js"],
     jax: ["input/TeX", "output/HTML-CSS"],
     tex2jax: {
       inlineMath: [ ['$','$'], ["\\(","\\)"] ],
       displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
       processEscapes: true
     },
     "HTML-CSS": { availableFonts: ["TeX"] }
   });
</script>
-------------------

To add this to my .cfg file, I copied the above and added
it inside

\Configure{@HEAD}{\HCode{ .. HERE .... }}

I tried adding \Hnewline in few places, but nothing helped. Here
is what I have now

-------------------------------
  \Configure{@HEAD}{\HCode{
      <script type="text/x-mathjax-config">
        MathJax.Hub.Config({
          extensions: ["tex2jax.js"],
          jax: ["input/TeX", "output/HTML-CSS"],
          tex2jax: {
            inlineMath: [ ['$','$'], ["\\(","\\)"] ],
            displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
            processEscapes: true
          },
          "HTML-CSS": { availableFonts: ["TeX"] }
        });
      </script>\Hnewline
   }}
-----------------------

When I run a tex file that uses the above .cfg,
I get syntax errors:

--------------------------
! Undefined control sequence.
\\  ->\let \reserved at e
                \relax \let \reserved at f \relax \@ifstar {\let \reserv...
l.213 \EndPreamble
                   
?
--------------------------

I put a copy of my complete .cfg file in this folder:

http://12000.org/tmp/080114/

if someone like to see the whole file. Here is a test:

----  foo.tex -----
\documentclass{article}%
\begin{document}
test
\end{document}
------------------

htlatex foo.tex  "nma.cfg"

and the error will show up. I think it is an escape character
issue?

texlive 2013, on linux machine

thank you,
--Nasser









More information about the tex4ht mailing list