BibTeX Management

reset

Reset the bibmanager database.

Usage

bibm reset [-h] [-d | -c] [bibfile]

This command resets the bibmanager database from scratch. It creates a .bibmanager/ folder in the user folder (if it does not exists already), and it resets the bibmanager configuration to its default values.

If the user provides the bibfile argument, this command will populate the database with the entries from that file; otherwise, it will set an empty database.

Note that this will overwrite any pre-existing database. In principle the user should not execute this command more than once in a given CPU.

Options

bibfile
Path to an existing BibTeX file.

-d, -\-database
Reset only the bibmanager database.

-c, -\-config
Reset only the bibmanager config parameters.

-h, -\-help
Show this help message and exit.

Examples

# Reset bibmanager database from scratch:
bibm reset

# Reset, including entries from a BibTeX file:
bibm reset my_file.bib

# Reset only the database (keep config parameters):
bibm reset my_file.bib -d

# Reset only the config parameters (keep database):
bibm reset -c

merge

Merge a BibTeX file into the bibmanager database.

Usage

bibm merge [-h] bibfile [take]

Description

This command merges the content from an input BibTeX file with the bibmanager database.

The optional ‘take’ arguments defines the protocol for possible- duplicate entries. Either take the ‘old’ entry (database), take the ‘new’ entry (bibfile), or ‘ask’ the user through the prompt (displaying the alternatives). bibmanager considers four fields to check for duplicates: doi, isbn, bibcode, and eprint.

Additionally, bibmanager considers two more cases (always asking):
(1) new entry has duplicate key but different content, and
(2) new entry has duplicate title but different key.

Options

bibfile
Path to an existing BibTeX file.

take
Decision protocol for duplicates (choose: {old, new, ask}, default: old)

-h, -\-help
Show this help message and exit.

Examples

# Merge BibTeX file ignoring duplicates (unless they update from arXiv to peer-reviewed):
bibm merge my_file.bib

# Merge BibTeX file ovewriting entries if they are duplicates:
bibm merge my_file.bib new

# Merge BibTeX file asking the user which to take for each duplicate:
bibm merge my_file.bib ask

edit

Edit the bibmanager database in a text editor.

Usage

bibm edit [-h]

Description

This command let’s you manually edit the bibmanager database, in your pre-defined text editor. Once finished editing, save and close the text editor, and press ENTER in the terminal to incorporate the edits (edits after continuing on the terminal won’t count).

bibmanager selects the OS default text editor. But the user can set a preferred editor, see ‘bibm config -h’ for more information.

Options

-h, -\-help
Show this help message and exit.

Examples

# Launch text editor on the bibmanager BibTeX database:
bibm edit

Meta-Information

(New since Version 1.2)
bibmanager allows the user to add meta-information to the entries (info that is not contained in the BibTex itself). This meta-info can be set while editing the database with the bibm edit command, by writting it before an entry. There are currently two meta-parameters:
  • The freeze meta-parameter is a flag that freezes an entry, preventing it to be modified when running ads-update.

  • The pdf meta-parameter links a PDF file to the entry. To do this, type ‘pdf:’ followed by the path to a PDF file. If the PDF file is already in the home/pdf folder (see config), there’s no need to specify the path to the file. Alternatively, see the commands in PDF Management.

  • The tags meta-parameter enable setting user-defined tags for grouping and searching entries (New since Version 1.4)

Below there’s an example to freeze and link a PDF file to an entry:

This file was created by bibmanager
https://pcubillos.github.io/bibmanager/

...

