jkitchin / jmax

Johns customizations to maximize emacs
185 stars 59 forks source link

Link display with citation modifiers #23

Closed eigengrau closed 10 years ago

eigengrau commented 10 years ago

It would be very useful if it were possible in some way to add pre- and suffixes (i.e., the «foo» and «bar» in «cite[foo][bar]{bibkey}») to reference links, to add things like page-numbers and «e.g.» keywords.

Is that feasible somehow, or does org-mode limit what kind of characters can appear in links? Otherwise, a syntax such as «cite:[e.g][p.43]bibkey» would come in handy.

Btw. thanks for taking the time working on a more canonical solution to reftex-links in org. There’s a bunch of snippets on the net, but a well-maintained and thought through solution is something sorely needed.

eigengrau commented 10 years ago

Oh, I spoke too soon. It seems that this is already built-in. Wonderful!

One question, though: Do you know if it’s possible displaying the link target together with the description for «cite:» links? Because otherwise these links will appear as «cf.::p.23» unless links are shown in verbatim.

jkitchin commented 10 years ago

There is an example in http://kitchingroup.cheme.cmu.edu/blog/2014/05/19/Exporting-citations-with-biblatex/ on how to rewrite a format function to do pre/post things. that example works, but I don't really like it, because as you point out it is hard to see the key without literal links.

cite:[e.g][p.43]bibkey is an interesting idea. That would take some work in parsing out the key reliably for the clicking and formatting. I will think about if that is feasible.

eigengrau commented 10 years ago

Thanks for the example. Your [foo::bar] syntax is actually a little more elegant. The question would be if org let’s one tweak the displayed decription in a way that takes the link target as argument, and composes the description out of it and the syntactical description. The snippets I found on the web all just took the description and reformatted it, so not sure if that’s possible.

If org mode doesn’t choke on the parentheses in the link target, moving the modifiers there would be a way around the above limitation. Tough it would have the drawback that the modifiers wouldn’t show up in the org buffer, which is not perfect either.

jkitchin commented 10 years ago

check out this approach:

http://kitchingroup.cheme.cmu.edu/blog/2014/06/26/Another-parsing-of-links-for-citations-with-pre-and-post-text/

you can write links like: mehta-2014-ident-poten http://kitchingroup.cheme.cmu.edu/blog/2014/06/26/Another-parsing-of-links-for-citations-with-pre-and-post-text/#mehta-2014-ident-poten, (pre text)mehta-2014-ident-poten http://kitchingroup.cheme.cmu.edu/blog/2014/06/26/Another-parsing-of-links-for-citations-with-pre-and-post-text/#%28pre%20text%29mehta-2014-ident-poten and (pre text)(post text)biskup-2014-insul-ferrom-films http://kitchingroup.cheme.cmu.edu/blog/2014/06/26/Another-parsing-of-links-for-citations-with-pre-and-post-text/#%28pre%20text%29%28post%20text%29biskup-2014-insul-ferrom-films. a multiple citation mehta-2014-ident-poten http://kitchingroup.cheme.cmu.edu/blog/2014/06/26/Another-parsing-of-links-for-citations-with-pre-and-post-text/#mehta-2014-ident-poten ,thompson-2014-co2-react http://kitchingroup.cheme.cmu.edu/blog/2014/06/26/Another-parsing-of-links-for-citations-with-pre-and-post-text/#thompson-2014-co2-react ,calle-vallejo-2013-number http://kitchingroup.cheme.cmu.edu/blog/2014/06/26/Another-parsing-of-links-for-citations-with-pre-and-post-text/#calle-vallejo-2013-number.

John


John Kitchin Associate Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu

On Thu, Jun 26, 2014 at 7:42 AM, eigengrau notifications@github.com wrote:

Thanks for the example. Your [foo::bar] syntax is actually a little more elegant. The question would be if org let’s one tweak the displayed decription in a way that takes the link target as argument, and composes the description out of it and the syntactical description. The snippets I found on the web all just took the description and reformatted it, so not sure if that’s possible.

If org mode doesn’t choke on the parentheses in the link target, moving the modifiers there would be a way around the above limitation. Tough it would have the drawback that the modifiers wouldn’t show up in the org buffer, which is not perfect either.

— Reply to this email directly or view it on GitHub https://github.com/jkitchin/jmax/issues/23#issuecomment-47215755.

eigengrau commented 10 years ago

That post looks very promising. Thanks for sharing! I’ll try working that into my org-ref setup, though Emacs Lisp still instills me with existential dread… ;)