Skip to content

Commit

Permalink
fix: autofiling from PDF with DOI
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser committed Jun 21, 2023
1 parent 98d2fed commit 90ed731
Show file tree
Hide file tree
Showing 5 changed files with 218 additions and 191 deletions.
51 changes: 26 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ A citation picker and minimalistic reference manager for [Alfred](https://www.al

## Feature Overview
- Inserts __Pandoc Citation Syntax__ (`[@citekey]`), supporting page numbers & multiple citations (`[@citekey, p. 23; @citekey, p. 42]`). Can also be configured to use __LaTeX__, __Multi-Markdown__, __eta templates__, __Org Mode__, `[[wikilinks]]`, or `#tags` or `bare citkeys` as citation format.
- __app-independent:__ works system-wide, in every text field of every app.
- __Smart Search:__ search for citekeys, authors, title, publication, keywords (tags), include or exclude authors in *et al*, tab-completion, fuzzy-matching, sorting recently used entries to the top.
- __App-independent:__ works system-wide, in every text field of every app.
- __Smart Search:__ search for citekeys, authors, title, publication, keywords (tags), include or exclude authors in *et al.*, tab-completion, fuzzy-matching, sorting recently used entries to the top.
- __Feature-rich:__ paste single-entry bibliographies, open URLs, open or create literature notes, attach PDFs, search for `.csl` files online, and more.
- __Blazingly Fast:__ considerably quicker than any other citation pickers (~200 ms to fully reload a library with ~4000 entries).
- __Simple Installation:__ No required plugins, no setup. Just enter the path to your `.bib` file.
- __Minimalistic reference manager__: add or remove entries to the BibTeX library, automatically rename and file PDFs, and more.
- __Obsidian integration:__ When located in an [Obsidian](https://obsidian.md/) vault, literature notes are automatically opened or created in Obsidian instead of the default markdown app.
- __Obsidian integration:__ When located in your [Obsidian Vault](https://obsidian.md/), literature notes are automatically opened or created in Obsidian instead of the default markdown app.

## Table of Contents
<!--toc:start-->
Expand All @@ -28,7 +28,7 @@ A citation picker and minimalistic reference manager for [Alfred](https://www.al
- [Icon Meanings](#icon-meanings)
- [Changing the Citation Format](#changing-the-citation-format)
- [Available Formats](#available-formats)
- [Further Format Customization](#further-format-customization)
- [Other Format Customization](#other-format-customizations)
- [Advanced Usage](#advanced-usage)
- [Bibliography Actions](#bibliography-actions)
- [Literature Note Actions](#literature-note-actions)
Expand All @@ -49,17 +49,17 @@ A citation picker and minimalistic reference manager for [Alfred](https://www.al
Press the hotkey in any text field to start the citation picker.

### Search
- Search for the title, author/editor (last name), year, or collection or journal-title.
- You can search for the title, author/editor (last name), year, or collection or journal-title.
- Prepend `@` to a word to search for a citekey, for example `@Grieser2020`.
- Prepend `#` to search for keywords (tags), for example `#sociology`.
- *Smart Queries*: You can search for any combination of the above. For example, the query `2020 #cognition Grieser` searches for entries published in 2020, with the tag "cognition," and with "Grieser" as author/editor.
- *Smart Queries*: You can search for any combination of the above. For example, the query `2020 #cognition grieser` searches for entries published in 2020, with the tag "cognition," and with "Grieser" as author/editor.

### Citation Actions
- ``: Paste the citekey of the selected citation.
- `⌥ + ↵`: Add another citation.
- `⌘⇧ + ↵`: Paste an inline-citation (citation without surrounding formatting, for example `@Grieser2022` instead of `[@Grieser2022]`)
- `⌘ + ↵`: Add page numbers before pasting the selected citekey.
- Confirm the page number with `⌥ + ↵` to add another citation afterwards.
- Confirm the page number with `⌥ + ↵` to add another citation afterward.
- Confirm with `⌘⇧ + ↵` for an inline-citation with page number (`@Grieser2022 [p. 42]`).

### URL Actions
Expand All @@ -82,35 +82,36 @@ Press the hotkey in any text field to start the citation picker.
### Available Formats
You can use the `scp` and select __Change Citation Format__ to change the format of the citations:

- Pandoc (default)
- pandoc (default)
- Org Mode
- Multi-Markdown (MMD)
- Latex
- Eta template
- LaTeX
- eta
- iA Writer
- Wikilink
- wikilink
- Tag
- Bare Citekey
- Bracketed Citekey
- bare citekey
- bracketed citekey

> __Note__
> Not all formats support all citation-related features. For example, adding Page numbers as well as inline-citations are not supported for Latex, Wikilinks, and Tags, and iA Writer does not support multiple citations.
### Further Format Customization
### Other Format Customizations
If you want to use a format that is not available, you can customize the format yourself by changing the workflow environment variables starting with `_format`. (Tutorial: [how to set environment variables in Alfred](https://www.alfredapp.com/help/workflows/advanced/variables/#environment))

If there is a citation syntax that is commonly used, or if you want to improve support for an existing format, feel free to make a PR to [this file which generates the formats](https://github.com/chrisgrieser/alfred-bibtex-citation-picker/blob/main/scripts/toggle-citation-format.js) or open a [Feature Request](https://github.com/chrisgrieser/alfred-bibtex-citation-picker/issues/new?assignees=&labels=enhancement&template=feature_request.yml&title=Feature+Request%3A+).
If there is a citation syntax that is commonly used, or if you want to improve support for an existing format, feel free to open a [Feature Request](https://github.com/chrisgrieser/alfred-bibtex-citation-picker/issues/new?assignees=&labels=enhancement&template=feature_request.yml&title=Feature+Request%3A+).
You can also make a PR to [this file which defines the citation formats](https://github.com/chrisgrieser/alfred-bibtex-citation-picker/blob/main/scripts/toggle-citation-format.js).

## Advanced Usage

### Bibliography Actions
- `⇧ + ↵`: Reveal the entry in Zotero, neovim, BibDesk, VS Code, or Sublime, depending on the setting in the workflow configuration.
- `⌘⌥ + ↵`: Paste the full bibliographic entry in the APA 6th Style (requires [Pandoc](https://pandoc.org/installing.html)).
- `⌘ + L`: Preview the (unabridged) title, abstract, and list of keywords in Large type.
- `⌘ + L`: Preview the (unabridged) title, abstract, and list of keywords.
- `⌘fn + ↵`: Delete the entry from the BibTeX library. (⚠️ This feature is untested with BibTeX files created with apps other than BibDesk and Bookends. [Create an issue](https://github.com/chrisgrieser/alfred-bibtex-citation-picker/issues) for problems with other apps.)
- `universal action`: Uses the selected __DOI__, __ISBN__, or __URL containing a DOI__ to add a new entry to the library.
- *Experimental:* A second universal action can be used to parse & add a bibliographic entry. Requires [anystyle](https://github.com/inukshuk/anystyle).
- The new entry is added to your library, with a correctly formatted and unique citekey. Afterwards, the entry is opened.
- The new entry is added to your library, with a correctly formatted and unique citekey. Afterward, the entry is opened.
- `file action`: Use the "Add Entry and Auto-file" action on a PDF file that includes a DOI. The DOI is automatically retrieved from the PDF, the entry added to the library, and the PDF auto-filed (see [PDF Management Actions](#pdf-management-actions)). Requires [pdfgrep](https://pdfgrep.org/).

> __Note__
Expand All @@ -120,9 +121,9 @@ If there is a citation syntax that is commonly used, or if you want to improve s
- The citation picker looks in the folder specified in the workflow settings for files that are *exactly* named like the citekey, optionally followed by an underscore and some text like `{citekey}_{title}.md`. The citekey must not contain underscores (`_`), the filename should not include the `@`.
- Entries that have such a literature note is indicated by a `📓`.
- `⌃⌥ + ↵`[^2]: Open the literature note.
- If the file is in an [Obsidian Vault](https://obsidian.md/), it is opened directly in Obsidian instead of the default text editor.
- If the file is in your [Obsidian Vault](https://obsidian.md/), it is opened directly in Obsidian instead of the default text editor.
- If there is no literature note, a new one is created.
- `⌘ + Y`: Preview the literature note with QuickLook (requires QLmarkdown or Peek[^1]).
- `⌘ + Y`: Preview the literature note with `QuickLook` (requires `QLmarkdown` or `Peek`[^1]).
- Add `*` to any search query to filter only for entries with literature notes, for example `* grieser` searches for entries matching "grieser" which also have a literature notes. Can be combined with other queries (see: [smart queries](#search)).

### PDF Management Actions
Expand All @@ -131,17 +132,18 @@ The following features require that all your PDFs are located in the folder spec
- `fn + ↵`: __Auto-file and auto-rename__ the *currently selected PDF*. Inside your selected PDF folder, uses the template path: `{first_letter_of_citekey}/{citekey-author-part}/{citekey}_{shortened_title}.pdf`
- The `📕` indicates that the entry already has an associated PDF at that location.
- `Hyper + ↵`[^2]: If the entry has an associated PDF file, open it with the default PDF reader. The citekey must not contain an underscore (`_`).
- ℹ️ Add `pdf` to any search query to filter only for entries with PDFs that have been added by the auto-file feature. `pdf grieser`, for example, displays only entries from the author "Grieser" with PDFs. Can be combined with other queries (see: [smart queries](#search)).
- Add `pdf` to any search query to filter only for entries with PDFs that have been added by the auto-file feature. `pdf grieser`, for example, displays only entries from the author "Grieser" with PDFs. Can be combined with other queries (see: [smart queries](#search)).

### Auxiliary Features
<!-- vale Vale.Spelling = NO -->
Triggered via the Alfred Keyword `scp` (for `S`upercharged `C`itation `P`icker).

- __Cheat sheet: Citation Picker Actions__: Open a cheat sheet of the available actions of the Supercharged Citation Picker.
<!-- vale Vale.Spelling = YES -->
- __Cheatsheet: Citation Picker Actions__: Open a cheat sheet of the available actions of the Supercharged Citation Picker.
- __Citation Style Search__: Search for a citation style (`.csl` file), which is downloaded to the location specified in your workflow settings (default: `~/.pandoc/csl/`).
- __Force Buffer Reload__: Force a reload of the citation picker. Mostly for debugging purposes.

<!-- vale Google.FirstPerson = NO -->
## About the Developer
<!-- vale Google.FirstPerson = NO -->
In my day job, I am a sociologist studying the social mechanisms underlying the digital economy. For my PhD project, I investigate the governance of the app economy and how software ecosystems manage the tension between innovation and compatibility. If you are interested in this subject, feel free to get in touch.

### Profiles
Expand All @@ -159,9 +161,8 @@ In my day job, I am a sociologist studying the social mechanisms underlying the

### Credits
<a href="https://www.flaticon.com/authors/freepik">Icons created by Freepik (Flaticon)</a>

<!-- vale Google.FirstPerson = YES -->

[^1]: [QLmarkdown](https://github.com/sbarex/QLMarkdown) and [Peek](https://apps.apple.com/app/peek-quick-look-extension/id1554235898) both enable previewing of Markdown documents. Peek works with a wide range of other file types than Markdown, but costs around 5€. QLMarkdown is free, but only works for Markdown and requires some minor setup. To enable the proper display of YAML headers, you need to enable the respective setting in the Advanced Options of QLMarkdown or Peek.
[^1]: [QLmarkdown](https://github.com/sbarex/QLMarkdown) and [Peek](https://apps.apple.com/app/peek-quick-look-extension/id1554235898) both enable previewing of Markdown documents. Peek works with a wide range of other file types than Markdown, but costs around 5€. `QLMarkdown` is free, but only works for Markdown and requires some minor setup. To enable the proper display of YAML headers, you need to enable the respective setting in the Advanced Options of `QLMarkdown` or Peek.

[^2]: `Hyper` is an artificial "fifth" modifier key equal to `⌘⌥⌃⇧`, and can be created using apps like [Karabiner Elements](https://karabiner-elements.pqrs.org/), [BetterTouchTool](https://www.macupdate.com/app/mac/32953/bettertouchtool), or [Hyperkey](https://hyperkey.app/).
Loading

0 comments on commit 90ed731

Please sign in to comment.