Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

LaTeX For Economists

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Template-based introductory guide to LaTeX for

Economics
Laudo M. Ogura
Department of Economics, Grand Valley State University (GVSU)
[Latest minor update: 5/17/2010] [Latest major update: 3/2005]

Abstract
This is a very introductory guide on using LaTeX to write Economics papers. It is based
on a sample file (template) that you can edit to create your first LaTeX article (you must
have something yours to write, of course!). After that, consult more complete guides or
search for what you want on the internet. Warning: this is not for people who already know
the basics (you wont learn anything new here)!
Keywords: LaTeX; Economics Research.
JEL Classification Numbers: Y90 (Miscellaneous Categories -Other -Other).

Address: 401 W. Fulton St., 478C DeVos Center, Grand Rapids-MI, 49504, USA, telephone: 1-616-3317234, e-mail: ogural@gvsu.edu. The author is grateful to J. Mauricio Prado Jr. for suggestions on how to
improve the usage of LaTeX over the years (some of Prados suggestions are incorporated in this guide).

Introduction

When I started learning to use LaTeX, I could not find a sample or template that was
useful for learning-by-doing, so I had to learn from scratch (reading manuals!). It took me
months to learn! Using the sample/template and guide below, I hope you can write your
first LaTeX working paper in a couple of days!!!

1.1

What you should get

First of all, if a URL link is broken, search for the resource using your preferred search
engine (e.g., Google).
There are several editors that can be used with a LaTeX compiler. The standard
(most used) compiler out there seems to be MiKTeX. You can use it with a text editor like
TeXnicCenter (free I use it!) or Winedt (proprietary), which are interfaces to edit your
document (they still require to learn some coding. If you dont want to learn math codes,
you can use Mathtype (proprietary) to write math expressions in WYSIWYG (What You
See Is What You Get) and then copy-and-paste into the LaTeX file.
To get started, download and install MiKTeX and then TeXnicCenter (search on the
internet for their current versions). After installing MiKTeX, check whether it is configured
to install new packages on the fly (go to Windows Start, All Programs, MiKTeX, Settings,
and find the Package Installation option choose yes for Install missing package on
the fly), otherwise you might get a missing package error when compiling your .tex file
(packages are like add-ins, which allows you to do something in addition to the basic). Now,
you need a basic guide that will help you with the commands. I wrote the guide below, which
uses the approach of learning-by-copying (i.e., you get a sample file to practice by changing
the parameters and the text content). A more complete manual is Oetikers [(2008)] Notso-short introductory manual (I used that manual for learning).
I highly recommend these resources:
Excel-to-LaTeX: a free Excel macro that convert an Excel selection to a LaTeX table.
You can do most of the work on tables (including formatting and lines) using Excel and then
converting it to a LaTeX code with this macro.
LaTeX2rtf: free software to convert from LaTeX to rtf file (which can then be converted
to doc files). The conversion is not perfect (there are problems with footnote numbering,
table alignments, citations, references, etc.). This is probably unnecessary by now (in the
past, some journals would not accept LaTeX or pdf files, thus requiring to convert to a doc
file!).
Rtf2LaTeX2e - free software to convert from rtf (MS-Word) to LaTeX. It saves a lot of
2

work when converting existent papers written in Word, but it is not perfect (tables, graphs,
equations, and formats may not convert properly - you will have to revise them).
As an alternative to the LaTeX interface editors above, there are Scientific Word (proprietary) and similar programs. Those are complete programs to write texts and convert
to LaTeX on the go (the need to learn LaTeX codes is highly reduced and you write math
expressions in a WYSIWYG environment). I personally recommend to learn in the hard way
(writing LaTeX codes) because 1) it is free and 2) it gives more flexibility and compatibility
with other users files.

1.2

Links for publication of economics research

Search for these useful links on the web (Ill add the links to this document later).
JEL Classification Numbers
How to publish in Economics by Prof. Kwan Choi (Editor, Review of International
Economics)
Rejected ideas by Prof. Xavier Sala-I-Martin.
Look for instructions on formatting your paper in the journals website (where you are
submitting your paper). In general, you dont have to strictly follow the instructions when
you submit a manuscript for review (you only really need to really follow the instructions
when you submit the final version for publication after your paper is accepted - good luck
with that!).

Template-based guide

This needs revision and update. Feel free to copy and make your own improved version.
In the following, LaTeX codes are preceded by a \. Parameters are inside brackets (most
are in bold so that you know you have to personalize it, like the name of a section, captions,
etc).

