emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Reftex in Org-Mode exporting and recognizing figures or equations
@ 2012-08-03  3:39 Jeffrey Spencer
  2012-08-03  6:20 ` Thomas S. Dye
  2012-08-03  9:38 ` Rasmus
  0 siblings, 2 replies; 5+ messages in thread
From: Jeffrey Spencer @ 2012-08-03  3:39 UTC (permalink / raw)
  To: emacs-orgmode

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

1) I was wondering if anyone has got the reftex feature of easily
recognizing the figures and equations to insert as a ref command to work in
org-mode.

2) Also I had seen on a website that you can use the command to get
org-mode type citations. This seems to export to latex as a \ref command
with citep in the middle (eg. \ref{citep}).
(reftex-set-cite-format
    "[[citep][%l]]")
This doesn't seem to work for me but maybe I'm doing something wrong.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reftex in Org-Mode exporting and recognizing figures or equations
  2012-08-03  3:39 Reftex in Org-Mode exporting and recognizing figures or equations Jeffrey Spencer
@ 2012-08-03  6:20 ` Thomas S. Dye
  2012-08-03  9:38 ` Rasmus
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas S. Dye @ 2012-08-03  6:20 UTC (permalink / raw)
  To: Jeffrey Spencer; +Cc: emacs-orgmode

Aloha Jeffrey,

Jeffrey Spencer <jeffspencerd@gmail.com> writes:

> 1) I was wondering if anyone has got the reftex feature of easily
> recognizing the figures and equations to insert as a ref command to work in
> org-mode.

I'm not aware of this being done. 

>
> 2) Also I had seen on a website that you can use the command to get
> org-mode type citations. This seems to export to latex as a \ref command
> with citep in the middle (eg. \ref{citep}).
> (reftex-set-cite-format
>     "[[citep][%l]]")
> This doesn't seem to work for me but maybe I'm doing something wrong.

There are some examples of how to manage citations in Org mode here:

http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-17-2

I'm really enjoying ebib in this regard.  It recognizes both Org mode
and LaTeX mode documents, so is ready to work with me in both of my
writing environments.

hth,
Tom

> 1) I was wondering if anyone has got the reftex feature of easily recognizing the figures and equations to insert as a ref command to work in org-mode.2) Also I had seen on a website that you can use the command to get org-mode type citations. This seems to export to latex as a \ref command with citep in the middle (eg. \ref{citep}).
>
> (reftex-set-cite-format    "[[citep][%l]]")This doesn&#39;t seem to work for me but maybe I&#39;m doing something wrong.

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reftex in Org-Mode exporting and recognizing figures or equations
  2012-08-03  3:39 Reftex in Org-Mode exporting and recognizing figures or equations Jeffrey Spencer
  2012-08-03  6:20 ` Thomas S. Dye
@ 2012-08-03  9:38 ` Rasmus
  2012-08-05  9:02   ` Jeffrey Spencer
  1 sibling, 1 reply; 5+ messages in thread
From: Rasmus @ 2012-08-03  9:38 UTC (permalink / raw)
  To: emacs-orgmode


Jeffrey Spencer <jeffspencerd@gmail.com> writes:

> 1) I was wondering if anyone has got the reftex feature of easily
> recognizing the figures and equations to insert as a ref command to work in
> org-mode.

I haven't gotten this to work.  It's doable, but requires some work.
For now I'd be happy if I could replace the \ref

> 2) Also I had seen on a website that you can use the command to get
> org-mode type citations. This seems to export to latex as a \ref command
> with citep in the middle (eg. \ref{citep}).
> (reftex-set-cite-format
>     "[[citep][%l]]")
> This doesn't seem to work for me but maybe I'm doing something wrong.

Here's my setup which works decently:

#+begin_src emacs-lisp
(defun org-mode-reftex-setup ()
    (load-library "reftex")
    (and (buffer-file-name)
         (file-exists-p (buffer-file-name))
         (reftex-parse-all))
    (make-local-variable 'reftex-cite-format)
    (setq reftex-cite-format 'org)
    (define-key org-mode-map (kbd "C-c )") 'reftex-citation))

  (add-hook 'org-mode-hook 'org-mode-reftex-setup)


(eval-after-load 'reftex-vars
  '(progn

     (add-to-list 'reftex-cite-format-builtin
                  '(org "Org-mode citation"
                        ((?\C-m . "[[cite:%l]]")
                         (?t . "[[textcite:%l]]")
                         (?p . "[[parencite:%l]]")
                         (?s . "[[posscite:%l]]")
                         (?a . "[[citeauthor:%l]]")
                         (?y . "[[citeyear:%l]]"))))))
#+end_src

I add nodes manually with C-l after inserting, if needed.

–Rasmus

-- 
⠠⠵

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reftex in Org-Mode exporting and recognizing figures or equations
  2012-08-03  9:38 ` Rasmus
@ 2012-08-05  9:02   ` Jeffrey Spencer
  2012-08-05 11:18     ` Rasmus
  0 siblings, 1 reply; 5+ messages in thread
From: Jeffrey Spencer @ 2012-08-05  9:02 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

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