freeze
pdf: /home/user/Downloads/Rubin1980.pdf
@ARTICLE{1980ApJ...238..471R,
       author = {{Rubin}, V.~C. and {Ford}, W.~K., Jr. and {Thonnard}, N.},
        title = "{Rotational properties of 21 SC galaxies with a large range of luminosities and radii, from NGC 4605 (R=4kpc) to UGC 2885 (R=122kpc).}",
      journal = {\apj},
         year = "1980",
        month = "Jun",
       volume = {238},
        pages = {471-487},
          doi = {10.1086/158003},
       adsurl = {https://ui.adsabs.harvard.edu/abs/1980ApJ...238..471R},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

...

add

Add entries into the bibmanager database.

Usage

bibm add [-h] [take]

Description

This command allows the user to manually add BibTeX entries into the bibmanager database through the terminal prompt.

The optional ‘take’ argument defines the protocol for possible-duplicate entries. Either take the ‘old’ entry (database), take the ‘new’ entry (bibfile), or ‘ask’ the user through the prompt (displaying the alternatives). bibmanager considers four fields to check for duplicates: doi, isbn, bibcode, and eprint.

Additionally, bibmanager considers two more cases (always asking):
(1) new entry has duplicate key but different content, and
(2) new entry has duplicate title but different key.

Options

take
Decision protocol for duplicates (choose: {old, new, ask}, default: new)

-h, -\-help
Show this help message and exit.

Examples

# Start multi-line prompt session to enter one or more BibTeX entries:
bibm add

tag

Add or remove tags to entries in the database.

Usage

bibm tag [-h] [-d] [-v VERB]

Description

This command adds or removes user-defined tags to specified entries in the Bibmanager database, which can then be used for grouping and searches. The tags are case sensitive and should not contain blank spaces.
(New since version 1.4)
Additionally, if the user only sets tags (but no entries), this command will display the existing entries that contain those tags.
There are five levels of verbosity:
verb < 0: Display only the keys of the entries
verb = 0: Display the title, year, first author, and key
verb = 1: Display additionally the ADS/arXiv urls and meta info
verb = 2: Display additionally the full list of authors
verb > 2: Display the full BibTeX entries

Options

-h, -\-help
Show this help message and exit.
-d, -\-delete
Delete tags instead of add.
-v VERB, -\-verb VERB
Verbosity level if used to display entries.

Examples

# Add a tag to an entry:
bibm tag
(Syntax is: KEY_OR_BIBCODE KEY_OR_BIBCODE2 ... tags: TAG TAG2 ...)
Hunter2007ieeeMatplotlib tag: python

# Add multiple tags to multiple entries:
bibm tag
(Syntax is: KEY_OR_BIBCODE KEY_OR_BIBCODE2 ... tags: TAG TAG2 ...)
1913LowOB...2...56S 1918ApJ....48..154S tags: galaxies history

# Remove tags:
bibm tag -d
(Syntax is: KEY_OR_BIBCODE KEY_OR_BIBCODE2 ... tags: TAG TAG2 ...)
Slipher1913lobAndromedaRarialVelocity tags: galaxies


# Display all entries that contain the 'galaxies' tag:
bibm tag
(Syntax is: KEY_OR_BIBCODE KEY_OR_BIBCODE2 ... tags: TAG TAG2 ...)
tags: galaxies


browse

Browse through the bibmanager database.
(New since version 1.3)

Usage

bibm browse [-h]

Description

Display the entire bibmanager database in an interactive full-screen application that lets you:
- Navigate through or search for specific entries
- Visualize the entries’ full BibTeX content
- Select entries for printing to screen or to file
- Open the entries’ PDF files
- Open the entries in ADS through the web browser
- Select sub-group of entries by tags (New since version 1.4)

Options

-h, -\-help
Show this help message and exit.

Examples

bibm browse

export

Export the bibmanager database into a bib file.

Usage

bibm export [-h] bibfile

Description

Export the entire bibmanager database into a bibliography file to a .bib or .bbl format according to the file extension of the ‘bibfile’ argument.

Caution

For the moment, only export to .bib.

Options

bibfile
Path to an output BibTeX file.

-h, -\-help
Show this help message and exit.

-meta
Also include meta-information in output file.

Examples

bibm export my_file.bib

cleanup

Clean up a bibtex or latex file of duplicates and outdated entries.

Usage

bibm cleanup [-h] [-ads] bibfile

Description

Clean up a BibTeX (.bib) or LaTeX (.tex) file by removing duplicates, sorting the entries, and (if requested) updating the entries by cross-checking against the ADS database. All of this is done independently of the bibmanager database. The original files will be preserved by prepending the string ‘orig_yyyy_mm_dd_’ with the corresponding date.
(New since version 1.1.2)

Options

bibfile
Path to an existing .tex or .bib file.
(New since version 1.4.9 this can also update .tex files)
-ads
Update the bibfile entries cross-checking against the ADS database.
-h, -\-help
Show this help message and exit.

Examples

# Remove duplicates and sort:
bibm cleanup file.bib

# Remove duplicates, update ADS entries, and sort:
bibm cleanup file.bib -ads

# Remove duplicates, update ADS entries, and sort a .tex file
# (and also its .bib file and other referenced .tex files in the main .tex file)
bibm cleanup file.tex -ads

config

Manage the bibmanager configuration parameters.

Usage

bibm config [-h] [param] [value]

Description

This command displays or sets the value of bibmanager config parameters. These are the parameters that can be set by the user:

  • The style parameter sets the color-syntax style of displayed BibTeX entries. The default style is ‘autumn’. See http://pygments.org/demo/6780986/ for a demo of the style options. The available options are:

    default, emacs, friendly, colorful, autumn, murphy, manni, monokai, perldoc, pastie, borland, trac, native, fruity, bw, vim, vs, tango, rrt, xcode, igor, paraiso-light, paraiso-dark, lovelace, algol, algol_nu, arduino, rainbow_dash, abap

  • The text_editor sets the text editor to use when editing the bibmanager manually (i.e., a call to: bibm edit). By default, bibmanager uses the OS-default text editor. Typical text editors are: emacs, vim, gedit. To set the OS-default editor, set text_editor to ‘default’. Note that aliases defined in the .bash file are not accessible.

  • The paper parameter sets the default paper format for latex compilation outputs (not for pdflatex, which is automatic). Typical options are ‘letter’ (e.g., for ApJ articles) or ‘A4’ (e.g., for A&A).

  • The ads_token parameter sets the ADS token required for ADS requests. To obtain a token, follow the steps described here: https://github.com/adsabs/adsabs-dev-api#access

  • The ads_display parameter sets the number of entries to show at a time, for an ADS search query. The default number of entries to display is 20.

  • The home parameter sets the bibmanager home directory (this could be very handy, e.g., by placing the database in a Dropbox folder to share the same database across multiple machines).

The number of arguments determines the action of this command (see examples below):

  • with no arguments, display all available parameters and values.

  • with the ‘param’ argument, display detailed info on the specified parameter and its current value.

  • with both ‘param’ and ‘value’ arguments, set the value of the parameter.

Options

param
A bibmanager config parameter.

value
Value for a bibmanager config parameter.

-h, -\-help
Show this help message and exit.

Examples

# Display all config parameters and values:
bibm config

bibmanager configuration file:
PARAMETER    VALUE
-----------  -----
style        autumn
text_editor  default
paper        letter
ads_token    None
ads_display  20
home         /home/user/.bibmanager/
# Display value and help for the ads_token parameter:
bibm config ads_token

The 'ads_token' parameter sets the ADS token required for ADS requests.
To obtain a token follow the two steps described here:
  https://github.com/adsabs/adsabs-dev-api#access

The current ADS token is 'None'
# Set the value of the BibTeX color-syntax:
bibm config style autumn

style updated to: autumn.