2

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

? 
2

2 Answers 2

2

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$
}
0

As suggested here, changing \newcommand to \providecommand in your desired .bst-file worked for me:

  1. Locate the .bst-file for the \bibliographystyle you want to use, e.g., /usr/share/texlive/texmf-dist/bibtex/bst/bibtex/alpha.bst on Linux or C:\MiKTeX 2.9\bibtex\bst\bibtex\alpha.bst on Windows
  2. Edit the file and navigate to the FUNCTION {begin.bib} section
  3. Change \newcommand{\etalchar}[1]{$^{#1}$} to \providecommand{\etalchar}[1]{$^{#1}$}
  4. Run (sudo) texhash
  5. Clean auxilary files in your LaTeX project (e.g., using Tools - Clean Auxillary Files) in TeXstudio
  6. Recompile your document

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .