计算上边距

计算上边距
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt]{book}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{libertine}
\usepackage[showframe, paperwidth=40pc, paperheight=40pc, margin=4pc]{geometry}
\usepackage{kantlipsum}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{}
\chead{\thepage}
\rhead{}
\cfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\setlength{\headheight}{15pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{titlesec}
\titleformat{\chapter}
    [block]
    {\Huge}
    {\thechapter\quad}
    {0pt}
    {}
    \assignpagestyle{\chapter}{empty}
\titlespacing*{\chapter}{0pt}{-30pt}{40pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\chapter{Test}
\kant[1-4]
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

在此处输入图片描述 在此处输入图片描述

我需要如何计算才能使页面顶部和正文之间的垂直空间在章节第一页和下一页中相同?

答案1

这不是一个答案,而是一些对于评论来说太长的问题的提示。

您希望一般文本块的高度等于章节标题后面文本的高度。您还需要较大的顶部边距,以便让正文上方有足够的空间。您可以通过包为您的文档设置这些geometry

您需要更改章节标题的位置,以使其适合顶部边距,且不占用文本块的空间。

作为 GOM,如果你不喜欢自己想要实现的结果,那就这样吧。祝你好运。

相关内容