如何设置标题内部和周围的精确间距

如何设置标题内部和周围的精确间距

我正在撰写的一篇论文要求章节标签和上边距之间的间隙为 75 毫米,章节标签和章节标题之间的间隙为 25 毫米,章节标题和后续文本之间的间隙为 25 毫米。

有人可以解释一下实现这一目标的最佳方法是什么吗?

我尝试了以下操作:

\documentclass[a4paper, 12pt, oneside]{report}
\usepackage[lmargin=30mm,rmargin=20mm,tmargin=30mm,bmargin=22mm,
        headheight=3mm,headsep=12mm,footskip=13mm]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage{titlesec}
\usepackage{showframe}

\begin{document}
    \titleformat{\chapter}[display]{\bfseries \Large \center \setlength{\parskip}{0 mm}}{Chapter \ \thechapter}{25mm}{}[]
    \titlespacing{\chapter}{0 mm}{75 mm}{25 mm}
    \setlength{\parindent}{12 mm}
    \setlength{\parskip}{15 mm}
    
    \chapter{Introduction}
    <some text>
\end{document}

其结果是: 结果

问题:章节标签从 115 毫米开始,而不是 30+75=105 毫米,标题和文本之间的间隙太大(40 毫米而不是)

虽然标签和标题之间的间距大约是 25 毫米(我仍然完全不清楚它是如何测量的),但其他间距需要更正。

(这是我第一次使用 LaTeX,确实遇到了很多困难,我需要完成格式化,这样我才能开始处理内容,否则我将不得不回到 MS Word)

答案1

必须使用[rigidchapters]选项titlesec,这使得为标题区域保留的间距具有固定长度,并通过反复试验找到长度参数的值:

\documentclass[a4paper, 12pt, oneside]{report}
\usepackage[lmargin=30mm,rmargin=20mm,tmargin=30mm,bmargin=22mm,
        headheight=3mm,headsep=12mm,footskip=13mm, showframe]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage[rigidchapters]{titlesec}

\titleformat{\chapter}[display]{\bfseries \Large \center \setlength{\parskip}{0 mm}}{Chapter \ \thechapter}{
\dimexpr25mm-\baselineskip}{}[]
\titlespacing{\chapter}{0 mm}{61.2mm}{38mm}
\setlength{\parindent}{12 mm}
\setlength{\parskip}{15 mm}
\begin{document}

\chapter{Introductory}

In former days -- that is to say, once upon a time, there lived in the Land of Gramblamble, Seven Families. They lived by the side of the great Lake Pipple-popple (one of the Seven Families, indeed, lived in the Lake), and on the outskirts of the City of Tosh, which, excepting when it was quite dark, they could see plainly. The names of all these places you have probably heard of, and you have only not to look in your Geography books to find out all about them.

 Now the Seven Families who lived on the borders of the great Lake Pipple-popple, were as follows in the next Chapter.

\end{document} 

在此处输入图片描述

相关内容