From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Moe Subject: Re: Newbie: Custom link type formatting in LaTeX export? Date: Wed, 12 May 2010 12:12:50 +0200 Message-ID: <4BEA7F22.4060207@christianmoe.com> References: <4BE92DCB.1070408@hf.uio.no> <3D145F75-7633-4F98-A7CD-1300228A42FE@gmail.com> Reply-To: mail@christianmoe.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040009010600080109000503" Return-path: Received: from [140.186.70.92] (port=41278 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OC9hB-0001Z6-MA for Emacs-orgmode@gnu.org; Wed, 12 May 2010 07:01:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OC9hA-0004xV-Eu for Emacs-orgmode@gnu.org; Wed, 12 May 2010 07:01:45 -0400 Received: from mars.hitrost.net ([91.185.193.39]:34310) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OC9hA-0004rZ-5A for Emacs-orgmode@gnu.org; Wed, 12 May 2010 07:01:44 -0400 In-Reply-To: <3D145F75-7633-4F98-A7CD-1300228A42FE@gmail.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: Carsten Dominik Cc: Emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------040009010600080109000503 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, This patch (below and attached) seems to fix it. I've put the code at the end of org-export-latex-links, which seems to be the right place (it doesn't parallel the organization in the html exporter though). Please check my work! I'm new to Lisp, and used git for the first time today. Simple test: Export to LaTeX from an Org file including [[bbdb:Jane Doe][Ms Doe]] Currently it defaults to fixed-width (\texttt{Ms Doe}). When patched, it should come out italicized (\textit{Ms Doe}) as per the export function in org-bbdb.el. Yours, Christian ========================================================================================== diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 15d667e..eb293da 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -1876,6 +1876,11 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (setq path (org-export-latex-protect-amp path) desc (org-export-latex-protect-amp desc))) (insert (format org-export-latex-hyperref-format path desc))) + ((functionp (setq fnc (nth 2 (assoc type org-link-protocols)))) + ;; The link protocol has a function for formatting the link + (insert + (save-match-data + (funcall fnc (org-solidify-link-text raw-path) desc 'latex)))) (t (insert "\\texttt{" desc "}"))))))) ============================================================================================ >> It looks like support for formatting custom link types in LaTeX export >> is broken? (...) >> I've found that org-bbdb-export does not italicize bbdb links in >> LaTeX, nor does my own org-cite-export turn my custom =cite:= links >> into LaTeX =\cite{}= citations. Everything works fine in HTML export, >> but in LaTeX all custom link types get formatted as =\texttt{descr}=. >> >> I see that org-export-as-html and org-export-as-docbook look up >> org-link-protocols to get the function for formatting the link, but it >> seems that org-export-as-latex doesn't. > > Hi CHristian, > > this is correct. Since you already looked into the code, would you like > to write a patch to this effect? > > - Carsten > --------------040009010600080109000503 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="customlinkslatex.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="customlinkslatex.diff" diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 15d667e..eb293da 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -1876,6 +1876,11 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (setq path (org-export-latex-protect-amp path) desc (org-export-latex-protect-amp desc))) (insert (format org-export-latex-hyperref-format path desc))) + ((functionp (setq fnc (nth 2 (assoc type org-link-protocols)))) + ;; The link protocol has a function for formatting the link + (insert + (save-match-data + (funcall fnc (org-solidify-link-text raw-path) desc 'latex)))) (t (insert "\\texttt{" desc "}"))))))) --------------040009010600080109000503 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --------------040009010600080109000503--