jkitchin / org-ref

org-mode modules for citations, cross-references, bibliographies in org-mode and useful bibtex tools to go with it.
GNU General Public License v3.0
1.35k stars 242 forks source link

Patent citation #810

Closed notuntoward closed 3 years ago

notuntoward commented 3 years ago

I have a bib file containing IEEEtran format patent references. Would it be possible for org-ref to recognize them?

In the bibfile, when put the cursor on one of these @Patent entries, I'm able to run org-ref-bibtex-store-link without complaint. However when I go to a .org file and run org-insert-link, there's not cite link for the patent.

Here's an example patent bib entry:

@Patent{Hoff17riskProbFrcstRenewFleet_Pat,
  nationality = {USA},
  number      = {US 2017/0228834 A1},
  year        = {2017},
  yearfiled   = {2017},
  address     = {Napa, CA (US)},
  assignee    = {Clean Power Research L. L. C.},
  author      = {Thomas E. Hoff},
  day         = {10},
  dayfiled    = {24},
  language    = {English},
  month       = aug,
  monthfiled  = apr,
  title       = {Generating A Risk-Adjusted Probabilistic Forecast Of Renewable Power Production For A Fleet With The Aid Of A Digital Computer},
  type        = {patentus},
  url         = {https://www.freepatentsonline.com/y2017/0228834.html},
  abstract    = {Probabilistic forecasts of the expected power production of renewable power sources, such as solar and wind, are generally provided with a degree of uncertainty. The expected power production for a fleet can be projected as a time series of power production estimates overa time period ahead of the current time. The uncertainty of each power production estimate can be combined with the costs and risks associated with power generation forecasting errors, and displayed or visually graphed as a single, deterministic result to assist power grid operators (or planners) in deciding whether to rely on the renewable power source.},
  comment     = {},
  file        = {Official Patent:Hoff17riskProbFrcstRenewFleet_Pat.pdf:PDF;:Hoff17riskProbFrcstRenewFleet_PatTxt.docx:Word 2007+;:Hoff17riskProbFrcstRenewFleet_PatDrw.pdf:PDF},
}
jkitchin commented 3 years ago

I think this happens because patent is not a recognized bibtex type. See https://github.com/jkitchin/org-ref/issues/482 for some hints that might show you how to add a special type.

fleimgruber commented 3 years ago

@notuntoward The quick fix could be to just set (bibtex-set-dialect 'biblatex) in init?

@jkitchin Another issue I noticed while trying to reproduce: When point is on the bib entry, a C-c l (org-store-link), I get a helm buffer asking "Which function for creating the link?" and the candidates

org-store-link
org-bibtex-store-link

where org-bibtex-store-link is from ol-bibtex.el from the org-plus-contrib package. The choice of org-ref-bibtex-store-link is not in the default candidates, but I can make it show up if I spell out org-ref-bibtex-store-link which then works. Is this expected? My feeling is that org-ref-bibtex-store-link should show up there by default, what do you think? BTW, what would be the difference to org-ref-store-bibtex-entry-link in this case?

jkitchin commented 3 years ago

@notuntoward The quick fix could be to just set (bibtex-set-dialect 'biblatex) in init?

@jkitchin Another issue I noticed while trying to reproduce: When point is on the bib entry, a C-c l (org-store-link), I get a helm buffer asking "Which function for creating the link?" and the candidates

org-store-link
org-bibtex-store-link

where org-bibtex-store-link is from ol-bibtex.el from the org-plus-contrib package. The choice of org-ref-bibtex-store-link is not in the default candidates, but I can make it show up if I spell out org-ref-bibtex-store-link which then works. Is this expected? My feeling is that org-ref-bibtex-store-link should show up there by default, what do you think? BTW, what would be the difference to org-ref-store-bibtex-entry-link in this case?

I think that is expected behavior, and I don't know how to get org-ref-store-bibtex-entry-link to show up first. This happens inside org-store-link in ol.el at line 1495. It uses the first link name as the initial input. Probably no input would be better so you can see what is there. The only way around this would be to find a way to make sure org-ref-store-bibtex-entry-link comes first. I am not sure what it would take to do that though.

org-ref-bibtex-store-entry-link operates on a bibtex entry at point in a bib file org-ref-store-bibtex-entry-link saves a link to a bibtex entry from a cite link

jkitchin commented 3 years ago

This is a grungy kind of solution to avoid the initial input when multiple functions store links.

(defun scimax-store-link-advice (orig-fun &rest args)
  (cl-letf (((symbol-function 'symbol-name)
         (lambda (sym)
           "")))
    (apply orig-fun args)))

(advice-add 'org-store-link :around 'scimax-store-link-advice)
jkitchin commented 3 years ago

(bibtex-set-dialect 'biblatex)

This is indeed the issue and solution. I am going to close this issue.