maranget / hevea

Hevea is a fast latex to html translator
http://hevea.inria.fr
Other
97 stars 12 forks source link

Emulate "\discretionary" and implement "\-". #22

Closed cspiel closed 3 years ago

cspiel commented 4 years ago

Hevea lacks the \discretionary macro which means words that need it (on the LaTeX side) get butchered in the HTML output. This P/R implements just as much of

\discretionary{pre-break}{post-break}{no-break}

that the special cases \discretionary{}{}{} (empty discretionary) and \discretionary{-}{}{} (simple hyphenation point) are covered and all others simply expand to no-break.

Mapping of the empty discretionary to "word-break opportunity": Some browser interpret the zero-width space character, some the HTML5 tag wbr, and presumable others do not understand either. So, we have introduced an extra level of indirection called \word@break@opportunity, which can be redefined by the user to get the desired translation of \discretionary{}{}{}. The default is wbr.

TeX macro \- directly maps to the soft hyphen.

maranget commented 3 years ago

Merged thanks