Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In the standard LaTeX article class (and probably others as well), paragraph indentation follows standard American publishing norms of not indenting the first paragraph after a \section{} or \subsection{}.

I've redefined \maketitle in a LaTeX document and put the actual title left-aligned as the last line, fairly close to the actual text (kind of like this)

Author
Date

Title

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud 
exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.

    Duis aute irure dolor in reprehenderit in voluptate velit 
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint 
occaecat cupidatat non proident, sunt in culpa qui officia 
deserunt mollit anim id est laborum.

Section title

Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud 
exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.

    Duis aute irure dolor in reprehenderit in voluptate velit 
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint 
occaecat cupidatat non proident, sunt in culpa qui officia 
deserunt mollit anim id est laborum.

Since the title is left-aligned and so close to the text, I'd like the first paragraph of the document to not be indented, just like with the headings

...
Title

Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud 
exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.

    Duis aute irure dolor...
...

I've attempted to use \@afterindentfalse, which is what the \section commands use, inside my renewed commands, but it doesn't work.

\makeatletter

\def\noindentation{\let\@afterindentfalse}

\newcommand{\mytitle}[1]{%
    \vskip 2em
    {\bf\sffamily\LARGE #1}
    \noindentation}

\renewcommand{\@maketitle}{
    \begin{flushleft}{

        % Author
        \@author \par 

        % Date
        \@date \par 

        % Title
        \mytitle{\@title}

    } \end{flushleft}
} 
\makeatother

By default the first paragraph in the article class is indented, so this question is applicable whether or not I renew \maketitle.

So, what's the best way to automatically not indent the first paragraph of the document?

share|improve this question

migrated from stackoverflow.com Feb 16 '12 at 21:25

This question came from our site for professional and enthusiast programmers.

    
To me it's not clear what you're doing. For example, do you have a \section command after the \maketitle? It would be useful if you could provide a minimal working example. –  Marc van Dongen Feb 17 '12 at 8:33
add comment

5 Answers 5

up vote 8 down vote accepted

Have you tried using the \noindent command in your definition of \maketitle?

Normally when you put \noindent at the beginning of a paragraph, it prevents that paragraph from being indented. It may or may not work for your purposes. (For all I know it might just use \@afterindentfalse internally)

share|improve this answer
    
Yeah, that works, but I'm hoping to make it automatic, so I don't have to worry about manually adding that to the first paragraph... –  Andrew Aug 12 '09 at 18:01
    
Oh, yeah, I actually meant to suggest that you try \noindent in your definition of \maketitle :-/ I'll edit that for clarity. –  David Z Aug 12 '09 at 19:46
3  
\noindent will only work if it is placed immediately before the text that you want not to indent (with no blank lines in between). So adding it to the end of your definition of \maketitle will only work if you start the first paragraph immediately after the \maketitle command. –  Anton Geraschenko Aug 13 '09 at 14:40
    
I had a feeling that was the case, but thanks for clarifying that, Anton. –  David Z Aug 13 '09 at 14:57
    
I ended up doing this. I have a perl script that generates the LaTeX, so I just stuck in a \noindent. –  Andrew Aug 15 '09 at 18:59
add comment

The titlesec package allows you to do this very neatly.

\titlespacing*{\section}{0pt}{1.5ex}{1.5ex}

The * version of \titlespacing command removes the initial indentation of the first line in a section. The other arguments are for tuning the whitespace around the section title.

share|improve this answer
add comment

If you want all the paragraphs to have no indent, but a line skip instead, use \usepackage[parfill]{parskip}.

From a layout stand point, it seems like it should be an all-or-nothing proposition, either all are indented, or all use the line break to indicate a new paragraph.

share|improve this answer
    
Nah, it's not necessarily an all-or-nothing thing--plenty of books and articles do the first-paragraph-not-indented thing for stylistic purposes. It'd be a ton easier if that wasn't the case, though... –  Andrew Aug 12 '09 at 19:05
    
Thanks for the parskip package pointer. I might just use that instead if this turns out to be undoable. –  Andrew Aug 12 '09 at 19:06
    
your document is going to looks quite strange if some paragraphs are indented, while others are not, even if its after a heading... but that's just my 2 cents :D –  Mica Aug 13 '09 at 16:11
add comment

I believe problem has to do with grouping. You have to call \@afterindentfalse at the outermost level (and it seems you also have to use \@afterheading). For this reason making a general \noindentation macro may be difficult.

The following modification works for me.

\renewcommand{\@maketitle}{
  \begin{flushleft}{
      % Author
      \@author \par
      % Date
      \@date \par 
      % Title
      \mytitle{\@title}
    }
  \end{flushleft}
  \aftergroup\@afterindentfalse
  \aftergroup\@afterheading
}
share|improve this answer
    
Very nice! I had the same problem. –  Bart Snapp Apr 21 at 19:30
add comment

The cleanest solution is probably to use \noindent in front of the first paragraph. You only have to do it once, so redefining \maketitle seems like more trouble than it's worth.

If you're determined to redefine \maketitle so that the first paragraph is not indented, then just redefining it to end with \noindent will not work if you have a blank line between \maketitle and the first paragraph (because the blank line causes TeX to enter vertical mode). Instead of using \noindent, you can use the combination \@afterindentfalse\@afterheading. In other words, the following should do what you want:

...
\maketitle
\makeatletter
  \@afterindentfalse
  \@afterheading
\makeatother

Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
...

If you want to, you can redefine \maketitle to include \@afterindentfalse\@afterheading at the end.

However, it seems like adding \@afterindentfalse\@afterheading to the end of \@maketitle doesn't work. Some of the things that \maketitle does after it does \@maketitle must be messing it up.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.