From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Willig Subject: Re: Integration of RefTeX and LaTeX export Date: Fri, 17 Feb 2012 17:46:28 +1300 Message-ID: <24B979D4-6B28-4521-92F5-AED136335FB0@canterbury.ac.nz> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:41002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyFiP-0006Gr-Vu for emacs-orgmode@gnu.org; Thu, 16 Feb 2012 23:46:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RyFiO-0004kL-An for emacs-orgmode@gnu.org; Thu, 16 Feb 2012 23:46:37 -0500 Received: from cantvi.canterbury.ac.nz ([132.181.2.61]:2877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyFiN-0004k9-OT for emacs-orgmode@gnu.org; Thu, 16 Feb 2012 23:46:36 -0500 Received: from DISCAIMER-DAEMON.it.canterbury.ac.nz by it.canterbury.ac.nz (PMDF V6.5 #31848) id <01OC3T4CUG7K91066V@it.canterbury.ac.nz> for emacs-orgmode@gnu.org; Fri, 17 Feb 2012 17:46:30 +1200 (NEW ZEALAND STANDARD TIME) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Thomas S.Dye" Cc: emacs-orgmode@gnu.org Hi Thomas, thanks for this hint. I have looked at this, the changed / added = functions are below, everything else has not changed. I still have a problem. I have created a new link type as you suggested and have consulted = google on how to do it (my emacs-lisp-fu is not good enough to sort out = directly what this function is doing ...). In my understanding the third argument is a = function that is called when an export process has started and a link is about to = be exported. My first problem is: this handler function is never called, = the error message that i have inserted below does never appear. I have seen that = the variable "org-link-types" contains the defined link type, and the = variable "org-link-protocols" shows my handler. My second problem is that the generated LaTeX output is "\texttt{\cite{key}}" but it should simply be "\cite{key}". I would guess that the second = problem is a corollary of the first one ... Any ideas? Andreas =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (defun rt-handler (path) (message "dummy handler called, path =3D %s" path) (let ((arg (concat "\\cite{" path "}"))) (reftex-view-crossref arg))) (org-add-link-type "rtcite"=20 'rt-handler (lambda (path desc format) (error "my handler is called") (cond ((eq format 'latex) (if (or (not desc) (equal 0 (search = "rtcite:" desc))) (format "\\cite{%s}" path) (format "\\cite[%s]{%s}" desc path)))))) (defun org-mode-reftex-setup () (load-library "reftex") (and (buffer-file-name) (file-exists-p (buffer-file-name)) (progn ;;enable auto-revert-mode to update reftex when bibtex file = changes on disk (global-auto-revert-mode t) (reftex-parse-all) ;;add a custom reftex cite format to insert links (reftex-set-cite-format "[[rtcite:%l][\\cite{%l}]]") )) (define-key org-mode-map (kbd "C-c )") 'reftex-citation) (define-key org-mode-map (kbd "C-c (") 'org-mode-reftex-search)) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D On 17/02/2012, at 11:08 AM, Thomas S. Dye wrote: > Andreas Willig writes: >=20 >> Hi, >>=20 >> i am relatively new to org mode. Yesterday i have tried to use org = mode for >> the first time to write the beginnings of a paper, and found that i = wanted to >> insert literature references and a bibliography. I like RefTeX a lot = and google >> provided me some links for proper integration. As a result, i have = added the >> stuff to my .emacs that you find below. The = "org-latex-to-pdf-process" stuff >> works. >>=20 >> My problems are related to (reftex-set-cite-format ..). Right now i = do not use >> it and get the default implementation by which RefTeX simply expands = the >> chosen reference to \cite{Key}, which is not highlighted in the org = buffer. I would >> like to have this expanded into an org link with the [[][]] syntax. I = have tried >> several variations of (reftex-set-cite-format ...) but i have never = succeeded in >> creating the bibliography. After generating the LaTeX output into a = buffer=20 >> (C-c C-e L) i found that org translates [[][]] type of stuff into = \hyperref{}s and not >> into \cite{} commands. >>=20 >> So, how can i change things so that in the org buffer the bib key = gets displayed >> nicely and in the LaTeX output a \cite{} command is generated? >>=20 >> Any help would be appreciated!! >>=20 >> Best regards, >>=20 >> Andreas >>=20 >> -------------------------------------- >>=20 >> (require 'org-latex) >> (unless (boundp 'org-export-latex-classes) >> (setq org-export-latex-classes nil)) >>=20 >>=20 >> (add-to-list 'org-export-latex-classes >> '("article" >> "\\documentclass{article}" >> ("\\section{%s}" . "\\section*{%s}") >> ("\\subsection{%s}" . "\\subsection*{%s}") >> ("\\subsubsection{%s}" . "\\subsubsection*{%s}") >> ("\\paragraph{%s}" . "\\paragraph*{%s}"))) =20 >>=20 >> (add-to-list 'org-export-latex-classes >> '("komaarticle" >> "\\documentclass{scrartcl}" >> ("\\section{%s}" . "\\section*{%s}") >> ("\\subsection{%s}" . "\\subsection*{%s}") >> ("\\subsubsection{%s}" . "\\subsubsection*{%s}") >> ("\\paragraph{%s}" . "\\paragraph*{%s}"))) =20 >>=20 >>=20 >> (add-to-list 'org-export-latex-classes >> '("komabook" >> "\\documentclass{scrbook}" >> ("\\chapter{%s}" . "\\chapter*{%s}") >> ("\\section{%s}" . "\\section*{%s}") >> ("\\subsection{%s}" . "\\subsection*{%s}") >> ("\\subsubsection{%s}" . "\\subsubsection*{%s}") >> ("\\paragraph{%s}" . "\\paragraph*{%s}"))) =20 >>=20 >>=20 >> (defun org-mode-reftex-setup () >> (load-library "reftex") >> (and (buffer-file-name) (file-exists-p (buffer-file-name)) >> (progn >> (global-auto-revert-mode t) >> (reftex-parse-all) >> ;;(reftex-set-cite-format "\[cite][%l]]") >> )) >> (define-key org-mode-map (kbd "C-c )") 'reftex-citation) >> (define-key org-mode-map (kbd "C-c (") 'org-mode-reftex-search)) >>=20 >> (add-hook 'org-mode-hook 'org-mode-reftex-setup) >>=20 >>=20 >> (defun org-mode-reftex-search () >> ;;jump to the notes for the paper pointed to at from reftex search >> (interactive) >> (org-open-link-from-string (format "[[notes:%s]]" (reftex-citation = t)))) >>=20 >> (setq org-latex-to-pdf-process >> '("pdflatex -interaction nonstopmode %b" >> "bibtex %b" >> "pdflatex -interaction nonstopmode %b" >> "pdflatex -interaction nonstopmode %b")) >>=20 >>=20 >> This email may be confidential and subject to legal privilege, it may >> not reflect the views of the University of Canterbury, and it is not >> guaranteed to be virus free. If you are not an intended recipient, >> please notify the sender immediately and erase all copies of the = message >> and any attachments. >>=20 >> Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more >> information. >>=20 >>=20 > Aloha Andreas, >=20 > Welcome to Org Mode! >=20 > You might want to define a new link type. See > http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-17-2 = for > one example of how this might be done. >=20 > hth, > Tom > --=20 > Thomas S. Dye > http://www.tsdye.com This email may be confidential and subject to legal privilege, it may not reflect the views of the University of Canterbury, and it is not guaranteed to be virus free. If you are not an intended recipient, please notify the sender immediately and erase all copies of the message and any attachments. Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more information.