\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>}

有問題的行缺少兩個強制參數。我無法猜測這兩個參數應該是什麼,所以為了讓這個錯誤消失,我建議你刪除這一行。

請注意,即使 Overleaf 產生了 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 用戶沒有註意到錯誤訊息的範例

相關內容