22

I am trying to merge my tex and bib files into one for a journal submission. Somebody suggested to use the bbl file. I am using texmaker / miktex, and bibtex.

I have no idea as to how to actually create bbl file from bib. All the links I found on this website / google don't actually explicitly explain, step by step, how to do this. And I mean step-by-step (since my knowledge of latex / computing generally is next to nothing). For example, I see instructions "compile"... And I don't know what this means (as to what key on my keyboard I should be pressing).

Thank you.

Alex
  • 1,113
  • Well regarding "compile" that will be very dependent. If you're using a program designed specifically for writing LaTeX, such as Texmaker (I know you are) it might have a button and/or a keyboard shortcut. But many people use a command line and you can too. What this is called and how to get to it will very from Operating System to Operating System, but if you're using Windows I think it's still called "command prompt". There you would type an instruction. That's the how, what it means in TeX terms is basically turning your LaTeX code into a document – Au101 Feb 01 '17 at 00:35
  • Yes...The problem is, I still can't see any guide as to how to obtain the bbl file. For example this post: http://tex.stackexchange.com/questions/324034/what-is-bbl-bibliography-format explains what it is, but not how to obtain and actually find it.@Au101 – Alex Feb 01 '17 at 00:40
  • Does this help: http://tex.stackexchange.com/questions/119805/bibliography-in-texmaker – Au101 Feb 01 '17 at 00:43
  • I know how to run the normal sequence latex, bibtex, latex, etc. That's not a problem. The problem is knowing how and when the bbl file actually appears, and where to find it @Au101 – Alex Feb 01 '17 at 00:45
  • The .bbl file should not be written by you (you can tweak it manually, but you shouldn't because your changes will get written over whenever you produce a new revision), it is produced by the bibtex program. You have to run bibtex on the .aux file produced by pdflatex – Au101 Feb 01 '17 at 00:45
  • The .bbl file appears after you've run bibtex, it is produced by the bibtex program, not by you. How is probably not worth going into, but it uses your .bib file, the .aux file and any .bst (style files) you've requested. You will find it in the same folder as your .tex file along with the .log the .aux and other such files that pdflatex produces, unless your system is configured to put those files somewhere else so that they don't clutter up your folders, in which case, we need to know more about your system – Au101 Feb 01 '17 at 00:47
  • 1
    The .bbl file will be in your working directory after you've run bibtex. Open it, copy the contents into a thebibliography environment in the place where you had \bibliographystyle{<style>}\bibliography{<bibfile>}. – cfr Feb 01 '17 at 00:48
  • That is, copy it, including the thebibliography environment. I don't mean to add another one. See my example below. – cfr Feb 01 '17 at 01:02

2 Answers2

17

Suppose that we have the following document:

\documentclass{article}
\begin{document}
\cite{article-crossref} and \cite{article-full}.
\bibliographystyle{plain}
\bibliography{xampl}
\end{document}

Now, we compile in the usual way, using our editor of choice or on the command line or whatever. We make sure that everything is properly resolved and defined, running the compilation sequence multiple times if needed. (Compilation is just running e.g. pdflatex -> bibtex -> pdflatex -> pdflatex.)

stage 1

Now, to prepare the file for journal submission, we open the .bbl file, which will be in the working directory, by default, or wherever you've asked for generated files to go.

Here's mine:

\newcommand{\noopsort}[1]{} \newcommand{\printfirst}[2]{#1}
  \newcommand{\singleletter}[1]{#1} \newcommand{\switchargs}[2]{#2#1}
\begin{thebibliography}{1}

\bibitem{article-crossref}
L[eslie]~A. Aamport.
\newblock The gnats and gnus document preparation system.
\newblock {\em \mbox{G-Animal's} Journal}, 41(7):73+, July 1986.
\newblock This is a cross-referencing ARTICLE entry.

\bibitem{article-full}
L[eslie]~A. Aamport.
\newblock The gnats and gnus document preparation system.
\newblock {\em \mbox{G-Animal's} Journal}, 41(7):73+, July 1986.
\newblock This is a full ARTICLE entry.

\end{thebibliography}

We copy this into our original .tex file at the point where we issued the \bibliographystyle and bibliography commands:

\documentclass{article}
\begin{document}
\cite{article-crossref} and \cite{article-full}.
\newcommand{\noopsort}[1]{} \newcommand{\printfirst}[2]{#1}
  \newcommand{\singleletter}[1]{#1} \newcommand{\switchargs}[2]{#2#1}
\begin{thebibliography}{1}

\bibitem{article-crossref}
L[eslie]~A. Aamport.
\newblock The gnats and gnus document preparation system.
\newblock {\em \mbox{G-Animal's} Journal}, 41(7):73+, July 1986.
\newblock This is a cross-referencing ARTICLE entry.

\bibitem{article-full}
L[eslie]~A. Aamport.
\newblock The gnats and gnus document preparation system.
\newblock {\em \mbox{G-Animal's} Journal}, 41(7):73+, July 1986.
\newblock This is a full ARTICLE entry.

\end{thebibliography}
\end{document}

Now clean to remove the generated files, so you are sure you aren't still relying on the external .bbl and re-compile at least twice (pdflatex -> pdflatex) to obtain the same result from just your .tex file.

cfr
  • 198,882
  • 1
    By far the most perfect answer on the Internet. In case you are doing compiling via latex instead of pdflatex, the steps of compilation shall be:

    Filename saved is main.tex
    Ref name is ref.bib

    latex main -> bibtex main -> latex main -> latex main -> dvips main.dvi -> ps2pdf main.ps main.pdf

    Rest of the steps remain the same.

    – Mayank Agarwal Feb 24 '22 at 08:02
0

In TeXmaker, a priori, you only have to write

\bibliographystyle{name-of-the-bibstyle}
\bibliography{name-of-the-.bib file}% without the .bib extension

in your .tex file, at the place where you want to have your bibliography, then pdflatex (F6) + bibtex (F11) + pdflatex (twice) on the .tex file. Alternatively you can choose Fast compilation, which will do that automatically for you.

Bernard
  • 271,350
  • I don't think this is the problem. I think the issue is that the OP doesn't know how to eliminate the dependency on the .bib file. Could be mistaken, though, of course. – cfr Feb 01 '17 at 01:00
  • @cfr: it's me who misunderstood. However, if the OP knows about .bib files and .bibtex, he/she would have noticed the creation of a .bbl file, don't you think? – Bernard Feb 01 '17 at 01:09
  • The problem is that Texmaker does not show all file name extensions. The bbl. file was hidden - that was half of my problem@Bernard – Alex Feb 01 '17 at 01:10
  • 3
    That's not a problem of TeXmaker, but of Windows configuration. It's always better to ask showing file extensions (I believe they're hidden by default). – Bernard Feb 01 '17 at 01:13
  • OS X tends to hide file extensions, too, if I remember correctly. (Perhaps I'm imagining it.) It certainly presents the underlying file-system in deeply misleading ways in Finder. Anyway, how often do you examine the contents of the working directory with a fine-tooth comb? If you know that is where it will be, you'll look. But if you don't know to look there, but believe it is something you need to create in some different way, then you won't know where to begin. – cfr Feb 01 '17 at 01:35
  • Yes exactly - I didn't know where to start @cfr – Alex Feb 01 '17 at 01:50