# Customize display of cite links

**URL:** <https://org-roam.discourse.group/t/customize-display-of-cite-links/129>\
**Category:** How To\
**Created:** [May 14, 2020, 7:10pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129 "2020-05-14T19:10:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![diagonallemma](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/diagonallemma/32/116_2.png) [@diagonallemma](https://org-roam.discourse.group/u/diagonallemma)\
**Post date:** [May 14, 2020, 7:10pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/1 "2020-05-14T19:10:01Z")

</div>

In my field, it is common to use author-year combinations or simply years as links to references. For example, an article might say:

> An alternative was presented by Lewis (1968) and Stalnaker (1974).

The years link to bibliography entries. Can I replicate something like this in my notes? Ideally, I’d like to have the following:

(1) When selecting a link from bibtex-completion, I’m offered a choice of using the year or author+year as link text.

(2) The link is then inserted as ‘[[cite:lewis1986counterpart][1968]’, for example, which displays as just ‘1968’. (At the moment, it displays in full, with all the brackets.)

Is that already possible?

---

<div class="post-metadata">

**Author:** ![bruce](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@bruce](https://org-roam.discourse.group/u/bruce)\
**Post date:** [May 14, 2020, 8:13pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/2 "2020-05-14T20:13:04Z")

</div>

Two things:

First, org is a structured format (like latex, or markdown), and citations are no different. Output presentation is more the focus of export or conversion.

But if you really want this …

… I think display config is handled by org-ref, so you’d want to check there.

BTW, the examples you gave would use the citet command.

---

<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:** [May 14, 2020, 8:15pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/3 "2020-05-14T20:15:45Z")

</div>

Theoretically, it could be possible, but I agree with @bruce: do you really need to have them show in the proper format in your `org` files? As long as they get extended properly in your exports, wouldn’t be all right to just have the citekey, which contains the same information?

---

<div class="post-metadata">

**Author:** ![diagonallemma](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/diagonallemma/32/116_2.png) [@diagonallemma](https://org-roam.discourse.group/u/diagonallemma)\
**Post date:** [May 14, 2020, 8:59pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/4 "2020-05-14T20:59:15Z")

</div>

Thanks. That’s the response I’ve seen elsewhere to this kind of questions. It makes sense for writing articles, where the end product is the exported pdf. But my zettelkasten notes are not written to be exported. They are meant to be read as org files, so I’d like them to be as readable as possible.

(There are other aspects to this as well. For example, I want LaTeX formulas and equations to be rendered properly, rather than shown as source, etc. Basically, I want the org file to look as much as an exported article as possible.)

---

<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:** [May 14, 2020, 9:10pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/5 "2020-05-14T21:10:51Z")

</div>

> [@diagonallemma](#):
>
> For example, I want LaTeX formulas and equations to be rendered properly, rather than shown as source, etc

cf. [LaTeX preview in org](https://orgmode.org/worg/org-tutorials/org-latex-preview.html)

> [@diagonallemma](#):
>
> Basically, I want the org file to look as much as an exported article as possible.

The problem is that, with Org-roam, we’re trying to stay true to Org-mode’s internals as much as possible, or to the default behaviour of the packages we employ, one of which is Org-ref. Org-ref provides us with the `cite:` links, which have their own formatting, and if we were to modify the way they work, it’d break compatibility with vanilla Org-mode and Org-ref.

Now, we can do it purely cosmetically, i.e., by fontifying the text with another version which might be retrieved via `bibtex-completion`, but this either introduces taxing operations upon loading/saving the file, or it has us modify the way `cite:` links work to display a description. The latter option could be discussed upstream.

---

<div class="post-metadata">

**Author:** ![bruce](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@bruce](https://org-roam.discourse.group/u/bruce)\
**Post date:** [May 14, 2020, 9:40pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/6 "2020-05-14T21:40:09Z")

</div>

Is it feasible (as in, a reasonable FR) for org-ref to add ability to hover over a cite link and get a preview of the formatted reference?

Nevermind; [already does this](https://github.com/jkitchin/org-ref/blob/master/org-ref.org#controlling-link-messages-and-tooltips) 🙂

[![](https://img.youtube.com/vi/ifSmlId2rk0/hqdefault.jpg "Improving org-ref cite links with tooltips") ](https://www.youtube.com/watch?v=ifSmlId2rk0)

@zaeph - any ideas why this isn’t working for me? Is there anything that org-roam is doing that would interfere with it, as it’s supposed to be default?

---

<div class="post-metadata">

**Author:** ![alan](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@alan](https://org-roam.discourse.group/u/alan)\
**Post date:** [May 14, 2020, 10:10pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/7 "2020-05-14T22:10:25Z")

</div>

I never got the tool-tip to work in org-ref, well before org-roam existed. Don’t know why.

---

<div class="post-metadata">

**Author:** ![bruce](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@bruce](https://org-roam.discourse.group/u/bruce)\
**Post date:** [May 14, 2020, 10:16pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/8 "2020-05-14T22:16:48Z")

</div>

Maybe we need to report it, if we can narrow down what’s going on?

---

<div class="post-metadata">

**Author:** ![alan](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@alan](https://org-roam.discourse.group/u/alan)\
**Post date:** [May 14, 2020, 10:52pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/9 "2020-05-14T22:52:14Z")

</div>

You can if you want to 😉 The minibuffer message has always worked, and I personally never really cared about the tooltip. I always chalked it up to one of those things that is supposed to function in his video but a lot of people had trouble with. Drag and drop PDF’s and url’s were others I remember being a common issue for people but I never bothered with them.

---

<div class="post-metadata">

**Author:** ![bruce](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@bruce](https://org-roam.discourse.group/u/bruce)\
**Post date:** [May 14, 2020, 11:28pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/10 "2020-05-14T23:28:21Z")

</div>

Maybe when org gets the new native citation support, this stuff will work there!

---

<div class="post-metadata">

**Author:** ![cobblepot](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@cobblepot](https://org-roam.discourse.group/u/cobblepot)\
**Post date:** [May 15, 2020, 3:49am UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/11 "2020-05-15T03:49:33Z")

</div>

I believe that org-ref has `citename:` and `citeyear:` options as well. I couldn’t find it in the online docs but it’s referenced in the github issues section.

---

<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:** [May 15, 2020, 8:20am UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/12 "2020-05-15T08:20:27Z")

</div>

> [@bruce](#):
>
> @zaeph - any ideas why this isn’t working for me? Is there anything that org-roam is doing that would interfere with it, as it’s supposed to be default?

Uh, that’s weird. It’s working all right on my end, minus the weird formatting issues because of the lack of support for the CSL, i.e., the inclusions of all the `{{…}}` meant to preserve capitals.

The bulk of our efforts with ORB so far have been with `bibtex-completion`, potentially reflects the usage discrepancy we have. I could look into it, but we’ve got more pressing matters to address with Org-roam for now.

---

<div class="post-metadata">

**Author:** ![diagonallemma](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/diagonallemma/32/116_2.png) [@diagonallemma](https://org-roam.discourse.group/u/diagonallemma)\
**Post date:** [May 15, 2020, 1:46pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/13 "2020-05-15T13:46:29Z")

</div>

Thanks @zaeph, I agree it might be an upstream issue, but I’m not sure it belongs to org-ref or bibtex-completion.

bibtex-completion actually has an option to insert author-year links: bibtex-completion-format-citation-org-apa-link-to-PDF, which display roughly the way I want. But the link leads to a PDF, so it breaks access to my bibliography notes etc.

In a reddit post (that I can’t find anymore), jkitchin said links of the form [[cite:key][Author (Year)] would be in principle possible, but they would break exporting. I’m happy to break exporting, and I don’t see any other clash with org-ref. What I don’t understand is why these links don’t “fold in”, i.e. why ‘[[cite:key][text]]’ does not display as ‘text’.

---

<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:** [May 15, 2020, 1:50pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/14 "2020-05-15T13:50:26Z")

</div>

> [@diagonallemma](#):
>
> What I don’t understand is why these links don’t “fold in”, i.e. why ‘[[cite:key][text]]’ does not display as ‘text’.

I suppose it’s because `cite:` takes precedence in the fontification over `org-links`.

> [@diagonallemma](#):
>
> Thanks @zaeph, I agree it might be an upstream issue, but I’m not sure it belongs to org-ref or bibtex-completion.

I’m 90% sure it’s coming from Org-ref. I don’t remember seeing code for this in `bibtex-completion`.

---

<div class="post-metadata">

**Author:** ![alan](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@alan](https://org-roam.discourse.group/u/alan)\
**Post date:** [May 15, 2020, 2:26pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/15 "2020-05-15T14:26:00Z")

</div>

> [@diagonallemma](#):
>
> What I don’t understand is why these links don’t “fold in”, i.e. why ‘[[cite:key][text]]’ does not display as ‘text’.

It looks like org-ref sets its `:display` parameter to `nil` which doesn’t fold. Add this to your config and it should work:

```auto
(org-link-set-parameters
 "cite"
 :display 'org-link)

```

---

<div class="post-metadata">

**Author:** ![diagonallemma](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/diagonallemma/32/116_2.png) [@diagonallemma](https://org-roam.discourse.group/u/diagonallemma)\
**Post date:** [May 15, 2020, 8:27pm UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/16 "2020-05-15T20:27:51Z")

</div>

@alan: yes this works, thanks! Now I’d only need to find a way to automatically insert links in this format.

---

<div class="post-metadata">

**Author:** ![cobblepot](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@cobblepot](https://org-roam.discourse.group/u/cobblepot)\
**Post date:** [May 16, 2020, 2:57am UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/17 "2020-05-16T02:57:07Z")

</div>

@zaeph Am I wrong that org-ref has the capability to cite just the Author or Year? [This recent issue](https://github.com/jkitchin/org-ref/issues/740) on org-ref GitHub has jkitchin saying “There is definitely a citeyear and citeauthor defined in `org-ref-natbib-types` which should be included in `org-ref-cite-types` .” Or does that only apply to citation exporting rather than editor display?

---

<div class="post-metadata">

**Author:** ![alan](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@alan](https://org-roam.discourse.group/u/alan)\
**Post date:** [May 16, 2020, 3:26am UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/18 "2020-05-16T03:26:55Z")

</div>

@cobblepot I would guess everything refers to export. The bibtex key is used to point to the citation for all of the link types, but the types define different export options.

`(setq org-ref-default-citation-link "citeyear")` can be used to default to a certain type when inserting links, but it won’t look different in the editor.

---

<div class="post-metadata">

**Author:** ![scotto](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@scotto](https://org-roam.discourse.group/u/scotto)\
**Post date:** [June 2, 2020, 2:26am UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/19 "2020-06-02T02:26:10Z")

</div>

Like @diagonallemma, I also care far more about org-mode readability than I do about exporting. For me, it works if I start making the link by opening the bibfile.

I put the cursor anywhere in the bibentry I want to link to. Then I do:

`M-x org-store-link`

and go to the .org file where I want to paste the link, and then:

`M-x org-insert-link`

The minibuffer displays the cite: link. If I hit return, it diplays a prototype link text. I edit that to taste and hit return. Then a folded cite: link appears in the org file.

This bulky procedure is cobbled together from [this org-ref issue](https://github.com/jkitchin/org-ref/issues/345#issuecomment-262646855). I’ve never understood why it couldn’t be simpler, but the org maintainer says this is as good as it gets – he’s super-responsive, so if you want to know more, he’ll likely answer your question.

---

<div class="post-metadata">

**Author:** ![bruce](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@bruce](https://org-roam.discourse.group/u/bruce)\
**Post date:** [June 2, 2020, 9:36am UTC](https://org-roam.discourse.group/t/customize-display-of-cite-links/129/20 "2020-06-02T09:36:46Z")

</div>

I will mention here, since it may have impact on this in the future: org will soon be getting native citation support. Part of that discussion could result in more robust ability to configure rendering.

[Next page](https://org-roam.discourse.group/t/customize-display-of-cite-links/129.md?page=2)
