使用 apacite 但未获得 apa 引用

使用 apacite 但未获得 apa 引用

我尝试使用 apacite 和 natbib 将 apa 引用与我当前的 latex 项目配合使用。但是它不起作用,因为这是我使用 \cite 时得到的结果:在此处输入图片描述。我正在使用模板项目,但对 latex 了解不多,因此我还没能弄清楚是什么原因导致 apacite 失败。以下是我的序言中的代码:

\author{TeXniCie}
\date{\today}
\title{Manual for thesis}

%%% overview of this file in order:
% most packages which don't need options
% geometry package
% header/footer settings
% theorem styles
% enable/disable parindents
% reference and bibliography settings
% front/main/back-matter


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{
        %layout,        % Allow visualisation of all the margins
        subfiles,       % For seperate main and sub documents
        graphicx,       % For image modifications and the figure enviroment
        amsmath,        % For the AMS math styles
        amssymb,        % The extended AMS math symbol list
        amsthm,         % For use of theorems (works together with thmtools)
        fancyhdr,       % For fancy headers and footers on pages
        %gensymb,       % For easy generic symbols (uniform use in math and text mode)
        %sidecap,       % For use of captions next to a float (figure, table, etc)
        %subcaption,    % For easy subfigures in a plot (with nice captions)
        tikz,           % Difficult drawing of awesome vector plots
        %listings,      % For listing pieces of code in a nice and neat way
        multicol,       % For easy local multicolumn use
        color,          % For handy color deafinitions (used cause of styling)
        %calc,          % To calculate stuff for the back-end
        %mdwlist,       % For customizing lists
        thmtools,       % Lets you define your own theorem style (used for all the fancy theorems, definitions etc.)
        etoolbox,       % Allows adjustment of commands (used to reset the claim counter at the end of a proof).
        xspace,         % Makes latex not eat spaces after commands
        xr-hyper,
        hyperref,       % Makes links, references, the Table of Contents, etc. clickable.
        url,
        apacite,
        dirtytalk,
        caption,
        lipsum,
        wrapfig,
        float,
        pdflscape
        }
        %^\usepackage[cm]{fullpage}
\usepackage[page,toc]{appendix}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        %\sepackage[margin=2.5cm]{geometry}     % Change the shape of a page (custom margins etc.)
        \usepackage[left=3cm,right=2cm,top=2.5cm,bottom=2cm]{geometry}
        %paper=a4paper slightly changes the style through the whole document.
             %%%% We set the margins for whole document here, except the titlepage. The titlepage uses special margins; see titlepage.tex.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% This is about changing the headers and footers (i.e. Top and bottom of the page)

\pagestyle{fancy}% use fancyheaders with the bar on the top
\fancyhf{} % Clear the normal style
\fancyhead[L]{\bfseries\leftmark} %this places the section number and name in the top left
\fancyhead[R]{\bfseries\thepage}% this places the pagenumber in the top right


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%        Theorem style

% The set-up is as follows, first you give the 'style' of your theorem. This determines whether it for instance is plain, or italic. Secondly you can give an option for the symbol on the end, normally it is nothing. But you could add some to increase the readability of your text. Finally you can use numberwithin to add the number of your section/theorem before your equations. This is useful if you want to keep the numbers of your equation in check (In this thesis there where over a 100) and keeps in order where the equations are.
%Finally you can use sibling to let different 'theorems' count together. Hence you will get Theorem 1 Definition 2 Claim 3, instead of Theorem 1 Definition 1 Claim 1. This is a matter of taste.

% Theorem definitions
\declaretheorem[style=definition,numberwithin=subsection]{definition} %If you want your theorems to be counted per section instead of subsection, then just remove the sub from the numberwithin
\declaretheorem[style=definition,qed=$\triangle$,sibling=definition]{example}% sibling says with what type of theorems you wan the numbering to count with.

