使用 APA7 包时 maketitle 命令失败

使用 APA7 包时 maketitle 命令失败

我一直在努力遵循 APA7 软件包说明。我不明白为什么 \maketitle 命令不起作用。即使我将标题页放在 \begin{document} 之前,代码仍然会失败。

以下是 CTAN 上对 APA7 包的引用: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.26\textwidth]{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}

答案1

  • 不要scrlayer-scrpage与 apa7 类一起使用。该类已经使用了fancyhdr页眉和页脚的包,因此您只需使用此包中的宏即可

  • 不要figure在标题宏中使用浮动环境,这没有意义

  • hyperref在其他包之后加载

  • 你真的确定你的编码是 吗utf8x?这在新千年里很常见...

  • 不要滥用\\换行符

  • apa7有自己的机制来处理多个作者,并将诅咒或讲师等信息添加到标题页

--

\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.26\textwidth]{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}

在此处输入图片描述

相关内容