# Latex error: Command \citename already defined. …*{\citename}{\blx@citexpunct{citename}}

I am try to compile my Latex file but I am getting this error during compilation:

Update Error message:

! 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.

This is my Latex file definitions:

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

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

\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}%
\printlist{location}%
\usebibmacro{date}%
\newunit}

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


Any idea about how can I fix this error ?

• Welcome to TeX.SX. Well, I don't see a \documentclass in your example. I don't see an end to your \begin{filecontents*}{example.eps} either. It is no wonder your are getting errors. Are you sure the error you are reporting is coming from this code you provided us? – gusbrs Apr 8 '18 at 22:30
• Your code can not be compilable, the documentclass is missing ... What should \begin{filecontents*}{example.eps} do as first line of code? – Mensch Apr 8 '18 at 22:30
• Sorry for this mistake, I forget to add these lines in this post. But it is exist in my latex file on my pc. – medo0070 Apr 8 '18 at 22:34
• I add missing lines to the post. I forget add these lines here while try to shortner the code for posting. Sorry again for this mistake. – medo0070 Apr 8 '18 at 22:40
• The problem with the particular error you report comes from your call \usepackage{harvard} and then later biblatex. The first defines \citename and when the second one tries to do the same, it issues an error. AFAIK, the both are incompatible, so if you intend to use biblatex, leave out \usepackage{harvard}. – gusbrs Apr 8 '18 at 22:47

You are loading harvard and latter biblatex. harvard is meant to work on a BibTeX setting for bibliography/citation, not with biblatex.
The problem you face with this particular error is that harvard has already defined \citename when you load biblatex which tries to define the same macro. So you get an error out of it.
In sum, if you intend to use biblatex, you should leave out \usepackage{harvard}.