EDIT: @michal.h21
you tip works well, but if I use a numerical code such as  
for thin space, instead of its name  
in your modified trick,
\def\mythinspace{\HCode{<span style="white-space:nowrap"> </span>}}
then the make4ht
outputs an error:
(d:/texlive/texmf-dist/tex/latex/newunicodechar/newunicodechar.sty)
! Illegal parameter number in definition of \mythinspace.
<to be read again>
8
l.29 ...{\HCode{<span style="white-space:nowrap">
201;</span>}}
?
QUESTION 1 : is it possible to enter a numerical name in the definition of \mythinspace
?
QUESTION 2: is it possible to turn every ~
from my .tex
used as a thin non breakable space, into a
<span style="white-space:nowrap"> </span>}
in my .html
???
For instance, there is also the case of the long dash ---
which must have a non breakable space inside it. I attempt to replace the tilde
by
\catcode`\~=\active%
\def\~{\unskip\mythinspace\ignorespaces}%
but of course it no longer shows the tilde
when I need one: Try to compile the code below with active the replacement of the tilde.
\textemdash~my text in long dash~---\\
---~asdmy text in long dash~\textemdash
\~{n}ana un tilde \~{}.
\char`\~
you see that the tilde
disappears. even worse, the .html
does not show a replacement of the tilde with the thin non-breakable space
<!--l. 202--><p class="noindent" ><span
class="cmr-12">—</span><span
class="cmr-12"> my text in long dash</span><span
class="cmr-12"> —</span><br
class="newline" /><span
class="cmr-12">—</span><span
class="cmr-12"> asdmy text in long dash</span><span
class="cmr-12"> —</span>
</p>
<!--l. 205--><p class="noindent" ><span style="white-space:nowrap"> </span><span
class="cmr-12">nana un tilde</span><span style="white-space:nowrap"> </span><span
class="cmr-12">.</span>
</p>
<!--l. 207--><p class="noindent" ><span
class="cmr-12">˜</span>
</p>
So is it possible to turn every ~
from my .tex
used as a thin non breakable space, into a
<span style="white-space:nowrap"> </span>}
in my .html
while keeping intact the use of ~
when it is used normally, like for accents in \~{o}
???
========= END OF EDIT ============
In my .tex
, I use both ---
and \textemdash
and I put always a ~
inside my long dashes.
Nonetheless, in the .html
, the ~
are suppressed in being turned into a regular breakable space.
Is it possible to tell
I know nothing about html
, but I want to output a .html
, from a .tex
which is written in utf8
and contains quotes «
, »
and other inputs like this that lualatex
displays well in a .pdf
. the problem is that, contrary to lualatex
which makes unbreakable the spaces inside thequotes, my command
make4ht -ul hello.tex
does not put unbreakable space inside the «
, »
. @michal.h21, michal.h21, Removing spaces before command, gives a solution for replacing, in the .html
, personal commands in the .tex
but since I enter directly the quotes «
, »
, I cannot use them.
For portability in order to avoid a .cfg
, I also want a solution which can be put, in the .tex
, inside the \ifx\HCode\undefined \else
:
\ifx\HCode\undefined \else
%unusable solution by @michal.h21
%\def\guillemotleft{\HCode{« }}
%\def\guillemotright{\unskip\HCode{ »}}
\fi
A complete document would thus be :
\documentclass[oneside,a4paper, 12pt]{article}
%\usepackage[french]{babel}
%\usepackage[style=french]{csquotes}%
\usepackage{alternative4ht}
\altusepackage{polyglossia}
\altusepackage{fontspec}
\setdefaultlanguage{french}
\begin{document}
\ifx\HCode\undefined \else
\Css{body{background-color:gainsboro;}}
\Tag{TITLE+}{possibilities for unbreakable space inside « » in HTML}
%unusable solution by @michal.h21
%\def\guillemotleft{\HCode{« }}
%\def\guillemotright{\unskip\HCode{ »}}
\fi
; œ ; Œ ; É ; È ; Ê ; À ; Á ; Å ; Ç
%\euro{}
; \oe{} ; \OE{} ; \'{E} ; \`{E} ; \^{E} ; \'{A} ; \`{A} ; \AA{} ; \c{C}
ī \={\i}
My quotes with breakable spaces, once in a html:
« blabla ».
In lualatex, the french spaces for !, ;, : are set properly.
No need for a ~ as in ~!, ~; ~:.
\end{document}
Here, is exposed various spaces in html
:
The best way to create a fixed-width nonbreaking space in HTML is probably to use the no-break space and style its width. Since the width of an inline element cannot be set in CSS, according to the specifications, we make the element an inline block. This means markup like the following (where can be replaced by the no-break space character itself:
<span class=fine> </span>
The style sheet could be:
.fine {
display: inline-block;
width: 0.125em;
}
which gives
<div>text before the quote <a class=fine> </a>: «<a class=fine> </a>the quote itself <a class=fine> </a>!<a class=fine> </a>».</div>
He says that there is also a NARROW NO-BREAK SPACE
, along with the ordinary NO-BREAK SPACE
.
QUESTION:
How can I my «
, »
in my .tex
be transformed, in the html
, into
«<a class=fine> </a>
<a class=fine> </a>»
in general how can I be sure that the french spacing
(for !
, ;
, :
and so on) is used in my html
?