How to create multilingual (English, Japanese) html document with htlatex
You can use one of helpers4ht packages, alternative4ht
. It isn't on CTAN yet, but installation is easy.
This method is described in a tutorial, your document needs only small changes:
\documentclass{article}
\usepackage{import}
\usepackage{alternative4ht}
%\nonstopmode
\usepackage{makeidx}
\usepackage{appendix}
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage[table]{xcolor}
\usepackage{enumerate}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{hyperref}
%
\altusepackage{fontspec}
\altusepackage{xeCJK}
%\usepackage[TS1,T1]{fontenc}
\altusepackage{xunicode}
\setCJKmainfont{AozoraMinchoRegular}
\defaultfontfeatures{Mapping=tex-text} % To support LaTeX quoting style
\defaultfontfeatures{Ligatures=TeX}
\pagenumbering{roman}
\providecommand{\tabularnewline}{\\}
\newcommand{\documentname}{マニュアル}
\title{TestHTML}
\date{\mydate{\today}}
\begin{document}
\clearpage
% -------- sections ----------------
\pagenumbering{arabic}
\setcounter{page}{1}
% end preamble
% Chapters
\documentname この章では、コマンドラインインターフェースで使用可能な機能について解説します。ユーザが使用できるオプションについて知り>たい場合は本章>を参照してください。
This section is in english.
\end{document}
important lines are
\usepackage{alternative4ht}
...
\altusepackage{fontspec}
\altusepackage{xeCJK}
%\usepackage[TS1,T1]{fontenc}
\altusepackage{xunicode}
this will load special version of these packages, which doesn't fail under tex4ht
. The config.cfg
can look like:
\Preamble{html}
\begin{document}
\Css{
body {
background: url(doc_preamble_html.jpg) no-repeat center center fixed;
background-repeat:no-repeat;
font-family:"ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro",Osaka, "メイリオ", Meiryo, "MS Pゴシック", "MS PGothic", sans-serif;
background-attachment:fixed;
background-position:top;
}
}
\EndPreamble
The file needs to be compiled with lualatex
as compiler, which can be done using:
make4ht -ulc config sample.tex
make4ht is alternative build system for tex4ht
, it has much more features than htlatex
.
The result: