emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Newbie: Custom link type formatting in LaTeX export?


From: Carsten Dominik
Subject: Re: [Orgmode] Newbie: Custom link type formatting in LaTeX export?
Date: Wed, 12 May 2010 15:15:55 +0200

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]