I am requested to use the apa6 package (https://ctan.org/pkg/apa6?lang=en) but cannot compile the examples provided there in the sample/ folder (by running pdflatex shortsample.tex, for example), and instead I get the error ''Missing \begin{document}'' within file apa6.cbx provided by the biblatex-apa6 package (https://ctan.org/pkg/biblatex-apa6?lang=en).

At the end of this question I paste the relevant excerpt of the log file. Below follows additional information.

In the manual apa6.pdf there is no obvious instruction on how to install the package, but in the root folder a .dtx and an .ins file are provided and after googling I found that compiling the .ins file (e.g., pdflatex apa6.ins) generates a set of files including the apa6.cls file.

After copying the apa6.cls file to the samples/ folder and running pdflatex shortsample.tex I got an error about biblatex and apa6 style. I found online the package biblatex-apa6, and in the instructions in file biblatex-apa6.pdf, section 3, it says that it can be installed by copying .cbx, .bbx and .lbx files to subfolders of <texmf>/tex/latex/biblatex/. In my computer biblatex (installed with the package texlive-bibtex-extra) the relevant <texmf> is /usr/share/texlive/texmf-dist/. I copied the files, ran texhash and I now get mentioned error.

Excerpt of shortsample.log:

Package biblatex Info: Trying to load citation style 'apa6'...
Package biblatex Info: ... file 'apa6.cbx' found.

File: apa6.cbx 2020/05/03 v8.4 APA 6th ed. biblatex citation style
Package biblatex Info: Delimiter 'nameyeardelim' in context '' already
Package biblatex Info: Delimiter 'nameyeardelim' in context 'textcite'
defined, overwriting.
Package biblatex Info: Delimiter 'andothersdelim' in context '' already
, overwriting.
Package biblatex Info: Redefining '\fullcite'.
Package biblatex Info: Redefining '\citeauthor'.
Package biblatex Info: Redefining '\citeyear'.
Package biblatex Info: Redefining '\cite'.
Package biblatex Info: Redefining '\cites'.
Package biblatex Info: Redefining '\parencite'.
Package biblatex Info: Redefining '\parencites'.

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.

l.509 ...DelimAlias*[nptextcite]{finalnamedelim}[parencite]{finalnamedelim}
  • [p arencite] has a space. Is that incorrect?
    – Cicada
    Jun 15 '20 at 11:57
  • apa6 is a class: from the manual (section 3.1) \documentclass[options]{apa6}. What code did you run to produce the errors? Are you compiling with pdflatex engine, or xelatex/lualatex?
    – Cicada
    Jun 15 '20 at 12:16
  • 2
    Only a small example code is needed, which can compile and reproduce the error.
    – Cicada
    Jun 15 '20 at 12:20
  • It would really help if you could share (and run) a short example document, so we all know what we are talking about. (That is usually called an MWE: tex.meta.stackexchange.com/q/228/35864. It need not contain more than \documentclass a few preamble lines and "lorem ipsum" as well as a citation in the document body.) In this case I have a hunch this could be a version problem, so the full .log file would be nice as well. If it is too long for the question, please upload it to a text-sharing site such as pastebin.com or gist.github.com
    – moewe
    Jun 15 '20 at 14:13
  • For now my working hypothesis is as follows. You installed your TeX live system via your Linux distribution (amongst other things also sudo apt install texlive-bibtex-extra). The TeX live versions shipped by Linux distributions can be quite outdated and in general don't keep up-to-date with CTAN. Then you installed the current version of biblatex-apa6 from CTAN. That version is intended to be used with a more modern version of biblatex than the biblatex shipped by your Linux distribution. That version mismatch causes the error.
    – moewe
    Jun 15 '20 at 16:12

It is almost always a problematic to install LaTeX packages, document classes or bibliography styles manually from CTAN. One of the risks with that is that you can run into version incompatibilities.

Here, you are using a TeX live from the repositories of your Linux distribution. Depending on the exact version of your OS that TeX live version may be a little or really quite outdated by today's standard.

In particular the error you get suggests that the version of biblatex installed on your system is too old for the biblatex-apa6 you manually installed from CTAN. (Now one might be tempted to manually update biblatex from CTAN, but this is a recipe for disaster due to the dependencies, so I strongly recommend you don't do that.)

I suggest you remove the files you installed manually (the class apa6 and the biblatex style biblatex-apa6). Instead make sure that you have installed the packages

  • texlive-publishers, which contains apa6 and
  • texlive-bibtex-extra, which contains biblatex and biblatex-apa (which in your outdated version of TeX live is equivalent to a modern biblatex-apa6; the current version of biblatex-apa implements 7th edition APA style)

from your Linux distribution.

With those packages installed, you should be able to run documents using the apa6 document class (using biblatex-apa instead of biblatex-apa6).

In case you want to have a fully up-to-date TeX live system, you should look into installing "vanilla" TeX live from TUG.org. See How to install "vanilla" TeXLive on Debian or Ubuntu?.

If you get TeX live 2020 from TUG.org, then you should install apa6 and biblatex-apa6 via tlmgr.

Since you mention a journal requesting you use apa6, double check that they also really want you to use biblatex-apa(6). The biblatex-based workflow of biblatex-apa is quite different from the standard LaTeX citation workflow and generally publishers seem to prefer the old BibTeX ways. Double check with their submission guidelines. Maybe they'd prefer if you used apacite instead of biblatex-apa(6).

  • I was unaware of the existence of the texlive-publishers package and that it had the apa6 document class. Indeed by making \usepackage[style=apa,...]{biblatex} the file now compiles. Thank you!
    – Joao
    Jun 15 '20 at 17:41
  • @Joao Basically every package in TeX live is available in some texlive-... package from your Linux distribution provided it is old enough that is was available back when the TeX live was packaged by your distributor. The trick is to find out which package contains the files you are looking for. (I usually just google the package name and "ubuntu" and that is often enough, but if not, apt has a search function)
    – moewe
    Jun 15 '20 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.