Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to combine Helvetica World (for roman, cyrillic, greek and arabic) and Hei Std (for simplified chinese) in one document with LuaLaTeX. Hei Std probably hasn't all the glyphs from Helvetica World and Helvetica World certainly hasn't all characters from Hei Std.

Can I get LuaLaTeX to automatically choose the right font based on the input, i.e. can I combine fonts into one "virtual font"? I don't want to switch the fonts manually.

Out of curiosity I'm also interested in a solution for XeLaTeX, but I need one for LuaLaTeX.

share|improve this question
    
In theory: yes - LuaTeX has on-the-fly-virtual-fonts. I am also interested in how to do that with luaotfload :) –  topskip Jul 11 '12 at 10:28
    
@PatrickGundlach: I've edited the question to also ask for XeTeX-based solutions. AFAIK XeTeX also has provisions for this. –  Martin Schröder Jul 11 '12 at 10:50
2  
the package unicode-math can handle different fonts for a defined range of characters. For a text font it maybe possible in the same way –  Herbert Jul 11 '12 at 11:00
4  
For XeLaTeX the best is probably to use xeCJK (see e.g. tex.stackexchange.com/questions/21046). This uses \XeTeXinterchartoks. For luatex there has been some discussion to implement something similar (tex.stackexchange.com/questions/21625) but the code suggested there by Taco has some problems (see the comment of Manual). I don't know if someone created something better (or is working on it). –  Ulrike Fischer Jul 11 '12 at 12:21
2  
@Herbert: this works for unicode-math because in math each symbol specify its font, in text mode it is entirely a different matter. ConTeXt support script and range-based font fallbacks without even using virtual fonts, so it is certainly possible... –  Khaled Hosny Jul 11 '12 at 13:45
show 5 more comments

1 Answer

up vote 2 down vote accepted

Yes, for XeLaTeX, you should use our xeCJK package. For Chinese typesetting in xeCJK, see my previous answers tagged cjk.

A simple example:

% UTF-8 encoding, compile with XeLaTeX
\documentclass{article}

\usepackage{xeCJK}
\setmainfont{Arial}
\setCJKmainfont{Microsoft YaHei}

\begin{document}
Arial font and 微软雅黑
\end{document}

And for LuaLaTeX, you can use luatexja-fontspec package from luatexja bundle. luatexja is originally designed for Japanese, but also useful for Chinese (due to Ma Qiyuan's work).

A simple example, very similar to xeCJK:

% UTF-8 encoding, compile with LuaLaTeX
\documentclass{article}

\usepackage{luatexja-fontspec}
\setmainfont{Arial}
\setmainjfont{Microsoft YaHei}

\begin{document}
Arial font and 微软雅黑
\end{document}

The English document of luatexja: http://mirror.ctan.org/macros/luatex/generic/luatexja/doc/luatexja-en.pdf

In ctex bundle, we shall also support luatexja as one of the background package. The new version has not been released.

share|improve this answer
    
Seems nice. It would be much more useful with a bit of english documentation... :-) Maybe an article in TUGboat? –  Martin Schröder Aug 22 '12 at 17:34
1  
@Martin: luatexja does have English document (and also in Japanese and Chinese). xeCJK 2.x used to have a document both in Chinese and English, but I'm sorry we updated the new version (3.x) and the English document is not ready yet. Sorry. –  Leo Liu Aug 23 '12 at 13:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.