Auto-Capitalizing BibTex Entries from Google Scholar
Quick tip in case anyone out there (probably future me) wants to enforce capitalization of BibTex entries which come from Google Scholar citations.
Unfortunately, Google Scholar BibTex entries do not have the required brackets
({}
) to enforce capitalization of journals, conferences, or paper titles.
Fortunately, we can fix this in one search and replace command using Vim :)
- Open your
*.bib
file (in my casecitations.bib
) in Vim :%s/\<[A-Z]\+/{\0}/g
- Done!
This works because Google Scholar is at least decent enough to preserve proper
capitalization, they just don’t use the brackets. Therefore this search and
replace will find all words that are either all caps or start with a capital
letter. It will then replace it with the entire capture group \0
surrounded
by the proper brackets.
Don’t forget to run the full incantations (pdflatex
, bibtex
, pdflatex
,
pdflatex
) for it to regenerate everything properly.