I am trying to write a text where the first line of each paragraph has an indent(tab). But for some reason, in a chapter or a section or subsection, except the first paragraph, the rest of the paragraphs have an indent(tab). Is there any way to add an indent to the first paragraph in a chapter or section or subsection?

-
Never use \\ to separate paragraphs. Just a blank line. – egreg Dec 2 '12 at 17:22

The easiest method is to call

\usepackage{indentfirst}


in your preamble. This package is included in all LaTeX distributions.

The standard setting of LaTeX is to suppress indentation in the first paragraph after a sectional title, which is standard usage in American typography.

Some babel language settings do similarly to indentfirst, for instance the French language definition file does, to set up the document according to French typographic traditions.

-
Good! Besides the package frame it consists of two code lines: \let\@afterindentfalse\@afterindenttrue and \@afterindenttrue. – Stefan Kottwitz Oct 14 '11 at 10:56
@StefanKottwitz That's David Carlisle magic. :) – egreg Oct 14 '11 at 11:03
Thanks.. this is exactly what I was looking for. - ) – Jay Oct 16 '11 at 22:29
@Anton If you want to indent it, just leave a blank line after itemize. This has nothing to do with indentation after a title. – egreg Dec 12 '13 at 20:30

The first paragraph after a section heading is not indented by default in most document classes (or rather its indentation is removed, which is why \indent doesn't help you either). If you do like all your paragraphs indented then the correct thing to do is to change this default. There is a package called indentfirst that precisely does this for you.

There are a couple of other packages that may influence/change the default behavior of the document class, e.g., titlesec has an option to specify how the behavior should be and the frenchb option for babel automatically adds indentation as this is a common typographically rule for French documents. And there may be others.

If for some (strange) reason you only want a single paragraph indented then try \indent\indent, the first will be swallowed but the second should survive.

-
It doesn't depend only on the document class, but also on packages like babel. For example for the french language, typographical rules (supposedly -- I never read them) state that all paragraphs should be indented, and babel enforces this rule. – T. Verron Dec 2 '12 at 18:00
@T.Verron right, but I didn't said that it only depends on the document class I only said that the default in most document classes is that. Of course any later package may overwrite what the document class uses as the default. That is true for indentfirst, titlesec, babel ... and who knows. – Frank Mittelbach Dec 2 '12 at 21:15
Yes, sorry if I was unclear. I meant your sentence "it is not indented by default in most document class" could be confusing for example for a french user who will use \usepackage[frenchb]{babel} everytime (without even thinking of it), and won't understand why he can't get the default behavior by using a standard document class. :) – T. Verron Dec 2 '12 at 21:20
@T.Verron you are right and I added a para to explain that possibility a bit better – Frank Mittelbach Dec 3 '12 at 8:35

You could redefine the internal macro \@afterheading for setting \@afterindent to true:

\documentclass{book}
\makeatletter
\@afterindenttrue
\makeatother
\begin{document}
\chapter{One}
text
\section{one}
text
\end{document}


This works without an additional package. Perhaps consider using the titlesec package which is very useful for customizing format and spacing of headings. Its command \titlespacing can make an indentation, but if used with a star such as \titlespacing* the indentation is removed.

-
Stefan, I don't think it is good advice to suggest low-level redefinitions if standard packages provide an adequate solution, e.g., indentfirst or titlesec. – Frank Mittelbach Dec 2 '12 at 21:08
@FrankMittelbach The hack in indentfirst disabling the internal switch \if@afterindent doesn't look much more stable ;-) but of course it's better to recommend using a package, so I upvoted egreg's answer earlier. It's at the top now, less recommendable alternative ways below, fine. – Stefan Kottwitz Dec 2 '12 at 21:19
it may not be better, it may even be the same code. But my point is that it is then in a single place and may get updated if necessary and not spread across all kind of user preambles resulting in future questions once it breaks. – Frank Mittelbach Dec 3 '12 at 7:23

Another simple solution is to include

\usepackage[indentafter]{titlesec}


in your document. This is a good choice if you also intend to use the package titlesec for other purposes.

-

Let's say you want to write an article. Here's a skeleton.

\documentclass{article}

% add here the packages you need, for instance
\usepackage[utf8]{inputenc}

\begin{document}

\author{Andrew}

\maketitle

\tableofcontents
\newpage % if you really want to go to a new page

\section{Introduction}

This is the first paragraph, that should be captivating the attention
of the readers. We say here some very important things, and then
we will proceed to explain what's in the paper.

This paragraph will be indented, since it's the second after a
section title. Note that paragraphs should be separated by a
blank line and not by a double backslash.

\section{Main results}

This paragraph is not indented. However, if your typographical
standard wants that also the first paragraph after a section
title is indented, it can be done.

The second paragraph \emph{is indented} anyway.

\subsection{Preliminaries}

Not the one following a subsection title.

\end{document}


The trick for indenting all paragraphs, including the first after a title, is to load

\usepackage{indentfirst}


Some people swear that sometimes it's good to go to a new line without indentation and this is attained by using \\ to terminate the paragraph. Those people are wrong.

-
just wondering, why a second answer? – mythealias Dec 3 '12 at 9:06
@mythealias It's the result of merging this question with a duplicate. I asked to undo the merging. – egreg Dec 3 '12 at 9:42