3

How to encode special unicode symbols as in here in latex?

enter image description here

4

My apologies for misunderstanding your question the first time. Here is a template that reproduces the example you gave in XeLaTeX. (Okay, I replaced the tildes with en dashes.)

\documentclass[varwidth = 10cm, preview]{standalone}
% This document class is appropriate for a TeX.SX MWE.  In a real document,
% you will want to change it.
\usepackage{fontspec}
\usepackage[english]{babel}
\usepackage{newunicodechar}

% Workaround for a bug in Babel 3.22:
\babelprovide[script = CJK, language = {Chinese Simplified}]{chinese-simplified}

% This example uses the Noto font family.  Any OpenType font should work.
\babelfont{rm}[Scale = 1.0, Ligatures = TeX ]{Noto Serif}
\defaultfontfeatures{ Scale = MatchUppercase, Ligatures = TeX }
\babelfont{sf}{Noto Sans}
\babelfont[chinese-simplified]{rm}[Ligatures = Common]{Noto Serif CJK SC}
\babelfont[chinese-simplified]{sf}[Ligatures = Common]{Noto Sans CJK SC}

\newfontfamily\miscsymfont{DejaVu Sans}

\newunicodechar{:}{\foreignlanguage{chinese-simplified}{:}}
\newunicodechar{⚊}{{\miscsymfont\symbol{"268A}}}
\newunicodechar{⚋}{{\miscsymfont\symbol{"268B}}}
\newunicodechar{⚌}{{\miscsymfont\symbol{"268C}}}
\newunicodechar{⚍}{{\miscsymfont\symbol{"268D}}}
\newunicodechar{⚎}{{\miscsymfont\symbol{"268E}}}
\newunicodechar{⚏}{{\miscsymfont\symbol{"268F}}}
\newunicodechar{☰}{{\miscsymfont\symbol{"2630}}}
\newunicodechar{☱}{{\miscsymfont\symbol{"2631}}}
\newunicodechar{☲}{{\miscsymfont\symbol{"2632}}}
\newunicodechar{☳}{{\miscsymfont\symbol{"2633}}}
\newunicodechar{☴}{{\miscsymfont\symbol{"2634}}}
\newunicodechar{☵}{{\miscsymfont\symbol{"2635}}}
\newunicodechar{☶}{{\miscsymfont\symbol{"2636}}}
\newunicodechar{☷}{{\miscsymfont\symbol{"2637}}}
% Also define U+4DC0-U+4DFF.

\begin{document}
\begin{enumerate}
    \item Miscellaneous Symbols (U+2600--U+26FF):
      \begin{itemize}
        \item \foreignlanguage{chinese-simplified}{兩儀:}U+268A--U+268B (⚊ ⚋)
        \item \foreignlanguage{chinese-simplified}{四象:}U+268C--U+268F (⚌ ⚍ ⚎ ⚏)
        \item \foreignlanguage{chinese-simplified}{八卦:}U+2630--U+2637 (☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷)
      \end{itemize}
    \item \foreignlanguage{chinese-simplified}{六爻符號:}
      \begin{itemize}
        \item \foreignlanguage{chinese-simplified}{六十四卦、易經:}U+4DC0--U+4DFF
      \end{itemize}
\end{enumerate}
\end{document}

Font sample of Chinese with Trigrams

You need to load the trigram symbols from a font that contains them. Another option would be to use ucharclasses with the character class MiscellaneousSymbols, although this does not play well with Babel.

  • Thanks for your help! I do not have trouble in Chinese encoding and I am using ceCJK. It is the special symbols I am having issue with. I can input them ok (C-x 8 RET 2630), but it does not show in pdf output. – Tony Tan Jan 27 at 23:26
  • @TonyTan Sorry for misunderstanding. You mean the trigrams aren’t displaying? You’d want to make sure to load them from a font that supports them, for example DejaVu Sans. I’ll update my answer. – Davislor Jan 27 at 23:32
  • @TonyTan Thank you for the clarification. Is this new answer more what you were looking for? – Davislor Jan 28 at 0:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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