Latex 错误:命令 \citename 已定义。...*{\citename}{\blx@citeexpunct{citename}}

Latex 错误:命令 \citename 已定义。...*{\citename}{\blx@citeexpunct{citename}}

我尝试编译我的 Latex 文件但在编译过程中出现此错误:

更新错误消息:

! LaTeX Error: Command \citename already defined. Or name \end... illegal, see p.192 of the manual. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.10472 ...*{\citename}{\blx@citexpunct{citename}} Your command was ignored.

这是我的 Latex 文件定义:

\begin{filecontents*}{example.eps}
\end{filecontents*}
\RequirePackage{fix-cm}
\documentclass{svjour3}  
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage[euler]{textgreek}
\usepackage{harvard}
\usepackage{empheq}
\usepackage{amsmath}
\DeclareMathOperator{\rank}{rank}
\makeatletter
\newenvironment{sqcases}{%
\matrix@check\sqcases\env@sqcases
 }{%
\endarray\right.%
 }
\def\env@sqcases{%
\let\@ifnextchar\new@ifnextchar
\left\lbrack
\def\arraystretch{1.2}%
\array{@{}l@{\quad}l@{}}%
}
\makeatletter
\def\BState{\State\hskip-\ALG@thistlm}
\algnewcommand\algorithmicforeach{\textbf{for each}}
\algdef{S}[FOR]{ForEach}[1]{\algorithmicforeach\ #1\ \algorithmicdo}

\makeatother

\usepackage[utf8]{inputenc}
\usepackage[style=authoryear-comp, citetracker=true, maxcitenames=1, 
giveninits, terseinits, uniquename=init]{biblatex}
\AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{2}}}

\usepackage{filecontents}

   \begin{filecontents}{\jobname.bib}
    @article{lam2016nonparametric,
        title={Nonparametric eigenvalue-regularized precision or covariance 
         matrix estimator},
         author={Lam, Clifford},
         journal={The Annals of Statistics},
         volume={44},
         number={3},
         pages={928--953},
         year={2016},
    publisher={Institute of Mathematical Statistics},
    doi = {0.1214/15-AOS1393}
    }

   \end{filecontents}

  \addbibresource{\jobname.bib}
  \addbibresource{biblatex-examples.bib}

  \DeclareNameAlias{sortname}{family-given}
  \renewcommand*{\revsdnamepunct}{}
  \DeclareDelimAlias{finalnamedelim}{multinamedelim}

  \DeclareDelimFormat[bib,biblist]{nametitledelim}{\addspace}

  \DeclareFieldFormat*{title}{#1}
  \DeclareFieldFormat*{journaltitle}{#1}
  \DeclareFieldFormat*{booktitle}{#1}
  \DeclareFieldFormat*{maintitle}{#1}

  \renewbibmacro{in:}{%
  \ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}

  \renewbibmacro*{publisher+location+date}{%
  \printlist{publisher}%
  \setunit*{\addcomma\space}%
  \printlist{location}%
  \setunit*{\addcomma\space}%
  \usebibmacro{date}%
  \newunit}

  \renewcommand*{\bibpagespunct}{\ifentrytype{article}{\addcolon} 
  {\addcomma\space}}
  \DeclareFieldFormat[article,periodical]{pages}{#1}

  \DeclareFieldFormat{doi}{\url{https://doi.org/#1}}

  \DeclareSourcemap{
    \maps[datatype=bibtex]{
        \map{
        \pertype{article}
        \step[fieldset=number, null]
    }
    }
    }

  \renewcommand*{\finentrypunct}{}
  \begin{document}
  .
  .
  .
  .
  \printbibliography
  \end{document}

关于如何修复此错误我有什么想法吗?

答案1

您正在加载harvard,后者biblatexharvard旨在用于参考书目/引文的 BibTeX 设置,而不是biblatex

您遇到的此特定错误问题是,加载时harvard已定义,并尝试定义相同的宏。因此您会收到错误。\citenamebiblatex

总之,如果您打算使用biblatex,则应省略\usepackage{harvard}

相关内容