Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}

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

\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.


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 






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


share|improve this question
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
add comment

1 Answer

up vote 8 down vote accepted

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.

share|improve this answer
I was one second from posting the same thing :) This question covers the same issue: http://tex.stackexchange.com/questions/736/pagebreak-vs-newpage –  doncherry Apr 30 '11 at 10:07
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.