Generating APA 6 formatting and references with LaTeX and BibLaTeX
What is LaTeXIt's a toolset that is able to transform the documents written in TeX language into something beautifully rendered, like a PDF file, requiring almost no effort for formatting. It was invented to counteract the problem of different machines displaying files differently, especially things that are hard to format, like equations, tables, and so on.
The steps typically look like this:
+----------------+ +------------------+ | Reference Mgr. +------> Biblatex .bib +--------+ +----------------+ +------------------+ +v-------------+ +-----------+ | latexmk +----> .pdf | +----------------+ +------------------+ +^-------------+ +-----------+ | Text editor +------> LaTeX .tex +--------+ +----------------+ +------------------+
Automate referencing and formatting with LaTeX for psychology papersPsychology papers are mostly text heavy with some formulas and tables, and generally with a lot of referencing and citations with special formattings, like APA 6 essay style, or two column formatting. Making sure that the document format and the references are correct is time consuming and error-prone but LaTeX can totally automate this process:
- Format the document according to the full APA 6 standard
- Automate referencing and bibliography management
- Highlight unused references
- Correctly reference all tables and figures
The advantage of using automation to generate the correct final APA 6 format is that we can focus on writing the content itself without worrying about accidentally missing a formatting requirement or a reference from bibliography, or correctly pointing to a figure from the text, or just an italics when inserting a mathematical formula. Also, as the source is a simple text file, it's much denser and easier to read than the final output, which according to APA 6 is required to use double spacing, making it hard to overview.
Workflow for reference managementFirst, as usual, we collect the references for the paper in either Zotero or Mendeley. I personally found a couple of papers that Mendeley had incorrectly imported and the author names were distorted, so I've settled for Zotero, which happens to be open source, unlike Mendeley. Once we have the references, we can export them into BibLaTeX format. I would also highly recommend installing Better BibTeX for Zotero, as the BibLaTeX export is not buggy, it allows customising the citation keys, and even copying them from Zotero with a shortcut (Shift+Command+C).
Editing the LaTeX (.tex) file can be done in any editor, even in Word or LibreOffice as it's a simple text file with some markers but without any kind of formatting. I have attached a sample APA 6 template at the end of this post that will generate a fully formatted APA 6 essay with very little effort from the author.
To generate the output PDF file, either use an online TeX editor or run the LaTeX toolkit locally (see both later):
latexmk -pdf -xelatex
Getting LaTeX, generating the APA 6 formatThe only difficult part of using LaTeX is actually setting up the environment. There are great online collaborative LaTeX tools that remove this problem altogether, like Overleaf. It's good to start with those to have a feel for editing TeX files before installing the environment ourselves.
When we are familiar with TeX, it's good to install it locally too: visit the LaTeX project and find the package for the system.
For Mac manual installation, I decided to install it using MacPorts instead of the prepackaged MacTex installer, so these are the components that I needed:
sudo port install texlive
sudo port install biblatex-biber sudo port install texlive-bibtex-extra sudo port install texlive-publishers sudo port install texlive-fonts-extra sudo port install texlive-fonts-recommended
Unfortunately, this approach is very time consuming, so retrospectively it would have been much easier to use MacTex...
Sample APA 6 TeX file and the outputThe following sample will generate an APA 6 essay in PDF with two "References" section. The second list is the "error list", highlighting the unused references in the BibLaTeX .bib resource - it's not a bug, it's a feature. Try to run it locally or just upload it to Overleaf.
The output PDF (as images). Notice the last page where the missing references are listed (indian_when_2014 was not cited in the text):