Dear John, This is great. I will tweak this as needed.
Thanks a lot, Christian 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) 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...
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 -- Christian Wittern, Kyoto