jkitchin / org-ref-cite Goto Github PK
View Code? Open in Web Editor NEWAn org-cite processor that is like org-ref.
An org-cite processor that is like org-ref.
Dear John,
I have just realized that org-ref-cite does not allow one to insert a citation as a 1st item in a plain list, neither. On the other hand, it is nonetheless possible to copy and paste a citation to this position. This problem seems to be related to the previous issue I have raised (org-ref-cite not inserting citations as 1st item in footnotes). Unfortunately, I have not got a reaction to that preceding issue so far, although you have always been replied to any of my questions very quickly. So I hope this repo is still active.
Best regards,
Elias
I was reviewing the org-roam-bibtex
code to see what would be involved in adapting it for org-cite
.
It has a hydra now, with extension points to add additional actions. See this, and the following two functions.
So my question: is there a way it would be possible to offer an extension point on the hydra here, such that one could add ORB-related actions?
My follow processor is embark-act
based. so all that would be involved is registering a keymap.
I'm aware of limitations with regard to the simultaneous use of prefixes and suffixes in Org-ref-cite and I'd like to know if a combination like the following is not possible in Org-ref-cite:
In other words, using Org-ref-cite, how can I create two or more citations, each with a page reference, following one after another? I'm asking this because this is a citation case that is of course not uncommon in scientific papers. On the other hand, my Org-ref-cite version, unfortunately, considers it erroneous, cf. the suffix highlighted in red on the screenshot.
Thanks for your help in advance.
Now that everything is nicely modularized, the natural conclusion: two MELPA packages:
org-ref-cite
(or org-ref-cite-ivy
)org-ref-cite-core
1 would only install the main file (and maybe org-ref-cite-insert.el
?), but have a package-requires for 2.
2 would install everything, but exclude 1.
Would allow developers to add the package-requires for 2, without installing ivy.
It seems a local bibliography defined using #+bibliography: is not checked and the citation is highlighted as missing if it is not in the global bibliography.
Sorry for the noob question, but I'm a little shaky when it comes to different parts of ivy.
Is it possible for the menu that is created when your open the alternative actions to match the one that happens when you click on the link (the follow action)? That menu looks really nice an having consistent keybindings is nice (for example, edit notes is e
in the alternate options for insert but is n
when using follow).
I guess the main disconnect is that I often am using the insert action as a menu to interact with my bibliography without having to insert the link first, not sure if there is a better way I should be handling that use case.
If I insert this citation:
[cite:@kaye2017;@amin2008;@kohn2001]
... and then shift any citation, I end up with a spurious semi-colon at the end.
[cite:@kaye2017;@kohn2001;@amin2008;]
Though, I guess this relates to earlier discussion about global vs local affixes, and isn't technically wrong.
My apologies if I have missed something obvious. I was wondering if org-ref/org-ref-cite have any tool build in for adding bibliographic entries manually to the bibtex database. How do you do it? That is, if I need to manually insert a reference in the bibtex database while working on an org file, does org-ref-cite provide me some key bindings that would open something like ebib?
When I try to insert a citation as the first item into a non-inline-definition footnote, org-ref-cite refuses to insert the citation returning in the minibuffer "Cannot insert citation here". The same problem does not occur if the footnote has an inline definition. As for non-inline-definition footnotes, if I copy the citation into the footnote, no problem occurs, either. The citation is also properly exported to LaTeX. Thanks for your help!
Even if you don't want to do this yourself, @jkitchin, I thought I'd pull this into a separate issue, in part because export processors are another area I have not yet worked with.
If this can work, the advantage is the UI can adapt to the user setup, and so it can be a general solution, without need for user config.
WDYT?
Also, little thing: how do I parse a string into a citation object?
I feel like this is not possible. What would you do in an org-file that is going to be used for multiple exports, e.g. There will be a pdf version (via latex), an html version, an ODT version, and a plain text version. What does an accurate preview even mean? It will be different depending on the output.
The idea was just to run it to produce the plain text output, since it's not intended to be WYWIWG; more just help the user know what style to choose.
So for the TeX processors, would produce the same output as we have in our current UIs, but CSL would produce the kind of output you see in the csl-activate
processor (which is also not a precise representation, and uses a default style).
The user would likely be able to choose which to display, and/or it would be auto-configured based on the export processors the user has set up.
Might even involve curated input example, to be sure to show what some of the variants (notable "full" and "caps) will produce.
Originally posted by @bdarcus in #6 (comment)
I tried to figure out how to fix this, but couldn't.
Interestingly, standard hydra
has the :columns
parameter, which looks like it should format columns correctly. But pretty-hydra
doesn't appear to support it .
If you could remove the colon, as in transient
, then adding the preceding space would align it all,
I'm still not sure the best UI here (see emacs-citar/citar#203), but assuming the current behavior here is, add a preview annotation to the list of keys to select from?
org-ref-cite/org-ref-cite-follow.el
Line 298 in c1347c4
Also, I would maybe change the prompt to "Citation key " or (org-cite language) "Citation reference"?
Hi! I'm not sure why this error comes up each time I install org-ref-cite on my doom-emacs setup. I'm also very new to emacs world, so if there is anything else that might help, please tell me to report.
Error running timer ‘flyspell-lazy-check-visible’: (invalid-function (code entity export-snippet inline-babel-call inline-src-block line-break latex-fragment link macro statistics-cookie target timestamp verbatim citation citation-reference)) [2 times]
Debugger entered--Lisp error: (invalid-function (code entity export-snippet inline-babel-call inline-src-block line-break latex-fragment link macro statistics-cookie target timestamp verbatim citation citation-reference))
(code entity export-snippet inline-babel-call inline-src-block line-break latex-fragment link macro statistics-cookie target timestamp verbatim citation citation-reference)(nil)
org-ref-cite--flyspell-object-check-p((paragraph (:begin 13302 :end 13547 :contents-begin 13302 :contents-end 13547 :post-blank 0 :post-affiliated 13302 :parent nil)))
apply(org-ref-cite--flyspell-object-check-p (paragraph (:begin 13302 :end 13547 :contents-begin 13302 :contents-end 13547 :post-blank 0 :post-affiliated 13302 :parent nil)))
org--flyspell-object-check-p((paragraph (:begin 13302 :end 13547 :contents-begin 13302 :contents-end 13547 :post-blank 0 :post-affiliated 13302 :parent nil)))
org-mode-flyspell-verify()
flyspell-word()
flyspell-check-region-doublons(13498 14739)
flyspell-large-region(13498 14739)
flyspell-region(13498 14739)
flyspell-lazy-check-visible()
apply(flyspell-lazy-check-visible nil)
explain-pause--wrap-callback(#s(explain-pause-command-record :command idle-timer :native t :parent #s(explain-pause-command-record :command root-emacs :native nil :parent nil :executing-time 31980 :entry-snap (24852 11566 804425 188000) :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 0) :executing-time 0 :entry-snap nil :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 1) flyspell-lazy-check-visible)
apply(explain-pause--wrap-callback (#s(explain-pause-command-record :command idle-timer :native t :parent #s(explain-pause-command-record :command root-emacs :native nil :parent nil :executing-time 31980 :entry-snap (24852 11566 804425 188000) :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 0) :executing-time 0 :entry-snap nil :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 1) flyspell-lazy-check-visible))
timer-event-handler([t 0 3 0 t explain-pause--wrap-callback (#s(explain-pause-command-record :command idle-timer :native t :parent #s(explain-pause-command-record :command root-emacs :native nil :parent nil :executing-time 31980 :entry-snap (24852 11566 804425 188000) :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 0) :executing-time 0 :entry-snap nil :too-slow nil :is-profiled nil :under-profile nil :profile nil :depth 1) flyspell-lazy-check-visible) idle 0])
I'd like to try out org-ref-cite which I find very interesting (apart from the package bibtex-actions). So I cloned the git repository, copied the set up to my init and adjusted the paths. In addition, I installed the packages org-ref-cite depends on. Unfortunately, I still get the message Error (use-package): Cannot load org-ref-cite
. Is it possible to have org-ref-cite alone without the rest of scimax? Or is maybe some kind of installation of org-ref-cite needed I am not aware of? Thanks a lot of your help in advance.
This is a followup to:
In the latter, @jkitchin says:
I don't see why you couldn't require that lib, and add (org-cite-csl-activate citation) into an activate function. I already sort of do that in oc-bibtex.el, I call (org-cite-basic-activate citation) and then add some extra properties.
So this is the line in question:
(defun org-ref-cite-activate (citation)
"Add a keymap to cites.
Argument CITATION is an org-element holding the references."
(org-cite-basic-activate citation)
So you're just using `oc-basic for fontification?
As in, that line could be changed to use org-cite-csl-activate
instead?
If yes, could you add a variable so we can just set that with setq
?
And on the flip side, perhaps @andras-simonyi could do something similar on his end to import your functionality?
Or are you saying we should write our own active processor that imports logic from these two activate processors?
What do you two think?
One issue with the org-cite design is insert processors are less modular than they could be, unless you use org-cite-make-insert-processor
.
I do use it, so can separately specify functions for editing the style, and inserting the keys, and it is therefore easy for people to create an alternative that uses a different style UI.
But you don't.
Perhaps you could add an extension point to your insert processor to allow a different one be used here?
I'm totally agnostic, BTW, where a really kick-ass, general, style editing UI lives.
I am currently in the process of splitting out mine into a separate oc-bibtex-actions-insert.el
file:
But my goal is one that works well across any export processor, and which generates the previews from those export processors, so that they are always accurate, and the code is simpler to maintain.
PS - I'm learning that the long-term future of the ivy module in Doom is uncertain (there's been talk of deprecating it). So it's possible I can't include the full package with the insert processor anyway. Even if so, the question is relevant more widely, and certainly to the hydra.
It occurred to me we can leverage the org-cite syntax for cross-references, e.g. [cite/ref:@Label] would be a cross-reference to "label" defined in a CUSTOM_ID on a heading, a NAME or in raw latex like \label{label}.
You could use substyles for equations, pageref, etc. e.g. [cite/ref/eq:@Label] for an equation.
You could also use a prefix to indicate a figure, table, equation, e.g. [cite/ref/eq:Equation @Label]
This adds a bit of complexity to the processors, and probably won't be fully supported by all of them. For LaTeX though, it would make for a total replacement of org-ref.
Hi, thank you for such an awesome package, can't wait for it going on MELPA. Though org 9.5 has been released, it can be considered 😄
After a brief try, I have a suggestion if we can speed up (require 'org-ref-cite)
by lazy loading. While I know I could just require parts of it, I think lazy loading features would make it easier for newbies to use.
For example:
(require 'org-ref)
if the user didn't need it. (benchmark-run (require 'org-ref-cite-compat)) ;; (2.06666 0 0.0)
ivy-set-display-transformer
and other non-defined settingsI am trying to use your setup of org-cite
and org-ref-cite
but I keep getting the error
Cannot open load file: No such file or directory, org-cite.
My adjusted setup is:
(add-to-list 'load-path "/Users/XXX/github/org-mode/lisp/")
(use-package org-cite
:load-path "/Users/XXX/github/org-mode/lisp/"
:config
(require 'oc-csl)
)
The folder org-mode
is the git-repo from https://code.orgmode.org/bzg/org-mode
Using Emacs 27.2 and use-package
is also installed.
I cannot find any difference to your setup. Any guidance would be appreciated. Thank you.
Hi, I cannot seem to pinpoint the issue, but, with my current configuration, calling org-cite-insert
just looks weird...
... while it looks as expected when I call ivy-bibtex
:
My configuration is:
(use-package! ivy-bibtex
:after org-roam
:init
(setq bibtex-completion-notes-path org-roam-directory)
(setq bibtex-completion-bibliography (concat org-roam-directory "master.bib"))
(setq bibtex-completion-pdf-field "file")
(setq bibtex-completion-additional-search-fields '(keywords))
(setq bibtex-completion-display-formats
'((article . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${journal:40}")
(inbook . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} Chapter ${chapter:32}")
(incollection . "${=has-pdf=:1}${=has-note=:https://github.com/blaisewang/img2latex-mathpix1} ${year:4} ${author:36} ${title:*} ${booktitle:40}")
(inproceedings . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}")
(t . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*}")))
:config
(ivy-mode +1))
(use-package! org-ref-cite
:after org-roam
:config
(add-to-list 'org-cite-global-bibliography bibtex-completion-bibliography)
(setq org-cite-insert-processor 'org-ref-cite)
(setq org-cite-follow-processor 'org-ref-cite)
(setq org-cite-activate-processor 'org-ref-cite)
(setq org-cite-export-processors '((latex org-ref-cite))))
Additionally, calling org-cite-insert
with a prefix does not work at all, it gives me an empty menu to choose from:
I am very curious to find out where I screwed up this configuration and why it does not work. Maybe more experienced users can quickly spot this issue.
Additional Information:
I tried to insert a citation in a footnote. Unfortunately, when exporting to pdf (via LaTeX) the citation is ignored, i.e., it is left out and does not appear in the pdf and the preceding LaTeX output. Is there a way to make references appear in the footnotes or is there rather a mistake in my set up of org-ref-cite? Thanks in advance for you help.
The following text in Orgmode markup
is exported to LaTeX as:
My Org-ref-cite set up is as follows:
;;======Org-ref-cite===========
(use-package ivy-bibtex
:init
(setq bibtex-completion-bibliography '("~/elisp/org-ref-cite/references_2021_09_05.bib")
bibtex-completion-notes-path "~/elisp/org-ref-cite/notes"
bibtex-completion-notes-template-multiple-files "#+TITLE: Notes on: ${author-or-editor} (${year}): ${title}\n\nSee [cite/t:@${=key=}]\n"
bibtex-completion-library-path '("~/elisp/org-ref-cite/bibtex-pdfs/")
bibtex-completion-additional-search-fields '(keywords)
bibtex-completion-display-formats
'((article . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${journal:40}")
(inbook . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} Chapter ${chapter:32}")
(incollection . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}")
(inproceedings . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}")
(t . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*}"))
bibtex-completion-pdf-open-function
(lambda (fpath)
(call-process "open" nil 0 nil fpath))))
(use-package citeproc)
(use-package oc
:load-path "~/elisp/org-mode/lisp"
:config
(require 'oc-biblatex))
(add-to-list 'load-path "~/elisp/org-ref-cite/")
;;ensures oc-csl uses local variants of styles
(setq org-cite-csl-locales-dir "~/locales")
(use-package org-ref-cite
:load-path "~/elisp/org-ref-cite/"
:config
;; I like green links
(set-face-attribute 'org-cite nil :foreground "DarkSeaGreen4")
(set-face-attribute 'org-cite-key nil :foreground "forest green")
(setq
org-cite-global-bibliography bibtex-completion-bibliography
;; https://github.com/citation-style-language/styles
;; or https://www.zotero.org/styles
org-cite-csl-styles-dir "~/elisp/org-ref-cite/csl-styles"
org-cite-insert-processor 'org-ref-cite
org-cite-follow-processor 'org-ref-cite
org-cite-activate-processor 'org-ref-cite
org-cite-export-processors '((html csl "chicago-author-date-16th-edition.csl");;
(latex biblatex)
(t basic)))
(define-key org-mode-map (kbd "C-c \\") 'org-cite-insert))
(setq flyspell-duplicate-distance 0
flyspell-mark-duplications-flag nil
warning-minimum-level :error)
;;===Ivy configuration: Activating ivy-mode===
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "(%d/%d) ")
I gather that [cite:prefix @key suffix]
should export to \cite[prefix][suffix]{key}
.
The following is legal syntax:
[cite:prefix1 @key1 suffix1; pre2 @key2 suffix2]
What is this expected to export to (to LaTeX using natbib, with bibtex (not biblatex) as the citation processor)?
Similarly, if you were to shift key2 to come first, what is the expected new citation?
Is it [cite: pre2 @key2 suffix2, prefix1 @key1 suffix1]
or should it be [cite: pre1 @key2 suffix2, prefix1 @key1 suffix2]
(i.e. preserving the original prefix and suffix)?
@bdarcus What do you think? Are these supported differently in other backends?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.