序言问题

序言问题

在此处输入图片描述不幸的是,我没有任何最小工作示例来说明问题出在哪里。但是,我有以下序言,并且我的章节标题上方和下方有一些间距,我无法使用 vspace 来改变间距。我只能发布序言,希望有人能尽快发现一些错误。

\documentclass[11pt,twoside,dvipsnames]{article}
\usepackage{geometry}
\usepackage{enumerate}
\usepackage{latexsym,booktabs}
\usepackage{amsmath,amssymb}
\usepackage[singlespacing]{setspace}
\usepackage{hyperref} %% to make the referencing clickable 
\usepackage{graphicx}
\usepackage{caption} 
\captionsetup[table]{skip=6pt}
\usepackage{float}

\usepackage{array, makecell}

%% to change the title of the chapters 
\usepackage{titlesec}
\titleformat{\chapter}{\normalfont\Large}{\thechapter}{1em}{} \vspace{6pt}]
\titlespacing\subsubsection{-5pt}{12pt plus 4pt minus 2pt}{-5pt plus 2pt minus 2pt}

% Referencing packages 
\usepackage[natbibapa]{apacite}

%% Copied from repository before to make make comments

\usepackage{xcolor}

\newcommand{\tb}[1]{\noindent \textcolor{NavyBlue}{\textbf{Tom:}  #1}} % 1 'cause Trom is the best! 
\newcommand{\ish}[1]{\noindent \textcolor{Orange}{\textbf{Ish:}  #1}}


%% For modeling
\usepackage{optidef}

\geometry{a4paper,left=2cm,right=2.0cm, top=2cm, bottom=2.0cm}

\newtheorem{Definition}{Definition}
\newtheorem{Theorem}{Theorem}
\newtheorem{Lemma}{Lemma}
\newtheorem{Corollary}{Corollary}
\newtheorem{Proposition}{Proposition}
\newtheorem{Algorithm}{Algorithm}
\numberwithin{Theorem}{section}
\numberwithin{Definition}{section}
\numberwithin{Lemma}{section}
\numberwithin{Algorithm}{section}
\numberwithin{equation}{section}


% *********************************************************************
% Headings and page layout
% *********************************************************************
%\usepackage{fancyhdr} % to design my own headings
%\usepackage{titlesec, titletoc} % to design my own toc and part/chapter/section styles

% page style of "chapter"
\titleformat{\chapter}[display]{\LARGE \bfseries}
    {\Large Chapter \thesection \thispagestyle{plain}}{0ex}{\titlerule\vspace{2ex}}
\titlespacing*{\chapter}{0ex}{-8ex}{8ex}

%\titleformat{\section}[display]{\LARGE \bfseries}
%   {\Large Section \thesection \thispagestyle{plain}}{0ex}{\titlerule\vspace{2ex}}
%\titlespacing*{\section}{0ex}{-8ex}{8ex}


% definition of headings
\fancypagestyle{memo}{
    \pagestyle{fancy}
    \fancyhf{}
    \fancyhead[RO,LE]{\thepage}
    \fancyhead[RE]{\rightmark}
    \fancyhead[LO]{\leftmark}
    \renewcommand\headrulewidth{0.5pt}
}


\section{Clustering} \label{sec:clustering}

All new hurriances in the city blasting away the air and water
\subsection{Choice of clustering} \label{subsec:choice_of_clustering}
cluster cluster where are you? 

\subsection{Validity of clusters} \label{subsec:validity_of_clusters}

\end{document}

答案1

我不知道您在这里尝试了什么,但这看起来有点像误用。不过,我会尽力回答。

一般来说:如果您想找到一般错误,请复制并删除 begin 和 end-document 之间的所有内容。然后检查错误是否仍然出现。如果出现(很可能会出现),请注释掉整个序言并逐步取消注释,直到出现错误。总的来说,所有 vspace 都集中在一个段落内并添加到段落末尾。因此,如果您的代码如下所示:

\vspace*{-10pt}
\section{tigglywiggly}

它不起作用,因为没有新段落。您可以在以下代码中看到此行为。

\documentclass[a4, 11pt]{article}
\usepackage{lipsum}

\begin{document}

\lipsum[1] A paragraph \vspace{-3pt} is \vspace{20pt} going \vspace{-8pt} to end.

\lipsum[1] This paragraph is also \vspace{9pt} finished now.

\lipsum[1] This paragraph has \vspace{20pt} 20pt.

\lipsum[1] This paragraph is is without vspace.

\lipsum[1]

\end{document}

前两个段落分隔符的大小相同,两个段落间距的总和为 9pt。

如果要强制出现垂直空间,可以使用 vskip:

\documentclass[a4, 11pt]{article}
\usepackage{lipsum}

\begin{document}

\lipsum[1] A paragraph \vskip -3pt\relax is \vskip 20pt\relax going \vskip -8pt\relax to end.

\lipsum[1] This paragraph is also \vskip 9pt\relax finished now.

\lipsum[1] This paragraph has \vskip 20pt\relax 20pt.

\lipsum[1] This paragraph is is without vspace.

\lipsum[1]

\end{document}

如您所见,\vskip将文本分成段落。有时会被抑制,即在页面开头。如果您想强制这样做,则需要在之前、之后或两者中输入 null:\null\vskip 30pt\relax\null

\relax不执行任何操作。它表示 已\vskip在此处完成。将其与 之类的命令一起使用。\vskip否则会产生副作用。 \null是一个空框,其行为类似于可打印字符。

相关内容