格式化标题

格式化标题

山西

我对 Latex 还不太熟悉,希望能得到一些关于如何设置章节和标题字体格式的帮助。我已经在论坛上浏览了好几个小时,想看看自己能不能把这些拼凑起来,但最后不得不放弃。

我主要有两个问题。

1. 所需格式

1 章 1.1 节 1.1.1 小节 1.1.1.1 小小节

我发现可以通过以下方法实现:

\usepackage{titlesec}
\titleformat{\chapter}{}{}{0em}{\bf\LARGE\thechapter.~}

但是这也会在摘要章节中放置一个 0,我不知道如何删除它。它还会在目录中创建双重编号。

有没有办法解决这个问题,以便我可以保留除摘要之外的编号,并且目录中不会有双重编号?

2. 更改字体

我找到了如何更改整个文档的字体的方法。我只需使用:

\usepackage[T1]{fontenc}
\usepackage{ebgaramond}
\usepackage[ebgaramond]{mathdesign}

我只希望使用 Garamond 作为普通文本,同时使用其他字体(http://surl.dk/e1e/最有可能来自此列表)作为标题。我该如何更改标题的字体?

我在 Mac OSX 10.9.4 上使用 TeXworks。

示例截图

我感谢任何帮助。

完整代码:

%% Preamble start

%%%% --- Basic ---

\documentclass[12pt,twoside]{report}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}


%%%% --- Typography ---

\usepackage[T1]{fontenc}
\usepackage{ebgaramond}
\usepackage[english]{babel}
\usepackage{csquotes}
\setlength\parindent{0pt}
\usepackage{titlepic}

%%%% --- Headings ---

%
% ?????
%

%%%% --- Math and Chem specifics ---

\usepackage[ebgaramond]{mathdesign}
\usepackage{amsmath,amssymb}
\usepackage[version=3]{mhchem}  %Easier to write chem compounds ie. \ce{H2O} and \ce{PO4^2-}

%% Preamble end

\title{Report Ex}
\author{John Smith}

\begin{document}
\maketitle
\chapter{Abstract}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.\\
\tableofcontents
\chapter{Introduction}
\section{Background}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.\\
%
\subsection{Details}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.\\
%
%
\section{History}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.\\
%
\section{Analysis}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{document}

答案1

如果我理解正确的话,这应该能满足您的要求。我对代码做了一些注释。

要使用garamond选项,您需要安装 URW Garamond。您可以使用getnonfreefonts 系统sys这是一个可用于轻松安装其他字体的脚本。请确保在运行脚本时使用该版本。

\documentclass[12pt,twoside,a4paper]{report}
\usepackage[width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}  %Easier to write chem compounds ie. \ce{H2O} and \ce{PO4^2-}
\usepackage[garamond]{mathdesign}
\usepackage[british]{babel}% if you want UK - otherwise use american
\usepackage{csquotes}
\usepackage{parskip}% don't set \parindent and \parskip manually (and you'll want positive parskip if parindent is zero so this should work OK)
\usepackage{titlesec}
\titleformat{\chapter}{\bfseries\LARGE}{\thechapter~}{0em}{}

\title{Report Ex}
\author{John Smith}

\begin{document}
\maketitle
\chapter*{Abstract}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit.

\tableofcontents

\chapter{Introduction}

\section{Background}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

\subsection{Details}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

\section{History}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

\section{Analysis}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{document}

EBGaramond 在设计上缺乏粗体。因此,如果您想使用粗体,则需要使用另一种 Garamond。如果您想坚持使用 EBGaramond,请不要使用,mathdesign因为它不支持 EBGaramond,并且会导致您最终得到常规重量的 EBGaramond 和粗体的其他混合体,这不是很好。

相关内容