ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Cite​Bibtex

by sjpfenninger ST3

Effortlessly insert citations from BibTeX into texts written in Pandoc or LaTeX

Details

Installs

  • Total 7K
  • Win 3K
  • Mac 3K
  • Linux 1K
Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5
Windows 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 2 0 0 1 0 0 0 2 0 1 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0
Mac 0 0 0 0 0 2 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 1 1 1
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0

Readme

Source
raw.​githubusercontent.​com

CiteBibtex

A Sublime Text plugin to effortlessly insert citations from BibTeX into texts written in Pandoc or LaTeX.

Installation

Install via Package Control.

Compatible with Sublime Text 3 only.

Initial configuration

Set the path to your global BibTeX file (bibtex_file) in the plugin settings.

Use

Pressing the citation shortcut key (bound to F10 by default) brings up a quick panel for searching the bibliography file. Once the desired reference is found, pressing enter or clicking on it will insert a citation at the current cursor position (if there is more than one cursor, at the first cursor's position). The BibTeX file is checked for modifications each time the quick panel is brought up.

The format for inserted citations is auto-detected as pandoc (for use with Pandoc) or latex based on the syntax of the open file (this can be disabled by setting "autodetect_citation_style": false in the plugin settings). If auto-detection fails, the default is to use pandoc (which can be changed by setting default_citation_style in the plugin settings).

The bibtex_file setting can be overridden on a per-project basis in the project settings, using either a path relative to the project settings file or an absolute path. The following example project settings demonstrate this:

{
    "folders":
    [
        {
            "follow_symlinks": true,
            "path": ".",
        }
    ],
    "bibtex_file": "path/to/bibtex.bib"
}

Inserting plaintext bibliography entries

There is a separate command (bound to F9 by default) to insert a pre-formatted plaintext bibliography entry rather than a citation key. This is configured via the new citation_format_string setting in the plugin settings, which is a Python format string, set to "{author} ({year}). {title}" by default. Any BibTeX field can be used in the format string, missing ones will be replaced with an empty string.

Extraction of citations from master BibTeX file

The command CiteBibTeX: Extract citations in current file is available via the command palette, and will extract all references used in the currently open file from the global BibTeX file, saving that subset in a local BibTeX file.

For example, if my_paper.md is currently open and cites 10 out of 100 references in the global BibTeX file, calling this command will save those 10 references in a file called my_paper.bib in the same directory as my_paper.md. This may useful to keep references portable alongside the text that uses them for sharing or archiving.

Acknowledgments

Includes the BibTeX parsing library python-bibtexparser (LGPLv3-licensed).

Includes md2bib.py from pandoc-wrappers by Joseph Reagle (GPLv3-licensed).

License

GNU GPLv3 (see LICENSE file).