# How to indent section and subsection differently

I want to set parindent to 2mm in all my sections and parindent 0mm in all my subsections. Is there a way to do this ?
Thanks 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}

• Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
– DG'
Dec 20 '14 at 15:05
• Paragraphs should always be indented (possible exception for the first paragraph after a title) or never (and some vertical space should be added in front of each one); the second style can be used for short documents such as letters. Mixing indented and non indented paragraphs will confuse the readers. Is there any specific reason for doing the way you want? Dec 20 '14 at 21:55

Paragraphs should always be indented (possible exception for the first paragraph after a title) or never (and some vertical space should be added in front of each one); the second style can be used for short documents such as letters.

Mixing indented and non indented paragraphs will confuse your readers; this is something I can't recommend. Besides, 2mm is too small an indent.

You can easily do what you'd like. Please, don't.

\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}