1

I am pretty new to latex and trying to write a paper.

I have a template with this code :

% no labels in bibliography.
\def\@biblabel#1{}

% set the first line of each reference flush left, and each succeeding
% line with a 1em indentation.

\newlength{\bibhang}
\setlength{\bibhang}{1em}

%%%\def\thebibliography#1{\par\footnotesize
\def\thebibliography#1{%
  \section*{%
    \refname\@mkboth{\sl\uppercase{\refname}}{\sl\uppercase{\refname}}}

  \list{\relax}{\setlength{\labelsep}{0em}
                \setlength{\itemindent}{-\bibhang}
                \setlength{\leftmargin}{\bibhang}}
  \def\newblock{\hskip .11em plus .33em minus .07em}
  \sloppy\clubpenalty4000\widowpenalty4000
  \sfcode`\.=1000\relax}

\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@cite{\@for\@citeb:=#2\do
    {\@citea\def\@citea{; }\@ifundefined
      {b@\@citeb}{{\bf ?}\@warning
      {Citation '\@citeb' on page \thepage \space undefined}}%
{\csname b@\@citeb\endcsname}}}{#1}}

I use a bibtex.bib file for my sources, and they get displayed properly in my paper, however, the labels are missing and when I use ~\cite{...} in my paper, it always becomes [0] . How do I fix this? Is there a line in my template that prevents the labels from showing?

3
  • 1
    as the comment you show indicates % no labels in bibliography. Always start from a document with an empty preamble and just add code if you need it. This code is redefining internals, using commands that are not defined by default and likely to be incompatible with citation packages if not core latex itself. What is it trying to do? If in doubt I would simply delete this. – David Carlisle Jun 19 '20 at 16:43
  • @DavidCarlisle deleting the whole thing actually solved the problem. thanks a lot! – krise Jun 19 '20 at 16:51
  • if you tested it feel free to post a self answer saying that:-) – David Carlisle Jun 19 '20 at 16:52
0

As David Carlisle suggested "the code is redefining internals, using commands that are not defined by default and likely to be incompatible with citation packages if not core latex itself" seems to be the problem, so simply deleting the whole thing actually solved the problem and made the bibliography have correct labels.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.