2.1

Sample working paper and software needed

Use the .tex file below as a template for your first LaTeX working paper! This file is
based on an earlier version of the Ogura[(2010)] paper. The figure.pdf file refers to a figure
that is inserted in the working paper (objects can be inserted in several ways; I inserted as
a pdf file). Download both files and put them in the same folder (create a folder for your
working paper where you can have all the associated files, i.e., figures, backup, log, etc.).
Click on the links below to download:
3

[workingpaper.tex]
[figure.pdf]
The output you should get after compiling the .tex file with MiKTeX is this (click on the
link to download): [workingpaper.pdf].
The sample above is just a very simple template to get you started. There are many
things that you can learn over time to make your life easier, e.g., how to make better looking
tables, change the way citations and notes appear, use BibTeX, adding an appendix, etc.
Use the LaTeX editor (TeXnicCenter) to open the workingpaper.tex file and then learn how
to compile and build a pdf output (its pretty easy - explore the menu at the top - later
learn to customize the toolbar buttons in TeXnicCenter as they will be extremely helpful).
Caution: you may have to run the compilation of the file twice (the first attempt sometimes
doesnt work well - you will see errors in the log file, not sure why). You should be able to
get an output that is nearly the same as the one I posted above (the workingpaper.pdf file).
After that, its up to you: change text, format, etc. to your taste and content. Have fun!
For figures, it may be better to choose file names with no spaces (I had problems before
with file names with spaces, but it might just have been bad luck). Put all associated files
(LaTeX file and figures) in the same folder.
When generating the pdf output, you may have to close the previous pdf file (with the
same name) before generating a new one (you will see an error message if thats the case).
Pdf output may not work properly if there are non-pdf figures in your file (in that case, you
may have to create a dvi file first, and then convert to pdf using a converter). When you
are working in your paper, its easier to generate a dvi file (instead of pdf) because the dvi
previewer will open the file on the page where you made the last change (at least if you
are using Yap as the dvi previewer; also, you dont have to close a previous dvi file before
generating a new one with the same name). The only problem with requesting a dvi output
is that pdf figures wont be shown (if you have figures as pdf files, you must generate a pdf
output to be able to see them).
All files generated (including backups and logs) will be saved in the folder where your
.tex file is located.
Additional tips on how to personalize your paper to your needs are given next. There
may be mistakes and there are definitely easier ways to do some of them. I learned some of
the better ways, but this guide wasnt seriously revised since many years ago.
In the guide below, periods (.) might have been skipped at the end of sentences to
avoid confusion (a reader might think the period was part of a code). Sorry for the disrespect
to good grammar (there are other typos or grammar issues too, since I never seriously revised
this).
4

2.2

Using packages

For most changes in format, you must use packages. Packages are inserted by writing the
following in the preamble:
\usepackage{package name}
The preamble is the initial part of the .tex file, which has the specifications to be followed
when compiling the output; the preamble comes before the actual text, i.e., before the Title,
Author, etc.

2.3

Forcing a specific authorship date

If you dont want the current automatic date to be shown under the Title/Author, add
the following after \title{ } or after \author{ }. For example:
\title{Title}
\date{\small date you want}
\author{Name,Affiliation,etc.}

2.4

The Outline in TeXnicCenter

TeXnicCenter has a very useful feature called Outline (it was called Navigator in version
1), which allows to see a tree with sections, subsections, figures, tables, etc. to help you
navigate inside your file. To use the Outline, you have to create a project file (in the menu,
click Project, Create with active file). Then, when you reopen the project (or .tex) file later,
the .tex (or project) file will open together automatically. To see the outline, in the menu,
click View, Tool Windows, Outline.
If you are using a project file, to close the file when you are done, in the menu, click File,
Close project (instead of Close).

3
3.1

Format and layout


Page number

To force an initial page number (other than 1), write:


