# [Cjk] CJKTeX -> HTML

Danai SAE-HAN (=?iso-2022-jp?B?GyRCNFpDI0JRGyhC?=) danai.sae-han at skynet.be
Mon Jul 7 00:46:58 CEST 2003

From: jsbien at mimuw.edu.pl (Janusz S. Bień)
Subject: Re: [Cjk] CJKTeX -> HTML
Date: 06 Jul 2003 19:14:00 +0200
Message-ID: <873chjbmsn.fsf at mimuw.edu.pl>

jsbien>
jsbien> It worked for me.

I've tried HyperLaTeX on a simple CJK document (id est without ruby,
change of fonts, &U-[xxxx]; references, et alii) and it worked pretty
well.  Of course, I have copied everything to another file and
converted it to UTF-8 (I mostly use emacs-mule encoding, and use
\CJKencfamily{}{} because I mostly mix FanTi and JianTi, and sometimes
add a bit of Japanese too ;).

The tricky thing with HyperLaTeX is that you have to comment out'
things it doesn't understand, either with \T if it's a single line, or
\texonly{} if it's multi-line.

For example, it doesn't understand \def, so here's what to do:
\texonly{
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
}

It doesn't know what to do with packages like calc, pinyin, ruby, and
95% of the existing packages, so it will produce a little warning, but
nothing major.  Just put \usepackage{hyperlatex} at the beginning and
comment out' all the packages it doesn't understand with \T.

HyperLaTeX has the possibility to use HTML code with the \W or
\htmlonly{} tags.  I don't know about latex2html though.  I think this
is a good thing, because TeX and HTML aren't the same thing: HTML
should not be an exact copy of TeX, as if it were a printed text
viewed online, nor vice versa.
For example, the entry'' environments in `The LaTeX Companion'
(p. 63-64):

\T\usepackage{calc}
\texonly{
\newenvironment{Ventry}[1]%
{\begin{list}{}%
{\renewcommand{\makelabel}[1]{\CJKencfamily{GB}{gbsn}{##1:}\CJKencfamily{GB}{fangzhengkaitijianti}\hfil}%
\settowidth{\labelwidth}{\textsf{#1:}}%
\setlength{\leftmargin}{\labelwidth+\labelsep}}}%
{\end{list}}
}
\htmlonly{
\newenvironment{Ventry}[1]
{\begin{description}}
{\end{description}}
}

You can use CSS selectors[1] like :first-child to change your HTML,
and put it in a seperate CSS file.

The HTML code it produces is XHTML 1 Transitional, with quite a lot of
(rather small but still inconvenient) errors, but imho it is the way
to go.  There are a few interesting commands, like \htmlcharset{} and
\htmlcss{}.

I could keep rambling for hours to come about HyperLaTeX, but it comes
with a manual.  *phew*

jsbien> However, I've done the conversion from mule-ucs to
jsbien> utf-8 with the CVS version of unicode-emacs instead of Mule-UCS as I

Cool.  I must check it out some time. :D

[1] http://www.w3.org/TR/REC-CSS2/selector.html

Danai SAE-HAN

--