[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [org-ref] how to tweak display of links and entries

From: Christian Wittern
Subject: Re: [O] [org-ref] how to tweak display of links and entries
Date: Fri, 13 Jan 2017 08:57:29 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

Dear John,

This is great.  I will tweak this as needed.

Thanks a lot,


On 01/13/2017 01:04 AM, John Kitchin wrote:
#+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)
           (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)))
              ((= 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

; remove advice like this.
;(advice-remove 'bibtex-completion-apa-format-authors  #'format--cjk-authors)


That generates Ailong Fang (方愛龍) & Another Fang (方愛龍), Super
interesting report, J. Interesting Reports, 1(),  (2007).  for the
tooltips and messages.

for this entry

  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...

Yes, but its a great start. This proves that this is a viable road for this kind of material. There is still no established and robust way to do this kind of thing in any format, so I am great to see this is possible.

All the best,


Christian Wittern, Kyoto

reply via email to

[Prev in Thread] Current Thread [Next in Thread]