I'm working on a fairly vanilla (few additional packages), up-to-date installation of MiKTeX 2.9.6668 on Windows. At some point, I noticed that my source file includes two instances of the \bibliographystyle{...} command. It's called once in the preamble, and once in the document body right before generating the actual bibliography using \bibliography{...}.

After removing the first of the two calls, bibtex no longer generated a .bbl file, so the bibliography was missing from my document. Then, I found out that removing the other call also makes the bibliography no longer compile. The document will only contain the bibliography if both calls are present in the document, which seems redundant to me. In examples on where to use \bibliographystyle, I have seen both options, but none of the sources I could find says that it needs to be present in both places.

I did use makebst of the custom-bib package to generate a custon bericht.bst bibliography style. This style works fine and my bibliography looks as I expect it to, and it doesn't make a difference whether I use the custom style or plain – the command still has to be there both times for the bibliography to appear.

My toolchain is running latex -> bibtex -> latex -> latex, and I'm using a standard BibTeX .bib file (no biblatex). The bibtex logfile (.blg) contains the following:

This is BibTeX, Version 0.99dThe top-level auxiliary file: bericht.aux
I found no \bibstyle command---while reading file bericht.aux
(There was 1 error message)

This error message is the same, regardless of which instance of \bibliographystyle I remove.

The issue is not critical since everything works as I want it to as long as both calls are there. But why is that so?

Edit: It turns out that I didn't go far enough in narrowing down the problem. The cause is, of course, that I misunderstood and misapplied a command offered by a package, and that I was stupidly very confident that that one couldn't be related to the problem. Here is a reduced source that causes the issue; I will post the answer right after.

% !TX TS-program = pdfLaTeX+MakeIndex+BibTeX
% !TEX encoding = UTF-8 Unicode







\title{Article title}




% Commenting this out causes bibtex failure.
% \bibliographystyle{plain}

  • 3
    As always on this site, please post a full minimal example so we can get a better idea of what exactly you are doing, there are many factors and without code we have no idea.
    – daleif
    Jun 11, 2018 at 9:35
  • 3
    You answered your own question in the first paragraph. One of the commands in \bibliographystyle, the other one is \bibliography. They are not the same command.
    – thymaro
    Jun 11, 2018 at 9:44
  • 1
    @thymaro: No, I use \bibliographystyle twice, and \bibliography once. If I remove one of the two calls to \bibliographystyle, bibtexfails. I will prepare a minimal example that causes the issue and add it to the question. Jun 11, 2018 at 9:49
  • Denn bruche mr es MWE.
    – thymaro
    Jun 11, 2018 at 10:05

1 Answer 1


The problem was that I misapplied a feature by the etoolbox package, which I prematurely excluded as a possible cause (partly because it "seemed to work").

The offending code is the \iftoggle which is lacking an 'else' block.


This does not work properly without an additional group (even if empty) to denote the output if the toggle is false. The \iftoggle immediately preceded the bibliography in my document, and caused the error. It was enough to add an empty group to the toggle:


bibtex now properly works with only one of the calls to \bibliographystyle, and complains if both are in the source:

This is BibTeX, Version 0.99d (MiKTeX 2.9.6700 64-bit)
The top-level auxiliary file: minimal.aux
The style file: plain.bst
Illegal, another \bibstyle command---line 21 of file minimal.aux
 : \bibstyle
 :          {plain}
I'm skipping whatever remains of this command

What led to the confusion (not an excuse for wrongfully excluding it as a potential cause, I know!) was that the document was generated properly even with the missing group, as long as the \bibliographystyle was repeated before calling \bibliography. I'm still not entirely sure why it needed to also be called before the \iftoggle to produce a correct-looking output. But that's what you get for only skimming package documentation. Mea culpa.

  • 2
    Since \iftoggle expects three arguments, the missing last arg ate \bibliographystyle and bericht should appear in the text.
    – daleif
    Jun 11, 2018 at 10:31
  • 1
    That makes sense, and is exactly what happens, thank you! The name of the bibliography style appears in the document, well-hidden at the end of the \listoftodos. Jun 11, 2018 at 11:27
  • That's often why I insert a \clearpage or simular before these notes.
    – daleif
    Jun 11, 2018 at 11:47

You must log in to answer this question.

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