The reason why the Latex title is exactly on the first line of the page, setting the spacing before the paragraph through `\titlespacing` is invalid

The reason why the Latex title is exactly on the first line of the page \titlespacingis invalid by setting the space before the paragraph

Usually, for a latex document, \geometrystatements are used at the beginning to complete the setting of the page layout: page margins, header height, etc. For example:

\RequirePackage[includeheadfoot]{geometry}
\geometry{
	top=2.5cm, bottom=2cm, left=2.5cm, right=2cm
	,headheight=13pt, headsep=0.1cm,
    footskip=0.51cm
}

The above code sets the margins as: top margin 2.5cm, bottom margin 2cm; left margin 2.5cm, right margin 2cm. headheight is the height of the header, and headsep is the distance from the bottom of the header to the top of the first line of text.

The relationship between several geometric properties in the code is as follows:
paperwidth = left + width + right paperheight = top + height + bottom \text{paperwidth = left + width + right}\\ \text{paperheight = top + height + bottom}paperwidth = left + width + rightpaperheight = top + height + bottom

After setting includeheadfoot, there is:
height = textheight + headheight + headsep + footskip \text{height = textheight + headheight + headsep + footskip}height = textheight + headheight + headsep + footskip

Digression: If not set includeheadfoot, then:
height = textheight \text{height = textheight}height = textheight

As set in the above code, we can see that textheight = height - headheight - headsep - footskip \text{textheight = height - headheight - headsep - footskip}textheight = height - headheight - headsep - footskip . At this time, the paper size is determined first, so after setting top and bottom, the value of height is determined; after setting properties such as left and right, the value of width is determined.

According to the actual needs, the user may \titlespacingdefine \sectionthe geometric attributes of the statement, including the spacing before and after the paragraph, etc.
However, when the title appears on the first line of the page , no matter how you set the pre-paragraph spacing of the title, it cannot keep it away from the bottom of the header, because textheightit is certain that the position of the top of the first line of text is also fixed.

Reference reading:
latex titles, paragraphs and line spacing
What do headheight, headsep, etc. do in the vmargin package?

Guess you like

Origin blog.csdn.net/qq_42679415/article/details/131048512