TransWikia.com

The maketitle command fails when using the APA7 package

TeX - LaTeX Asked by Ray Jio on January 30, 2021

I have been struggled to follow APA7 package instructions. I don’t understand why maketitle command just won’t work. Even if I put title page before begin{document}, the code still fails.

Here is the reference to APA7 package on CTAN: http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/apa7/apa7.pdf.

documentclass[a4paper,12pt,doc,noextraspace]{apa7}
usepackage[english]{babel}
usepackage{amsmath}
allowdisplaybreaks[4]
% usepackage{inputenc}
usepackage{csquotes}
usepackage[utf8x]{inputenc}
% package for including graphics with figure-environment
usepackage{graphicx}
setlength{intextsep}{5pt}
usepackage{float} 
usepackage{placeins}
usepackage{subfigure} 
usepackage{hyperref}
usepackage{setspace}
usepackage{bookmark}
linespread{1.25}

% colors for hyperlinks
% colored borders (false) colored text (true)
hypersetup{colorlinks=true,citecolor=black,filecolor=black,linkcolor=black,urlcolor=black}

% package for bibliography
usepackage[authoryear,round]{natbib}
% package for header
usepackage[automark,headsepline]{scrlayer-scrpage}
pagestyle{scrheadings}
ihead[]{Name1,Name2,Name3}
ohead[]{today}
cfoot[]{pagemark} 

setcounter{secnumdepth}{5}

begin{document}
    title{
    begin{figure}[!ht]
        % flushleft
            includegraphics[width=0.26textwidth]{pic_lib/icon.png}
    end{figure}
    vspace{1cm}
    Huge Project II
    }
    
    % if you are the only author, you might use the following
    % author{Name of student}  
    
    % Insert here your name and correct mail address
    author{
        href{mailto:a}{1} 
    href{mailto:a}{2}
    href{mailto:a}{3}
    }
    
    
    % name of the course and module
    date{
    large Course: 0  
    vspace{0.8cm}
    large Lecturer: 0 
    vspace{1cm}
    today
    }

% begin{document}
maketitle 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CONTENT PAGE
newpage
tableofcontents
    

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%          Problem Set 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
newpage

pdfbookmark{contentsname}{Problem Set 2}
section*{Problem Set 2}
label{sec:ps2}

section{Problem}
label{sub:Problem}

.......
end{document}

One Answer

  • don't use scrlayer-scrpage with the apa7 class. The class already uses the fancyhdr package for the headers and footers, so you can simply use the macros from this package

  • don't use a floating figure environment inside the title macro, that makes no sense

  • load hyperref after the other packages

  • are you really sure that your encoding is utf8x? That's highly usual in this millennium...

  • don't abuse for line breaks

  • apa7 has it's own mechanism to deal with multiple authors and add information like the curse or lecturer to the title page

--

documentclass[a4paper,12pt,stu,noextraspace]{apa7}
usepackage[english]{babel}
usepackage{amsmath}
allowdisplaybreaks[4]
% usepackage{inputenc}
usepackage[utf8x]{inputenc}
usepackage{csquotes}

% package for including graphics with figure-environment
usepackage{graphicx}
setlength{intextsep}{5pt}
usepackage{float} 
usepackage{placeins}
usepackage{subfigure} 
usepackage[authoryear,round]{natbib}
usepackage{setspace}
usepackage{bookmark}
linespread{1.25}

% colors for hyperlinks
% colored borders (false) colored text (true)
usepackage{hyperref}
hypersetup{colorlinks=true,citecolor=black,filecolor=black,linkcolor=black,urlcolor=black}

setcounter{secnumdepth}{5}


lhead{Name1,Name2,Name3}%
rhead{today}%
cfoot{thepage}%



begin{document}
    title{Project II}
    
    % if you are the only author, you might use the following
    % author{Name of student}  
    
    % Insert here your name and correct mail address
    authorsnames{href{mailto:a}{1},href{mailto:a}{2},href{mailto:a}{3}}
    authorsaffiliations{}
%    
%    

%    % name of the course and module
    duedate{today}
        course{Course: 0}
        professor{Lecturer: 0}

% begin{document}
{flushleft  includegraphics[width=0.26textwidth]{example-image-duck}}

maketitle 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CONTENT PAGE
newpage
tableofcontents
    

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%          Problem Set 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
newpage

pdfbookmark{contentsname}{Problem Set 2}
section*{Problem Set 2}
label{sec:ps2}

section{Problem}
label{sub:Problem}

.......
end{document}

enter image description here

Answered by samcarter_is_at_topanswers.xyz on January 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP