views:

3476

answers:

4

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?

Thanks!

+3  A: 

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)

David Zaslavsky
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
Oh, yeah, I actually meant to suggest that you try `\noindent` in your definition of `\maketitle` :-/ I'll edit that for clarity.
David Zaslavsky
`\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
I had a feeling that was the case, but thanks for clarifying that, Anton.
David Zaslavsky
I ended up doing this. I have a perl script that generates the LaTeX, so I just stuck in a \noindent.
Andrew
+3  A: 

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.

Mica
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
Thanks for the parskip package pointer. I might just use that instead if this turns out to be undoable.
Andrew
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
+1  A: 

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.

Anton Geraschenko
+1  A: 

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
}
Ivan Andrus