How do I set a fallback font for LaTex export to pdf?

I have the following setting in my init.el.

(setq org-latex-classes

\\usepackage{zhnumber} % package for Chinese formatting of date time (use /zhtoday)
%\\usepackage[yyyymmdd]{datetime} % set date time to numeric

% Set default indentation


% Set Paper Size, Page Layout (another variable is 'bindingoffset')
\\usepackage[margin = 1.5in, paper = a4paper, inner = 2.5cm,
outer = 2.5cm, top = 3cm, bottom = 2.5cm]{geometry}

% Keep paragraph indentation while having a line break in between paragraphs.

% Indent first paragraph.

\\usepackage{fontspec} % packages for title and section-heading font setting.

% Set Font.
\\setsansfont{Arial Unicode MS}
\\setmainfont{Calibri} % Set serifed font to Calibri. Originally set to 'Times New Roman', but it cannot display certain characters such as ①②③.
\\setCJKsansfont{Kaiti TC} % Set Chinese font. NOTE: Remember to append CJK before of the font class. CJK HAS to be there for the font to show.

\\titleformat*{\\subsubsection}{\\fontsize{12}{14}\\bfseries\\sffamily} % Set formats for each heading level. 'sffamily' will point to the sans-serif font. In this case, 「楷體」.
\\renewcommand{\\maketitlehooka}{\\sffamily} % Set title font.

% Set quotation font.
\\newCJKfontfamily\\quotefont{Kaiti TC}

% Tweak default settings.
\\renewcommand{\\baselinestretch}{1.2} % Set line width.
\\renewcommand{\\contentsname}{目次} % Translate content page title to Chinese. (Could possibly be done automatically with '\\usepackage[heading]{CJK}'. TODO experiment. )

% For text-boxes


% [FIXME] ox-latex 的設計不良導致 hypersetup 必須在這裡插入
  colorlinks=true, %把紅框框移掉改用字體顏色不同來顯示連結
         ("\\section{%s}" . "\\section*{%s}")
         ("\\subsection{%s}" . "\\subsection*{%s}")
         ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
         ("\\paragraph{%s}" . "\\paragraph*{%s}")
         ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))

Sample Org Document:

#+OPTIONS: toc:nil

㊀㊁㊂ ①②③

㊀㊁㊂ ①②③

PDF generated:

enter image description here

As apparent from the above example, Kaiti TC contains the characters ㊀ etc. but MingLiU does not.

How can we define a fallback font for CJKmainfont so that ㊀㊁㊂ without the quote can be displayed properly?


I've found a working solution with the code below:

\\newCJKfontfamily\\fallbackfont{PingFang TC}
\\newunicodechar{㊀}{{\\fallbackfont ㊀}}
\\newunicodechar{㊁}{{\\fallbackfont ㊁}}
\\newunicodechar{㊂}{{\\fallbackfont ㊂}}
\\newunicodechar{㊃}{{\\fallbackfont ㊃}}
\\newunicodechar{㊄}{{\\fallbackfont ㊄}}
\\newunicodechar{㊅}{{\\fallbackfont ㊅}}
\\newunicodechar{㊆}{{\\fallbackfont ㊆}}
\\newunicodechar{㊇}{{\\fallbackfont ㊇}}
\\newunicodechar{㊈}{{\\fallbackfont ㊈}}

I would appreciate other suggestions to the problem, especially with shorter code.

| improve this answer | |

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.