(mini guide) open access images in bibliography

Hello everyone,

I recently modified the bibliography style to include icons for open/closed access.

My aim was to create something similar to what Wikipedia has in their References, since in my opinion, it is a lot nicer if I - as the reader - can see directly whether I can access the resource, or if other means are necessary. This was surprisingly easy to do, so I wanted to share a rough how-to if anyone else is interested. For a general introduction into customizing the Bibliography style, refer to https://texmacs.github.io/notes/docs/create-bibliography-style.html.

In the Bibliography, I added

;; Define the openaccess field and default value
(define (bib-format-openaccess x)
  (let* ((oa (bib-field x "openaccess")))
    (if (or (bib-null? oa) (equal? oa "false"))
        `(image "logos/NoOpenAccess.png" 10pt "" "" "") ;; Image for non-open access
        `(image "logos/OpenAccess.png" 10pt "" "" "")))) ;; Image for open access

and for e.g. the article I appended

(tm-define (bib-format-article n x)
  (:mode bib-julius-one-num?)
  `(concat ,(bib-format-bibitem n x)
	   ,(bib-format-openaccess x) ;; Add openaccess icon
	   ,(bib-label (list-ref x 2))
	   ,(bib-new-block
...

In your project, there needs to be a logos folder in the root directory, with the following two images:

NoOpenAccess.png
OpenAccess.png
(both are CC0, and modified by me from here. Feel free to use them as you like.)

In your bibliography, there is a new entry that you need to add to your Resources: openaccess = {true}, (or openaccess = {false},).
If it is not defined, it will default to the closed access icon.

I hope that this can help someone :slight_smile: , feel free to ask questions/give suggestions.

3 Likes

Now you just need to open a pull request on tm-forge :slight_smile:

will do :slight_smile:

I’d still like to try a few things before that, to see if it is possible to put the icons somewhere else, so that it is not necessary to have that folder structure for every project that uses this style (e.g. by using an absolute path and putting it in the TeXmacs Home directory).

I did not realize that you meant the icons in the project directory. You might try the environment variable TEXMACS_HOME_PATH, which I think Scheme can use under every operating system.

1 Like