6

When I start a section and attempt to indent the first paragraph with \indent, the command has no effect:

\documentclass{article}


\begin{document}

  % Section 0

    \indent Paragraph 1. % indented

    \noindent Paragraph 2.

  \section{Section 1}

    \indent Paragraph 1. % not indented

    \noindent Paragraph 2.

  \section{Section 2}

    \leavevmode\indent Paragraph 1. % indented

    \noindent Paragraph 2.

\end{document}

I found that \leavevmode\indent solves the problem (as does \indent\indent), but why is this happening in the first place?

  • With \usepackage{indentfirst} in the preamble, no \indent or \leavevmode command is needed. – egreg Jun 07 '13 at 21:58
  • 3
    It is not that it doesn't work it is that LaTeX goes to some effort to ensure that you do not get indentation in that position, as that is the normal typographical convention in at least some countries. – David Carlisle Jun 07 '13 at 22:01
  • @DavidCarlisle See the edited code ("Section 0"): it's surprising that \indent works in a sectionless place but not after a section heading. – Lover of Structure Jun 07 '13 at 22:14
  • @DavidCarlisle Also, I've always thought of \indent and \noindent as manual overrides; shouldn't they always work? The user will think of them as if they toggled a bit that is being inspected when a new paragraph is started. I know that this isn't how these two actually work, but it's unexpected that \indent\indent gives double indentation. I would have expected it to be a sort of "indentation ensurer" so that there is no harm in having \indent at the end of a macro and calling it again paragraph-initially. Similarly, shouldn't \indent be forbidden inside a paragraph? – Lover of Structure Jun 07 '13 at 22:21
  • It shouldn't be surprising, anyway \indent does work, like all your \indent examples it is redundant as the paragraph indentation is automatic. The heading code removes the indentation box, so it isn't that \indent doesn't work, it is that the indentation however added is suppressed after a heading. – David Carlisle Jun 07 '13 at 22:23
  • @DavidCarlisle Okay - why do \indent and \noindent not set a binary flag? I've always understood them to work as if they were named \ensureindent and \ensurenoindent. This is confusing, why can't one add such ensure-macros and use those instead? – Lover of Structure Jun 07 '13 at 22:29
  • TeX primitives are handed down from Knuth:-) – David Carlisle Jun 07 '13 at 22:54
  • @DavidCarlisle LaTeX3? – Lover of Structure Jun 07 '13 at 23:03
  • overriding the class design by explicit spacing commands in the document should be a non-goal of any document markup system. – David Carlisle Jun 07 '13 at 23:14
  • @DavidCarlisle Well, the question then is why \indent and \noindent exist in the first place. If they exist, they serve a function, but this function is achieved in an unexpected manner. So one might as well define a manual override that uses a flag. Also if working with templates were without problems (in that we never needed to adjust anything), everybody would be perfectly content with LaTeX2e and neither resort to plain TeX nor be interested in LaTeX3 :-) – Lover of Structure Jun 07 '13 at 23:18
  • well be happy some very kind person wrote the indentfirst package to make the problem go away:-) – David Carlisle Jun 07 '13 at 23:25
  • @DavidCarlisle I am glad, but I think there was just another very kind person, except of course not as kind as the other one making an awesome LaTeX3 feature request. It's the sort of thing I'd build in if I could rewrite TeX. I never know to what extent such things will happen and what the scope of LaTeX3 is with regard to such things. (The latter is a serious question, I'm not joking.) – Lover of Structure Jun 07 '13 at 23:43
  • The system is getting cross with us so I'll stop here, but you need to remember that latex3 like 2e is being written in TeX using the same primitives, so some things will be different, but some will be the same. – David Carlisle Jun 08 '13 at 00:00
  • 1
    @LoverofStructure The LaTeX3 xgalley module does indeed use a flag here. What you are actually after though is a different template for the section headings (we'll still set the flag to suppress indents after section, as standard). Parts of this mechanism are set up, others still need work. – Joseph Wright Jun 08 '13 at 05:16

1 Answers1

0

You can use \setlength\parindent{24pt} to automatically indent all your paragraphs. So you don't have to \indent every time you start a new paragraph.

abdu
  • 1,849