Add BibTeX layer.
Integrates with org mode and LaTeX in order to manage citations. Signed-off-by: JP-Ellis <josh@jpellis.me>
This commit is contained in:
parent
05e99aa0a1
commit
97aff9d8db
|
@ -33,6 +33,9 @@
|
|||
* Description
|
||||
This layer enables [[http://orgmode.org/][org mode]] for Spacemacs.
|
||||
|
||||
For more extensive support of references through BibTeX files, have a look at
|
||||
the [[../+lang/bibtex][BibTeX layer]].
|
||||
|
||||
** Features:
|
||||
- Vim inspired key bindings are provided by [[https://github.com/edwtjo/evil-org-mode][evil-org-mode]]
|
||||
- Nicer bullet via [[https://github.com/sabof/org-bullets][org-bullets]]
|
||||
|
|
79
layers/+lang/bibtex/README.org
Normal file
79
layers/+lang/bibtex/README.org
Normal file
|
@ -0,0 +1,79 @@
|
|||
#+TITLE: BibTeX layer
|
||||
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../../css/readtheorg.css" />
|
||||
[[file:img/logo.png]]
|
||||
* Table of Contents :TOC_4_org:noexport:
|
||||
- [[Description][Description]]
|
||||
- [[Install][Install]]
|
||||
- [[Configuration][Configuration]]
|
||||
- [[Key bindings][Key bindings]]
|
||||
|
||||
* Description
|
||||
BibTeX and BibLaTeX files are a common way to manage bibliographies. The format
|
||||
was original designed to work with LaTeX files and subsequently has been adopted
|
||||
by other markup formats such as MarkDown and Org mode.
|
||||
|
||||
This layer adds support to manipulate BibTeX and BibLaTeX files and offer
|
||||
utilities to automatically add new entries by DOI, arXiv identifier, ISBN, and
|
||||
more.
|
||||
|
||||
Once enabled, this layer also introduces additional shortcuts in other modes to
|
||||
easily insert citations.
|
||||
|
||||
* Install
|
||||
To use this contribution add it to your =~/.spacemacs=
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq-default dotspacemacs-configuration-layers '(bibtex))
|
||||
#+end_src
|
||||
|
||||
* Configuration
|
||||
This layer also supports having a global BibTeX file. For a basic
|
||||
configuration, add this to your =~/.spacemacs= inside
|
||||
=dotspacemacs/user-config=:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq org-ref-default-bibliography '("~/Papers/references.bib")
|
||||
org-ref-pdf-directory "~/Papers/"
|
||||
org-ref-bibliography-notes "~/Papers/notes.org")
|
||||
#+end_src
|
||||
|
||||
Certain modes, such as ~latex-mode~ with AucTeX, will automatically lookup
|
||||
references in a document if any of the recognized bibliography commands are
|
||||
used. Other modes may have a similar feature, or one could always set
|
||||
file-local variables (through ~SPC f v f~).
|
||||
|
||||
You can also customize which program is used to display the PDFs. For example,
|
||||
to use Zathura:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq org-ref-open-pdf-function (lambda (fpath) (start-process "zathura" "*helm-bibtex-zathura*" "/usr/bin/zathura" fpath)))
|
||||
#+end_src
|
||||
|
||||
More configuration options are available and are detailed in the ~org-ref~ and
|
||||
~helm-bibtex~ package documentations.
|
||||
|
||||
* Key bindings
|
||||
In a Bib(La)TeX files, the following key bindings are added:
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+--------------------------------------------|
|
||||
| ~<SPC> m j~ | Next entry |
|
||||
| ~<SPC> m k~ | Previous entry |
|
||||
| ~<SPC> m p~ | Open PDF |
|
||||
| ~<SPC> m n~ | Open notes |
|
||||
| ~<SPC> m b~ | Open browser |
|
||||
| ~<SPC> m i~ | Insert new entry |
|
||||
| ~<SPC> m s~ | Sort entry |
|
||||
| ~<SPC> m h~ | Various actions on entry |
|
||||
| ~<SPC> m l a~ | Lookup and add arXiv paper (don't get PDF) |
|
||||
| ~<SPC> m l A~ | Lookup and add arXiv paper (download PDF) |
|
||||
| ~<SPC> m l d~ | Lookup and add paper by DOI |
|
||||
| ~<SPC> m l i~ | Lookup and add book by ISBN |
|
||||
| ~<SPC> m l p~ | Lookup and add paper by PMID |
|
||||
|
||||
In addition, ~org-mode~, ~latex-mode~ and ~markdown-mode~ all have the following
|
||||
key binding added:
|
||||
|
||||
| Key Binding | Description |
|
||||
|-------------+-----------------|
|
||||
| ~SPC m i c~ | Insert citation |
|
BIN
layers/+lang/bibtex/img/logo.png
Normal file
BIN
layers/+lang/bibtex/img/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
57
layers/+lang/bibtex/packages-config.el
Normal file
57
layers/+lang/bibtex/packages-config.el
Normal file
|
@ -0,0 +1,57 @@
|
|||
;;; packages-config.el --- BibTeX Layer packages file for Spacemacs
|
||||
;;
|
||||
;; Copyright (c) 2012-2014 Sylvain Benner
|
||||
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
|
||||
;;
|
||||
;; Author: Joshua Ellis <josh@jpellis.me>
|
||||
;; URL: https://github.com/JP-Ellis
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defun bibtex/init-org-ref ()
|
||||
(use-package org-ref
|
||||
:defer t
|
||||
:config
|
||||
(progn
|
||||
(spacemacs/set-leader-keys-for-major-mode 'bibtex-mode
|
||||
;; Navigation
|
||||
"j" 'org-ref-bibtex-next-entry
|
||||
"k" 'org-ref-bibtex-previous-entry
|
||||
|
||||
;; Open
|
||||
"b" 'org-ref-open-in-browser
|
||||
"n" 'org-ref-open-bibtex-notes
|
||||
"p" 'org-ref-open-bibtex-pdf
|
||||
|
||||
;; Misc
|
||||
"h" 'org-ref-bibtex-hydra/body
|
||||
"i" 'org-ref-bibtex-hydra/org-ref-bibtex-new-entry/body-and-exit
|
||||
"s" 'org-ref-sort-bibtex-entry
|
||||
|
||||
;; Lookup utilities
|
||||
"la" 'arxiv-add-bibtex-entry
|
||||
"lA" 'arxiv-get-pdf-add-bibtex-entry
|
||||
"ld" 'doi-utils-add-bibtex-entry-from-doi
|
||||
"li" 'isbn-to-bibtex
|
||||
"lp" 'pubmed-insert-bibtex-from-pmid
|
||||
))))
|
||||
|
||||
(defun bibtex/post-init-auctex ()
|
||||
(spacemacs/set-leader-keys-for-major-mode 'latex-mode
|
||||
"ic" 'org-ref-helm-insert-cite-link))
|
||||
|
||||
(defun bibtex/post-init-org ()
|
||||
(spacemacs/set-leader-keys-for-major-mode 'org-mode
|
||||
"ic" 'org-ref-helm-insert-cite-link))
|
||||
|
||||
(defun bibtex/post-init-markdown-mode ()
|
||||
(spacemacs/set-leader-keys-for-major-mode 'markdown-mode
|
||||
"ic" 'org-ref-helm-insert-cite-link))
|
||||
|
||||
;;; packages.el ends here
|
25
layers/+lang/bibtex/packages.el
Normal file
25
layers/+lang/bibtex/packages.el
Normal file
|
@ -0,0 +1,25 @@
|
|||
;;; packages.el --- BibTeX Layer packages file for Spacemacs.
|
||||
;;
|
||||
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
||||
;;
|
||||
;; Author: Joshua Ellis <josh@jpellis.me>
|
||||
;; URL: https://github.com/JP-Ellis
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defconst bibtex-packages
|
||||
'(
|
||||
auctex
|
||||
helm
|
||||
org
|
||||
org-ref
|
||||
markdown-mode
|
||||
))
|
||||
|
||||
;;; packages-config.el ends here
|
|
@ -19,6 +19,9 @@
|
|||
* Description
|
||||
This layer adds support for LaTeX files with [[https://savannah.gnu.org/projects/auctex/][AucTeX]].
|
||||
|
||||
For more extensive support of BibTeX files than RefTeX provides, have a look at
|
||||
the [[../bibtex][BibTeX layer]].
|
||||
|
||||
** Features
|
||||
- Auto-build with [[https://github.com/tom-tan/auctex-latexmk/][auctex-latexmk]]
|
||||
- Auto-completion with [[https://github.com/alexeyr/company-auctex][company-auctex]]
|
||||
|
@ -83,7 +86,6 @@ is nil.
|
|||
#+END_SRC
|
||||
|
||||
* Keybindings
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+--------------------------------------------|
|
||||
| ~SPC m -~ | recenter output buffer |
|
||||
|
@ -96,7 +98,7 @@ is nil.
|
|||
| ~SPC m b~ | build |
|
||||
| ~SPC m c~ | close LaTeX environment |
|
||||
| ~SPC m e~ | insert LaTeX environment |
|
||||
| ~SPC m i~ | insert =\item= |
|
||||
| ~SPC m i i~ | insert =\item= |
|
||||
| ~SPC m k~ | kill TeX job |
|
||||
| ~SPC m l~ | recenter output buffer |
|
||||
| ~SPC m m~ | insert LaTeX macro |
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
"." 'LaTeX-mark-environment ;; C-c .
|
||||
"c" 'LaTeX-close-environment ;; C-c ]
|
||||
"e" 'LaTeX-environment ;; C-c C-e
|
||||
"i" 'LaTeX-insert-item ;; C-c C-j
|
||||
"ii" 'LaTeX-insert-item ;; C-c C-j
|
||||
"s" 'LaTeX-section ;; C-c C-s
|
||||
"fe" 'LaTeX-fill-environment ;; C-c C-q C-e
|
||||
"fp" 'LaTeX-fill-paragraph ;; C-c C-q C-p
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
|
||||
This layer adds markdown support to Spacemacs.
|
||||
|
||||
For more extensive support of references with BibTeX files, have a look at the
|
||||
[[../bibtex][BibTeX layer]].
|
||||
|
||||
** Features:
|
||||
- markdown files support via [[http://jblevins.org/git/markdown-mode.git/][markdown-mode]]
|
||||
- TOC generation via [[https://github.com/ardumont/markdown-toc][markdown-toc]]
|
||||
|
|
Loading…
Reference in a new issue