1

I use TeXstudio, sometimes when I build the *.tex file, the related *.bbl file was reset to a empty document:

\begin{thebibliography}{\uppercase{}}

\end{thebibliography}

And there is a error message:

Something's wrong--perhaps a missing \item. \end{thebibliography}

My *.bbl file was manually created(copy from another project and manually modify the content), did I create the bibliography incorrectly?

My default compiler is PdfLaTeX, default bibliography tool is BibTeX.

  • 1
    Nothing deletes bbl by default so you must used have some option to "clean" the working directory of generated files. A simple way to avoid that would be to rename the file from .bbl to .tex and replace \bibliography{yourfile} by \input{yourfile} – David Carlisle Aug 18 '21 at 13:08
  • Off-topic: The argument of \begin{thebibliography} should be a positive integer; the instruction \uppercase{} as the argument of \begin{thebibliography} seems suspect. – Mico Aug 18 '21 at 13:54
  • Thank for the comment. I was copied bbl file from other people and modified based on that file. I didn't notice that there is an error in the argument. – Chris Guo Aug 18 '21 at 14:01
  • actually, to amend my initial comment, a clean directory option would have deleted the file not replaced it with a file with an empty environment. Most likely you have run bibtex on your main document when you have no bib file, only the edited bbl, this will give bibtex errors but could potentially make an empty bibliography. (I would still suggest renaming the file to .tex) – David Carlisle Aug 18 '21 at 18:25
  • @Mico Strictly speaking the argument of thebibliography need not be an integer at all: It should hold the longest citation label (if citation labels are 'repeated' in the bibliography as is the case for numeric and alphabetic styles). In numeric styles the number of the last entry is a very good approximation for that (see https://tex.stackexchange.com/q/449462/35864). But if you use alphabetic labels you would usually end up with an alphabetic label in the argument of thebibliography. – moewe Aug 19 '21 at 06:38
  • @moewe - Thanks! My earlier comment, about the argument of \begin[thebibliography} needing be a positive integer (generally, but not necessarily, given by the total number of bib entries), was indeed based on an assumption that the document employs numeric-style citation call-outs. It was good of you to point out that if the document employs alphabetic-style citation call-outs, the argument of \begin[thebibliography} should be the longest citation label. – Mico Aug 19 '21 at 07:53

1 Answers1

4

The .bbl file is not intended for manual editing.

BibTeX produces a printable bibliography in the .bbl file from the .bib file according to the style specified in \bibliographystyle. This .bbl file is regenerated on every BibTeX run. Thus the .bbl file is a temporary/auxiliary file like the .aux file.

LaTeX itself does not reset the .bbl file, but it is very possible that your editor either tries to clean up auxiliary/temporary files from time to time or tries to run BibTeX on your document, which may result in errors and eventually an empty .bbl if your document otherwise is not properly set up for BibTeX.

If you want to write your bibliography manually, don't use a .bbl file. Just write

\begin{thebibliography}{<longest label>}
\bibitem{<key>} <bibliography data>
\end{thebibliography}

directly into your .tex document where you want your bibliography to appear (you may or may not have a \bibliography{<some file name>} there at the moment, remove the \bibliography instruction and any \bibliographystyle you may have in your document: they are only needed for BibTeX). That way you don't have to go via a .bbl file that might get overwritten by an external tool.

Most people, however, use BibTeX (or biblatex) to produce their bibliography. In that case you would create a .bib file of your resources and specify the .bib file with \bibliography and the bibliography style you would like to see your entries formatted in with \bibliographystyle. A nice answer showcasing the various options you have can be found at How do I add "citations" at the end of the document as done here?. You may also be interested in https://www.learnlatex.org/en/lesson-12.


Note that

\begin{thebibliography}{\uppercase{}}

\end{thebibliography}

looks a bit fishy: The mandatory argument to thebibliography should hold the largest citation label in your bibliography. The \uppercase does not appear to have any business there.

moewe
  • 175,683