# How to adjust vertical space before and after center environment

It seems that there are vertical blank spaces before and after the center enviroment, as shown in the attached picture.

My question is: how to adjust these vertical blank spaces?

Code:

\documentclass{article}
\parindent0pt
\begin{document}
\rule{\textwidth}{1pt}
\begin{center}
aaa\\bbb\\ccc
\end{center}
\rule[\baselineskip]{\textwidth}{1pt}
\end{document}


• Instead of \begin{center}...\end{center}, use {\centering...\par} to eliminate the added space. May 21 at 1:35
• Thank you @Steven. As \centering may lead to some odd and uncontrolable behavior, center enviroment seems to be better, except that how to adjust the extra vertical spaces before/after it.
– lyl
May 21 at 1:41
• I am not sure why you think "odd and uncontrollable behavior" may result. The use of braces { } before and after the \centering...\par is intended to limit the effect of \centering to the scope within the braces. May 21 at 1:44
• For your particular use case, I would also add a \strut before the \par. May 21 at 1:46
• Also, if you show the \meaning of \center (the environment), you will discover that it is just \centering inside of a \trivlist. May 21 at 1:49

I added a \vspace{} command inside the center environment at the top and buttom, which seems to have worked. You can make the space smaller by using negative values and make the space larger by using positive values.

\documentclass{article}
\parindent0pt
\begin{document}
\rule{\textwidth}{1pt}
\begin{center}
\vspace{-4mm}
aaa\\bbb\\ccc
\vspace{-2mm}
\end{center}
\rule[\baselineskip]{\textwidth}{1pt}
\end{document}


This code produces:

Using positive values 5mm and 7mm:

• Thank you for your solution. I'd like to know if there are default values for these vertical spaces in the center enviroment and where can I find them.
– lyl
May 21 at 14:09
• mirror.math.princeton.edu/pub/CTAN/macros/latex/base/… Page 621: \def\center{\trivlist \centering\item\relax} \def\endcenter{\endtrivlist} Centering invokes the trivlist environment to handle vertical spacing before and after. This is found on page 648. Beofre: \parskip (which is dependent on the documentclass) After: \vskip \lastskip -\@outerparskip + \parskip. May 21 at 16:18
• To find the documentation go to latex-project.org -> help -> documentation -> scroll down to "Source documentation" -> click on "The LaTeX2e Sources (1000+ pages)". May 21 at 16:22
• Thank you so much!! And what does \item do in the defination of \center?
– lyl
May 22 at 0:02
• I guess it is the same as item in enumerate and itemize, but without any point/ number. The item probably refers specificually (in this case) to eighter the text in the center environment or nothing (an empty list is after all a trivial list). May 22 at 7:59