TransWikia.com

!Misplaced alignment tab character & in bibtex entry

TeX - LaTeX Asked on November 14, 2021

As the title says, I tried adding a BibTeX entry:

@Book{hebbrule,
    author = {Donald O. Hebb},
    title = {The Organization of Behavior: A Neuropsychological Theory},
    publisher = {Taylor & Francis Inc},
    year = {1949},
}

In the first version, I didn’t have the before the & and I got the above mentioned error. Then I added the , which should solve it, but the error remains even if I delete the whole entry!

Does LaTeX not recognize when I change some of my files? Because I had some errors where I removed the cause and they would still remain. (I’m using Texmaker btw.)

2 Answers

The behaviour is not as dumb as it appears at first sight. You have to understand that entries in a .bib file only make their way into LaTeX indirectly. After a change has been made, the new and correct entries will not find their way in until after the next bibtex run. Until then, the old and incorrect entries, which are sitting in the .bbl file that bibtex produced last time will continue to be used. That is the source of your error on this occasion. Your rerun sequence didn't "change nothing": it changed the contents of the .bbl file.

Three ways to solve this:

  • After updating the .bib file, run bibtex again before running LaTeX. That only works if all you have changed is the .bib file. It won't work if, for instance, you have added a citation to the TeX source file too.

  • Run LaTeX again, ignoring any errors, and then run bibtex and then LaTeX. That is what you did here, evidently.

  • Delete the various files that LaTeX produces or uses as it runs (.aux and .bbl in particular, and then regenerate the document from scratch. That isn't really different from the previous option, but it avoids you seeing any errors at all, and in some cases (if an error is so bad that it really causes LaTeX to choke fatally) it's the only thing to do.

As a rough rule of thumb, if you ever get errors which are caused by something in the .bib file, it's probably a good idea to go back to a clean slate. Many editors will offer an easy way of deleting the cruft files. The same is also true for anything else that puts data into external files (such as glossaries, indexes, and so forth, even tables of contents and labels in extreme cases): if you find yourself getting hard-to-explain errors which persist even after you think you've put things right, going back to a clean sheet is often wise.

Answered by Paul Stanley on November 14, 2021

I somehow got it working. All I needed to do was run pdflatexbibtexpdflatex twice and all of a sudden the error disappeared even though I changed absolutely nothing.

Answered by Stammer91 on November 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP