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

2014-07-20 Thread Michal Hoftich
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 (#x00A0;) are converted to regular spaces
with this option.

Best regards,
Michal

2014-07-20 1:08 GMT+02:00 Nasser M. Abbasi n...@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




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

2014-07-20 Thread Karl Berry
Hi Michal,

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

Wouldn't it be better for \qquad to actually insert 2em, as in
  span style=width:2emnbsp;/span
(css out of my head, probably wrong, but you get the idea.)
Likewise \quad - 1em.

Also, it's not clear to me why it should be unbreakable.  It's not
unbreakable in (La)TeX.

Maybe new configuration, like
\Configure{thinspace-text} should be provided instead in text mode.

I guess.  One way or another, ideally \, would insert \thinspace (1/6em)
in text, since that'what it does in LaTeX.  \, only works in math in
plain TeX, but tugboat and other plain styles allow it to work in text
too, so why not allow it there too ...

Can you hack up a patch, perchance?

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

(I imagine character set bugs are endless.)  I don't see anything
obvious in the binary itself.  My first suspicion is that it is a
consequence of the lengthy chain of configuration files and/or in one of
the scripts that gets called :(.

thanks,
karl