diff --git a/layers/+emacs/org/README.org b/layers/+emacs/org/README.org index 7d92ee36b..c737d4f4f 100644 --- a/layers/+emacs/org/README.org +++ b/layers/+emacs/org/README.org @@ -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]] diff --git a/layers/+lang/bibtex/README.org b/layers/+lang/bibtex/README.org new file mode 100644 index 000000000..750f74648 --- /dev/null +++ b/layers/+lang/bibtex/README.org @@ -0,0 +1,79 @@ +#+TITLE: BibTeX layer +#+HTML_HEAD_EXTRA: +[[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 | +|---------------+--------------------------------------------| +| ~ m j~ | Next entry | +| ~ m k~ | Previous entry | +| ~ m p~ | Open PDF | +| ~ m n~ | Open notes | +| ~ m b~ | Open browser | +| ~ m i~ | Insert new entry | +| ~ m s~ | Sort entry | +| ~ m h~ | Various actions on entry | +| ~ m l a~ | Lookup and add arXiv paper (don't get PDF) | +| ~ m l A~ | Lookup and add arXiv paper (download PDF) | +| ~ m l d~ | Lookup and add paper by DOI | +| ~ m l i~ | Lookup and add book by ISBN | +| ~ 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 | diff --git a/layers/+lang/bibtex/img/logo.png b/layers/+lang/bibtex/img/logo.png new file mode 100644 index 000000000..fac271b8c Binary files /dev/null and b/layers/+lang/bibtex/img/logo.png differ diff --git a/layers/+lang/bibtex/packages-config.el b/layers/+lang/bibtex/packages-config.el new file mode 100644 index 000000000..ace0d798c --- /dev/null +++ b/layers/+lang/bibtex/packages-config.el @@ -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 +;; 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 diff --git a/layers/+lang/bibtex/packages.el b/layers/+lang/bibtex/packages.el new file mode 100644 index 000000000..77b8d2f93 --- /dev/null +++ b/layers/+lang/bibtex/packages.el @@ -0,0 +1,25 @@ +;;; packages.el --- BibTeX Layer packages file for Spacemacs. +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Joshua Ellis +;; 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 diff --git a/layers/+lang/latex/README.org b/layers/+lang/latex/README.org index 4df377643..9aee57fb4 100644 --- a/layers/+lang/latex/README.org +++ b/layers/+lang/latex/README.org @@ -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 | diff --git a/layers/+lang/latex/packages.el b/layers/+lang/latex/packages.el index 0b7a8cb60..bd027e675 100644 --- a/layers/+lang/latex/packages.el +++ b/layers/+lang/latex/packages.el @@ -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 diff --git a/layers/+lang/markdown/README.org b/layers/+lang/markdown/README.org index 1fb47ecca..96c6ac10b 100644 --- a/layers/+lang/markdown/README.org +++ b/layers/+lang/markdown/README.org @@ -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]]