A PHP script for tidying a .bib file and synchronise it with the .tex file using the .bib file.
2019-2021 Shujun Li @ www.hooklee.com
php sync_tex_bib.php [options]
Options:
-t file Path of the input .tex file (required)
-b file Path of the input .bib file (default: the same name as the .tex file)
-o file Path of the output .bib file (default: [input_bib_filename]_output.bib)
-r [...] Specify a comma-separated list of unwanted BibTeX fields for removal
Default value: abstract,address,isbn,issn,keywords,file,location,timestamp,biburl,bibsource,month
To set the list to empty (i.e., keep all fields), simply use -r without any list.
-s Sort the BibTeX items by their keys (default: do not sort = keep the original order)
-cp [...] Specify a comma-separated list of citation command prefixes (default: cite)
-n Use original field names and item types in all BibTeX items (default: converting to lowercase)
-rlb Remove the leading text before the first BibTeX item (default: keep it)
-ric Remove all inline comments between BibTeX items (default: keep them)
-kfb Keep the final text after the last BibTeX item (default: remove it)
-% Do not exclude inline comments in the .tex file (default: exclude)
-, Add a comma at the end of a field line if it is missing (default: do nothing)
- Added a new feature for excluding inline comments in the .tex file
- Fixed some bugs
- Revised the way how BibTeX items are extracted to be more robust
- New feature: processing inline comments between BibTeX items
- New feature: processing the final text after the last BibTeX item
- New feature: changing BibTeX filed names and item type to lower case
- Changed the option for removing unwanted fields and the default value
- Made processing of input arguments more robust
- Improved error and warning messages
- Added a new option -amc for adding a missing comma to a field line
- Corrected a minor typo.
- Fixed some bugs and enhanced fault tolerance
- Added a feature to process BibTeX fields across multipline lines
- Changed the manual configuration to command line arguments
- Added key-based sorting
sync_tex_bib was derived from Martin Rebane's bib-matcher v1.0, but has been substantially rewritten and extended to support a range of new features and future extensions.