7

I want bibtex-mode to align and properly indent fields. I copied a bibtex entry for the following article into Emacs: (Article source here)

But, with a simple paste, the alignment is lost in Emacs and the indentation is messed up:

The TAB key doesn't work to align or indent the entry. How to solve this problem?

  • Unrelated to your question, consider using bibslurp package, it allows you to retriev BibTeX entries from The SAO/NASA Astrophysics Data System within Emacs itself. – giordano Jul 14 '17 at 13:32
  • I can't reproduce that behaviour. What happens if you start Emacs with the -Q switch? – Erik Jul 15 '17 at 15:01
  • I get the same behaviour when starting with a -Q switch – Viesturs Jul 15 '17 at 17:57
9

When the cursor is somewhere in the entry, run the command bibtex-fill-entry (bound to C-c C-q), which will align the fields. You may also want to set variable bibtex-align-at-equal-sign to a non nil value to change the details of alignment.

2

I had a similar issue, when using the smartparens package in bibtex-mode, where shameful amounts of spaces where inserted. For some reason unknown, bibtex-mode sets the fill-prefix variable to a string containing 18 spaces. (setq fill-prefix nil) in the bibtex-mode-hook fixed the issue in my case.

1

Usually, you would use the align-regexp command (or the align command if bibtex-mode supported it). But that won't help you with the broken indentation.

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.