如何根据文档设置调整垂直间距

如何根据文档设置调整垂直间距

我希望获得一些帮助来删除我的 LaTeC 文档中的垂直空间。

第二段代码显示了看似简单的代码……所以我不确定间距在哪里(在部分开始)来自哪里。

\documentclass[twoside,twocolumn]{article}

\usepackage{blindtext} % Package to generate dummy text throughout this template 

\usepackage[sc]{mathpazo} % Use the Palatino font
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\linespread{1.05} % Line spacing - Palatino needs more space between lines
\usepackage{microtype} % Slightly tweak font spacing for aesthetics

\usepackage[english]{babel} % Language hyphenation and typographical rules

\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
\usepackage[ small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
\usepackage{booktabs} % Horizontal rules in tables

\usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text

\usepackage{enumitem} % Customized lists
\setlist[itemize]{noitemsep} % Make itemize lists more compact

\usepackage{abstract} % Allows abstract customization
\renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
\renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text

\usepackage{titlesec} % Allows customization of titles
\renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
\renewcommand\thesubsection{\roman{subsection}} % roman numerals for subsections
\titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{} % Change the look of the section titles
\titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles

\usepackage{fancyhdr} % Headers and footers
\pagestyle{fancy} % All pages have headers and footers
\fancyhead{} % Blank out the default header
\fancyfoot{} % Blank out the default footer
\fancyhead[C]{Integrated Science Curriculum -- December 2021} % Custom header text
\fancyfoot[RO,LE]{\thepage} % Custom footer text

\usepackage{titling} % Customizing the title section

\usepackage{hyperref} % For hyperlinks in the PDF
\usepackage{graphicx}
\graphicspath{ {./images/} }



%----------------------------------------------------------------------------------------
%   TITLE SECTION
%----------------------------------------------------------------------------------------

\setlength{\droptitle}{-4\baselineskip} % Move the title up

\pretitle{\begin{center}\Huge\bfseries} % Article title formatting

\posttitle{\end{center}} 

\setlength\parindent{24pt}
\usepackage{float}
\usepackage{pdfpages}
\newsavebox\mysavebox
\usepackage{hanging}
\usepackage{siunitx}

\usepackage[
backend=biber,
style=alphabetic,
sorting=ynt
]{biblatex}
\addbibresource{sample.bib}

%----------------------------------------------------------------------------------------

% Article title closing formatting
\title{\centering{Pathogen Resistance of 
\textit{Saccharomyces cerevisiae}}
\LARGE{-- Support For Mutation Hypothesis In Eukaryota}
} % Article title

\author{%
\textsc{Test \small{Test} }\\[1ex] % Your name
\normalsize Test\\ 
}
\date{\today} % Leave empty to omit a date
\renewcommand{\maketitlehookd}
{%
\begin{abstract}
\blindtext
\end{abstract}
}
 
\begin{document}

\maketitle

\textbf{\section{Background}}

\blindtext
\blindtext

\end{document}

在此处输入图片描述

答案1

正如我所评论的,\textbf{\section{Background}}这是不恰当的。事实上,颠倒顺序\section{\textbf{Background}}名义上可以解决这个问题。然而,这本身也不是最好的方法。更好的方法是进行以下更改:将完全\textbf\section参数中删除,而是将其\bfseries作为 titleformat 的一部分:

\titleformat{\section}[block]{\large\scshape\bfseries\centering}{\thesection.}{1em}{}

这是修订后的 MWE。

\documentclass[twoside,twocolumn]{article}

\usepackage{blindtext} % Package to generate dummy text throughout this template 

\usepackage[sc]{mathpazo} % Use the Palatino font
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\linespread{1.05} % Line spacing - Palatino needs more space between lines
\usepackage{microtype} % Slightly tweak font spacing for aesthetics

\usepackage[english]{babel} % Language hyphenation and typographical rules

\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
\usepackage[ small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
\usepackage{booktabs} % Horizontal rules in tables

\usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text

\usepackage{enumitem} % Customized lists
\setlist[itemize]{noitemsep} % Make itemize lists more compact

\usepackage{abstract} % Allows abstract customization
\renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
\renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text

\usepackage{titlesec} % Allows customization of titles
\renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
\renewcommand\thesubsection{\roman{subsection}} % roman numerals for subsections
\titleformat{\section}[block]{\large\scshape\bfseries\centering}{\thesection.}{1em}{} % Change the look of the section titles
\titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles

\usepackage{fancyhdr} % Headers and footers
\pagestyle{fancy} % All pages have headers and footers
\fancyhead{} % Blank out the default header
\fancyfoot{} % Blank out the default footer
\fancyhead[C]{Integrated Science Curriculum -- December 2021} % Custom header text
\fancyfoot[RO,LE]{\thepage} % Custom footer text

\usepackage{titling} % Customizing the title section

\usepackage{hyperref} % For hyperlinks in the PDF
\usepackage{graphicx}
\graphicspath{ {./images/} }



%----------------------------------------------------------------------------------------
%   TITLE SECTION
%----------------------------------------------------------------------------------------

\setlength{\droptitle}{-4\baselineskip} % Move the title up

\pretitle{\begin{center}\Huge\bfseries} % Article title formatting

\posttitle{\end{center}} 

\setlength\parindent{24pt}
\usepackage{float}
\usepackage{pdfpages}
\newsavebox\mysavebox
\usepackage{hanging}
\usepackage{siunitx}

\usepackage[
backend=biber,
style=alphabetic,
sorting=ynt
]{biblatex}
\addbibresource{sample.bib}

%----------------------------------------------------------------------------------------

% Article title closing formatting
\title{\centering{Pathogen Resistance of 
\textit{Saccharomyces cerevisiae}}
\LARGE{-- Support For Mutation Hypothesis In Eukaryota}
} % Article title

\author{%
\textsc{Test \small{Test} }\\[1ex] % Your name
\normalsize Test\\ 
}
\date{\today} % Leave empty to omit a date
\renewcommand{\maketitlehookd}
{%
\begin{abstract}
\blindtext
\end{abstract}
}
\begin{document}

\maketitle

\section{Background}

\blindtext
\blindtext

\end{document}

在此处输入图片描述

相关内容