[Tex/LaTex] LaTeX Error: Command \etalchar already defined

errorsmacrospackages

Has anyone ever come across the following error, and how would I solve it? Quick googling did not seem to help, and I guess that the issue may not be with \etalchar (I don't define it ever), but some conflicting packages.

LaTeX Error: Command \etalchar 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.1 \newcommand{\etalchar}[1]{$^{#1}$}

? 

Best Answer

A search of this site, http://tex.stackexchange.com/search?q=%5Cetalchar+ reveals that the command \etalchar exists already for use in bibliography applications. It is defined, for example, in the alphadin.bst file (https://github.com/youkan/abschlussarbeit-latex/blob/master/alphadin.bst)

If the OP was not himself defining the command explicitly, it could mean that there is a package conflict, in which two separate packages are both trying to define the macro \etalchar.

However, based on the comment from the OP, it appears that a redundant call was accidentally made to the bibliography, which had the effect of trying to execute the same set of code twice, containing the \etalchar definition. Thus, an error was thrown, as a result of the redundancy.

Relevant part of alphadin.bst code:

FUNCTION {begin.bib}
{ et.al.char.used
    { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
    'skip$
  if$
  preamble$ empty$
    'skip$
    { preamble$ write$ newline$ }
  if$
  "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  newline$
  "% this bibliography is generated by alphadin.bst [8.2] from 2005-12-21"
  write$ newline$
  newline$
  "\providecommand{\url}[1]{\texttt{#1}}"
  write$ newline$
  "\expandafter\ifx\csname urlstyle\endcsname\relax"
  write$ newline$
  "  \providecommand{\doi}[1]{doi: #1}\else"
  write$ newline$
  "  \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi"
  write$ newline$
}