# [Tex/LaTex] center and \centering both add space above; \centerline does not

horizontal alignmentnagspacing

The nag package suggests I use the center environment in LaTeX, rather than the TeX \centerline command.

When I do that, however, I find that the former inserts a blank line above the line (in my case), whereas the latter does not.

I'd prefer to use the "correct" LaTeX env, but I don't want the extra blank line.

I tried \centering, as recommended here, but that still added space above, although that link suggests that it should not.

I'm doing this within the letter class, if that makes a difference.

You don't really want \centerline, that doesn't allow line breaks and whose behavior may surprise.

I don't really see why you want something centered inside a chunk of justified text without giving it some room. But if you really insist, \centering is the correct solution. It doesn't add more vertical space than what a normal start of paragraph would. If you're using a nonzero parskip, then you're the cause of your own trouble.

Here's a way to get a center environment that doesn't add vertical space around it even with nonzero parskip set.

\documentclass{article}
% \usepackage{parskip}

\newenvironment{nscenter}
{\parskip=0pt\par\nopagebreak\centering}
{\par\noindent\ignorespacesafterend}

\begin{document}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut
purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut
purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
\begin{nscenter}
\bfseries Here's some short material\\ I wanted centered
\end{nscenter}
Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget,
consectetuer id, vulputate a, magna. Donec vehicula augue eu
neque. Pellentesque habitant morbi tristique senectus et netus et

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut
purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
\end{document}


Here's the result (thanks to A. Ellett for the precious text), first with zero parskip

and then with nonzero parskip (obtained by uncommenting the line in the source)