# I'm not able to \begin or \end{document} in my article on TexStudio

This is the MWE of the code I have used (I'm using APA6 package to make an apa formatted document for my research article so have used that as the document class rather than article). When I try to compile, it keeps saying error at \begin and \end document. I'm using TexStudio on MikTex

\documentclass[a4paper, 11pt, man]{apa6}
\usepackage[utf8]{inputenc}

\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=apa]{biblatex}

\title
\shorttitle
\author{name\\affiliation \and name\\affiliation}

\begin{document}

Text \cite and \textcite

\printbibliography
\end

• Welcome to TeX.SE! In your MWE there is only \end, not \end{document} – CarLaTeX Nov 12 '18 at 13:07
• Welcome to TeX.SX! For once, you need \end{document} to close your document environment. Second, you probably should have \title and \shorttitle after \begin{document}. – gusbrs Nov 12 '18 at 13:08
• And \cite and \textcite need an argument (the bibitem id). – CarLaTeX Nov 12 '18 at 13:09
• Yes, sorry, I did put in \end{document} and it still says there are errors. However, It's now building the pdf and inserting authors properly as I added the abstract having used the apa class and switched from apacite to biblatex but has decided not to insert references properly from my bibtex file. But you have solved my original problem (off to find that thread now!) thank you :) – PlanetRTex Nov 12 '18 at 14:41
• Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – user36296 Nov 16 '18 at 12:38

Your code contain several errors, although one of them is not, (as suggested in the comments) place \title and \shorttitle in the preamble.

This is a minimal working (compilable) example:

\documentclass{apa6}
\usepackage[british]{babel}
\usepackage[style=apa]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
\title{A} % very short tile
\shorttitle{B} % very short shorttile
\threeauthors{C}{D}{F} %three very short author names
\threeaffiliations{U. of H}{U. of I}{U. of J.}
\abstract{bla bla ...}
\begin{document}
\maketitle

Text \textcite{IEEEexample:article_typical}

\printbibliography
\end{document}


Note that you cannot use \and as in standard articles, nor mix names and affiliations, nor make the article without abstract. You must use the specific commands of this class to make a minimal working structure. Run texdoc apa6 to discover them. Then add/modify what you need (for example, \threeauthors by \twoauthors) and check that still is compilable.

• +1 I stand duly corrected! – gusbrs Nov 12 '18 at 14:11
• @gusbrs Thanks. Is not usually explained, but \title could be even before of the \documentclass. Just remove in my MWE the \title{A} and place \title{Whatever} in the first line. Anyway, place \title and author after \begin{document} is always safer as far it is before \maketitle. The opposite is not always true (e.g, you cannot place \threeauthors before the preamble) . – Fran Nov 12 '18 at 14:31
• Fran, of course, I was fooled by the lack of arguments and the non standard class and implicitly assumed those were the class' version of \maketitle... On second thought, I should've thought twice. :) – gusbrs Nov 12 '18 at 14:37