From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Christian Wittern <cwittern@gmail.com>
Cc: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: [org-ref] how to tweak display of links and entries
Date: Thu, 12 Jan 2017 11:04:12 -0500 [thread overview]
Message-ID: <m21sw8jmdf.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <b67e2bab-5e70-79bb-24af-d19dd5edd037@gmail.com>
Christian Wittern writes:
> Dear John,
>
> Thanks for your answer.
>
> On 01/11/2017 10:33 PM, John Kitchin wrote:
>>
>> There is not a way to hook or define a format for this that I know of.
>> For helm-bibtex, you might be able to redefine or advise
>> bibtex-completion-apa-format-authors to handle that.
Here is a lightly tested way to modify the authors. It basically works
by bypassing bibtex-completion-apa-format-authors to do what you want. I
adapted it from the bibtex-completion-apa-format-authors code.
#+BEGIN_SRC emacs-lisp
(defun format--cjk-authors (orig-fun &rest args)
"Format authors my way."
(cl-loop for a in (s-split " and " value t)
collect
(let ((fields (mapcar (lambda (x)
(let* ((f (split-string x "="))
(prop (s-trim (nth 0 f)))
(val (s-trim (nth 1 f))))
(cons prop val)))
(s-split "," a t))))
(s-format "${given} ${family} (${cjk})" 'aget fields))
into authors
finally return
(let ((l (length authors)))
(cond
((= l 1) (car authors))
((= l 2) (s-join " & " authors))
((< l 8) (concat (s-join ", " (-butlast authors))
", & " (-last-item authors)))
(t (concat (s-join ", " authors) ", ..."))))))
(advice-add 'bibtex-completion-apa-format-authors :around
#'format--cjk-authors)
; remove advice like this.
;(advice-remove 'bibtex-completion-apa-format-authors #'format--cjk-authors)
#+END_SRC
That generates Ailong Fang (方愛龍) & Another Fang (方愛龍), Super
interesting report, J. Interesting Reports, 1(), (2007). for the
tooltips and messages.
for this entry
@article{fang-2007-super,
title = {Super interesting report},
author = {family=Fang, given=Ailong, cjk=方愛龍 and family=Fang, given=Another, cjk=方愛龍},
journal = {J. Interesting Reports},
keywords = {test, word},
volume = 1,
year = 2007,
}
It is not very robust, e.g. it assumes there will be family, given and
cjk for all authors, that authors are split by and, and prop=val is
split by commas, etc...
>
> Well, thanks, I'll investigate that. Is that what is also used for the
> display as popup and in the echo area that org-ref is providing?
yes, I think so.
>
>>
>> You can turn off the full display like this:
>>
>> #+BEGIN_SRC emacs-lisp
>> (loop for cite in org-ref-cite-types
>> do
>> (org-link-set-parameters cite :display nil))
>> #+END_SRC
>>
>
> OK, that is what I wanted to know, all I want to do is hide the citekey in
> this case.
>
> All the best, and thanks for given us the present of org-ref,
>
> Christian
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
next prev parent reply other threads:[~2017-01-12 16:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-11 4:42 [org-ref] how to tweak display of links and entries Christian Wittern
2017-01-11 13:33 ` John Kitchin
2017-01-11 23:03 ` Christian Wittern
2017-01-12 16:04 ` John Kitchin [this message]
2017-01-12 23:57 ` Christian Wittern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m21sw8jmdf.fsf@andrew.cmu.edu \
--to=jkitchin@andrew.cmu.edu \
--cc=cwittern@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.