From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Moe Subject: Re: org-add-link-type Date: Mon, 27 Dec 2010 11:58:46 +0100 Message-ID: <4D187166.4020806@christianmoe.com> References: <4D182DBE.8030504@christianmoe.com> <348CF591-80F3-414A-BDD4-895410F5DEA6@tsdye.com> Reply-To: mail@christianmoe.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=49659 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PXAkU-0004A0-04 for emacs-orgmode@gnu.org; Mon, 27 Dec 2010 05:56:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PXAkS-0003IX-Rt for emacs-orgmode@gnu.org; Mon, 27 Dec 2010 05:56:17 -0500 Received: from mars.hitrost.net ([91.185.211.18]:34125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PXAkS-0003Ee-IC for emacs-orgmode@gnu.org; Mon, 27 Dec 2010 05:56:16 -0500 In-Reply-To: <348CF591-80F3-414A-BDD4-895410F5DEA6@tsdye.com> 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 Hi again, That is indeed surprising. It looks as if an empty desc is never passed, instead it is replaced with the full raw path. I don't think that's the right behavior, and I don't really see how it could result from org-export-latex-links. Hadn't noticed this before because my own "cite" links all have a desc part, e.g. [[cite:green84][Green, 1984]], and then the problem doesn't come up. Yours, Christian On 12/27/10 8:06 AM, Thomas S. Dye wrote: > Hi Christian, > > Thanks, I've put away my copy of ANSI Common Lisp. > > The results surprise me. > > (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} > > > All the best, > Tom > > On Dec 26, 2010, at 8:10 PM, Christian Moe wrote: > >> Hi, Thomas, >> >> Try it with "if" rather than "when". >> >> Yours, >> Christian >> >> >> On 12/27/10 1:29 AM, Thomas S. Dye wrote: >>> Aloha all, >>> >>> Sorry in advance for coming to the list with a beginner type question, >>> but I'm stumped. >>> >>> I'm trying to use the extended link syntax to export citations to >>> LaTeX. If the link lacks a description, then I don't want the \citep >>> command to have an optional argument. As I understand the >>> documentation, if the description is absent, then the variable desc is >>> nil, so the following looks good to my untrained eye. But, it doesn't >>> add the optional argument when the description is present. >>> >>> (org-add-link-type >>> "citep" 'ebib >>> (lambda (path desc format) >>> (cond >>> ((eq format 'latex) >>> (when (and desc) >>> (format "\\citep[%s]{%s}" desc path) >>> (format "\\citep{%s}" path)))))) >>> >>> All the best, >>> Tom >>> >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Please use `Reply All' to send replies to the list. >>> Emacs-orgmode@gnu.org >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >>> >> >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Please use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > >