From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Newbie: Custom link type formatting in LaTeX export? Date: Wed, 12 May 2010 15:15:55 +0200 Message-ID: <6B1AD663-E844-4EBC-ABEC-759DF9973B2F@gmail.com> References: <4BE92DCB.1070408@hf.uio.no> <3D145F75-7633-4F98-A7CD-1300228A42FE@gmail.com> <4BEA7F22.4060207@christianmoe.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=56902 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCCU9-0000TP-0R for Emacs-orgmode@gnu.org; Wed, 12 May 2010 10:00:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OCCU6-0003eP-WC for Emacs-orgmode@gnu.org; Wed, 12 May 2010 10:00:28 -0400 Received: from ey-out-1920.google.com ([74.125.78.150]:51008) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCCU6-0003e8-R0 for Emacs-orgmode@gnu.org; Wed, 12 May 2010 10:00:26 -0400 Received: by ey-out-1920.google.com with SMTP id 13so116504eye.34 for ; Wed, 12 May 2010 07:00:25 -0700 (PDT) In-Reply-To: <4BEA7F22.4060207@christianmoe.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: mail@christianmoe.com Cc: Emacs-orgmode@gnu.org Hi Christian, this looks pretty good! I just made a let binding for you local fnc variable and replaced org-solidify-link-text with org-link-unescape. Thanks, the patch is applied. - Carsten On May 12, 2010, at 12:12 PM, Christian Moe wrote: > 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 > > > 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 "}"))))))) > > - Carsten