I write LaTeX on a Ubuntu Linux system using emacs. I have a LaTeX document where I would like to have some characters from other various numeral systems (cuneiform, hieroglyphic, Chinese, and others, see numeral systems). Most of my document is English in a default LaTeX font and math typeset as usual in LaTeX. Initial research has suggested that XeLaTeX might be better than pdfLaTeX. Many of the answers I have found are for including just one family of unicode characters (just cuneiform or just hieroglyphics). They often suggested installing new fonts which I do not know how to do. Many of these answers also suggest setting the main font to be one which includes the desired unicode characters. Since I would like a diverse range of characters and I do not want to change the font for the main body of my text, how do I accomplish this?
-
There may exist dedicated packages for each numeral system, e. g. https://www.ctan.org/tex-archive/fonts/hieroglyph – Fii May 26 '21 at 15:33
-
3well if you want to show glyphs you need a font which has them. So the first step is to decide which fonts you want to use. If you have a current tex system you could use albatross to find out which fonts on your system supports the needed glyphs. https://tex.stackexchange.com/a/575584/2388 – Ulrike Fischer May 26 '21 at 15:37
2 Answers
With xelatex and ucharclasses one can set what fonts to use and when.
% !TeX program = xelatex
% !TeX encoding = UTF-8 Unicode
\documentclass[xetex,a4paper]{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Symbola}
\newfontfamily{\defaultfont}{Symbola}
\newfontfamily{\Egyptfont}{Noto Sans Egyptian Hieroglyphs}
\newfontfamily{\Cuneifont}{Noto Sans Cuneiform}
\newfontfamily{\cjkfont}{Noto Sans CJK TC}
\usepackage{polyglossia}
\setdefaultlanguage[variant=british]{english}
\usepackage[Latin, CJK, EgyptianHieroglyphs, NumberForms]{ucharclasses}
\setDefaultTransitions{\defaultfont}{}
\setTransitionsFor{NumberForms}{\defaultfont}{}
\setTransitionsFor{Cuneiform}{\Cuneifont}{\defaultfont}
\setTransitionsFor{EgyptianHieroglyphs}{\Egyptfont}{\defaultfont}
\setTransitionsForCJK{\cjkfont}{\defaultfont}
\usepackage{unicode-math}
\setmathfont[Ligatures=TeX]{STIX Two Math}
\begin{document}
東南西北零一二三四五六七八九十百千萬億
ō α β γ δ ε ϝ ζ η θ ι
{\Cuneifont }
{\fontspec{STIX Two Text}0123456789 ₀₁₂₃₄₅₆₇₈₉}
\end{document}
Link to fonts:
symbola, Noto Egyptian, Noto Cunei, Han Sans

- 705
-
You've specified
\oldstylenumsfor STIX Two Text, but the digits certainly don't look old style to me. I see only STIX Two Math loaded explicitly, but maybe the text part is loaded somewhere else, just not accessed properly? (All the rest looks quite nice.) – barbara beeton May 26 '21 at 18:50 -
-
-
Can you please link to some instructions for installing the necessary fonts? I get the following message when I run xelatex on this example:
! Package fontspec Error: The font "Symbola" cannot be found.If I simply hit return it trieskpathsea: Running mktextfm Symbolamany times with no success. – brett stevens May 28 '21 at 15:20 -
My other question is how do I use Computer Modern as my default font so the standard text in my document looks the same as it did before? – brett stevens May 28 '21 at 15:23
-
added link to fonts, Latin Modern Roman is similar to Computer Modern.
\setmainfont[Ligatures=TeX]{Latin Modern Roman}. – Oni May 29 '21 at 09:26 -
I installed all the Noto fonts via Ubuntu's
aptand tried to use the Noto CJK fonts with\newfontfamily{\cjkfont}{NotoSansCJK-Regular}. Xelatex had no problem with the cuneiform and hieroglyphic commands and those characters appear exactly as shown above. Only the first of the greek characters appears. – brett stevens May 31 '21 at 18:08 -
xelatex did complain about the CJK:
! Package fontspec Error: The font "NotoSansCJK-Regular" cannot be found.UsingkpsewhichI found that perhaps I should specify\newfontfamily{\cjkfont}{NotoSansCJK-Regular.ttc}. This prevented the xelatex error but the CJK symbols do not appear in document. Similarly, xelatex could not find "STIX Two Math" but replacing it with "STIX2Math.otf" resolved the error but the characters did not appear in pdf. – brett stevens May 31 '21 at 18:08 -
Looks like you're missing that font here is link to CJK fonts or try use font name
Noto Sans CJK TC. – Oni May 31 '21 at 21:43 -
Thanks @Oni. Using
Noto Sans CJK TCworked when I also remove CJK fromucharclasses– brett stevens Jun 03 '21 at 20:06 -
I am still only getting first Greek letter. Is there a font I need to include for that? – brett stevens Jun 03 '21 at 20:06
-
The command
\newfontfamily{\defaultfont}{Latin Modern Roman}is preventing\bfand\textscfrom working. – brett stevens Jun 03 '21 at 23:16
XeTeX is not the only option. You may use also LuaTeX, which provides some additional and useful features. With babel you can switch the fonts based on the Unicode ranges, as the following example shows. You need also some fonts with the required characters, and a complete solution is Noto.
\documentclass{article}
\usepackage[english]{babel}
% Declare the locales:
\babelprovide[onchar=fonts]{chinese}
\babelprovide[onchar=fonts]{hieroglyphic}
\babelprovide[onchar=fonts]{cuneiform}
% Declare the fonts:
\babelfont{rm}{FreeSerif}
\babelfont[chinese]{rm}{FandolSong}
\babelfont[hieroglyphic]{rm}{NotoSansEgyptianHieroglyphs-Regular.ttf}
\babelfont[cuneiform]{rm}{NotoSansCuneiform-Regular.ttf}
% The Chinese range is predefined by babel, but not the
% following:
\babelcharproperty{"13000}["1342F]{locale}{hieroglyphic}
\babelcharproperty{"12000}["12474]{locale}{cuneiform}
\begin{document}
Text text text 一二三四五.
\end{document}
- 10,003
