段落之间不需要换行

段落之间不需要换行

我有一个 .tex 文件,其中定义了以下代码:

\section{Introduction}
\paragraph{}
This is an example
\paragraph{}
This is an example

显示如下:

在此处输入图片描述

如何避免在两个段落之间出现空的新行?我的 main.tex 定义如下:

\documentclass{article}

\usepackage{graphicx} % Required for inserting images
\usepackage{hyperref}
%\usepackage{indentfirst}

\title{}
\author{}
\date{}

\begin{document}
\begin{figure}
    \centering
    \includegraphics[width=0.3\linewidth]{logo uniba.png}
    \label{fig:enter-label}
\end{figure}
\begin{center}
    Università degli Studi di Bari "Aldo Moro"

    
    Master's Degree in Computer Science
\end{center}
\noindent\rule{\textwidth}{1pt}

\begin{center}
    Thesis in Artificial Intelligence for Security
\end{center}
\vspace{15mm}
\begin{center}
    \large \textbf{A study based on XAI of the performance of a feature-based classifier learned  for PE malware classification and evaluated on adversarial samples generated in the problem space}
\end{center}

\vfill

\raggedright\textbf{\textbf{First supervisor:}}

Annalisa Appice

\textbf{\textbf{Second supervisor:}}
\hfill
\textbf{\textbf{Graduating student:}}

Giuseppina Andresini
\hfill
Paolo Gasparro

\noindent\rule{\textwidth}{1pt}

\begin{center}
    Academic year 2022-2023
\end{center}

\newpage

\renewcommand{\contentsname}{Index}

\begin{center}
    \tableofcontents
    \newpage
\end{center}

\input{Chapters/Introduction}
\input{Chapters/Background}
\input{Chapters/Defined Pipeline}
\input{Chapters/Experimental Study}
\input{Chapters/Conclusions and future works}

\end{document}

感谢您的帮助。

答案1

您没有提供示例代码来展示问题,但您似乎想要

在此处输入图片描述

\documentclass{article}
\usepackage{indentfirst}

\begin{document}

\section{Aaaa Bbbb}

An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 

An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 


\end{document}

主要错误是使用\raggedright将段落缩进设置为 0 并禁用右边距对齐:

在此处输入图片描述

\documentclass{article}
\usepackage{indentfirst}

\begin{document}
\raggedright

\section{Aaaa Bbbb}

An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 

An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 
An indented paragraph. An indented paragraph. 


\end{document}

尽管它的名字不太恰当,但\paragraph与文本段落无关(在源中应该用空行标记),它是之后的第四级标题,\section因此只能在之后使用(并且不应与空参数一起使用,因为如果增加,编号和目录会看起来很奇怪)。\subsection\subsubsection\subsubsectionsecnumdepth

相关内容