各位大师,
我正在使用书籍模板,可以在章节或节标题中使用泰语字体,但是当我在节正文中输入泰语字体时,它没有显示。请提供建议。
提前致谢。
\documentclass[p04]{elsevierbook}
\usepackage{geometry} % Required for adjusting page dimensions and margins
\geometry{
paper=a4paper, % Paper size, change to letterpaper for US letter size
top=5cm, % Top margin
bottom=3cm, % Bottom margin
left=3cm, % Left margin
right=3cm, % Right margin
headheight=14pt, % Header height
footskip=1.0cm, % Space from the bottom margin to the baseline of the footer
headsep=1cm, % Space from the top margin to the baseline of the header
%showframe, % Uncomment to show how the type block is set on the page
}
\usepackage{lipsum}
\usepackage{xltxtra}
\usepackage{fontspec}
\XeTeXlinebreaklocale "th_TH"
\XeTeXlinebreakskip = 0pt plus 2pt minus 1pt%
\setmainfont[Scale=1.1]{TH Sarabun New}
\setsansfont[Scale=1.1]{TH Sarabun New}
\setmonofont{TH Sarabun New}
\begin{document}
\Frontmatter
\Mainmatter
\chapter{\textbf{I can use Thai font here}}
\minitoc
\section{I also can use Thai font here too}
\lipsum[1]
When I type Thai ไทย here, it doesn't show up.
\end{document}
答案1
文档elsevierbook
类不适用于 XeLaTeX 和fontspec
。它将包newtxtext
与其他内容一起加载,您无法轻松地将其与\setmainfont
提供的宏等一起使用fontspec
。
您的设置应该是这样的(您可能需要寻找可以与 PDFLaTeX 一起使用的合适的泰语字体):
\documentclass[p04]{elsevierbook}
\usepackage{geometry} % Required for adjusting page dimensions and margins
\geometry{
paper=a4paper, % Paper size, change to letterpaper for US letter size
top=5cm, % Top margin
bottom=3cm, % Bottom margin
left=3cm, % Left margin
right=3cm, % Right margin
headheight=14pt, % Header height
footskip=1.0cm, % Space from the bottom margin to the baseline of the footer
headsep=1cm, % Space from the top margin to the baseline of the header
%showframe, % Uncomment to show how the type block is set on the page
}
\usepackage{lipsum}
\usepackage[thai,english]{babel}
\usepackage[utf8x]{inputenc}
\begin{document}
\Frontmatter
\Mainmatter
\chapter{\textbf{I can use Thai \textthai{ไทย} font here}}
\minitoc
\section{I also can use Thai \textthai{ไทย} font here too}
\lipsum[1]
When I type Thai \textthai{ไทย} here, it shows up as well.
\end{document}