xelatex 中的字体问题

xelatex 中的字体问题

我想知道将所有文本字体定义为特定大小的正确方法是什么。我使用\documentclass[20pt]{article}但它不会改变 xelatex 中的字体大小。而且这些符号("')不是 Times 字体,现在无论我如何更改字体,它们看起来都一样。这是最小工作代码。我想知道在 xelatex 中解决字体选择的正确方法是什么。我可以得到这样的结果吗?
在此处输入图片描述 而不是这样? 在此处输入图片描述

 %!TEX TS-program = xelatex

 \documentclass[20pt]{article}
 \usepackage{geometry}
 \usepackage{mathspec}
 \usepackage{lipsum}
 \setmainfont{Times}
 \setmathsfont(Digits,Latin,Greek){Times}
 \usepackage{titling}
 \usepackage{titlesec}
 \usepackage{setspace}
 \usepackage[colorlinks,urlcolor=black]{hyperref}
 \doublespacing
 \titleformat{\section}{\singlespacing\fontsize{20}{24}\bfseries\rmfamily\uppercase} {\thesection.}{0.5em}{}
  \begin{document}
 \section{"check"}
"just checking" this is a "check" and 'check'. 
 \end{document}

答案1

如果您被绑定到article文档类,那么有两个选项:

选项1

您可以使用scrextend包,将`KOMA-script 类的功能(如字体大小)扩展到其他类:

%!TEX TS-program = xelatex

\documentclass{article}
\usepackage{scrextend}         %%% this line
\changefontsizes[24pt]{20pt}   %%% and this line
\usepackage{geometry}
\usepackage{mathspec}
\usepackage{lipsum}
\setmainfont[Ligatures=TeX]{Times New Roman}
\setmathsfont(Digits,Latin,Greek){Times New Roman}
\usepackage{titling}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage[colorlinks,urlcolor=black]{hyperref}
\doublespacing
\titleformat{\section}{\singlespacing\fontsize{20}{24}\bfseries\rmfamily\uppercase} {\thesection.}{0.5em}{}
\begin{document}
\section{``check''}
``just checking'' this is a ``check'' and `check'.
\end{document}

选项-2

您可以使用包,这是Karl Koeller 在他的回答中提到的extsizes包版本。extarticle

%!TEX TS-program = xelatex

\documentclass{article}
%\usepackage{scrextend}
%\changefontsizes[24pt]{20pt}
\usepackage[20pt]{extsizes} %%% this line
\usepackage{geometry}
\usepackage{mathspec}
\usepackage{lipsum}
\setmainfont[Ligatures=TeX]{Times New Roman}
\setmathsfont(Digits,Latin,Greek){Times New Roman}
\usepackage{titling}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage[colorlinks,urlcolor=black]{hyperref}
\doublespacing
\titleformat{\section}{\singlespacing\fontsize{20}{24}\bfseries\rmfamily\uppercase} {\thesection.}{0.5em}{}
\begin{document}
\section{``check''}
``just checking'' this is a ``check'' and `check'.
\end{document} 

在此处输入图片描述

答案2

该类article仅支持10pt11pt12pt

您可以使用支持的extarticle(扩展)类。article20pt

在下面的 MWE 中,我将“Times”更改为“Times New Roman”,并且使用Ligatures=TeX选项获得了正确的引号,但您必须使用标准 LaTeX 方式来使用双引号。

%!TEX TS-program = xelatex

\documentclass[20pt]{extarticle}
\usepackage{geometry}
\usepackage{mathspec}
\usepackage{lipsum}
\setmainfont[Ligatures=TeX]{Times New Roman}
\setmathsfont(Digits,Latin,Greek){Times New Roman}
\usepackage{titling}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage[colorlinks,urlcolor=black]{hyperref}
\doublespacing
\titleformat{\section}{\singlespacing\fontsize{20}{24}\bfseries\rmfamily\uppercase} {\thesection.}{0.5em}{}
\begin{document}
\section{``check''}
``just checking'' this is a ``check'' and `check'.
\end{document} 

输出

在此处输入图片描述

如果您想"..."这样做,您可以在序言中添加以下两行:

\usepackage{csquotes}
\MakeOuterQuote{"}

答案3

使用

\documentclass[fontsize=20pt]{scrartcl}

相关内容