[Tex/LaTex] center horizontally and vertically a block of text

horizontal alignmentvertical alignment

I would center horizontally and vertically a block of text as if it was an abstract text block.How can I do?

I tried this:

\null\vfill
\begin{center}

\end{center}
\vfill\null

it It correct?

Best Answer

A "correct" way could be

\clearpage
\vspace*{\fill}
\begin{center}
\begin{minipage}{.6\textwidth}
Text that will be justified
...
\end{minipage}
\end{center}
\vfill % equivalent to \vspace{\fill}
\clearpage

The top vertical space should be \vspace*, so it doesn't disappear at the break. The justified text will be on a line width that's 6/10 of the normal line width, change the fraction to suit you.

You can in a similar way decide also for different spaces at the top and at the bottom; for instance

\clearpage
\vspace*{\stretch{2}}
\begin{center}
\begin{minipage}{.6\textwidth}
Text that will be justified
...
\end{minipage}
\end{center}
\vspace{\stretch{3}}
\clearpage

will leave spaces in the proportion 2/3; something of this kind can turn useful for a dedication page, as the dedication is usually not in the center of the page.

If you need that the text inside the minipage has indented paragraphs as the normal text, then center and minipage are not good. This can be accomplished by a more complicated construction:

\documentclass{article}
\usepackage{lipsum}

\begin{document}

\clearpage
\vspace*{\fill}
\begin{list}{}{%
  \leftmargin=.2\textwidth
  \rightmargin=.2\textwidth
  \listparindent=\parindent
  \itemindent=\parindent
  \itemsep=0pt
  \parsep=0pt}
\item\relax
\lipsum[1-2]
\end{list}
\vfill % equivalent to \vspace{\fill}
\clearpage

\end{document}

The package lipsum just produces some text.

Related Question