将标题、章节标题和数学页面的字体类型更改为 Times New Roman 字体

将标题、章节标题和数学页面的字体类型更改为 Times New Roman 字体

我的目标是让文档中的所有内容(包括数学)都采用 Times New Roman 字体。我正在使用 -packageauthblk制作标题页。

我已尝试以下内容,但标题、副标题、章节和小节均未使用 Times 字体。

\documentclass[a4paper,12pt,bibliography=totoc]{scrartcl}

\usepackage[affil-it]{authblk} 
\usepackage{blindtext} 
\usepackage{newtxtext} 
\usepackage{newtxmath}

\titlehead{This is in times \hfill}
\title{Main Title with wrong font}
\subtitle{Sub Title with wrong font}
\author[1,2,*]{First Author}
\author[1,2]{Second Author}
\author[1,3]{Third Author}
\author[2,4]{Supervisor Author}
\affil[1]{University}
\affil[2]{College}
\affil[3]{Institute}
\affil[4]{School \break}
\affil[*]{Corresponding author: [email protected] \newline Contributing authors: [email protected], [email protected], [email protected]}
\date{\today}


\begin{document}

\maketitle

\section{This}
\subsection{is in}
\subsubsection{times}

This is in times.

在此处输入图片描述

同样的问题:

% !TEX TS-program = xelatex
%That was the first line of code
%\usepackage{newtxtext} %newtx packages are commented
%\usepackage{newtxmath}

\usepackage{fontspec}
\setmainfont{Times New Roman}

答案1

楼主。看来我漏掉了一行代码,因为 scrartcl 是 KOMA 类。(更多信息请点击此处)只需添加

\setkomafont{disposition}{\bfseries}

完整 MWE:

\documentclass[a4paper,12pt,bibliography=totoc]{scrartcl}

\usepackage[affil-it]{authblk} 
\usepackage{blindtext} 
\usepackage{newtxtext} 
\usepackage{newtxmath}
\setkomafont{disposition}{\bfseries} % this was missing
%\usepackage{fontspec}
%\setmainfont{Times New Roman}


\titlehead{This is in times \hfill}
\title{Main Title in Times}
\subtitle{Sub Title in Times}
\author[1,2,*]{First Author}
\author[1,2]{Second Author}
\author[1,3]{Third Author}
\author[2,4]{Supervisor Author}
\affil[1]{University}
\affil[2]{College}
\affil[3]{Institute}
\affil[4]{School \break}
\affil[*]{Corresponding author: [email protected] \newline Contributing authors: [email protected], [email protected], [email protected]}
\date{\today}


\begin{document}

\maketitle

\section{This is in times}
\subsection{This is in times as well}
\subsubsection{Times is the way to go}

This is in times.


\end{document}

在此处输入图片描述

答案2

希望这不是最好的,但它有效:

\documentclass[a4paper,12pt,bibliography=totoc]{scrartcl}

\makeatletter
\renewcommand*{\@gr@gsffamily}{%just tweak this tag
  \if@egregdoesnotlikesansseriftitles\else\rmfamily\fi
}
\makeatother

\usepackage[affil-it]{authblk} 
\usepackage{blindtext} 
\usepackage{newtxtext} 
\usepackage{newtxmath}

\titlehead{This is in times \hfill}
\title{Main Title with wrong font}
\subtitle{Sub Title with wrong font}
\author[1,2,*]{First Author}
\author[1,2]{Second Author}
\author[1,3]{Third Author}
\author[2,4]{Supervisor Author}
\affil[1]{University}
\affil[2]{College}
\affil[3]{Institute}
\affil[4]{School \break}
\affil[*]{Corresponding author: [email protected] \newline Contributing authors: [email protected], [email protected], [email protected]}
\date{\today}


\begin{document}

\maketitle

\section{This}
\subsection{is in}
\subsubsection{times}

This is in times.

\end{document}

在此处输入图片描述

相关内容