The problem is with tex4ht
, application which converts dvi file to html, doesn't support opentype fonts and compilation fails when one is used. Because it seems there is nobody who understand tex4ht
c source and would be able to fix this bug, the only solution is to hack unicode-math
to not use opentype fonts with tex4ht
.
I hacked fontspec
in similar way and it worked with texlive 2012, I am not sure about texlive 2013, since there was upgrade of many involved packages - package code and info page. I tried also to hack unicode-math
, but I failed with that.
You can add some support with \DeclareUnicodeCharacter
, but it would fail in some cases, as you noted.
Edit
For your edited question, I can correctly compile your example, if I edit it little bit:
\documentclass{article}
\ifdefined\HCode
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{newunicodechar}
\newunicodechar{ö}{\"o}
\newunicodechar{φ}{\phi}
\else
\usepackage{unicode-math}
\setmathfont{Asana-Math.otf}
\fi
\begin{document}
Löse $\sqrt{φ} = 1$
\end{document}
and compile with
htxelatex filename "xhtml, mathml, charset=utf-8" " -cunihtf -utf8"
A simple example using ucharclasses
package:
\documentclass{article}
\usepackage{ucharclasses}
\usepackage{fontspec}
\usepackage{bidi}
% some fonts with Windows
\setDefaultTransitions{\fontspec{Times New Roman}}{}
\setTransitionsForCJK{\fontspec{SimSun}}{}
\setTransitionsForArabics{\fontspec{Times New Roman}\setRTL}{\setLTR}
\setTransitionsFor{Gurmukhi}{\fontspec{Raavi}}{}
\begin{document}
\begin{tabular}{ll}
Arabic (MSA) & حَوّامتي مُمْتِلئة بِأَنْقَلَيْسون \\
Chinese (Mandarin, Simplified) & 我的气垫船充满了鳝鱼 \\
Punjabi & ਮੇਰਾ ਹਵਰਕ੍ਰਾਫ਼ਤ ਨਾਂਗਾਂ ਨਾਲ਼ ਭਰਿਆ ਪਿਆ।\\
\end{tabular}
\end{document}
You should read the package document and set the proper fonts.
The use of loop in your question is OK. See also my previous answer in Generating a table of glyphs with XeTeX , but \iffontchar
is not necessary.
Best Answer
According to the TeXnicCenter site, there'a an alpha version that supports unicode: TeXnicCenter 2.0 Alpha 1.
If you are willing to change your editor, perhaps the answers to this question can be useful for you: LaTeX Editors/IDEs.
I personally use TeXworks (I use it under Linux, but it is multiplataform, so you can also use it on Windows machines).