Monday, March 14, 2011

LaTeX in a Nutshell (#1)

Introduction

Writing research papers in industry tends to involve one of two text formats: Word and LaTeX. From my experience, Word is still dominating the creation of technical reports, papers, etc., but LaTeX was essentially written for programmers and technical researchers who want an extensible, programmable paper format. This blog entry is intended to group together examples and descriptions of features. Hopefully, the blog series will be appealing to beginner to intermediate LaTeX users.

Starting Out

Like C++ or Java, you are probably going to break your main project into pieces. If you are collaborating with other authors or researchers, this will be especially essential, as it will allow you to each work on and revise different sections of the paper at the same time with no conflicts! Importing other LaTeX files is easy. Let's start with a simple example of a paper with three sections: abstract, solution, and experiments. We use the ACM Conference Proceeding document class to format the document for submission to an ACM conference. Be sure to download the .cls files into the same directory as your document!

\documentclass{acm_proc_article-sp} 

% package includes.
% For now, including graphicx for images is enough
\usepackage{graphicx}

% begin document signals the beginning of rendering
% anything before this point is just metadata or package includes
\begin{document}

% title and author information. Note how we specify
% two different authors (James Edmondson and John Smith)
\title{Research Paper}
\numberofauthors{2}
\author{
  \alignauthor James Edmondson\\
    \affaddr{Vanderbilt University}\\
    \email{james.r.edmondson@vanderbilt.edu}
  \alignauthor John Smith\\
    \affaddr{Vanderbilt University}\\
    \email{john.q.smith@vanderbilt.edu}
}

% Render the author and title information first
\maketitle

% These are macros that we can use in tables to provide
% extra space at the top (\T) when under a horizontal line
% and at the bottom (\B) when on top of a horizontal line
\newcommand\T{\rule{0pt}{2.6ex}}
\newcommand\B{\rule[-1.2ex]{0pt}{0pt}}
 
% include the three sections
\input{abstract}
\input{solution}
\input{experiments}

% include the bibliography
\bibliographystyle{abbrv}
\bibliography{master}
\end{document}

This main file, which is frequently called the name of the targeted conference might be called technicalreport.tex. The three included files would need to be called abstract.tex, solution.tex, and experiments.tex. At the end of the file, we include a bibliography called master.bib.

The three input files can just be a paragraph, if you like, but the master.bib file should have a format. The best part about using LaTeX is that most research portals like ACM, IEEE, and Citeuseek provide LaTeX bibliography files for you to directly copy into  your master.bib file. For instance, here is a complete listing of papers by E.W. Dijkstra. The best part about bibliographies (called Bibtex) in LaTeX is that when you change the documentclass and the bibliographystyle, the bibliography is automatically formatted to the specification of your target conference or journal. Anyone who has had to do this in Word knows how difficult this can be with most Word Processors.

Another nice feature of Bibtex is that the bibliography will only print a bibliography for papers or journals that are actually cited in the paper. In this way, you can build a master bibliography file that has all of the papers you have ever read and use it between all of your papers without any problems.

Notes

Try to avoid using underscores (_) or percent (%) in your bibliography. If you do use these, make sure you escape the sequence with a backslash (\).

Links for Further Reading

Check out these links if you would want to find out some specifics that may not be covered in this blog series.


No comments:

Post a Comment