3

In a document, I need to get all these working:

  • japanese text
  • latin diacritics with cedilla, e.g şţ and with comma, e.g șț
  • slanted text

This is a book I also distribute to others, so I can't change back to pdflatex, it has to remain xelatex (and besides, in xelated the second criteria is fulfilled).

With the following POC, the former and the latter don't work:

\documentclass[10pt]{article}
\usepackage{ifxetex}

\ifxetex
  \usepackage{fontspec}
  \usepackage{xunicode}
  \defaultfontfeatures{Mapping=tex-text} % To support LaTeX quoting style
  \defaultfontfeatures{Ligatures=TeX}
\else
  \usepackage[utf8]{inputenc}
  \usepackage[T1]{fontenc}
\fi

\usepackage{helvet}

\begin{document}
    \setmainfont[Ligatures={TeX, Common}, % sequences of two or more characters yeld one character]
    ItalicFont={Charis SIL:style=Italic},
%    SlantedFont={SourceSansPro Slanted},
    ItalicFeatures=FakeSlant,
    %MonoFont={Myriad CAD:style=Regular},
    Mapping=tex-text,AutoFakeSlant=0.2
    ]{Source Sans Pro:style=Regular} % found by $ fc-list

hello world \textit{italic text} and \textsl{slanted text} and \texttt{monospaced text}.

Diacritics: șş țţ ȘŞ ȚŢ î Î ă Ă

Japanese: 守 破 離

\end{document}

The output looks like:

enter image description here

How to get it working properly?

Working example

Thanks to @Ulrike Fischer, I got it working like this on ArchLinux with xelatex:

\documentclass[10pt]{article}

\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont[SlantedFont={Charis SIL},SlantedFeatures={FakeSlant=0.2}]{Charis SIL}

\usepackage{xeCJK}
\setCJKmainfont{DejaVu Sans Mono}
\setCJKfamilyfont{sf}{Kozuka Mincho Pr6N:style=R,Regular}
\setCJKfamilyfont{tt}{DejaVu Sans Mono}
\newcommand{\jptext}[1]{\sffamily#1}


\begin{document}
%Roman font Charis SIL:
hello world \textit{italic text} and \textsl{slanted text}.
Diacritics: șş țţ ȘŞ ȚŢ î Î ă Ă

\texttt{monospaced font}

Japanese: \jptext{守 破 離}

----------------------------------------------

%Sans serif font:
\sffamily
hello world \textit{italic text} and \textsl{slanted text}.
Diacritics: șş țţ ȘŞ ȚŢ î Î ă Ă

\texttt{monospaced font}

Japanese: \jptext{守 破 離}
\end{document}

Hope it helps someone.

4
  • @lockstep thanks for the edit. I've tried to use the tags japanese for cjk and diacritics for accents, but I didn't have enough reputation. Could you create those tag synonyms?
    – Flavius
    Commented Aug 4, 2012 at 13:36
  • I'l see what I can do (haven't created synonyms for a long time).
    – lockstep
    Commented Aug 4, 2012 at 13:38
  • Hmm ... I'd need 5 rep in {cjk}, which I haven't -- will ping a moderator.
    – lockstep
    Commented Aug 4, 2012 at 13:40
  • @lockstep: Now {janpanese} tag does not exist. I'll add the synonyms when necessary next time.
    – Leo Liu
    Commented Aug 4, 2012 at 16:35

1 Answer 1

4

Regarding the japanese you should imho use xecjk and setup a suitable cjk-font. I don't have much fonts with japanese glyphs so I used Arial Unicode, but there are other.

(Side remark: The xecjk version currently distribuated with miktex doesn't work with the newest l3kernel. You need to get the xecjk from CTAN if you run into errors).

I don't understand which setup for the text fonts you actually want. Your mix of a serif font (Charis Sil) and a sans serif font (Source Sans Pro) is rather curious. As a general remark: There don't exist much fonts with a slanted and an italic version, so normally fontspec maps the two commands to the same font. If you really want both types you can do something like this:

\documentclass[10pt]{article}


\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont[SlantedFont={Charis SIL},
             SlantedFeatures={FakeSlant=0.2}]{Charis SIL}
\setsansfont[SlantedFont={Source Sans Pro},
             SlantedFeatures={FakeSlant=0.2}]{Source Sans Pro}

\usepackage{xeCJK}
\setCJKmainfont{Arial Unicode MS}

\begin{document}
%Roman font Charis SIL:
hello world \textit{italic text} and \textsl{slanted text}.
Diacritics: șş țţ ȘŞ ȚŢ î Î ă Ă

%Sans serif font:
\sffamily
hello world \textit{italic text} and \textsl{slanted text}.
Diacritics: șş țţ ȘŞ ȚŢ î Î ă Ă


Japanese: 守 破 離
\end{document}
2
  • xeCJK is updated in time (on CTAN and TeX Live). MiKTeX is a bit slower but it would be fine soon, I think.
    – Leo Liu
    Commented Aug 4, 2012 at 15:54
  • Thanks, got it working with no warnings, it's very clean now!
    – Flavius
    Commented Aug 7, 2012 at 8:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .