I'm writing a book and I need to include the range of Unicode characters 4DC0 – 4DFF up to display the hexagrams of the Chinese book Yi Jing http://en.wikipedia.org/wiki/I_Ching
I've used the various packages and I've also read all the questions about how to use Unicode here in the Community. I am a beginner in LaTeX.
My environment: MikTeX with TeXnicCenter with option XeLaTeX, Windows 8.
I saved my document in UTF-8.
Just a comment (it is solved): I can display all Chinese characters using the CJK package?
Here we have an example. But how to display each hexagram in LaTeX?
http://en.wikipedia.org/wiki/I_Ching_hexagram_01
Please, I ask for a complete example that works for my environment described. Do not write things like "do this" or "use it."
I hope understanding and help.
Below is an example of the packages that I am using
\documentclass[a4paper,12pt,twoside,openright]{book}
\usepackage[T1]{fontenc}
\usepackage[brazil,portuguese]{babel}
\usepackage{lmodern} % Type1-font for non-english texts and characters
\usepackage{graphicx} % For loading graphic files
\usepackage{amssymb, amsmath, pxfonts} % permite simbolos matemáticos
\usepackage{ae}
\usepackage{aecompl}
\usepackage{fontspec}
%----------------------------------------------
% Unicode environment
%----------------------------------------------
\usepackage{autofe}
\usepackage{ucs}
\usepackage{newunicodechar}
\usepackage[utf8x]{inputenc}
\usepackage[unicode=true]{hyperref}
\hypersetup{unicode=true}
\usepackage{cmap}
\usepackage{CJKutf8}
\DeclareUnicodeCharacter{4DC0}{\hex1}
\newunicodechar{4DC2}{\hex2}
\catcode"4DC0=\qian
%----------------------------------------------
\begin{document}
$hex1$ $hex2$
\qian
\unichar{4DC0}
\char"4DC0
Hexagram \hex1
\end{document}
Best Answer
The
ucs
andinputenc
package must not be used with XeLaTeX as well asfontenc
, in general, but the last one may have its uses; never loadae
andaecompl
: they are obsolete.CJKutf8
package is a mixture ofCJK
package andinputenc
package withutf8
option. it is also not used in XeLaTeX.You don't need any CJK package in order to print some glyphs: just find a font that has them. On my system, I found DejaVu Sans. So I defined a macro that takes as argument the glyph's number (from 0 to 63, it would be easy to start at 1, if you so desire).
For some reason, apparently due to how
xeCJK
decides what's Chinese and what's not, one has to declare the font twice: for hexagrams it has to be declared with\newCJKfontfamily
and for trigrams with\newfontfamily
(or\newfontface
that's more efficient for a font that's not required to change shape according to the context).An alternative method is to declare Yijing Hexagrams Symbols as non-CJK characters in
xeCJK
: