[tex4ht] tex4ht support for Non-Breaking Space according to \quad and \qquad etc..

Michal Hoftich michal.h21 at gmail.com
Sun Jul 20 12:16:08 CEST 2014


Hi Nasser,

you can use

\Configure{qquad}{\HCode{\string&\#x00A0;}}

to configure \qquad in your config file. It don't have a configuration
by default. \, can be configured with \Configure{,}, but it seems that
this work only in math mode, if I understand correctly definition in
tex4ht-4ht.tex:

----------
\def\:tempc{\relax\ifmmode\csname a:,\endcsname\else\thinspace\fi}
\expandafter\HLet\csname , \endcsname=\:tempc
\def\:tempc{\relax
  \ifmmode\csname a:,\endcsname\expandafter\:gobble\fi
  \o:thinspace: }
\HLet\thinspace=\:tempc
\NewConfigure{,}{1}
\Configure{,}{\mskip\thinmuskip}
------------

\, is configured to use \Configure{,} in math mode, otherwise
\thinspace is used. \thinspace is also configured to use \Configure{,}
in math mode, otherwise original \thinspace code is used
(\o:thinspace: is created with \HLet\thinspace and it is saved
original \thinspace). Maybe new configuration, like
\Configure{thinspace-text} should be provided instead in text mode.

I've also found some really weird behavior of tex4ht with -utf8 option, like in

    htlatex filename "xhtml, charset=utf-8" " -cunihtf -utf8"

non breaking space entities ( ) are converted to regular spaces
with this option.

Best regards,
Michal

2014-07-20 1:08 GMT+02:00 Nasser M. Abbasi <nma at 12000.org>:
> Hello;
>
> The following tex file
> -------------------
> \documentclass[12pt]{article}
> \begin{document}
> This is \qquad space.
> \end{document}
> -------------------
>
> when compiled using htlatex foo.tex produces this html for
> the line above
>
> ------------------------
>
> <!--l. 6--><p class="noindent" >This is       space.
>     ----------------------------------
>
> But the above space in HTML shows up as a single space does
> not show up. It should have used Non-Breaking Space "&nbsp".
>
> One way to add this support is given by Radhakrishnan in
> this answer:
>
> http://comments.gmane.org/gmane.comp.tex.tex4ht/86
>
> One has to add this to the .cfg
>
> \makeatletter
> % thin space to html thin space
> %\ <at> ifundefined{HCode}{}{\def\thinspace{\HCode{\string&\#x2009;}}}
> % thin space to html non-breaking space
> \ <at> ifundefined{HCode}{}{\def\thinspace{\HCode{\string&\#x00A0;}}}
> \makeatother
>
> I was wondering if it is not much work, if this could be
> integrated into tex4ht itself, so that it works like the above
> out of the box for both \quad and \qquad?
>
> thank you
> --Nasser
>



More information about the tex4ht mailing list