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. ctan.org/tex-archive/fonts/hieroglyph– FiiMay 26, 2021 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. tex.stackexchange.com/a/575584/2388– Ulrike FischerMay 26, 2021 at 15:37
2 Answers
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}
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
-
You've specified
\oldstylenums
for 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.) May 26, 2021 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 Symbola
many times with no success. May 28, 2021 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? May 28, 2021 at 15:23