我正在使用我提供的文档模板在 Overleaf 中编写文档,我需要使用该模板中设置的格式样式。我不得不将我使用的编译器从 pdfLaTeX 更改为 LuaLaTeX,以便我可以使用某些语言 Unicode 字符。
我遇到的问题是,更改编译器似乎破坏了模板的格式,而且我不确定如何修复它。
为了方便新编译器,我在序言中做的唯一更改是将其替换为:
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
有了这个:
\usepackage{fontspec}
\newfontfamily\abr{Noto Serif}
\newfontfamily\og{Noto Sans Ogham}
现在我的标题页已经改变,标题不再是粗体或使用正确的边距大小。目录中的章节标题全部是小写,正文中的章节标题也是小写。除了这些具体问题之外,整个文档的主要字体也明显发生了变化。这些只是我注意到的问题,我怀疑还有更多我还没有注意到的细微变化。
我怎样才能使它看起来像旧的编译器一样?
这里有一些图片供参考。
之前(正确格式):
之后(格式损坏):
编辑:添加最少的代码以便重新产生该问题。
只需在编译器之间切换即可重现该问题,而无需对下面的代码进行任何更改。
\documentclass[a4paper,headinclude,footinclude]{book}
% document packages
\usepackage{iftex}
\iftutex
\usepackage{fontspec}
\newfontfamily\abr{Noto Serif}
\newfontfamily\og{Noto Sans Ogham}
\else
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\fi
\usepackage[english]{babel}
\usepackage[hyphens]{url}
\usepackage{setspace}
\usepackage{graphicx}
\graphicspath{{./chapters/images/}}
\usepackage{titling}
\usepackage[toc,page]{appendix}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[
eulerchapternumbers,
eulermath,
subfig,
beramono,
pdfspacing,
floatperchapter,
]{classicthesis}
\usepackage{arsclassica}
\usepackage[ % check the README file about margins
left=3cm,
right=3cm,
top=3cm,
bottom=3cm,
heightrounded,
]{geometry}
\usepackage{lipsum} % for dummy text, you can remove this
% macro definitions
\newcommand{\figurePath}[1]{figures/#1}
% use one and a half line spacing
\onehalfspacing
% set your title, author and publication date here
\title{Development of Natural Looking Titles and Reports about Nothing; with an Application for Deterring Authorship in Other Word Processors}
\author{Andrew Daly}
\date{\today}
% start the document with the title page
\begin{document}
\begin{titlepage}
\centering
% main logo
\vspace*{3em}
% main title, author and date
{\color{darkgray} \Large \bfseries\selectfont Team Report} \\ [5em]
{\sffamily \bfseries \selectfont \huge \singlespacing \thetitle \par}
\vspace*{2em}
{\Large \theauthor} \\ [4em]
{\textbf \thedate} \\ [4em]
% teams and members
\parbox{0.25\textwidth}{
\centering \color{darkgray}
\textbf{Team A} \\ Greg Thompson
}
\parbox{0.4\textwidth}{
\centering \color{darkgray}
\textbf{Team B} \\ John McAvoy \\ Cliodhna Dempsy
}
\parbox{0.25\textwidth}{
\centering \color{darkgray}
\textbf{Team C} \\ Paul Buttler
} \\
\vfill
% secondary logo and footer
{\color{darkgray}
Centre for Mocked Up Team Reviews \\
College of Teamwork, International University of Jupiter
}
\end{titlepage}
% the front matter of the document
\frontmatter
\chapter*{Abstract}
This is an abstract, there should be about a paragraph of text here.
\lipsum[10]
\tableofcontents
\chapter*{Acknowledgements}
Thanks folks!
% these are the included chapters
\mainmatter
\chapter{Review of the Literature}\label{ch:litrev}
\section{All About the Dictionary}
This is some text about a dictionary. \lipsum[5]
\section{Teamwork in the Context of Dictionaries}
It would be difficult to write a dictionary on your own. \lipsum[10]
\section{Another Title I Came Up With}
I'm running out of things to say here. \lipsum[9]
\lipsum[6-8]
\appendices
\chapter{Placeholders}
\section{Unused References}
\begin{enumerate}
\item List item 1
\item List item 2
\item List item 3
\end{enumerate}
\end{document}
答案1
classicthesis 和 arsclassica 软件包实际上并未针对 Unicode 字体进行设置,并且 LaTeX 会警告您 sans serif 不起作用,
LaTeX Font Warning: Font shape `TU/iwona/m/n' undefined
(Font) using `TU/lmr/m/n' instead on input line 65.
(/usr/local/texlive/2021/texmf-dist/tex/latex/microtype/mt-LatinModernRoman.cfg
)
LaTeX Font Warning: Font shape `TU/iwona/b/n' undefined
(Font) using `TU/iwona/m/n' instead on input line 65.
第一个说它找不到 iwona 所以将使用拉丁现代,然后第二个说它找不到粗体。
但是,您可以使用 fontspec 将无衬线字体设置为 iwona 的 OpenType 版本,然后它也会设置粗体
lualatex 的输出:
\documentclass[a4paper,headinclude,footinclude]{book}
% document packages
\usepackage{iftex}
\usepackage[english]{babel}
\usepackage[hyphens]{url}
\usepackage{setspace}
\usepackage{graphicx}
\graphicspath{{./chapters/images/}}
\usepackage{titling}
\usepackage[toc,page]{appendix}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[
eulerchapternumbers,
eulermath,
subfig,
beramono,
pdfspacing,
floatperchapter,
]{classicthesis}
\usepackage{arsclassica}
\iftutex
\usepackage{fontspec}
\newfontfamily\abr{Noto Serif}
\newfontfamily\og{Noto Sans Ogham}
\setsansfont{iwona}
\else
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\fi
这解决了主要问题,尽管 arsclassica 仍然有一些低级代码,例如
%************************************************************
% Chapter numbers
%************************************************************
\let\chapterNumber\undefined
\ifct@eulerchapternumbers
\newfont{\chapterNumber}{eurb10 scaled 5000}%
\else
\newfont{\chapterNumber}{pplr9d scaled 5000}%
\fi
它使用内部名称和缩放命令来强制使用传统的 8 位字体,您可能应该使用\iftutex
上面序言中的块来使用 fontspec 定义的字体\chapterNumber
。