Italicize and maintain letter case for species names in titles in Zotero collections.
Zotero is an amazing free cloud-based reference management tool, with integrated browser and word processing addins, making it an absolute breeze to collect references from the web and use them in your documents. Zotero also has great BibTex support for LaTex and markdown lovers (in particular the Better BibTex extension)...
The one issue I came around working with Zotero is that it doesn't maintain the correct styling for species names (italicized, genus name starts with a capital letter, species name in lower cap letter, such as Homo sapiens) in the titles of journals, books, theses, etc.
Zotero titles can be manually edited to include the correct html tags to italicize the species names and to protect it from word capitalization (which happens automatically with some citation styles).
However, manual labour is not how we do stuff, so when I came across pyzotero, that allows you to read and update items from your Zotero library, I knew I had the tool I needed to write a small program to scan my library based on a list of Genus names (entered manually or via a csv file) and suggest to add the html tags to "correct" the styling of the species names in the titles.
- Prepare a config file that contains your personal Zotero library ID and API key (obtained from Zotero's web client settings). The file is a simple text file, formatted like an
.ini
file, see example and below:
[zotero]
api_key = <Paste your Zotero api key here>
library_id = <Paste your Zotero library id here>
library_type = user
# Set library_type to 'group' if you are accessing a shared group library
- Run the script mazospega.py from the Python prompt (windows X11 enabled) or your favourite Python IDE
- Follow the directions in the popup windows:
a. Browse and select your config file
b. Enter Genus name, or type CSV to enter it from a file
c. If selected CSV, browse and select your input.csv
file (see examples folder)
d. For each suggestion, select whether you would like to proceed and modify the particular title or move to the next one - Open Zotero and syncronize your library to see the magic!
- List of organisms' genus names in a csv file (one in a line), or manually enter genus names
- Config file containing Zotero library API key and library ID obtained from Zotero's web client settings
- Python 3.7 (preferrably installed and managed with conda), with easygui and pyzotero packages (both can be installed from
conda-forge
channel by typingconda install -c conda-forge easygui pyzotero
) - Graphical windows enabled system (MS-windows or X11 on linux machines)
- Fix text being truncated in message box
- Add exception handling for program abort (no input files selection)
- Tidy up functions
- Command line version