1

I would like to clean up BibTeX entries so that fields always appear in the same order.

For example, I would like the order of fields to always be: author, year, title, journal. So, pressing C-c C-q on:

@Article{Smit90,
  title = {The Title},
  year = 1990,    
  author = {Smith, J.},
  journal = {The Journal}
}

Should produce:

@Article{Smit90,
  author = {Smith, J.},
  year = 1990,    
  title = {The Title},
  journal = {The Journal}

}

bibtex-mode has many options to reformat and clean up fields (see http://www.jonathanleroux.org/bibtex-mode.html#0620), but does not seem to have a way to reorder fields. Ideally, the order of fields should be controlled from bibtex-entry-format and follow the order of fields that is defined in bibtex-BibTeX-entry-alist.

How could this be done?

  • I think you meant C-c C-c (bibtex-clean-entry) and not C-c C-q (bibtex-fill-entry). – jagrg Feb 9 at 13:06
1

You have to add sort-fields to bibtex-entry-format.

  • Interesting. I didn't know about that option (it wasn't in the manual I linked in the question). Thanks! – scaramouche Feb 10 at 2:02

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.