# How to get the code on a single page [duplicate]

Hi I am new to Latex and am trying to create a latex document with the following preamble and content.

While, the code produces the desired output, somehow all the output comes on page 2, leaving page 1 totally blank.

\documentclass[a4paper,12pt]{article}
\topmargin 0pt
\textheight 8.9in
\usepackage{enumerate}
\oddsidemargin 0pt
\evensidemargin \oddsidemargin
\marginparwidth 0.5in
\textwidth 6.5in

\begin{document}

\title{ MISC \\
Homework II \\
Computer Science \\Fall 2011\\}
\date{ September 17, 2011 }

\begin{center}
\begin{Large}
\maketitle{All the code here is entirely mine}\\
\end{Large}
\end{center}

\end{document}


Could someone help me in figuring out what I am doing wrong.

P.S. If I dont center my title, the output does show on a single page, but the formatting is not very presentable.

## marked as duplicate by Marco Daniel, user11232, percusse, morbusg, Claudio FiandrinoSep 18 '12 at 18:55

There are a few problems with your code: \maketitle does not take any arguments. It just print the title, author, data data according to the predefined style. For article the title is on the same page as the text. You can use the titlepage option for the document class article or switch to report class.

The \\ in the line of \maketitle is useless.

\documentclass[a4paper,12pt,titlepage]{article}
\topmargin 0pt
\textheight 8.9in
\usepackage{enumerate}
\oddsidemargin 0pt
\evensidemargin \oddsidemargin
\marginparwidth 0.5in
\textwidth 6.5in

\begin{document}

\title{ MISC \\
Homework II \\
Computer Science \\
Fall 2011}
\date{ September 17, 2011 }
\author{Your Name\thanks{All the code in this report is entirely mine}}

\maketitle

\end{document}


\maketitle takes no arguments. To get the desired output, the code is

\begin{document}

\title{ MISC \\
Homework II \\
Computer Science \\Fall 2011\\}
\date{ September 17, 2011 }

\maketitle

\begin{center}
\begin{Large}
All the code here is entirely mine
\end{Large}
\end{center}
\end{document}


Note that the title and date definition may be done in the preamble, that is, before \begin{document}.

use the environment titlepage if you want to create your own title and set the margins with package geometry:

\documentclass[a4paper,12pt]{article}
\usepackage{geometry}
\geometry{textheight=8.9in,textwidth=6.5in,marginparwidth=0.5in}
\usepackage{enumerate}
\begin{document}

\begin{titlepage}
\begin{center}
\Large
MISC \\
Homework II \\
Computer Science \\Fall 2011

\vspace{1cm}
September 17, 2011

\vspace{1cm}
All the code here is entirely mine
\end{center}
\end{titlepage}

next page
\end{document}