Skip to main content

zotero-bibtize

Refurbish exported Zotero-BibTex bibliographies into a more latex friendly representation.

In the current state exporting the contents of a Zotero database to Bibtex format most special characters are replaced by Zotero internal versions or escaped before written to the output file. This behavior is exceptionally annoying if entries contain code which is meant to be processed by latex (i.e. chemical or mathematical expressions and formulas in the title, etc.).

zotero-bibtize can be used to post-process the generated Zotero output files and remove added escape sequences (i.e. the output is an identical replica of the raw entry contents stored in the Zotero interface)

Usage

After installing the package zotero-bibtize can be invoked via a call to the zotero-bibtize command on the command line:

$ zotero-bibtize zotero_bibliography.bib bibtized_bibliography.bib

which will process the original contents zotero_bibliography.bib and writes the processed contents to the new bibtized_bibliography.bib file. Note that specifying a target file is optional and the input file will be overwritten if left out.

Example

Original bibtex entry generated by Zotero export:

$ cat zotero_bibliography.bib
@article{LangCM2015,
  title = {Lithium {Ion} {Conduction} in {\textbackslash}ce\{{LiTi}2({PO}4)3\} and {Related} {Compounds} {Based} on the \{{NASICON}\} {Structure}: {A} {First}-{Principles} {Study}},
  volume = {27},
  issn = {0897-4756, 1520-5002},
  shorttitle = {Lithium {Ion} {Conduction} in {\textbackslash}ce\{{LiTi}2({PO}4)3\} and {Related} {Compounds} {Based} on the {NASICON} {Structure}},
  url = {http://pubs.acs.org/doi/10.1021/acs.chemmater.5b01582},
  doi = {10.1021/acs.chemmater.5b01582},
  language = {en},
  number = {14},
  urldate = {2019-02-11},
  journal = {Chem. Mater.},
  author = {Lang, Britta and Ziebarth, Benedikt and Els{\textbackslash}"\{a\}sser, Christian},
  month = jul,
  year = {2015},
  pages = {5040--5048}
}

After running zotero-bibtize zotero_bibliography.bib:

$ cat zotero_bibliography.bib
@article{LangCM2015,
  title = {Lithium Ion Conduction in \ce{LiTi2(PO4)3} and Related Compounds Based on the NASICON Structure: A First-Principles Study},
  volume = {27},
  issn = {0897-4756, 1520-5002},
  shorttitle = {Lithium Ion Conduction in \ce{LiTi2(PO4)3} and Related Compounds Based on the NASICON Structure},
  url = {http://pubs.acs.org/doi/10.1021/acs.chemmater.5b01582},
  doi = {10.1021/acs.chemmater.5b01582},
  language = {en},
  number = {14},
  urldate = {2019-02-11},
  journal = {Chem. Mater.},
  author = {Lang, Britta and Ziebarth, Benedikt and Els\"{a}sser, Christian},
  month = jul,
  year = {2015},
  pages = {5040--5048}
}

Custom BibTex Keys (very experimental)

Custom BibTex keys can be defined through the optional --key-format option that will be written to the bibliography file instead of the default keys generated by Zotero. The key format defines the way how to combine and format contents taken from the BibTex entry fields to build a custom key format. In general the format key is of the form [field1:option][field2:option]... where field defines the BibTex entry field to take the contents from and the options defines different format options that will be applied to the contents. Currently the following fields are implemented:

author

Adds the author's lastnames to the key entry
General format: [author:num:options]

num

Defines the maximal number of author names used for the key

options

The format options that will be applied to the author names, i.e.

  • capitalize: Capitalize the names
  • upper: Transform names uppercase
  • lower: Transform names to lowercase
  • abbreviate: Only us the first letter instead of the full name

title

Adds contents of the title string to the key entry
General format: [title:num:options]

num

Defines the maximal number of words in the title used for the key (Note that function keys will not be taken into account)

options

The format options that will be applied to the title contents, i.e.

  • capitalize: Capitalize the names
  • upper: Transform names uppercase
  • lower: Transform names to lowercase
  • abbreviate: Only us the first letter instead of the full name

journal

Adds contents of the journal name to the key entry
General format: [journal:options]

options

The format options that will be applied to the journal name, i.e.

  • capitalize: Capitalize the names
  • upper: Transform names uppercase
  • lower: Transform names to lowercase
  • abbreviate: Only us the first letter instead of the full name

year

Add the publication year to the key entry
General format: [year:option]

option

Adding the year only allows to specify two types of options:

  • short: Add the year to the key as 2-digit quantity
  • long: Add the full year to the (i.e. as 4-digit quantitiy)

Example

In the following example we create a custom key containing the first author name and the abbreviated journal name followed by the publication year. The key format defining such a key is of the following form: [author:1:capitalize][journal:capitalize:abbreviate][year] The original entry generated by Zotero looks like this:

$ cat zotero_bibliography.bib
@article{lang_lithium_ion_conduction_2015,
  title = {Lithium {Ion} {Conduction} in {\textbackslash}ce\{{LiTi}2({PO}4)3\} and {Related} {Compounds} {Based} on the \{{NASICON}\} {Structure}: {A} {First}-{Principles} {Study}},
  volume = {27},
  issn = {0897-4756, 1520-5002},
  shorttitle = {Lithium {Ion} {Conduction} in {\textbackslash}ce\{{LiTi}2({PO}4)3\} and {Related} {Compounds} {Based} on the {NASICON} {Structure}},
  url = {http://pubs.acs.org/doi/10.1021/acs.chemmater.5b01582},
  doi = {10.1021/acs.chemmater.5b01582},
  language = {en},
  number = {14},
  urldate = {2019-02-11},
  journal = {Chem. Mater.},
  author = {Lang, Britta and Ziebarth, Benedikt and Els{\textbackslash}"\{a\}sser, Christian},
  month = jul,
  year = {2015},
  pages = {5040--5048}
}

After running zotero-bibtize zotero_bibliography.bib --key-format [author:1:capitalize][journal:capitalize:abbreviate][year] the original contents will be processed by zotero-bibtize and the original Zotero key will be replaced with the modified version:

$ cat zotero_bibliography.bib
@article{LangCM2015,
  title = {Lithium Ion Conduction in \ce{LiTi2(PO4)3} and Related Compounds Based on the NASICON Structure: A First-Principles Study},
  volume = {27},
  issn = {0897-4756, 1520-5002},
  shorttitle = {Lithium Ion Conduction in \ce{LiTi2(PO4)3} and Related Compounds Based on the NASICON Structure},
  url = {http://pubs.acs.org/doi/10.1021/acs.chemmater.5b01582},
  doi = {10.1021/acs.chemmater.5b01582},
  language = {en},
  number = {14},
  urldate = {2019-02-11},
  journal = {Chem. Mater.},
  author = {Lang, Britta and Ziebarth, Benedikt and Els\"{a}sser, Christian},
  month = jul,
  year = {2015},
  pages = {5040--5048}
}

Metadata

Release files for zotero-bibtize 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zotero-bibtize 0.1.0
File Size Uploaded Provenance
zotero-bibtize-0.1.0.tar.gz 9.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for zotero-bibtize 0.1.0
File Interpreter ABI Platform
zotero_bibtize-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.4 kB

Release files / zotero-bibtize-0.1.0.tar.gz

Download URL zotero-bibtize-0.1.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3b8dc2256645a403443ba292f5b1ad658842b0bc2db8311bccc1f78419b453d9
BLAKE2b-256 checksum
How to use checksums
8a5b8b222a629e9dbab166bd0c826909d46bb3c1168b997fc54db44d36447ec4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191101 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.7

Release files / zotero_bibtize-0.1.0-py3-none-any.whl

Download URL zotero_bibtize-0.1.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3bd126809e08dcdde711833f07b1f4c4b3b48f0b3ea71d7e405ddad063a7cec6
BLAKE2b-256 checksum
How to use checksums
e7537536ee2d39a136eb88555c28505add46fc9b2d35ce5fdb83e0bd98c58bf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191101 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.7

Security for zotero-bibtize 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page