文章类几何边距

文章类几何边距

问题仍未得到解答

我正在尝试在整个文档周围设置等于 2.5cm 的边距。使用 geometry(和 fancyhdr)包,它是:

\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm]{geometry}

但是我注意到默认情况下顶部和底部边距比左侧和右侧边距略大。为什么会这样?如何解决?

那么如何使这些边距(所有边距)相同且等于 2.5 厘米?

我的整个代码是:

\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\newcommand*{\savedfootnotes}{}
\newcommand*{\resetsavedfootnotes}{\global\let\savedfootnotes\empty}
\newcommand{\tablefootnote}[1]%
{%
    \footnotemark
    \xdef\savedfootnotes%
    {\unexpanded\expandafter{\savedfootnotes}\noexpand\footnotetext{#1}}%
}
\edef\endtable%
{%
    \aftergroup\noexpand\savedfootnotes
    \aftergroup\noexpand\resetsavedfootnotes
    \unexpanded\expandafter{\endtable}%
}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{lastpage}
\usepackage{titling}
\usepackage{array}
\usepackage{titlesec}
\usepackage{bibentry}
 \nobibliography*
\usepackage{tocloft}
 \usepackage{titling}
\newcommand{\subtitle}[1]{%
    \posttitle{%
        \par\end{center}
    \begin{center}\large#1\end{center}
    \vskip0.5em}%
}

\renewcommand\cftsecfont{\normalfont}
\renewcommand\cftsecpagefont{\normalfont}
\renewcommand{\cftsecleader}{\cftdotfill{\cftsecdotsep}}
\renewcommand\cftsecdotsep{\cftdot}
\renewcommand\cftsubsecdotsep{\cftdot}
\usepackage{cite}
\usepackage{fancyhdr}
\usepackage[pdftex,
pdfauthor={},
pdftitle={}]{hyperref}
%
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}

 \linespread{1.5}
\fancyhf{}

\renewcommand{\headrulewidth}{0pt} 
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm]{geometry}

\pagestyle{fancy}
\cfoot{ \thepage}
\setlength{\droptitle}{5cm}
\setlength\parindent{1cm}

\makeatletter
\renewcommand\thesection{}
\renewcommand\thesubsection{\@arabic\c@section.\@arabic\c@subsection}
\makeatother

\titlespacing*{\section}
{2.5cm}{0 pt}{1.5 pt}
\titlespacing*{\subsection}
{2.5cm}{1.5 pt}{1.5 pt}

\setcounter{section}{-1}


\begin{document}
    \pagenumbering{gobble}


\pagenumbering{arabic}
\setcounter{page}{0}
\thispagestyle{empty}
\clearpage

title page


\newpage
\tableofcontents
\newpage
\section{\hfil 0 \hfil}
\newpage


\section{\hfil 1 \hfil}



\section{\hfil Bib \hfil}
\nocite{*}

\begingroup
\renewcommand{\section}[2]{}
\bibliographystyle{plain}
\bibliography{bibl2}

\endgroup
\newpage

\end{document}

整个页面如下所示: 在此处输入图片描述

顶部比左侧多了 0.1 英寸。我希望每个地方都有 1 英寸


由 touhami 编辑

根据以下评论,问题似乎是如何消除框架和章节标题之间的间隙(这与有关titlesec

\documentclass[12pt,a4paper]{article}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm,showframe]{geometry}

\usepackage{titlesec}

\usepackage{mwe}% just for the example

\linespread{1.5}

\begin{document}
\blinddocument
\end{document}

答案1

一个解决方案是不使用titlesec。可以替换此包中的内容,即

\usepackage{titlesec}

\titlespacing*{\section}
{2.5cm}{0 pt}{1.5 pt}
\titlespacing*{\subsection}
{2.5cm}{1.5 pt}{1.5 pt}

\makeatletter 
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-1sp \@plus -1pt \@minus -.2pt}%
                                   {1.5pt \@plus .2pt}%
                                   {\normalfont\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-1.5pt \@plus -1pt \@minus -.2pt}%
                                     {1.5pt \@plus .2pt}%
                                     {\normalfont\large\bfseries}}
\makeatother

平均能量损失

\documentclass[12pt,a4paper]{article}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm,showframe]{geometry}

\usepackage{mwe}% just for the example


\makeatletter 
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-1sp \@plus -1pt \@minus -.2pt}%
                                   {1.5pt \@plus .2pt}%
                                   {\normalfont\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-1.5pt \@plus -1pt \@minus -.2pt}%
                                     {1.5pt \@plus .2pt}%
                                     {\normalfont\large\bfseries}}
\makeatother

\linespread{1.5}

\begin{document}
\section{lipsum foo}
\lipsum[1]
\section{lipsum foo}
\lipsum[1]
\subsection{lipsum foo}
\lipsum[1]
\end{document}

在此处输入图片描述

相关内容