2

I am doing my thesis and trying to set up biblatex with APA on overleaf. In my references.bib file I have:

@misc{ramstedt2014andt,
  title={ANDT-bruket och dess negativa konsekvenser i den svenska befolkningen 2013},
 author={Ramstedt, Mats and Sundin, Erica and Landberg, Jonas and Raninen, Jonas},
 year={2014},
 publisher={Rapport}
}

@book{andersson2009alcohol,
title={Alcohol Use and Stress in University Freshmen-A Comparative Intervention Study of Two Universities},
author={Andersson, Claes},
volume={2009},
number={41},
year={2009},
publisher={Clinical Alcohol Research, Department of Health Sciences, Lund    University}
}

In my main file I have:

 \documentclass[bachelor,lith,english]{liuthesis}
  %% Settings go in settings.tex
  \include{settings}

Now this comes in the settings file

\usepackage[backend=biber,hyperref, style=apa]{biblatex}
\DeclareLanguageMapping{british}{british-apa}


\ExecuteBibliographyOptions{maxnames=99}

\addbibresource{references.bib}

However when I cite like this:

Today approximately 446 000 people suffer from alcohol addiction in Sweden \cite{ramstedt2014andt}.

I get:

Today approximately 446 000 people suffer from alcohol addiction in Sweden . ramstedt2014andt 

EDIT:

The style I am expecting is classic APA such as:

(Ramstedt et al, 2014)
(Ramstedt, 2014)
 Ramstedt (2014)

The warnings I have is:

./demo_student_thesis.tex:
Package biblatex Warning: Please (re)run Biber on the file:
(biblatex)                demo_student_thesis
(biblatex)                and rerun LaTeX afterwards.


./intro.tex:37:
LaTeX Warning: Citation 'ramstedt2014andt' on page 1 undefined on input line 37
.

./demo_student_thesis.tex:79:
LaTeX Warning: Empty bibliography on input line 79.

EDIT II

Some progress here. I managed to compile after adding "backref=true".

\usepackage[backend=biber,hyperref,backref=true style=apa]{biblatex}

What this did was adding a numbered reference as such 1 for the ramstedt2014andt reference. I compared my settings with this overleaf template.

EDIT III By remowing \printbibliography from the main file I got this result: Ramstedt, Sundin, Landberg and Raninen, 2014. I could just write "and others" in the reference.bib file however the parenthesis does not seem to be included still.

Parenthesis could be solved by using \parencite{}. However is there a way to automatically set et al instead of adding "and others" in the bib.file?

  • 1
    What style do you expected?(in text) Please add a full MWE tex.meta.stackexchange.com/questions/228/… . As example bib entries you can use in the MWE tex.stackexchange.com/questions/141957/… . – Bobyandbob Mar 29 '17 at 16:41
  • 1
    Welcome to TeX.SX! This sounds like it might be Question mark or bold citation key instead of citation number but if you're using Overleaf I think they normally automate the necessary biber run for you. Possibly there's a typo somewhere so the references.bib entry is not exactly the same as that of the \cite{} command but the example looks ok, could you add a minimal (non-)working example with bibliography (MWEB) to the question? – Dai Bowen Mar 29 '17 at 16:47
  • I hope the new info is enough as a MWEB. – sockevalley Mar 29 '17 at 17:12
  • Please post a full MWE (ideally that would be one document that we can just copy and run on our machines without further changes - you have only shown code snippets so far). Since you are using Overleaf, Biber should be run for you automatically. So the problem is probably directly related to your actual .bib entries or the way you us it. Please check the .log file for errors (you should be able to have a look at the top right.) – moewe Mar 29 '17 at 17:13
  • 2
    It means exactly that the citation cannot be found. It could just be that you misspelled it, but that is quite unlikely from what I see here. Normally you get an error as this because Biber failed to run properly (for more info on what Biber does see tex.stackexchange.com/q/63852/106162 as linked to by Dai Bowen). In order to find out why Biber failed to process your citations properly, we need to see the .blg file – moewe Mar 29 '17 at 17:32
2

Use \input instead of \include in the preamble.

\include can only be used after the \begin{document}.

For an explanation why and what the difference between those two is see the answer from "Martin Scharrer" at When should I use \input vs. \include?

  • 1
    @moewe I also thought that \include shouldn't be to blame here but it does seem to make a difference (I guess through the use of a different aux file), with \begin{filecontents}{settings.tex} \usepackage{biblatex} \addbibresource{biblatex-examples.bib} \end{filecontents} \documentclass{article} \include{settings.tex} \begin{document} Foo~\cite{bertram} \end{document} I get the citation rendering as [?] with \include suggesting biblatex is not loading (haven't checked this with the latest biblatex yet though). – Dai Bowen Mar 29 '17 at 18:20
  • ... And, regardless of whether you can or cannot use \include in the bibliography, it is almost always better to use \usepackage{settings} (with a file called settings.sty rather than settings.tex). (And if you don't know why that is, you are 99.9% of the time better off using \usepackage rather than \include or \input for your preamble settings.) – jon Mar 29 '17 at 18:46
  • 1
    @DaiBowen Ah yes indeed, you can't load biblatex in an \include. I didn't see that the package was loaded in setings.tex (strange place to load a package ...). – moewe Mar 30 '17 at 6:54
2

I believe the problem may be (anyway a problem is) that you have set your language to english (probably! that at any rate is an option passed to your class) but your \DeclareLanguageMapping specifies british. biblatex is picky, about these things. If I set babel to english and then map only british, using article class, I get (as one would expect) undefined control sequence errors as a result of not having apa specific code loaded. It may be that Overleaf is struggling on and hiding these from you ... I don't know since I don't use it. But I do know that you must match your language mapping to your language definition.

Separately, the form of the citation: as you have worked out, use \parencite or \autocite. That is by design.

(The include is wrong too of course, but not the source of the problem here. Biblatex doesn't care about the .aux file.)

  • Cool thanks, another issue that have arrived is that I cannot use the \printbibliography for some reason. – sockevalley Mar 29 '17 at 22:29
  • That is very odd. It's really hard to diagnose these problems with snippets and odd classes and templates behind them. I suggest you start by stripping things down to a minimum, in a single file, using a standard class (= "template") such as \usedocument{book}. Get it working there first so you thoroughly understand the simple case first. – Paul Stanley Mar 29 '17 at 23:12
  • @PaulStanley -- "... such as \documentclass{book}." (I know you know this, but just case others think there's a command \usedocument....) – jon Mar 29 '17 at 23:53
  • @jon Crikey! They would be forgiven for thinking so. ... When we get a question on that, you can blame me. – Paul Stanley Mar 30 '17 at 0:00

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.