\blx@defformat@i 的参数有一个额外的 }

\blx@defformat@i 的参数有一个额外的 }

我正在 Overleaf 上撰写我的博士论文,我使用的是网上找到的模板,并根据我的大学指南进行了调整。我对 LaTeX 还很陌生,是一个基础用户。

大约一个月前,我一直无法在 Overleaf 上编译我的论文,尽管没有显示任何错误。因此,我将 LaTeX 下载到我的 Mac 上,但当我尝试编译文档时,我收到此错误消息:Argument of \blx@defformat@i has an extra }参考第 92 行(我修改了参考书目设置以使其符合我的大学指导方针)。

这是我的序言的一部分:

\documentclass[
12pt,
openany,
english, 
onehalfspacing,
headsepline, 
]{MastersDoctoralThesis} % The class file specifying the document structure

\usepackage[T1]{fontenc} % Output font encoding for international characters
\usepackage{fontspec}

\usepackage{multirow}
\usepackage{tabularx}

\setmainfont{Times New Roman}
\hyphenpenalty=1000 % preventing splitting of words
\usepackage{xurl}
\usepackage{hyperref}
\hypersetup{breaklinks=true}

\usepackage{ragged2e}
\usepackage[format=plain,margin=25pt,font=small,labelsep=colon]{caption}

\newcommand{\foo}{\foo}

%-------------------------------------------------------------------                 BIBLIOGRAPHY SETTINGS UNIGRAZ  ---------------------------------------------------------------------

\usepackage[style=ext-authoryear,sorting=nyt,sortcites=true,mincitenames=1,maxcitenames=3,autopunct=true,autolang=hyphen,hyperref=true,abbreviate=true,backref=false,backend=biber,maxbibnames=20,innamebeforetitle=true,uniquename=false,uniquelist=false]{biblatex} % Use the bibtex backend with the authoryear citation style (which resembles APA)

\DeclareDelimFormat{multinamedelim}{\addslash} %slash between names
\DeclareDelimAlias{finalnamedelim}{multinamedelim}

\renewcommand{\bibpagespunct}{\addcomma\addspace}
\DeclareFieldFormat{pages}{#1} %remove "pp"

\DeclareFieldFormat[article,incollection]{pages}{#1}
\renewbibmacro*{volume+number+eid}{
  \printfield{volume}
   \setunit{\addcolon}
  \printfield{number}
  \setunit{\addcomma\space}%
  \printfield{eid}}
\DeclareFieldFormat[article,incollection]{number}{\addcolon{#1}} %volume:issue
\usepackage{xpatch}
\xpatchbibdriver{article}
  {\usebibmacro{title}%
   \newunit}
  {\usebibmacro{title}%
   \printunit{\addcomma\space}}
  {}
  {} %comma after title of articles
  
  
\DefineBibliographyStrings{english}{%
  urlfrom = {in},
}
\DeclareFieldFormat{url}{\bibstring{urlfrom}\addcolon\space\url{#1}} %url as "in"
\DeclareFieldFormat[misc]
**\usepackage{xpatch}** %here error while compiling
\xpatchbibdriver{misc}
  {\usebibmacro{title}%
   \newunit}
  {\usebibmacro{title}%
   \printunit{\addcomma\space}}
  {}
  {}%comma after titles of articles in websites
\DeclareFieldFormat{urldate}{\mkbibbrackets{\bibstring{urlseen}#1}}
\DefineBibliographyStrings{english}{urlseen ={}} %url in square brackets without "accessed on"


\DeclareNameAlias{sortname}{family-given} %lastname first

\renewcommand{\labelnamepunct}{\addspace} %no period after year

\renewcommand*{\postnotedelim}{\addcolon}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1} %quotes (year:page)


\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimFormat{editortypedelim}{\addspace}
\DeclareFieldAlias{translatortype}{editortype}
\DeclareDelimAlias{translatortypedelim}{editortypedelim}
\DeclareNameAlias{default}{family-given}
\DeclareNameAlias{sortname}{family-given}
  \renewbibmacro*{in:}{%
  \setunit{\addcomma\space}%
  \printtext{%
    \bibstring{in}\intitlepunct}} %incollection with title, :in editor (ed.)

\DeclareLabeldate{\field{year}\field{eventdate} \field{origdate}\literal{nodate}} % n.d. in sites when no year

\addbibresource{example.bib} % The filename of the bibliography

\usepackage[autostyle=true]{csquotes} % Required to generate language-dependent quotes in the bibliography

\setlength\bibitemsep{0.5\baselineskip} % space between bibliography entries

答案1

标记前的线%here error while compiling有故障。

\DeclareFieldFormat[misc]

是不完整的。语法\DeclareFieldFormat

\DeclareFieldFormat[<entry type_1,...,entry type_n>]{<field>}{<formatting code>}

有问题的行缺少两个必需参数。我无法猜测这两个参数应该是什么,因此为了消除此错误,我建议您删除此行。

请注意,即使生成了 PDF 输出,Overleaf 也应该向你显示此错误行的错误。

事实上如果我尝试

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear]{biblatex}

\DeclareFieldFormat[misc]


\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{sigfridsson}

\printbibliography
\end{document}

如同https://www.overleaf.com/read/rvgqqbfngrrv

Overleaf 报告了一个错误(参见“重新编译”按钮旁边带有 1 的红色框 - 以粉红色突出显示)

Overleaf 上显示的错误编号

Overleaf 可以很好地隐藏错误消息。这就是为什么你应该总是确保您的文档没有错误。另请参阅Overleaf 用户未注意到错误消息的示例

相关内容