\setcounter{number for this page}
(example, \setcounter{2} makes the page where this command is written to be 2 and the
following pages will follow this value.
If you dont want page number on a particular page (usually on the first page in a working
paper), write the following in the portion of the document that corresponds to the page:
5

\thispagestyle{empty}

3.2

Line spacing

The package {setspace} must be added and then write the following where you want
spacing to have effect:
\singlespacing
or
\onehalfspacing
or
\doublespacing
If you add this command before the start of the text, the spacing that you set will valid
for the entire document. To set different line spacing for a portion of the document, add
the corresponding command in the start of the portion and then, at the end of portion,
write the original spacing command to return to the original spacing. Instead of the spacing
commands above, you can use:
\setstretch{n}
where n is a decimal number and represents the spacing parameter (1=single, 1.5=one and
half, 2=double, 3=triple, etc.).

3.3

New line or paragraph

To start a new line with indent like for a new paragraph, skip one line in your .tex file.
To start a new line without indent add \\ at the point where you want the new line
to start.

3.4

Indent

To eliminated the indent in a given paragraph (useful when preparing presentation slides),
start the paragraph with \noindent
To increase the indent, add a \quad or \hspace{Xcm}, where X is the number of centimeters to skip (you can use in=inch too).

3.5

Margins

To change page layout margins, alter the parameters in


\geometry{left=1.0in,right=1.0in,top=1.0in,bottom=1.0in}

Instead of inches (in), you could use centimeters (cm). You must be using the geometry
package, i.e., make sure the following is in the preamble of your .tex file:
\usepackage[nohead]{geometry}

3.6

Hyphenation

To avoid excessive hyphenation (i.e., word-breaks between lines), add the following to
where you want the command to start having effect (usually before the beginning of your
text):
\sloppy
This command does not completely eliminate hyphenation, but makes it very rare. LaTeX
was create to generate a nice looking output, so the compiler tries to avoid hyphenation, but
sometimes it would create large spaces between words, so it prefers to hyphenate the last
word of the line.

3.7

Justification

Justification is generally not needed for working papers, but here it is. To have text
justified to the left, use \flushright at the point you want justification to start. To have text
justified to the right, use \flushleft at the point you want justification to start. To have text
centered, use:
\begin{center}
Text that you want to be centered
\end{center}

3.8

Font size

Font sizes depend on the initial shell (a shell is like a setting-file with predetermined
formats, which is specified in the preamble of the .tex file). In the {article} shell, the
following is the most used font sizes if the standard size is set to 12pt (this is the case in
the workingpaper.tex file that you downloaded). Write the command for font size before the
text that will have that size. If you want to go back to the initial size (or change to another
size) later, write a new font size command. If you want to change the font size for a table,
you have to write the font size command inside the table environment (i.e., just after you
write the \begintable):
\Huge for size 25 (useful for slides)
\LARGE for size 20 (useful for slides)

\Large for size 17 (useful for slides)


\large for size 14
\normalsize for size 12
\footnotesize for size 10
\scriptsize for size 8 (useful only when reducing large tables)
TeXnicCenter also allows you change font size by selecting the text and then clicking in
Format/Font size (other size options are possible; the ones above are the most useful).

3.9

Font format

This is obvious if you are using TeXnicCenter (in the menu, click Format, Characters),
but here it is anyway:
\textbf{text}, which yields text
\textit{text} or \emph{text}, which yields text
\underline{text}, which yields text

4
4.1

Adding special content


Footnotes or endnotes

Footnotes are inserted with \footnote{Footnote text}. You should write this just at
the place where you want to have the footnote mark shown. Numbering of footnotes is
automatic. Be careful that you should not include footnotes in equations or equation arrays
(or any other math environment).
To have all footnotes shown at the end of the document, write in the preamble:
\renewcommand{\footnote}{\endnote}
Then, at the point of the text that you want your notes to begin (usually before or after the
references), write:
\begingroup
\theendnotes
\endgroup

4.2

References

You may want to learn to use BibTeX. In the long term, it should be worth. Search for
a BibTeX guide somewhere else (try Bibedit, a little software that helps writing and storing

references). For your first paper, just use a simpler method (see the example in the working
paper file). To add references at the end of your paper, write
\begin{thebibliography}{9}
\bibitem[(year)] {label}Your reference (author, article, journal, year, volume,
page, etc)
\bibitem[(year2)] {label}Your reference2 (author, article, journal, year, volume, page, etc)
\end{thebibliography}
The[(year)] is optional. Its not that useful (you can just write the year in each
citation yourself). The label (anything you want, but make it short so you remember)
allows you to cite the reference in the text by calling the label. The number {9} after
\begin{thebibliography} is the size of the widest-label (I guess it does not matter if you use
short labels). For numbered references, e.g., Smith [4], using labels are useful! The numbering is automatically sorted by the order in your list of references. So, if the Smith reference is
the forth that you listed, then it will appear numbered as [4]. In order to automatically show
the number in the text, you have to call the label like this: Smith \ref{labelforSmith}. For
references with year, like Smith (1996), using labels is not that useful because it is faster to
just write the year yourself. But if you want to get the year automatically using the label,
write Smith\cite{labelforSmith} or, if the reference is already within parentheses, write
(Smith, \citeyear{labelforSmith}).

4.3

Figures

There are several ways to add a figure, but I insert them as pdf files (you can search
for other methods in the internet). If you want to use pdf figures within your text (not at
the end of paper), the file must have almost no blank margins (so that the file has only the
picture). Insert the pdf figure (where you want it to be) using:
\begin{figure}[htbp]
\caption{Title}
\centering \includegraphics[width=0.75\textwidth]{filename.pdf } \\
A note you want to add here (like the source of the data for a graph).
\label{your key}
\end{figure}
where htbp is for the location on the page: here, top of the page, bottom, or floating on a
separate page, Title is the title that appears at the top of the figure (automatically precedes
with Figure X:, where X is the number of the figure), 0.75\textwidth gives the width as a

proportion of the text width (you can use a measure in inches or cm instead), filename.pdf
is the name of the file of the figure, which should be in the same folder of your .tex file, and
your key is the key that you can use to refer to the figure in the text (you have to write
\ref{your key} in order to have the reference (the number of the figure) shown in the text).
Notice that you can add a note at the bottom of the figure for sources or other remarks.
The example above should give something like the following figure (using the option h,
i.e., print it here).
Figure 1: Title

A note you want to add here (like the source of the data for a graph).
How can you create figures? MS-Powerpoint is great to draw diagrams. MS-Excel draws
several types of graphs. Mathematica, Matlab, Stata, etc. can create plots from data (or
simulations).

4.4

Unnumbered sections

If you dont want to have the number of the Section (or subsection, or sub-subsection)
showed in your final document, write * after \section like this:
\section*{section name}
Note that this section wont be automatically counted (if other sections are numbered).
This is useful when adding an Appendix (there is native way to add an appendix, but I prefer
to just add an unnumbered section called Appendix) or an end-of-paper acknowledgment
(again, LaTeX has its own way to add acknowledgments, although most Economics journals
ask you to add acknowledgments with your contact information on the first page).

4.5

URL with hyperlink

First, add the package hypertex in the preamble:


10

\usepackage[hypertex]{hyperref}
Then, write the following where you want the hyperlink to be in your text:
\href{url}{label}
where url is the full URL (including http://) and label is what you want to be shown in
the text (if you want to show the full URL, just repeat the URL for the label).

Slides

There are several ways to make slides using LaTeX. The easiest way (which I use),
although not the prettiest, is to make a copy of your article file, then change the format
to landscape, reduce margins, and increase letter size to \Huge (use smaller font sizes for
tables). Use \bullet, \Rightarrow, \blacktriangleright, etc. to create bullet points in your
presentation. The advantage of this method is that the font size will be just right! and
you wont be able to overstuff each page with too many words, equations, etc. The greatest
advantage, however, is that you dont have to learn anything else!!! and you can just delete
parts of your article to create the presentation!
To change the page orientation to landscape, write landscape as an argument in
\documentclass[12pt, landscape]{article} at the very start of the .tex file. Add the \Huge
after the \maketitle command (just after the title and author names). You will have to add
size commands to alter the size of anything in the title section (the title, author names, etc.)
by adding \huge or \LARGE or \Large or \large (as you prefer) to the text, as shown below:
\title{\huge Title of Paper}
\author{\LARGE Author Name \\
\Large School Name \\
\large Preliminary work: do not cite it.}
\date{\Large 3/29/2010}
You can make dynamic presentations with LaTeX, but you need special shells and learn
to use them (search in the internet). The {beamer} class has been used frequently lately.

Concluding remarks

Good luck! Yes, luck is helpful during this learning process (you can save a lot of time
by avoiding silly mistakes).
This is an open-source document. There are no plans for future revisions of this document.
Feel free to write and distribute your own improved version (but dont forget to cite this document). The original .tex file of this document is available at http://faculty.gvsu.edu/ogural/
11

References
Oetiker, T., 2008. Not-so-short introductory manual. Last revised version (9/25/2008) retrieved from http://www.ctan.org/tex-archive/info/lshort/english/.
Ogura, L.M., 2010. Effects of urban growth controls on intercity commuting. Urban Studies
(forthcoming in 2010).

12

You might also like