1.3. Creating a LaTeX document

Table of Contents

1.3.1. LaTeX basics
1.3.2. Creating the document
1.3.3. Beginning a document
1.3.4. Adding sections to the document
1.3.5. Labeling sections in the document
1.3.6. Adding external files to the document
1.3.7. Adding headers and footers the document
1.3.8. Adding an abstract to the document
1.3.9. Adding a style to the document
1.3.10. Adding a BibTeX bibliography to the document

1.3.1. LaTeX basics

  • Comments span from a `%' to the end of the line.
  • Paragraphs are separated by newlines.
  • Macros begin with a `\' and end with a separator, such as whitespace.
  • Macros may take arguments using `{...}':
    \documentclass{article}
    \parbox{3in}{text}
    
  • Macros may take optional arguments using `[...]':
    \documentclass[10pt,twocolumn]{article}
    \parbox[b]{3in}{text}
    
  • Environments configure blocks of text with matching beginning and end delimiters:
    \begin{document}
       % ...
    \end{document}
    
  • Environments may have required arguments:
    \begin{minipage}{6in}
       % ...
    \end{minipage}
    
  • Environments may have optional arguments:
    \begin{minipage}[t]{6in}
       % ...
    \end{minipage}
    

1.3.2. Creating the document

We will create a simple document, document.tex. First, we select a document class, of which there are several with the standard LaTeX distribution, including:

  • article
  • book
  • letter
  • report
  • slides

For example, here we start a two column article with 10pt font:

\documentclass[10pt,twocolumn]{article}

1.3.3. Beginning a document

Here is a simple document:

\documentclass[10pt,twocolumn]{article}

\title{My Impressive Document Title}
\author{Author N. One\\
Department of Computer Science\\
Clemson University
Clemson, SC, USA\\
{\small one@cs.clemson.edu}\\
\and
Author N. Two\\
University of Someotherplace\\
{\small two@someotherplace.edu}\\
}

\begin{document}
\maketitle
\end{document}

1.3.4. Adding sections to the document

Here is an outline for a document:

\begin{document}
\maketitle

\section{Introduction}
\section{Related Work}
\section{Technique}
\section{Case Studies}
\section{Results and Discussion}
\section{Conclusions}

\end{document}

1.3.5. Labeling sections in the document

Here we add a label, which may be referenced, to a section:

\section{Introduction}
\label{sec:intro}
The prefix 'sec:' is just a convention and is not required.

To reference a labeled section elsewhere in the document:

\ref{sec:intro}

1.3.6. Adding external files to the document

Here we add an external file to the document:

\section{Introduction}
\label{sec:intro}
\input{sections/intro}

The use of external files makes a document more modular, and eases interaction among co-authors.

1.3.7. Adding headers and footers the document

Headers and footers are provided by the fancy header package. To add this package to a document:

\documentclass[10pt,twocolumn]{article}
\usepackage{fancyhdr}

To use this package:

\begin{document}
\maketitle

\thispagestyle{empty}
\renewcommand{\headrulewidth}{0.0pt}
\thispagestyle{fancy}
%\lhead{}
%\chead{}
%\rhead{Submitted to ISSTA'04}
\lfoot{}
\cfoot{\it Submitted to
The First International Conference on SGA (SGA'06), Chicago, IL, USA, July 5-7, 2006
}
\rfoot{}
The thispagestyle commands are used to remove the header from the title page.

1.3.8. Adding an abstract to the document

Here we add an abstract to the document:

\begin{abstract}
% In this paper...
\end{abstract}

\section{Introduction}

1.3.9. Adding a style to the document

Here we apply the IEEE 8.5 x 11-Inch Proceedings Style `latex8.sty':

\documentclass[times,10pt,twocolumn]{article}
\usepackage{latex8}
\usepackage{times}

Note that custom styles may introduce custom document classes. For example, to apply a CUCS template:

\documentclass[10pt, letterpaper, boxed, hyperref]{CUcsThesis}

1.3.10. Adding a BibTeX bibliography to the document

Here we add a bibliography to the document:

\bibliographystyle{latex8}
\bibliography{document}

\end{document}
The BibTeX file is named document.bib, and the bibliography will use the style file `latex8.bst'.

Multiple BibTeX files may also be included:

\bibliographystyle{latex8}
\bibliography{nkraft,gdowdin}

\end{document}