# Creating html document notes with org-roam-bibtex

**URL:** <https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396>\
**Category:** Development\
**Created:** [June 16, 2020, 8:39pm UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396 "2020-06-16T20:39:44Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![bepolymathe](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/bepolymathe/32/688_2.png) [@bepolymathe](https://org-roam.discourse.group/u/bepolymathe)\
**Post date:** [June 16, 2020, 8:39pm UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/1 "2020-06-16T20:39:44Z")

</div>

Hi @zaeph ,

A question of the evening. I have a lot of references from websites and blogs in my zotero… so in my biblio.bib file like :

```
@online{kuan_how_2020,
  title = {How {{To Take Smart Notes With Org}}-Mode -},
  author = {Kuan, Jethro},
  date = {2020-02-14},
  url = {https://blog.jethro.dev/posts/how_to_take_smart_notes_org/}
  urldate = {2020-06-16},
  file = {/home/manu/Zotero/storage/3C34ZK85/how_to_take_smart_notes_org.html},
  keywords = {emacs,org-mode,org-roam}
}

```

My question : Is it possible to create a note via orb-note-action? That would mean a configuration in org-ref but which one?  
And more generally how do you manage web documents in zotero AND org-roam?  
Have a nice evening.

---

<div class="post-metadata">

**Author:** ![zaeph](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/zaeph/32/764_2.png) [@zaeph](https://org-roam.discourse.group/u/zaeph)\
**Post date:** [June 17, 2020, 6:32am UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/2 "2020-06-17T06:32:35Z")

</div>

`org-note-actions` is not for creating notes, but for running `helm/ivy`-like actions on the note.

ORB patches the `Open notes` action in `org-ref` and the `Edit notes` in `helm-`/`ivy-bibtex`, which are the commands you’re supposed to use to create your notes. ORB is mostly about helping you create your bibliographic notes by providing access to BibTeX fields during the template-expansion. [Check our manual for details](https://github.com/org-roam/org-roam-bibtex#configuration).

I know that we’re doing a bad job at explaining what ORB is doing, but this is something that I’m hoping to address soon with [#830](https://github.com/org-roam/org-roam/issues/830).

---

<div class="post-metadata">

**Author:** ![bepolymathe](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/bepolymathe/32/688_2.png) [@bepolymathe](https://org-roam.discourse.group/u/bepolymathe)\
**Post date:** [July 15, 2020, 1:42pm UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/3 "2020-07-15T13:42:47Z")

</div>

Hi @zaeph,

If I wanted to modify orb-templates to be able to edit notes for pdf but also html documents how should I adapt it?

---

<div class="post-metadata">

**Author:** ![mshevchuk](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mshevchuk](https://org-roam.discourse.group/u/mshevchuk)\
**Post date:** [July 15, 2020, 7:24pm UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/4 "2020-07-15T19:24:08Z")

</div>

Hi @bepolymathe,

I don’t understand what you mean by being “able to edit notes for pdf and html documents”. Could you please elaborate?

---

<div class="post-metadata">

**Author:** ![bepolymathe](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/bepolymathe/32/688_2.png) [@bepolymathe](https://org-roam.discourse.group/u/bepolymathe)\
**Post date:** [July 16, 2020, 7:33am UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/5 "2020-07-16T07:33:46Z")

</div>

Hi @mshevchuk ,

Yes, my explanations may not be very clear.

I use Zotero (with betterbibtex extension) to generate my bibliography in .bib file. It contains references to articles and books but also to many online documents (blog, press, etc) of which I only have an html copy. I would like to be able to use org-roam and org-roam-bibtex to take notes related to these html documents as I already do for pdf articles.

So I’m wondering how to modify my configuration (probably my template) to do this. Is it clearer?

---

<div class="post-metadata">

**Author:** ![mshevchuk](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mshevchuk](https://org-roam.discourse.group/u/mshevchuk)\
**Post date:** [July 16, 2020, 9:29am UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/6 "2020-07-16T09:29:31Z")

</div>

@bepolymathe, not really, sorry.

First of all let’s fix up the terminology, this is often the reason why people misunderstand each other. So, BibTeX files do not contain references, they instead contain `entries` in the form of bibliographic `records` that follow a special BibTeX syntax. BibTeX `records` contain `fields` in the form of `key = value` pairs. A typical BibTeX record looks like this (examples are taken from [here](https://www.overleaf.com/learn/latex/bibliography_management_with_bibtex)):

```auto
N.B. A BibTeX record starts with the "at" symbol and runs until the outermost 
balanced "}" symbol, everything else are comments

A BibTeX record
entry type: "article"
BibTeX key: "einstein1905"
"author" is the name of a field (its key)
"Albert Einstein" is the the value of the filed "author"
------------------------------------
@article{einstein1905,
    author = "Albert Einstein",
    title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
        [{On} the electrodynamics of moving bodies]",
    journal = "Annalen der Physik",
    volume = "322",
    number = "10",
    pages = "891--921",
    year = "1905",
    DOI = "http://dx.doi.org/10.1002/andp.19053221004"
}

another BibTeX record
entry type: "book"
BibTeX key: "latexcompanion1993"
------------------------------------
@book{latexcompanion1993,
    author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
    title = "The \LaTeX\ Companion",
    year = "1993",
    publisher = "Addison-Wesley",
    address = "Reading, Massachusetts"
}

yet another BibTeX record
entry type: "misc"
BibTeX key: "knuthwebsite"
------------------------------------
@misc{knuthwebsite,
    author = "Donald Knuth",
    title = "Knuth: Computers and Typesetting",
    url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}

```

Now, Org Roam package doesn’t care about BibTeX at all, it even doesn’t know BibTeX exists. With Org Roam you can take notes about anything you like.

Org Roam BibTeX package, however, offers some integration of BibTeX into Org Roam. It is able to read your bibliography `.bib` file or files and put the retrieved information into an Org Roam template when a note is created. This can be achieved if you have placed special placeholders into your `org-roam-capture-templates` or `orb-templates`. When you create a note from `helm-bibtex` or `org-ref`, before the note’s template is expanded by `org-roam`, `org-roam-bibtex` reads the corresponding BibTeX record (`helm-bibtex` or `org-ref` have told it which exactly record to read) and “preformats” the placeholders with the `values` of the corresponding `fields`. Typically, a placeholder contains the field `name`, e.g. `${author}` will be replaced with “Albert Einstein”, `${journal}` will be replaced with “Annalen der Physik” and so on. This is how you get `#+ROAM_KEY: einstein1905` from `#+ROAM_KEY: ${citekey}`.

But Org Roam BibTeX is completely agnostic with regard to what `entry` types you have, e.g `@article`, `@book` or `@misc`. It also doesn’t care about field `keys` and `values`. It works equally well for all of them. It also doesn’t know and doesn’t care about PDFs or HTML when creating a note.

After you’ve created a note, it is possible to run `orb-note-actions` to access such commands as “open PDF file” or “open URL link”. When you call such an action, Org Roam BibTeX looks for the entry `key` stored in `#+ROAM_KEY:` property, looks for the BibTeX record with this `key` and retrieves the values from `file` or `url` fields. If these values are retrievable, i.e. present in the particular `record`, Org Roam BibTeX will run the commands to open the PDF or URL.

There theoretically can be bugs in Org Roam BibTeX or the packages it depends on that will cause it to fail or produce some errors if you have non-conventional BibTeX entry `types`, but none that I’m aware of.

If you happen to explain your workflow in more detail, like “first I run this command, then I run this command and finally I run this command and this is my configuration file together with the relevant BibTeX record”, and also explain what prevents you from creating notes from your "html documents ", I’ll be happy to help you.

---

<div class="post-metadata">

**Author:** ![bepolymathe](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/bepolymathe/32/688_2.png) [@bepolymathe](https://org-roam.discourse.group/u/bepolymathe)\
**Post date:** [July 16, 2020, 9:53am UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/7 "2020-07-16T09:53:15Z")

</div>

Thank you for this detailed and educational response. I appreciate it.

Let’s try it step by step.

1. I have this entry.

2. I find it in my bibliography thanks to `helm-bibtex`.

 ![image](https://global.discourse-cdn.com/free1/uploads/orgroam/original/1X/66429d72fe85dcc26f53a566efbd6da5668cc350.png)

1. I try to edit note

![image](https://global.discourse-cdn.com/free1/uploads/orgroam/original/1X/54981544cb4eb46095b0672280732577f63a5b33.png)

1. I have a error message “Cannot resolve a template to values”

And for information, my template looks like :

```
(setq org-roam-capture-ref-templates
      '(("r" "ref" plain (function org-roam-capture--get-point)
         "%?"
         :file-name "${slug}"
         :head "#+TITLE: ${title}
#+ROAM_KEY: ${ref}
#+ROAM_ALIAS:
#+ROAM_TAGS: \"web\"
#+CREATED: %u
#+LAST_MODIFIED: %U
- tags :: \n\n"
         :unnarrowed t)))
```

---

<div class="post-metadata">

**Author:** ![mshevchuk](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mshevchuk](https://org-roam.discourse.group/u/mshevchuk)\
**Post date:** [July 16, 2020, 10:04am UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/8 "2020-07-16T10:04:22Z")

</div>

Thank you! This is what I was asking for.

Could you please paste the value of `orb-templates` and `org-roam-capture-templates`. The first one is responsible for creating notes, but if its value is nil, then the second one is used.

Are you sure the error message reads “Cannot resolve a template to values”? I could not find this error message neither in our packages nor in the associated ones.

---

<div class="post-metadata">

**Author:** ![mshevchuk](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mshevchuk](https://org-roam.discourse.group/u/mshevchuk)\
**Post date:** [July 16, 2020, 10:11am UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/9 "2020-07-16T10:11:06Z")

</div>

@bepolymathe, ok, I found what’s producing the error. I think the problem’s in your `orb-templates` or `org-roam-capture-templates` whichever you use.

---

<div class="post-metadata">

**Author:** ![bepolymathe](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/bepolymathe/32/688_2.png) [@bepolymathe](https://org-roam.discourse.group/u/bepolymathe)\
**Post date:** [July 16, 2020, 11:25am UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/10 "2020-07-16T11:25:13Z")

</div>

Hi,

My `orb-template`

```
(setq orb-templates
      '(("r" "ref" plain (function org-roam-capture--get-point)
         ""
         :file-name "${slug}"
         :head "#+TITLE: ${=key=}: ${title}\n#+ROAM_KEY: ${ref}

- tags ::
- keywords :: ${keywords}

\n* ${title}\n :PROPERTIES:\n :Custom_ID: ${=key=}\n :URL: ${url}\n :AUTHOR: ${author-or-editor}\n :NOTER_DOCUMENT: %(orb-process-file-field \"${=key=}\")\n :NOTER_PAGE: \n :END:\n\n"

 :unnarrowed t)))

```

My `org-roam-capture-templates`

```
(setq org-roam-capture-templates
  '(("d" "default" plain (function org-roam-capture--get-point)
     "%?"
     :file-name "${slug}"
     :head "#+TITLE: ${title}
#+ROAM_ALIAS:
#+ROAM_TAGS:
#+CREATED: %U
#+LAST_MODIFIED: %U\n
- tags :: \n\n"
     :unnarrowed t)))
```

---

<div class="post-metadata">

**Author:** ![mshevchuk](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mshevchuk](https://org-roam.discourse.group/u/mshevchuk)\
**Post date:** [July 16, 2020, 12:09pm UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/11 "2020-07-16T12:09:57Z")

</div>

@bepolymathe The problem here is that you have `author-or-editor` field set for pre-formatting in your template and in `orb-preformat-keywords`, but your BibTeX entry contains neither `author` nor `editor` fields. As far as I can see it, the `article` and `book` entries you get from PDF files in Zotero have the author field set, while the `online` entries you get from websites do not contain the author field, making an impression that “PDF documents” work and “HTML” do not work.

This is clearly a bad behaviour of `org-roam-bibtex` that should be fixed. Please, file a bug issue at [org-roam-bibtex](https://github.com/org-roam/org-roam-bibtex/issues).

Meanwhile as a workaround, either populate your `online` entries with the `author` field, or remove `"author-or-editor"` from `orb-preformat-keywords`, or remove `${author-or-editor}` placeholder from your template.

---

<div class="post-metadata">

**Author:** ![bepolymathe](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/bepolymathe/32/688_2.png) [@bepolymathe](https://org-roam.discourse.group/u/bepolymathe)\
**Post date:** [July 16, 2020, 12:47pm UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/12 "2020-07-16T12:47:52Z")

</div>

Thanks for that 👍

> [@mshevchuk](#):
>
> This is clearly a bad behaviour of `org-roam-bibtex` that should be fixed. Please, file a bug issue at [org-roam-bibtex](https://github.com/org-roam/org-roam-bibtex/issues).

DONE --» [https://github.com/org-roam/org-roam-bibtex/issues/83](https://github.com/org-roam/org-roam-bibtex/issues/83)

---

<div class="post-metadata">

**Author:** ![mshevchuk](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mshevchuk](https://org-roam.discourse.group/u/mshevchuk)\
**Post date:** [July 16, 2020, 1:13pm UTC](https://org-roam.discourse.group/t/creating-html-document-notes-with-org-roam-bibtex/396/13 "2020-07-16T13:13:57Z")

</div>

Thank you!
