Using LaTeX for class assignments (and more!)


(This introduction was written for the graduate Cognition class [PSY 8150], but you may find it useful for getting started with LaTeX for other writing projects.)

LaTeX is a typesetting program. This difers a bit from a traditional word processor (like MS Word), where "what you see is what you get" (WYSIWYG). In LaTeX, the content of what your writing is separated from the formatting. This is particularly useful for complex manuscripts, especially in scientific writing. Rather than having to worry about whether each reference is in APA format or how to get your figures to stay in the correct position, you write the paper and tell LaTeX that it should be formatted following APA style. Of course, this has its disadvantages too: LaTeX is more difficult to learn than Word. That said, I think it can be worthwhile to learn the basics. Once you do, you can decide for yourself which approach you like better. You might even find that you want to write your thesis using LaTeX.

Getting started

You can install LaTeX on your computer, or you can use the online editor Overleaf. A particularly useful feature of Overleaf is that it makes it easy for multiple authors to work on the same document (similar to Google Docs). You can create a free account on their website to use it. If you prefer to download install LaTeX onto your own computer, check out MacTeX if you're a Mac user and MiKTeX if you're a Windows user (if you use Linux, you can install LaTeX with your distro's package manager and use any editor you would like with it).

The rest of this introduction is the same regardless of whether you're using Overleaf or have LaTeX installed on your own machine.

Creating a document

LaTeX uses commands that tell the program how the document should be formatted (really, you are doing some basic computer programming). The first thing you need to do in any LaTeX document is give the program some basic information about what you'll be writing. This is done using the documentclass command. Create a new, blank LaTeX document and put this on the first line:


Two important things to note here. First, the command starts with a backslash (\), the one above the Enter key. All LaTeX commands will start with this character. Second, the argument to the command is put inside {curly brackets}. This is the basic format for most commands in LaTeX. The documentclass command also has optional arguments, which are specified inside [square brackets]. Above, this command tells LaTeX that we're writing an article/paper, and that we want the font to be 11 pt.

Note: if you're using Overleaf, you'll need to add one other command after this one, which is to specify the language you're using (I don't know why Overleaf requires this):


Chances are you'll want to create documents that are APA formatted. You can do that with this documentclass command instead:


The apa6 document class has been created specifically for creating papers that have APA-formatted references. Notice that there is also a second optional argument, man, which specified that we would like a manuscript-formatted document (i.e., double-spaced lines, title page, etc.). You may want to remove that argument for now. If you do, you will get a nicely formatted article with APA style citations.

The APA document class requires a few other pieces of information, specifically the title, running head (a.k.a. the short title), and author information. Specify those right after your documentclass command.

\title{A really awesome cognitive psychology manuscript}
\shorttitle{Awesome manuscript}
\author{Joe Toscano}
\affiliation{Villanova Univ.}

Note that for the date command, I included another command as the argument (\today). That causes LaTeX to set the date on the manuscript to today's date (useful if you make multiple versions of the manuscript).

LaTeX also has a number of packages that you can load to provide additional functionality. You don't need to worry about these too much for now, but I want to introduce two of them:

To load those two packages, using the following two lines of code:


Finally, we're ready to start writing our paper! Your LaTeX document should look like this:

% Document class and language

% APA information
\title{A really awesome cognitive psychology manuscript}
\shorttitle{Awesome manuscript}
\author{Joe Toscano}
\affiliation{Villanova Univ.}

% Other packages

I added a few comments in there also (the lines that start with a percent (%) symbol. You may find it useful to add comments at various times in your writing. These will show up in the LaTeX source (the .tex file), but not the PDF.

Add the following lines after the ones above:



Your introduction starts here.


That's it! The above code should compile as a (rather empty) PDF. You've made you first manuscript in LaTeX.

LaTeX formatting and section commands

For the most part, once you start writing, just write. Separate each paragraph with a blank line.

However, there will be times when you want to specify certain aspects of the document formatting. For example, suppose you want to italicize text. In LaTeX's terminology, this is called emphasizing text, and you do it using the emph command:

\emph{The text you want in italics.}

A similar command is used for making text appear bold: \textbf. For example:

This is regular text, but \textbf{these words} will be bold.

Notice that the command is used right in the middle of the rest of your text. LaTeX will bold just those words that are given inside the curly braces.

Some commands do not have any arguments. Those are just specified with the backslash. For example, if you didn't want LaTeX to indent a new paragraph (which is the default), you can start the paragraph with \noindent, as follows:

\noindent This paragraph will not be indented.

You should add this right before your introduction (there is an error in the \apa6 document class that incorrectly indents the very first line of the manuscript.

Sections and sub-sections are specified like this:

This is the beginning of the Method section.

This is the design of the current experiment.

The particpants were students at Villanvoa.

There are three basic heading/section levels in LaTeX: (1) section, (2) subsection, and (3) subsubsection. You'll need to use all three if you're writing a multi-experiment paper.


Since we're using the apa6 document class, all of our references will already be in APA format. But how do you actually include a reference in your paper? References are stored in a separate file (ending in .bib, for bibliography) and are specified using a slightly different syntax in the BibTeX format. First, to cite a paper in your text, do the following:

We attempted to replicate the study by \cite{Pisoni1974}, 
whose work was based on several earlier studies 
\citep{Liberman1957, Fujisaki1970, Studdert-Kennedy1963}.

This will add an in-text citation to something called Pisoni1974 and parenthetical citations for the other references. For this to work, we need to provide LaTeX with the full reference information for each article. This is handed via BibTeX. First, create a new file and save it as "MyReferences.bib". Then, add the following to it (don't worry about what this all means yet!):

  title={Reaction time to synthetic stop consonants and vowels at phoneme centers and at phoneme boundaries},
  author={Studdert-Kennedy, Michael and Liberman, Alvin M and Stevens, Kenneth N},
  journal={The Journal of the Acoustical Society of America},
  publisher={Acoustical Society of America}

  title={Some experiments on speech perception and a model for the perceptual mechanism},
  author={Fujisaki, Hj and Kawashima, T},
  journal={Annual Report of the Engineering Research Institute},
  publisher={Faculty of Engineering, University of Tokyo}

  title={The discrimination of speech sounds within and across phoneme boundaries.},
  author={Liberman, Alvin M and Harris, Katherine Safford and Hoffman, Howard S and Griffith, Belver C},
  journal={Journal of experimental psychology},
  publisher={American Psychological Association}

  title={Reaction times to comparisons within and across phonetic categories},
  author={Pisoni, David B and Tash, Jeffrey},
  journal={Perception \& Psychophysics},
Each of those four entries in the .bib file corresponds to a single reference. The first line (the part after @article) is the tag that you use in your LaTeX file to cite the article. Note, you don't have to type all of this in by hand! If you use another reference manager (such as Mendeley or Endnote), it will output BibTeX files for you. You can also get the BibTeX-formatted citation for any article from Google Scholar by clicking the "Cite" link below the paper (though double-check that Google got all the information correct).

One last thing: back in your LaTeX document, add this to the end:


That will tell LaTeX where to find your references.


The intro above is very basic. In general, if you have questions, Google it. You'll probably find the answer pretty quickly. Of course, please ask me for help if you need it.

Here are some resources on the web for learning LaTeX:

  1. Overleaf: Overleaf's intro to LaTeX can be found here.
  2. LaTeX - an introduction for students: An easy to use site aimed specifically at introducing LaTeX to students. I would suggest starting with this after you familiarize yourself with Overleaf.
  3. The Not So Short Introduction to LaTeX 2E (Oetiker et al.): Long and pretty technical, but it's thorough.