# Why is my text vertically spread out?

Can anyone see from the following LaTeX fragment why the page got formatted the way it can be seen in the picture below? For some reason everything got centered vertically across the whole page.

\section{Another way to double-space a file}

\begin{lstlisting}
awk 'BEGIN { ORS="\n\n" }; 1'
\end{lstlisting}

\bb{BEGIN} is a special kind of pattern which is not tested against the input.
It is executed before any input is read. This one-liner double-spaces the file
by setting the \bb{ORS} variable to two newlines. As I mentioned previously,
statement "\bb1" gets translated to "\bb{\{ print \}}", and every print statement
gets terminated with the value of \bb{ORS} variable.

\pagebreak


I am doing anything fancy and my document declaration looks like this:

\usepackage{amsmath} %Never write a paper without using amsmath for its many new commands
\usepackage{amssymb} %Some extra symbols
\usepackage{makeidx} %If you want to generate an index, automatically
\usepackage{graphicx} %If you want to include postscript graphics

\usepackage{listings}
\usepackage{xcolor}
\usepackage{textcomp}

\begin{document}

\newcommand{\bb}[1]{\textbf{#1}}

\definecolor{codebg}{HTML}{EEEEEE}
\definecolor{codeframe}{HTML}{CCCCCC}

\lstset{language=Awk}
\lstset{backgroundcolor=\color{codebg}}
\lstset{frame=single}
\lstset{framesep=10pt}
\lstset{rulecolor=\color{codeframe}}
\lstset{upquote=true}

\lstset{emph={awk}, emphstyle=\textbf}


-
Before you post a question here, I recommend playing around with your problem a bit and narrowing the issue down. This way it's easier for us to answer your questions (when stuff gets trickier than this) and (even more importantly!) you can actually learn a lot about how LaTeX works by trying different things. For example, you could easily rule out the packages as a cause for the problem by commenting them out one by one -- this won't change the problem, but you might eventually find out that commenting out \pagebreak solves it. Also take a look at this. –  doncherry Apr 30 '11 at 10:20

It's because you used \pagebreak. So LaTeX spreads out the text on the whole page. If you want to avoid this you need to use \newpage.