* Newbie: Custom link type formatting in LaTeX export?
@ 2010-05-11 10:13 Christian Moe
2010-05-12 6:15 ` Carsten Dominik
0 siblings, 1 reply; 6+ messages in thread
From: Christian Moe @ 2010-05-11 10:13 UTC (permalink / raw)
To: Emacs-orgmode
Hi,
(I'm new to the list; have been an enthusiastic Org user for a year and
half; now using version 6.36; am an Elisp novice.)
It looks like support for formatting custom link types in LaTeX export
is broken?
I was trying to implement a custom link type with its own formatting
function for HTML and LaTeX export, following the steps in
org-bbdb.el.
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.
Yours,
Christian Moe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Newbie: Custom link type formatting in LaTeX export?
2010-05-11 10:13 Newbie: Custom link type formatting in LaTeX export? Christian Moe
@ 2010-05-12 6:15 ` Carsten Dominik
2010-05-12 10:12 ` Christian Moe
0 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2010-05-12 6:15 UTC (permalink / raw)
To: christian.moe; +Cc: Emacs-orgmode
On May 11, 2010, at 12:13 PM, Christian Moe wrote:
> Hi,
>
> (I'm new to the list; have been an enthusiastic Org user for a year
> and
> half; now using version 6.36; am an Elisp novice.)
>
> It looks like support for formatting custom link types in LaTeX export
> is broken?
>
> I was trying to implement a custom link type with its own formatting
> function for HTML and LaTeX export, following the steps in
> org-bbdb.el.
>
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Newbie: Custom link type formatting in LaTeX export?
2010-05-12 6:15 ` Carsten Dominik
@ 2010-05-12 10:12 ` Christian Moe
2010-05-12 13:15 ` Carsten Dominik
0 siblings, 1 reply; 6+ messages in thread
From: Christian Moe @ 2010-05-12 10:12 UTC (permalink / raw)
To: Carsten Dominik; +Cc: Emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2168 bytes --]
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
>
[-- Attachment #2: customlinkslatex.diff --]
[-- Type: text/plain, Size: 694 bytes --]
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 "}")))))))
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: Newbie: Custom link type formatting in LaTeX export?
2010-05-12 10:12 ` Christian Moe
@ 2010-05-12 13:15 ` Carsten Dominik
2010-05-12 18:19 ` Christian Moe
2010-05-12 18:28 ` Christian Moe
0 siblings, 2 replies; 6+ messages in thread
From: Carsten Dominik @ 2010-05-12 13:15 UTC (permalink / raw)
To: mail; +Cc: Emacs-orgmode
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-05-12 18:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-11 10:13 Newbie: Custom link type formatting in LaTeX export? Christian Moe
2010-05-12 6:15 ` Carsten Dominik
2010-05-12 10:12 ` Christian Moe
2010-05-12 13:15 ` Carsten Dominik
2010-05-12 18:19 ` Christian Moe
2010-05-12 18:28 ` Christian Moe
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).