![Overleaf 中 Latex 的引用行为不稳定](https://linux22.com/image/456627/Overleaf%20%E4%B8%AD%20Latex%20%E7%9A%84%E5%BC%95%E7%94%A8%E8%A1%8C%E4%B8%BA%E4%B8%8D%E7%A8%B3%E5%AE%9A.png)
我似乎遇到了 Overleaf 中不稳定的引用行为问题。
问题:我想引用一些参考文献,但收到了警告‘第 YY 页上的引用 XX 在输入行 ZZ 上未定义’引用失败(见下图)
问题:我知道,通常当您输入错误的引文关键字或引用未包含在reference.bib文件中时,会出现此警告。但是,有时引用确实会出现上述警告,但有时它确实可以正常工作。今天,我收到了一条引文的警告(我仔细检查了关键字和参考文件)。我去参加了一个会议,回来后重新编译,没有做任何更改,引用仍然正常工作。
我确实在改编的文章模板中工作,所以我自己没有编写模板。我希望你能帮助我找出发生了什么,或者也许我只是疯了。
多谢!
[顺便说一句,下面的代码只是一段虚拟代码。由于知识产权规则,我不能分享我实际编写的代码]
Thiese 引用失败截图:
我的主文件的代码:
\input{packages/xjenza-preamble.tex}
% Front matter
\title{A nice title}
\articleType{A nice article type}%Research Article, Review Article, Research Note, News Article...
\author{Some nice authors}
\authorAnnotation{Some nice annotation}
\correspondanceName{Some nice name}
\correspondanceMail{Some nice email address}
% This goes in the header, in case the full title is too long
\shortTitle{ }
% \selfCitation{Borg, J. et al.\ (2022).\newblock {\em Xjenza Online}, \pageref{firstpage}--\pageref{lastPage}.}
% Bibliography file
\addbibresource{references.bib}
% Insert additional packages here
\usepackage{lipsum}
%%%%% Do not edit %%%%%
\def\firstpage{1}
\newcounter{pagna}
\setcounter{pagna}{\firstpage}
\setcounter{page}{\firstpage}
%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\label{firstpage}
\abstrac{\lipsum[1-11]
}
\maketitle
\section{Introduction}
I would really like to cite this guy: \parencite{aniceguy} and a second nice guy \parencite{asecondniceguy}. I also would like to mention \parencite{Thiese}, but sometimes the citation does not work properly.
% List all citations
\nocite{*}
\printbibliography
% Balance columns on last page
\balance
% For header on first page
\label{lastPage}
\end{document}
reference.bib文件的代码:
% Formatting guide:
%
% (at)article{key,
% author = {Surname, A. and Surname, B. C. and Surname, D.},
% title = {Titles are Written in Title Case},
% note = {Something Special about the Publication},
% journal = {Full Name of the Journal in Title Case},
% year = {2000},
% volume = {1},
% number = {1},
% pages = {1--5},
% url = {http://optional.com}
% }
@ARTICLE{aniceguy,
AUTHOR = {Nice},
TITLE = {A very nice title that I would like to cite},
YEAR = {2022},
JOURNAL = {A very nice year},
VOLUME = {1},
PAGES = {1-10}
}
@ARTICLE{asecondniceguy,
AUTHOR = {Nice Second },
TITLE = {A second nice title that I would like to cite},
YEAR = {2022},
JOURNAL = {A very nice year},
VOLUME = {1},
PAGES = {1-10}
}
@ARTICLE{Thiese,
AUTHOR = {Thiese, M.S., Hegmann, K.T., Wood, E.M. et al.},
TITLE = {Prevalence of low back pain by anatomic location and intensity in an occupational population},
YEAR = {2014},
JOURNAL = {BMC Musculoskelet Disord},
VOLUME = {15},
PAGES = {283}
}
以及 xjenza-preamble.tex 文件的代码:
\documentclass[twoside,a4paper,floatfix,twocolumn,superscriptaddress]{article}%twoside
\usepackage{packages/xjenza}
\usepackage{datetime,tabularx,multirow,subfigure,dblfloatfix}
\usepackage{graphicx,float}
\usepackage{fancyhdr,calc}
\usepackage{lipsum,cuted,setspace,enumerate}
\usepackage[compact]{titlesec}
\usepackage{changepage}
\usepackage{colortbl,color}
\usepackage[xcdraw]{xcolor}
\usepackage{soul,longtable}
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{textgreek, upgreek}% these should be before amssymb, amsthm and amsmath
\usepackage[T1]{tipa}
\usepackage{amssymb,amsthm}
\usepackage{relsize}
\usepackage{epstopdf}
\usepackage{siunitx}
\usepackage[version=4]{mhchem}
\usepackage{booktabs}
\usepackage{balance}
\usepackage{enumitem}
\usepackage{placeins}
\setlist{noitemsep}
\usepackage{latexsym}
\usepackage{csquotes}
\usepackage{pdfpages}
\usepackage[scale=1.03]{inconsolata}
\usepackage[ % For hyperlinks and PDF document links
hidelinks,
colorlinks,
linkcolor=blue!60!black,
citecolor=blue!60!black,
urlcolor=green!50!black,
bookmarks,
bookmarksopen,
bookmarksdepth=3,
pdfstartview={XYZ null null null},
pdfcreator={Created with vim+LaTeX}]{hyperref}
\usepackage[ % For clever in-document references
nameinlink,
noabbrev]{cleveref}
\usepackage[all]{hypcap} % Correct PDF hyperlinks to figures
% self inserted usepackages
\usepackage{subcaption}
% \usepackage[final]{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}
\usepackage{placeins}
\usepackage[none]{hyphenat}
% Maltese Letters
\newcommand \mc {\.c}
\newcommand \mC {\.C}
\newcommand \mg {\.g}
\newcommand \mG {\.G}
\newcommand \mh {{\leavevmode\rlap{\kern-.7pt\={\empty}}}h}
\newcommand \mhi {$\hbar$}
\newcommand \mH {\leavevmode\rlap{\raisebox{-.8pt}{\={\empty}}}H\llap{\raisebox{-.8pt}{\={\empty}}}}
\newcommand \mHi {\leavevmode\rlap{\kern-.3pt\raisebox{-.7pt}{\={\empty}}}H\llap{\raisebox{-.7pt}{\={\empty}}}}
\newcommand \mz {\.z}
\newcommand \mZ {\.Z}
% Montserrat for bold
\let\oldtextbf\textbf
\renewcommand{\textbf}[1]{{\small\fontfamily{Montserrat-LF}\selectfont{\oldtextbf{#1}}}}
%\usepackage{multicol}
%\usepackage{flushend}%balancing cols
%--Settings for the modified apa citation style--:::::::::::::::::::::::::::::::::
%
% This method uses the Biblatex package with the biber backend.
% After installing the Biblatex package install the
% biblatex-apa citation style. Afterwords, replace the `apa.bbx'
% and `apa.cbx' files in the biblatex-apa directory, ex:
% /usr/local/share/texmf/tex/latex/biblatex-apa
% with the files present in the packages folder.
\usepackage[british]{babel}
\usepackage[isbn=false,url=false,doi=false,eprint=false,maxcitenames=1,uniquelist=false,sorting=nyt,backend=biber,style=apa,texencoding=ascii]{biblatex}
\AtEveryBibitem{% suppressing the month
\clearfield{month}
\clearfield{day}
}
\DeclareLanguageMapping{british}{british-apa}
\setlength\bibhang{2em}
%---
%--Item spacing: add \begin{enumerate}[noitemsep,topsep=0pt,
%--parsep=0pt,partopsep=0pt] to use--:::::::::::::::::::::::::::::::::::::::::::::
\usepackage{enumitem}
\setitemize{noitemsep,topsep=0pt,parsep=0pt,partopsep=0pt}
%---
%--New commands--:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\newcommand{\udt}[3]{#1^{#2}_{\phantom{#2}#3}}
\newcommand{\dut}[3]{#1_{#2}^{\phantom{#2}#3}}
\newcommand{\dudt}[4]{#1_{#2\phantom{#3}#4}^{\phantom{#2}#3}}
%---
% This removes 'n.d.' from misc entries which have no year field associated with them
\DeclareLabeldate[misc]{%
\field{year}
}
% Suppress fancyhdr warning
\setlength{\headheight}{12.49998pt}
%--Setting section headers--::::::::::::::::::::::::::::::::::::::::::::::::::::::
\titleformat{\section}{\fontfamily{Montserrat-LF}\selectfont\large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\fontfamily{Montserrat-LF}\selectfont\normalsize\bfseries}{\thesubsection}{1em}{}
%\titleformat{\subsubsection}{\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}
%\titleformat{\paragraph}[runin]{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
%\titleformat{\subparagraph}[runin]{\normalfont\normalsize\bfseries}{\thesubparagraph}{1em}{}
%---
%--paragraph spacing--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\parindent 10 pt
\parskip 0 pt
%---
%::::::::::::::::::::::::--End of xjenza-preamble.tex--::::::::::::::::::::::::::%
xjenza.sty文件的代码:
% Copyright (C) 2014 William Hicklin. Last revised 04/03/2015.
% This is xjenza.sty, a LaTeX style for the Maltese Journal Xjenza.
%
% This package is supplied with a preamble file named `xjenza-preamble.tex'. This
% file contains a list on commonly used packages in this journal. There are also
% some new commands and redefinitions which might come in handy for some papers.
%
% This package is also supplied with a `xjenza-main.tex' file which can be
% changed to `xjenza-Vol-Issue.tex'. This file is where the document is written.
%
% The xjenza package should contain: packages/xjenza.sty, packages/xjenza-
% preamble.tex, packages/apa.bbx, packages/apa.cbx, xjenza-main.tex.
%
% The `apa.bbx' and `apa.cbx' files should be interchanged with those of the
% biblatex-apa style. On Linux systems this is normally found in
% /usr/local/share/texmf/tex/latex/biblatex-apa
%
% If you find any bugs in the style files, or omissions in the documentation,
% please report them to: E-mail [email protected]
%%%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
% Include required packages.
%%%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\RequirePackage{fancyhdr}
\RequirePackage{geometry}
\RequirePackage{graphicx}
\RequirePackage{amsthm}
\RequirePackage{cmbright}
%%%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
% Setting margins
%%%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\setlength{\paperwidth}{597.50787pt}
\setlength{\paperheight}{845.04684pt}
\setlength{\textwidth}{497.92322pt}
\setlength{\textwidth}{497.92322pt}
\setlength{\textheight}{695.41338pt}
\setlength{\oddsidemargin}{-21.33955pt}
\setlength{\evensidemargin}{-21.33955pt}
\setlength{\topmargin}{-28.45274pt}
\setlength{\headheight}{12.0pt}
\setlength{\headsep}{25.0pt}
\setlength{\topskip}{10.0pt}
\setlength{\footskip}{30.0pt}
\setlength{\marginparwidth}{4.0pt}
\setlength{\marginparsep}{10.0pt}
\setlength{\columnsep}{14.22636pt}
%%%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
% Set captions type-setting.
%%%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
% removed "margin=10pt," (29/07/2015)
\usepackage[font=footnotesize,labelfont=bf,margin=0.1in]{caption}
%%%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
% Settting global variables and definitions
%%%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\def\keywords#1{\gdef\@keywords{#1}}
\def\shortTitle#1{\gdef\@shortTitle{#1}}
%\def\doi#1{\gdef\@doi{#1}}
\def\articleType#1{\gdef\@articleType{#1}}
\def\authorAnnotation#1{\gdef\@authorAnnotation{#1}}
\def\correspondanceName#1{\gdef\@correspondanceName{#1}}
\def\correspondanceMail#1{\gdef\@correspondanceMail{#1}}
\def\correspondanceNames#1{\gdef\@correspondanceNames{#1}}
\def\abstrac#1{\gdef\@abstrac{#1}}
\def\selfCitation#1{\gdef\@selfCitation{#1}}
%%%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
% The \keywords{} command
%%%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\newcommand{\keywordscom}[1]{%
\ifthenelse{\equal{#1}{}}{}{
\noindent {\bfseries Keywords} #1\\
}
}
%%%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
% The \maketitle command
%%%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\renewcommand{\maketitle}{%
% the following fiedls are required
%
% \title{}
% \doi{}
% \articleType{} %(Research Article, Review Article, Research Note...)
% \authors{}
% \authorAnnotations{}
% \abstract{}
% \correspondenceName{}
% \correspondenceMail{}
%
% the following fiedls are optional
%
% \shortTitle{}
% \keywords{}
\clearpage% new page for new paper
%- New headers::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\pagestyle{fancy}
\ifx\@shortTitle\empty
\fancyhead[LE]{\arabic{pagna}\stepcounter{pagna}}
\fancyhead[RE]{\@title}
\fancyhead[LO]{\@title}
\fancyhead[RO]{\arabic{pagna}\stepcounter{pagna}}
\else
\fancyhead[LE]{\arabic{pagna}\stepcounter{pagna}}
\fancyhead[RE]{\@shortTitle}
\fancyhead[LO]{\@shortTitle}
\fancyhead[RO]{\arabic{pagna}\stepcounter{pagna}}
\fi
%\lfoot{\small{\fontfamily{Montserrat-LF}\selectfont{\bfseries\href{https://doi.org/\@doi}{\@doi}}}}
\rfoot{\small{\fontfamily{Montserrat-LF}\selectfont{\bfseries\href{https://laevo-exoskeletons.com}{www.laevo-exoskeletons.com}}}}
\chead{}
\cfoot{}
\renewcommand{\headrulewidth}{0pt} %remove the header underline
\renewcommand{\footrulewidth}{0pt} %remove the footer underline
%- Keeping footnotes on the left side of the page:::::::::::::::::::::::::::::::::
\interfootnotelinepenalty=10000
%- Setting page style for title page::::::::::::::::::::::::::::::::::::::::::::::
\fancypagestyle{firststyle}{
\lhead{\@selfCitation}
\rhead{\stepcounter{pagna}}
\rfoot{}
\chead{}
\cfoot{}
\fancyfoot[l]{
\ifx\@correspondanceName\empty
%No correspondance given
\else
\begin{adjustwidth}{-0mm}{}\footnotesize\emph{*Correspondence to}: \@correspondanceName{} (\href{mailto:\@correspondanceMail}{\@correspondanceMail})\end{adjustwidth}
\fi
% {\fontfamily{Montserrat-LF}\selectfont\large\bfseries{© 2022 Xjenza Online}}
}
}
%\fancypagestyle{firststyle}{
% \lhead{\@selfCitation}
% \rhead{\stepcounter{pagna}}
% \rfoot{}
% \chead{}
% \cfoot{}
% \fancyfoot[l]{
% \ifx\@correspondanceNames\empty
% \ifx\@correspondanceName\empty
% %No correspondance given
% \else
% \begin{adjustwidth}{-0mm}{}\footnotesize\emph{*Correspondence to}: \@correspondanceName{} (\href{mailto:\@correspondanceMail}{\@correspondanceMail})\end{adjustwidth}
% \fi
% %No correspondance given
% \else
% \begin{adjustwidth}{-0mm}{}\footnotesize\emph{*Correspondence to}: \@correspondanceNames{}
% \end{adjustwidth}
% \fi
% \large{\textbf{\copyright\,2017 Xjenza Online}}
% }
%}
%- Title page:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\begin{strip}
\vspace{-2cm}
\begin{adjustwidth}{-2mm}{}
\begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}r@{}}
\begin{tabular}{l}
% Xjenza Online: Science Journal of the Malta Chamber of Scientists\\
% \href{https://www.xjenza.org}{\nolinkurl{www.xjenza.org}}\\
%\ifx\@doi\empty
%No DOI given
%\else
%DOI: \href{https://doi.org/\@doi}{\nolinkurl{\@doi}}
%\fi
\\\\
\end{tabular} & \begin{tabular}{r} \includegraphics[width=.22\textwidth]{logo.png} \end{tabular}
\end{tabular*}\end{adjustwidth}
\noindent\emph{\@articleType}\\
\noindent\Large{\fontfamily{Montserrat-LF}\selectfont\bfseries{\@title}}\\
\noindent\normalsize{\fontfamily{Montserrat-LF}\selectfont\bfseries{\@author}}\\
\textit\@authorAnnotation
\vspace{2mm}
\end{strip}
\thispagestyle{firststyle}
% The following will draw a line below the abstract if only an abstract is present. If either the keywords are only present or both the keywords and the abstract are present, the line is drawn below the keywords.
\ifx\@abstrac\empty
% No abstract is given
\else
\noindent {\fontfamily{Montserrat-LF}\selectfont\bfseries{Abstract. }}\@abstrac\\
\vspace{-1ex}
\fi
\ifx\@keywords\empty
% No keywords given
\ifx\@abstrac\empty
% No abstract is given
\else
\noindent \rule{\columnwidth}{0.5pt}
\fi
\else
\noindent {\fontfamily{Montserrat-LF}\selectfont\bfseries{Keywords: }}\@keywords\\
\noindent \rule{\columnwidth}{0.5pt}
\fi
%\vspace{1mm}
%- Default settings:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\keywords{}
% Begins a refsection for separating bibliographies by papers.
% The \paperbib command must be used at the end of each paper where the bibliography
% will be printed.
}
%- Default settings:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\keywords{}
\shortTitle{}
\abstrac{}