梅威瑟:
\documentclass[]{report}
\usepackage[md]{titlesec} %required for section titles
\usepackage{subfiles}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage[titles]{tocloft}
\usepackage{tocbasic}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{gensymb}
\usepackage{float}
\usepackage{floatpag}
\floatpagestyle{plain}
\usepackage{indentfirst}
\setlength\parindent{0.5in}
\usepackage{titlesec}
\usepackage[verbose]{cite}
\usepackage{cleveref}
\usepackage{url}
\usepackage{breakurl}
\usepackage{graphicx}
\usepackage{epsfig}
\usepackage{epstopdf}
\usepackage[labelsep=space]{caption}
\usepackage{subcaption}
\usepackage{setspace}
\usepackage{appendix}
\usepackage[left=1.0in,
right=1.0in,
top=1.0in,
bottom=1.0in]{geometry}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@chapter}{\addtocontents{lof}{\protect\addvspace{10\p@}}}{}{}{}% LoF
\patchcmd{\@chapter}{\addtocontents{lot}{\protect\addvspace{10\p@}}}{}{}{}% LoT
\makeatother
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{quotes,angles}
\pgfplotsset{every axis/.append style={
axis x line=middle, % put the x axis in the middle
axis y line=middle, % put the y axis in the middle
axis line style={<->}, % arrows on the axis
xlabel={$x$}, % default put x on x-axis
ylabel={$y$}, % default put y on y-axis
},
cmhplot/.style={color=black,mark=none,line width=1pt,<->},
soldot/.style={color=black,only marks,mark=*},
holdot/.style={color=black,fill=white,only marks,mark=*},
}
\tikzset{>=stealth}
\titleformat{\chapter}[display]{\centering\normalfont\large}{CHAPTER \arabic{chapter}}{0pt}{}{}
\titleformat*{\section}{\centering\bfseries\large}
\titleformat*{\subsection}{\bfseries\large}
\titleformat*{\subsubsection}{\normalfont\large}
\titlespacing*{\section}{0pt}{1\baselineskip}{0pt}
\titlespacing*{\subsection}{0pt}{0pt}{0pt}
\titlespacing*{\subsubsection}{0pt}{2\baselineskip}{0pt}
\titlespacing{\paragraph}{0pt}{0pt}{1em}
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
\renewcommand{\contentsname}{}
\renewcommand{\listfigurename}{}
\renewcommand{\listtablename}{}
\renewcommand{\cftpartfont}{\normalsize\normalfont}
\renewcommand{\cftchapfont}{\normalsize\normalfont}
\renewcommand{\cftpartpagefont}{\normalsize\normalfont}
\renewcommand{\cftchappagefont}{\normalsize\normalfont}
%\renewcommand*\cftchapnumwidth{2em}
%\renewcommand*\cftsecnumwidth{3em}
\cftsetindents{chapter}{.25in}{.25in}
\cftsetindents{section}{.5in}{.25in}
\cftsetindents{subsection}{.75in}{.5in}
\cftsetindents{subsubsection}{1in}{.5in}
\renewcommand\cftsecafterpnum{\vskip-.5\baselineskip}
\renewcommand\cftsubsecafterpnum{\vskip-.5\baselineskip}
\renewcommand\cftsubsubsecafterpnum{\vskip-.5\baselineskip}
\newenvironment{MyFigure}[1][]{\begin{figure}[#1]\vspace{\baselineskip}}{\vspace{\baselineskip}\end{figure}}
\doublespacing
\raggedbottom
\begin{document}
%DO NOT USE \maketitle
\newgeometry{top=2.0in}
\thispagestyle{empty}
\begin{center}
\large
%\vspace*{2in}
Title\\
%\vspace{1in}
By\\
N
\vspace{.5in}
\end{center}
\newpage
\begin{center}
%\vspace*{2in}
T\\
%\vspace{1in}
By\\
\\
\vspace*{1in}
\\~\\~\\~\\
The University \\
\\~\\
\end{center}
\chapter*{}
\begin{center}
\vspace*{\fill}
Copyright \copyright\ 2022
\bigskip
\bigskip
All Rights Reserved
\vspace*{\fill}
\end{center}
\restoregeometry
\chapter*{ABSTRACT}
\addcontentsline{toc}{part}{\vspace{-.5\baselineskip}ABSTRACT}
%\large
\subfile{Sections/Abstract}
\chapter*{ACKNOWLEDGMENTS}
\addcontentsline{toc}{part}{\vspace{-.5\baselineskip}ACKNOWLEDGMENTS}
\subfile{Sections/Acknowledge}
\chapter*{DEDICATION}
\addcontentsline{toc}{part}{\vspace{-.5\baselineskip}DEDICATION}
\subfile{Sections/Dedication}
\vspace{-6\baselineskip}
\renewcommand{\contentsname}{TABLE OF CONTENTS}
\tableofcontents
%\chapter*{LIST OF FIGURES}
\vspace{-6\baselineskip}
\renewcommand{\listfigurename}{LIST OF FIGURES}
\listoffigures
\addcontentsline{toc}{part}{\vspace{-.5\baselineskip}LIST OF FIGURES}
%\cleardoublepage
\chapter*{LIST OF SYMBOLS}
%\vspace{-6\baselineskip}
\addcontentsline{toc}{part}{\vspace{-.5\baselineskip}LIST OF SYMBOLS}
\noindent
\subfile{Sections/Los}
%\chapter*{LIST OF FIGURES}
\vspace{-6\baselineskip}
\renewcommand{\listtablename}{LIST OF TABLES}
\listoftables
\addcontentsline{toc}{part}{\vspace{-.5\baselineskip}LIST OF TABLES}
%\cleardoublepage
\chapter*{LIST OF ABBREVIATIONS}
%\vspace{-6\baselineskip}
\noindent
\addcontentsline{toc}{part}{\vspace{-.5\baselineskip}LIST OF ABBREVIATIONS}
\subfile{Sections/Loa}
\cleardoublepage
\cleardoublepage
\large
\clearpage
\setcounter{page}{1}
\renewcommand{\thepage}{\arabic{page}}
\chapter{INTRODUCTION}}
\section{Background}
\subfile{Sections/Background}
%\newpage
\section{Questions}
\noindent
\label{Quest}
\subfile{Sections/quest}
\section{Limitations}
\label{Limit}
\subfile{Sections/Limit}
\chapter{RELATED WORKS}
\label{RelWorks}
\subfile{Sections/Relworks}
\chapter{CONCLUSION}
\label{Conclusion}
\subfile{Sections/conclusion}
\cleardoublepage
\addcontentsline{toc}{part}{\vspace{-.5\baselineskip}REFERENCES}
\cleardoublepage
\renewcommand\bibname{REFERENCES}
\setstretch{1}
\clearpage
%\titlespacing*{\chapter}{0pt}{50pt}{40pt}
\chapter*{VITA}
\addcontentsline{toc}{part}{VITA}
\large
\subfile{Sections/Vita}
\end{document}
答案1
由于您已经测量了环境所增加的空间,一个简单的方法是删除该空间(通过插入负空间),然后添加所需的空间(0.6 英寸)
在第一种情况下,这是使用命令的可选参数来完成的,该命令\titleformat
用于之后要执行的代码。
在第二种情况下,就在此之后\end{figure}
。
\documentclass[]{report}
\usepackage[md]{titlesec} %required for section titles
\usepackage{subfiles}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage[titles]{tocloft}
\usepackage{tocbasic}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{gensymb}
\usepackage{float}
\usepackage{floatpag}
\floatpagestyle{plain}
\usepackage{indentfirst}
\setlength\parindent{0.5in}
\usepackage{titlesec}
\usepackage[verbose]{cite}
\usepackage{cleveref}
\usepackage{url}
\usepackage{breakurl}
\usepackage{graphicx}
\usepackage{epsfig}
\usepackage{epstopdf}
\usepackage[labelsep=space]{caption}
\usepackage{subcaption}
\usepackage{setspace}
\usepackage{appendix}
\usepackage[left=1.0in,
right=1.0in,
top=1.0in,
bottom=1.0in]{geometry}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@chapter}{\addtocontents{lof}{\protect\addvspace{10\p@}}}{}{}{}% LoF
\patchcmd{\@chapter}{\addtocontents{lot}{\protect\addvspace{10\p@}}}{}{}{}% LoT
\makeatother
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{quotes,angles}
\pgfplotsset{every axis/.append style={
axis x line=middle, % put the x axis in the middle
axis y line=middle, % put the y axis in the middle
axis line style={<->}, % arrows on the axis
xlabel={$x$}, % default put x on x-axis
ylabel={$y$}, % default put y on y-axis
},
cmhplot/.style={color=black,mark=none,line width=1pt,<->},
soldot/.style={color=black,only marks,mark=*},
holdot/.style={color=black,fill=white,only marks,mark=*},
}
\tikzset{>=stealth}
%\titleformat{⟨command⟩}[⟨shape⟩]
%{⟨format⟩}
%{⟨label⟩}
%{⟨sep⟩}
%{⟨before-code}
%[⟨after-code⟩]
\titleformat{\chapter}[display] %changed <<<<<<<<<<<<
{\centering\normalfont\large}
{CHAPTER \arabic{chapter}}
{0pt}
{}
[% after code <<<<<<<<<<<<<
\vspace*{-0.74in} % remove inserted space <<<
\vspace*{0.6in}% add desired space <<<<
]
\titleformat*{\section}{\centering\bfseries\large}
\titleformat*{\subsection}{\bfseries\large}
\titleformat*{\subsubsection}{\normalfont\large}
\titlespacing*{\section}{0pt}{1\baselineskip}{0pt}
\titlespacing*{\subsection}{0pt}{0pt}{0pt}
\titlespacing*{\subsubsection}{0pt}{2\baselineskip}{0pt}
\titlespacing{\paragraph}{0pt}{0pt}{1em}
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
\renewcommand{\contentsname}{}
\renewcommand{\listfigurename}{}
\renewcommand{\listtablename}{}
\renewcommand{\cftpartfont}{\normalsize\normalfont}
\renewcommand{\cftchapfont}{\normalsize\normalfont}
\renewcommand{\cftpartpagefont}{\normalsize\normalfont}
\renewcommand{\cftchappagefont}{\normalsize\normalfont}
%\renewcommand*\cftchapnumwidth{2em}
%\renewcommand*\cftsecnumwidth{3em}
\cftsetindents{chapter}{.25in}{.25in}
\cftsetindents{section}{.5in}{.25in}
\cftsetindents{subsection}{.75in}{.5in}
\cftsetindents{subsubsection}{1in}{.5in}
\renewcommand\cftsecafterpnum{\vskip-.5\baselineskip}
\renewcommand\cftsubsecafterpnum{\vskip-.5\baselineskip}
\renewcommand\cftsubsubsecafterpnum{\vskip-.5\baselineskip}
\newenvironment{MyFigure}[1][]{\begin{figure}[#1]\vspace{\baselineskip}}{\vspace{\baselineskip}\end{figure}}
\doublespacing
\raggedbottom
\usepackage{kantlipsum} % ONLY dummy text <<<
\begin{document}
\chapter{INTRODUCTION}
\section{Background}
\kant[9]
\begin{figure}[hb!]
\centering
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-a}
\caption{Usage of Lights I}
\label{fig:one}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-b}
\caption{Usage of Lights II}
\label{fig:two}
\end{subfigure}
\caption{Usage of devices}
\label{fig:graphs}
\end{figure}
\vspace{-0.34in} % remove inserted space <<<
\vspace*{0.6in} % add desired space <<<<
\kant[11]
\end{document}
通过注释掉或者删除,\vspace*{0.6in}
可以验证空白是否消失。