emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Andreas Reuleaux <andreas@a-rx.info>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: org-ref code
Date: Tue, 13 May 2014 20:38:32 -0400	[thread overview]
Message-ID: <CAJ51ETpv6Gqj=Z+eocDwsBgFDvb9j3wmvg20jG3cY8prQJXZ4Q@mail.gmail.com> (raw)
In-Reply-To: <87ha4tmexn.fsf@a-rx.info>

[-- Attachment #1: Type: text/plain, Size: 5188 bytes --]

with the most recent org-ref, it should be sufficient to put this in your
init file:

(org-ref-define-citation-link "textcite" ?I)
(org-ref-define-citation-link "citeauthorfull" ?F)

this will create a textcite link and create a reftex menu you select with
the key I, and the other link with the key F. these should automatically be
links, and have completion functions. These will get exported as
\textcite{label} and \citeauthorfull{label}. The
org-ref-define-citation-link function adds the link, creates the functions
necessary, and adds the types to the right places.

You do not need to do the manual additions unless you manually define the
link like you did with org-add-link-type.

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 Tue, May 13, 2014 at 7:33 PM, Andreas Reuleaux <andreas@a-rx.info> wrote:

> John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
> > You can see a document I wrote using org-ref here:
> >
> http://kitchingroup.cheme.cmu.edu/org/2014/05/13/Using-org-ref-for-citations-and-references.org
> >
> > You will want to pull a current version. I added some code so it is in
> > principle easy for you to add your own citation types and use the org-ref
> > machinery to insert citations.
> >
> >
> > I made a little screencast here: http://screencast.com/t/bxfafVydE
> >
>
> Thanks for the sample file and the screencast, very nice.
>
> still a bit confused about org-ref-cite-types:
>
> Say, I want to add two new link types:
>
>
>   textcite - somehow standard in biblatex,
>              cf. the biblatex.pdf manual, p 81
>
>   citeauthorfull - my own creation - author with first- and lastname,
>                    cf below.
>
>
> from my document.org I load some latex preparation stuff like this
>
>   #+LaTeX_HEADER: \include{ltxhdr}
>
> I was just getting tired of prefixing so many lines with #+LaTeX_HEADER:
> and collected some of those in a lxthdr.tex file.
> there I have prepared something for this citeauthorfull thingy:
>
>
>   %% cf
>   %%
> http://tex.stackexchange.com/questions/24979/citing-authors-full-name-in-biblatex
>   %% called citeauthorfirstlast... there
>
>
>   \DeclareCiteCommand{\citeauthorfull}
>     {\boolfalse{citetracker}%
>      \boolfalse{pagetracker}%
>      \DeclareNameAlias{labelname}{first-last}%
>      \usebibmacro{prenote}}
>     {\ifciteindex
>        {\indexnames{labelname}}
>        {}%
>      \printnames{labelname}}
>     {\multicitedelim}
>     {\usebibmacro{postnote}}
>
> this does the job, don't ask me details.
>
> now back to org-ref:
>
> with your advice I add:
>
>   ;; add new format
>   (setf (nth 2 (assoc 'org reftex-cite-format-builtin))
>         (append (nth 2 (assoc 'org reftex-cite-format-builtin))
>                 '(
>
>                   ;; C-t like text
>                   (?\C-t  . "textcite:%l")
>
>
>                   ;; f like full
>                   (?f  . "citeauthorfull:%l")
>
>                   )))
>
> and I get the comfort of two additional citation formats to chose from
> when typing C-u C-c ] - nice, indeed. this is basically what you
> said in your e-mail before, now also on the org-ref.org webpage,
> (just shortcut and don't define that format variable)
>
> Now I can add these:
>
>   (add-to-list 'org-ref-cite-types "textcite")
>   (add-to-list 'org-ref-cite-types "citeauthorfull")
>
> but this is of limited use to me currently, at least I don't get
> the point, not sure if I am doing something wrong:
>
> say, I have added a few of these
>
>   textcite:foo
>
>   citeauthorfull:bar
>
> in my document.org, there are some problems with these:
>
> * first: they don't appear blue and clickable in my document.org
>
> * second: they don't get exported in the latex in a reasonable way,
>   they appear there just as
>
>     textcite:foo
>     citeauthorfull:bar
>
> Well I can cure the situation by adding by adding
>
>
> (org-add-link-type
>  "textcite"
>  'org-ref-cite-onclick-minibuffer-menu
>  ;; formatting
>  (lambda (keyword desc format)
>    (cond
>     ((eq format 'html) (format "(<textcite>%s</textcite>)" path))
>     ((eq format 'latex)
>      (concat "\\textcite{"
>              (mapconcat (lambda (key) key) (org-ref-split-and-strip-string
> keyword) ",")
>              "}")))))
>
>
>
> (org-add-link-type
>  "citeauthorfull"
>  'org-ref-cite-onclick-minibuffer-menu
>  ;; formatting
>  (lambda (keyword desc format)
>    (cond
>     ((eq format 'html) (format "(<citeauthorfull>%s</citeauthorfull>)"
> path))
>     ((eq format 'latex)
>      (concat "\\citeauthorfull{"
>              (mapconcat (lambda (key) key) (org-ref-split-and-strip-string
> keyword) ",")
>              "}")))))
>
>
> now they appear clickable in blue, and get properly exported
> to \textcite{...} and \citeauthorfull{...}
>
> Now, what was the deal of this adding them  to 'org-ref-cite-types
> in the first place, if I had to take care of the details by hand anyway?
> Is there anything I could have left out / shortcut / I have forgotten
> maybe?
>
> Thanks.
>
> -Andreas
>
>
>

[-- Attachment #2: Type: text/html, Size: 7335 bytes --]

  reply	other threads:[~2014-05-14  0:38 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30 20:59 org-ref code John Kitchin
2014-05-01  6:23 ` Eric S Fraga
2014-05-01 10:01 ` Eric S Fraga
2014-05-01 12:21   ` Seb Frank
2014-05-01 14:08     ` Eric S Fraga
2014-05-01 12:36   ` John Kitchin
2014-05-01 12:47     ` John Kitchin
2014-05-01 13:30       ` Eric S Fraga
2014-05-01 17:07         ` John Kitchin
2014-05-10 14:44           ` Eric S Fraga
2014-05-11 18:48             ` John Kitchin
2014-05-12  8:12               ` Andreas Reuleaux
2014-05-13  2:37                 ` John Kitchin
2014-05-12 13:36               ` Eric S Fraga
2014-05-12 17:20                 ` Andreas Reuleaux
2014-05-12 17:26                   ` John Kitchin
2014-05-13  0:03                     ` Andreas Reuleaux
2014-05-13 11:00                     ` Eric S Fraga
2014-05-13 18:51                       ` John Kitchin
2014-05-13 20:01                         ` Eric S Fraga
2014-05-13 20:11                         ` Eric S Fraga
2014-05-14  0:28                           ` John Kitchin
2014-05-14 18:17                             ` Eric S Fraga
2014-05-14 19:03                               ` Andreas Reuleaux
2014-05-14 19:48                                 ` Sharon Kimble
2014-05-14 20:08                                   ` Andreas Reuleaux
2014-05-14 22:14                                 ` Eric S Fraga
2014-05-14 20:35                               ` John Kitchin
2014-05-15  6:58                                 ` Eric S Fraga
2014-05-15  8:17                                   ` Eric S Fraga
2014-05-15 13:05                                     ` John Kitchin
2014-05-15 13:14                                       ` Eric S Fraga
2014-05-15 13:30                                       ` Eric S Fraga
2014-05-15 14:19                                         ` John Kitchin
2014-05-15 14:31                                           ` Eric S Fraga
2014-05-15 15:03                                             ` Eric S Fraga
2014-05-15 13:15                                   ` John Kitchin
2014-05-14  3:58                           ` Andreas Reuleaux
2014-05-14 13:17                             ` John Kitchin
2014-05-13 23:33                         ` Andreas Reuleaux
2014-05-14  0:38                           ` John Kitchin [this message]
2014-05-14  3:39                             ` Andreas Reuleaux
2014-05-14 13:14                               ` John Kitchin
2014-05-14 17:39                                 ` Andreas Reuleaux
2014-05-18 17:16                             ` org-ref for biblatex Andreas Reuleaux
2014-05-18 21:40                               ` John Kitchin
2014-05-18 22:38                                 ` Andreas Reuleaux
2014-05-19 11:38                                   ` John Kitchin
2014-05-19 12:15                                     ` Andreas Reuleaux
2014-05-19 17:34                                 ` Andreas Reuleaux
2014-05-08  8:31 ` org-ref code Vikas Rawal
2014-05-08 13:53   ` John Kitchin
2014-05-15 10:09     ` Bastien

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ51ETpv6Gqj=Z+eocDwsBgFDvb9j3wmvg20jG3cY8prQJXZ4Q@mail.gmail.com' \
    --to=jkitchin@andrew.cmu.edu \
    --cc=andreas@a-rx.info \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).