When I use your setup and insert a citation then export to latex I get:
[[cite:Paper]]
turns into:
\ref{cite-Paper}


On Fri, Aug 3, 2012 at 7:38 PM, Rasmus <rasmus@gmx.us> wrote:

> (defun org-mode-reftex-setup ()
>     (load-library "reftex")
>     (and (buffer-file-name)
>          (file-exists-p (buffer-file-name))
>          (reftex-parse-all))
>     (make-local-variable 'reftex-cite-format)
>     (setq reftex-cite-format 'org)
>     (define-key org-mode-map (kbd "C-c )") 'reftex-citation))
>
>   (add-hook 'org-mode-hook 'org-mode-reftex-setup)
>
>
> (eval-after-load 'reftex-vars
>   '(progn
>
>      (add-to-list 'reftex-cite-format-builtin
>                   '(org "Org-mode citation"
>                         ((?\C-m . "[[cite:%l]]")
>                          (?t . "[[textcite:%l]]")
>                          (?p . "[[parencite:%l]]")
>                          (?s . "[[posscite:%l]]")
>                          (?a . "[[citeauthor:%l]]")
>                          (?y . "[[citeyear:%l]]"))))))
>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reftex in Org-Mode exporting and recognizing figures or equations
  2012-08-05  9:02   ` Jeffrey Spencer
@ 2012-08-05 11:18     ` Rasmus
  0 siblings, 0 replies; 5+ messages in thread
From: Rasmus @ 2012-08-05 11:18 UTC (permalink / raw)
  To: jeffspencerd; +Cc: emacs-orgmode

Jeffrey Spencer <jeffspencerd@gmail.com> writes:

> When I use your setup and insert a citation then export to latex I get:
> [[cite:Paper]]
> turns into:
> \ref{cite-Paper}

You need to add them as link types:

See Worg.  Here's my setup

#+begin_src emacs-lisp

;; add latex:link-type [[latex:textsc][small caps]]
(org-add-link-type
 "latex" nil
 (lambda (path desc format)
   (cond
    ((eq format 'html)
     (format "<span class=\"%s\">%s</span>" path desc))
    ((eq format 'latex)
     (format "\\%s{%s}" path desc)))))


(org-add-link-type
 "citepos" 'ebib
 (lambda (path desc format)
   (cond
    ((eq format 'latex)
     (if (or (not desc) (equal 0 (search "citepos:" desc)))
         (format "\\posscite{%s}" path)
       (format "\\posscite[%s]{%s}" desc path)
       )))))


(org-add-link-type
 "citep" 'ebib
 (lambda (path desc format)
   (cond
    ((eq format 'latex)
     (if (or (not desc) (equal 0 (search "citep:" desc)))
         (format "\\citep{%s}" path)
       (format "\\citep[%s]{%s}" desc path)
       )))))

(org-add-link-type
 "citet" 'ebib
 (lambda (path desc format)
   (cond
    ((eq format 'latex)
     (if (or (not desc) (equal 0 (search "citet:" desc)))
         (format "\\citet{%s}" path)
       (format "\\citet[%s]{%s}" desc path)
       )))))


(org-add-link-type
 "citeauthor" 'ebib
 (lambda (path desc format)
   (cond
    ((eq format 'latex)
     (if (or (not desc) (equal 0 (search "citeauthor:" desc)))
         (format "\\citeauthor{%s}" path)
       (format "\\citeauthor[%s]{%s}" desc path)
       )))))

(org-add-link-type
 "citeyear" 'ebib
 (lambda (path desc format)
   (cond
    ((eq format 'latex)
     (if (or (not desc) (equal 0 (search "citeyear:" desc)))
         (format "\\citeyear{%s}" path)
       (format "\\citeyear[%s]{%s}" desc path)
       )))))


(org-add-link-type
 "cite" 'ebib
 (lambda (path desc format)
   (cond
    ((eq format 'html)
     (format "(<cite>%s</cite>)" path))
    ((eq format 'latex)
     (if (or (not desc) (equal 0 (search "cite:" desc)))
         (format "\\textcite{%s}" path)
       (format "\\textcite[%s][%s]{%s}"
               (cadr (split-string desc ";"))
               (car (split-string desc ";"))  path))))))


  (org-add-link-type
   "parencite" 'ebib
   (lambda (path desc format)
     (cond
      ((eq format 'html)
       (format "(<cite>%s</cite>)" path))
      ((eq format 'latex)
       (if (or (not desc) (equal 0 (search "parencite:" desc)))
           (format "\\parencite{%s}" path)
         (format "\\parencite[%s][%s]{%s}"
                 (cadr (split-string desc ";"))
                 (car (split-string desc ";"))  path))))))
#+end_src

-- 
When the facts change, I change my mind. What do you do, sir?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-05 11:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-03  3:39 Reftex in Org-Mode exporting and recognizing figures or equations Jeffrey Spencer
2012-08-03  6:20 ` Thomas S. Dye
2012-08-03  9:38 ` Rasmus
2012-08-05  9:02   ` Jeffrey Spencer
2012-08-05 11:18     ` Rasmus

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