如何以不同方式缩进章节和小节

如何以不同方式缩进章节和小节

我想在所有部分中将 parindent 设置为 2mm,在所有子部分中将 parindent 设置为 0mm。有办法吗?
谢谢 Ráď

\documentclass{article}

\begin{document}

\section{Section1}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.Etiam placerat porta massa eu malesuada.

This text has a space before it. Integer egestas venenatis ipsum, et interdum nulla sagittis sed. 

\subsection{Subsection1}
Fusce egestas ultricies turpis eget fermentum.

I want this text alligned. Maecenas sed scelerisque arcu. 

\end{document}

答案1

段落应该总是缩进(标题后的第一个段落可能例外)或者从不缩进(并且应该在每个段落前面添加一些垂直空间);第二种样式可用于信件等短篇文件。

混合缩进和非缩进段落会使读者感到困惑;我不建议这样做。此外,2mm 的缩进量太小了。

你可以轻易地做你想做的事。请不要这么做。

\documentclass{article}
\usepackage{indentfirst}

\let\LaTeXsection\section
\let\LaTeXsubsection\subsection
\def\section{\setlength{\parindent}{2mm}\LaTeXsection}
\def\subsection{\setlength{\parindent}{0mm}\LaTeXsubsection}

\begin{document}

\section{Section1}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.Etiam placerat porta massa eu malesuada.

This text has a space before it. Integer egestas venenatis ipsum, et interdum nulla sagittis sed. 

\subsection{Subsection1}
Fusce egestas ultricies turpis eget fermentum.

I want this text alligned. Maecenas sed scelerisque arcu. 

\section{Section1}
Lorem ipsum dolor sit amet, consectetur adipiscing elit.Etiam placerat porta massa eu malesuada.

This text has a space before it. Integer egestas venenatis ipsum, et interdum nulla sagittis sed. 

\subsection{Subsection1}
Fusce egestas ultricies turpis eget fermentum.

I want this text alligned. Maecenas sed scelerisque arcu. 

\end{document}

在此处输入图片描述

相关内容