From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: org-add-link-type Date: Mon, 17 Jan 2011 19:35:05 +0100 Message-ID: <87fwsr1iqu.fsf@altern.org> References: <4D182DBE.8030504@christianmoe.com> <348CF591-80F3-414A-BDD4-895410F5DEA6@tsdye.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=34086 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Petvo-0004vb-Nv for emacs-orgmode@gnu.org; Mon, 17 Jan 2011 13:36:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PetvD-0002vZ-Rl for emacs-orgmode@gnu.org; Mon, 17 Jan 2011 13:35:20 -0500 Received: from mail-fx0-f67.google.com ([209.85.161.67]:59478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PetvD-0002vT-L0 for emacs-orgmode@gnu.org; Mon, 17 Jan 2011 13:35:19 -0500 Received: by fxm17 with SMTP id 17so2279869fxm.6 for ; Mon, 17 Jan 2011 10:35:18 -0800 (PST) In-Reply-To: <348CF591-80F3-414A-BDD4-895410F5DEA6@tsdye.com> (Thomas S. Dye's message of "Sun, 26 Dec 2010 21:06:31 -1000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Thomas S. Dye" Cc: Org Mode , mail@christianmoe.com Hi Thomas, "Thomas S. Dye" writes: > (org-add-link-type > "citet" 'ebib > (lambda (path desc format) > (cond > ((eq format 'latex) > (if (and desc) > (format "\\citet[%s]{%s}" desc path) > (format "\\citet{%s}" path)))))) > > [[citet:green84:_settl_patter_studies_ocean]] > > yields this: > > \citet[citet:green84:_settl\_patter\_studies\_ocean] > {green84:_settl_patter_studies_ocean} This is because "_" chars are usually protected from conversion in links, but the LaTeX exporter might be confused by links it doesn't know. What about this : (org-add-link-type "citet" 'ebib (lambda (path desc format) (cond ((eq format 'latex) (if (and desc) (org-export-latex-protect-string (format "\\citet[%s]{%s}" desc path)) (org-export-latex-protect-string (format "\\citet{%s}" path))))))) Check for other uses of `org-export-latex-protect-string' in org-latex.el to better understand in what contexts this function is useful. HTH, -- Bastien