1

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.

(/usr/share/texlive/texmf-dist/tex/latex/biblatex/cbx/apa6.cbx File: apa6.cbx 2020/05/03 v8.4 APA 6th ed. biblatex citation style Package biblatex Info: Delimiter 'nameyeardelim' in context '' already defined, overwriting. Package biblatex Info: Delimiter 'nameyeardelim' in context 'textcite' already defined, overwriting. Package biblatex Info: Delimiter 'andothersdelim' in context '' already defined , 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}

Joao
  • 305
  • 1
  • 2
  • 6
  • [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: https://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 https://pastebin.com/ or https://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
  • There is no simple way out of this with your current setup. That's one of the reasons why it is generally discouraged to install packages manually from CTAN. Generally it is much better to install all packages through the same system (in your case your Linux distribution). But if your Linux is stuck with an old TeX live that doesn't have apa6 or biblatex-apa6 that is an issue. Do double check, though, if (an older version of) apa6 is available via apt, that version would presumably load an old version of biblatex-apa (which again should be available) instead of biblatex-apa6. – moewe Jun 15 '20 at 16:17
  • The radical way to get a more up-to-date system with apa6 and biblatex-apa6 would be to remove the TeX live installed via apt/apt-get and get a vanilla TeX live from TUG instead (https://tex.stackexchange.com/q/1092/35864). – moewe Jun 15 '20 at 16:18
  • Reply to Cicada: the space in [p arencite] was a leftover from copy-paste with a line break. I fixed it. I used pdflatex. I tried luatex too but that would give a different error. Anything that starts with \documentclass[man, 12pt, a4paper]{apa6} and has later in the preamble \usepackage[style=apa6,sortcites=true,sorting=nyt,backend=biber]{biblatex} yields the problem. – Joao Jun 15 '20 at 16:47
  • Reply to moewe: Your working hypothesis is correct and indeed the installed version of biblatex has an apa style, but the journal is requesting class apa6. I checked the link you provided for the TUG installation and it seems quite involved. – Joao Jun 15 '20 at 16:57
  • There is a difference here between the class apa6 and the bibliography style biblatex-apa6 (or in older versions biblatex-apa). It is possible that the class apa6 is available on your system in one of then many texlive-... packages served via apt. That version is likely to be compatible with all other packages on your system. So I suggest you completely remove the class apa6 and bibliography style biblatex-apa6 you manually installed. Instead make sure you have texlive-publishers and texlive-bibtex-extra installed. – moewe Jun 15 '20 at 17:06

1 Answers1

3

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).

moewe
  • 175,683
  • 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