\declaretheorem[style=plain,sibling=definition]{theorem}
\declaretheorem[style=plain,sibling=definition]{lemma}
\declaretheorem[style=plain,sibling=definition]{proposition}
\declaretheorem[style=plain,sibling=definition]{corollary}
\declaretheorem[style=definition]{claim}
\declaretheorem[style=definition,sibling=example]{remark}

\AtEndEnvironment{proof}{\setcounter{claim}{0}} % Sets the claim number to 0 after ending a proof

% these environments are very nice and all, but it is a bit much to type every time, so for normal theorem-proof cases you can make your own commands like these. 

\newcommand{\thm}[2]{\begin{theorem} #1 \begin{proof} #2 \end{proof} \end{theorem}}
\newcommand{\lm}[2]{\begin{lemma} #1 \begin{proof} #2 \end{proof} \end{lemma}}
\newcommand{\df}[1]{\begin{definition} #1 \end{definition}}
\newcommand{\clm}[1]{\begin{claim} #1 \end{claim}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Comment/uncomment the following to disable/enable parindents:
\setlength\parindent{0pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%% Add the bibliography with some settings:
% package:
\usepackage[]{natbib}
\setcitestyle{authoryear,open={(},close={)}}

% choose brackets:  default: round (), square [], curly {}, angle <>
% choose separation between multiple citations (\cite{a,b}):
%% default: colon ;, comma ,
% choose citation style:
%% default: authoryear Johnson (2017), numbers (25) or super ^[25]
% option: choose sort (\cite{13,5} gives [5,13]) or sort&compress
%% in authoryear mode, sort&compress changes Johnson[2016] Johnson[2017] to
%% Johnson[2016,2017].
% option: longnamesfirst (author names will be shortened (et al.) after the first time
% option: nonamebreak (can solve hyperref bugs, but will instead cause hbox problems)
% https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#Natbib

% bibliography sort style:
\bibliographystyle{apacite} %references in order of call
%more options: default: plainnat, apsrev, unsrtnat, abbrvnat, rmpaps (different sortings and abbreviation settings, no idea which is which)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%% frontmatter/mainmatter/backmatter:
\newcommand\frontmatter{%
    \cleardoublepage
    \pagenumbering{roman}} %small Roman numbers

\newcommand\mainmatter{%
    \cleardoublepage
    \pagenumbering{arabic}} %normal numbers

\newcommand\backmatter{%
    \cleardoublepage %% double page style
    %\clearpage %% single page style
    \pagenumbering{Roman}} %capital Roman numbers



\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \ifxetex
    \usepackage{mathspec}
  \else
    \usepackage{fontspec}
  \fi
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\usepackage{geometry}
\urlstyle{same}  % don't use monospace font for urls
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{248,248,248}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\ImportTok}[1]{#1}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.81,0.36,0.00}{\textbf{#1}}}
\newcommand{\BuiltInTok}[1]{#1}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.77,0.63,0.00}{#1}}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.94,0.16,0.16}{#1}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.64,0.00,0.00}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{#1}
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{4}
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi

%%% Use protect on footnotes to avoid problems with footnotes in titles
\let\rmarkdownfootnote\footnote%
\def\footnote{\protect\rmarkdownfootnote}

%%% Change title format to be more compact

\newcommand*{\addFileDependency}[1]{% argument=file name and extension
  \typeout{(#1)}% latexmk will find this if $recorder=0 (however, in that case, it will ignore #1 if it is a .aux or .pdf file etc and it exists! if it doesn't exist, it will appear in the list of dependents regardless)
  \IfFileExists{#1}{}{\typeout{No file #1.}}% latexmk will find this message if #1 doesn't exist (yet)
}

\newcommand*{\myexternaldocument}[1]{%
    \externaldocument{#1}%
    \addFileDependency{#1.tex}%
    \addFileDependency{#1.aux}%
}

我希望你们能明白是什么原因造成的!提前感谢你们的帮助。

相关内容