我对 TEX 完全一窍不通,所以请原谅我 :D
我正在尝试用 LATEX 准备一个模板,以便根据学院的规定将其用于所有需要撰写的论文。但是他们要求的标题不一致。第一个标题(章节)应该有一个尾点,而副标题(部分、小节……)不应该有尾点。
(我不认为我到目前为止所做的能够帮助你弄清楚如何解决问题,但我还是会这么做:D)
因此基本上标题(在目录中以及页面本身中)应该是这样的:
1.
1.1
1.2
1.2.1
2.
2.1
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % 布局 % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\documentclass[12pt,a4paper,headings=standardclasses]{scrreprt}
\usepackage{showframe}
\usepackage{graphicx}
\graphicspath{ {./images/} }
\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.00cm]{geometry}
\usepackage[onehalfspacing]{setspace}
%---------------------------------------------------------------------------------------- % 字体 %----------------------------------------------------------------------------------------
\usepackage{libertine}
\usepackage{libertinust1math}
%---------------------------------------------------------------------------------------- % 标题 %----------------------------------------------------------------------------------------
\KOMAoption{chapterprefix}{false}
\RedeclareSectionCommand
[%
beforeskip=-1sp
]
{chapter}
\renewcommand\chapterformat
{%
\mbox
{%
\chapappifchapterprefix{\nobreakspace}\thechapter\autodot
\IfUsePrefixLine{}{\enskip $|$\enskip}%
}%
}
我真的不知道如何才能(以一种巧妙的方式)实现这一点。此外,我的附录应列为
A
乙
C
我这样做了,不确定是否有更漂亮的方法:
\renewcommand{\thesection}{\Alph{section}}
\begin{appendices}
\input{appendices/demo-appendices.tex}
\end{appendices}
答案1
如果只有章节的数字末尾应该有一个点,则可以使用numbers=noenddot
删除所有数字的末尾点。标题和目录中章节的点可以通过以下方式添加
\usepackage{xpatch}
\xpretocmd\chapterformat
{\def\autodot{.}}% replace \autodot by a fixed dot for chapter headings
{}{\cfPatchFailed}%
\RedeclareSectionCommand[
beforeskip=-1sp,
tocentrynumberformat=\def\autodot{.}% replace \autodot by a fixed dot for chapter entries
]{chapter}
例子:
\documentclass[
12pt,
headings=standardclasses,
chapterprefix=false,
numbers=noenddot% no dots at the end of numbers
]{scrreprt}
\usepackage{blindtext}% only for dummy text
\usepackage{xpatch}
\xpretocmd\chapterformat
{\def\autodot{.}}% replace \autodot by a fixed dot for chapter headings
{}{\cfPatchFailed}%
\RedeclareSectionCommand[
beforeskip=-1sp,
tocentrynumberformat=\def\autodot{.}% replace \autodot by a fixed dot for chapter entries
]{chapter}
\begin{document}
\tableofcontents
\blinddocument
\blinddocument
\end{document}
结果: