Hi jjgod,<br><br> I came up with an inspiration yesterday night on the macro implementation of font selection and space skipping. It is based on the thought of explicit switch via the active tilde. After an hour's hack I've finished the primitive part. Further development requires a judge for math mode and parameterized commands, so the change of behavior of backslash and braces is needed.
<br><br> Following is a test case encoded in UTF-8. Compiled successfully on my XeTeX 2.2-0.996.<br><br>\catcode`@=11<br>\XeTeXlinebreaklocale "zh"<br>\XeTeXlinebreakskip = 0pt plus 1pt<br>\input xfwpunct.sty<br>
\FWPsetcompactlig % if you have xfwpunct.sty to judge the full-width punctuation kerning<br>\font\zhfont="SimSun" at 12pt<br>\zhfont<br>\font\enfont="Times New Roman" at 12pt<br>\newskip\toggleskip % skip when toggling font
<br>\newtoks\togglechinese<br>\toggleskip=0.3ex plus 0.6ex<br>\togglechinese={\enfont}<br>\long\def\xchin#1{\xchinese #1\endxchinese}<br>\def\xchinese{%<br> \begingroup<br> \xchinese@savespecials<br> \let\xchinese@savespecials\relax % no further save needed
<br> \xchinese@makespecials<br> \xchinese@iterate<br>}<br>\def\xchinese@savespecials{%<br> \let\xchinese@oldtilde~<br> \let\xchinese@oldtildecmd\~<br>}<br>{\catcode`\<=\active<br>\catcode`\>=\active<br>\catcode`\~=\active
<br>\gdef\xchinese@makespecials{%<br> \catcode`\<=\active<br> \catcode`\>=\active<br> \let<\xchinese@bgroup<br> \let>\relax<br> \let~\xchinese@tilde<br> \let\~\xchinese@oldtilde<br> \let\tild\xchinese@oldtildecmd
<br>}%<br>}<br>\def\xchinese@restorespecials{%<br> \catcode`\<=11<br> \catcode`\>=11<br> \let~\xchinese@oldtilde<br> \let\~\xchinese@oldtildecmd<br>}<br>\long\def\xchinese@tilde#1~{%<br> \begingroup<br> \xchinese@restorespecials
<br> \the\togglechinese<br> \hskip\toggleskip #1\hskip\toggleskip<br> \endgroup<br> \xchinese@iterate<br>}<br>{\catcode`\>=\active<br>\long\gdef\xchinese@bgroup#1>{%<br> \xchinese<br> #1\endxchinese<br> \xchinese@iterate
<br>}%<br>}<br>\long\def\xchinese@iterate#1{%<br> \ifx #1\endxchinese<br> \endxchinese<br> \else<br> \let\xchinese@iterate@next\xchinese@iterate<br> \ifx #1\xchinese@tilde<br> \let\xchinese@iterate@next\xchinese@tilde
<br> \else<br> \ifx #1\xchinese@bgroup<br> \let\xchinese@iterate@next\xchinese@bgroup<br> \else<br> \xchinese@restorespecials<br> #1\xchinese@makespecials<br> \fi<br> \fi<br> \expandafter\xchinese@
iterate@next<br> \fi<br>}<br>\def\endxchinese{%<br> \endgroup<br>}<br><br>\line{\hrulefill}<br><br>\def\frac#1#2{\bgroup #1\over #2\egroup}<br>\xchinese<br><br>由图可见,~PID~控制器是通加对误差信号~$e(t)$~进行<br>比例、积分和微分运算,其结果的加权,得到控制器的输
<br>出~$u(t)$~,该值就是控制对象的控制值。其输入<br>~$e(t)$~与输出~$u(t)$~的关系为:~<br><br>$$<br>u(t) = K_P e(t) + T_i \int_0^t e(\tau)d\tau + T_d \frac{de(t)}{dt}<br>$$~<br><br>\endxchinese<br><br>\xchinese\endxchinese<br><br>\bye<br><br><br><div>
<span class="gmail_quote">2007/2/14, Jjgod Jiang <<a href="mailto:gzjjgod@gmail.com">gzjjgod@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Peter and Bruno,<br><br>2007/2/14, Peter Dyballa <<a href="mailto:Peter_Dyballa@web.de">Peter_Dyballa@web.de</a>>:<br>> Font switching is not all, there should also happen a switch to a<br>> different language with other typographic rules. Something like
<br>> Babel's \selectlanguage{} might be the right thing: switching the<br>> text's language, switching the font and its script and language (like<br>> fontspec offers), plus some internals like writing direction, glue ...
<br><br>I can understand your points now. Indeed, we guys using XeTeX<br>to typeset Chinese are not very satified with glue between CJK<br>characters and Latin characters. So the questions is, can we solve<br>this problem at TeX macro level? If not, we still need low level
<br>mechanism provided by some XeTeX primitives.<br><br>- jjgod.<br>_______________________________________________<br>XeTeX mailing list<br><a href="mailto:postmaster@tug.org">postmaster@tug.org</a><br><a href="http://tug.org/mailman/listinfo/xetex">
http://tug.org/mailman/listinfo/xetex</a><br></blockquote></div><br>