emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: mail@christianmoe.com
Cc: Emacs-orgmode@gnu.org
Subject: Re: Newbie: Custom link type formatting in LaTeX export?
Date: Wed, 12 May 2010 15:15:55 +0200	[thread overview]
Message-ID: <6B1AD663-E844-4EBC-ABEC-759DF9973B2F@gmail.com> (raw)
In-Reply-To: <4BEA7F22.4060207@christianmoe.com>

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	other threads:[~2010-05-12 14:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2010-05-12 18:19       ` Christian Moe
2010-05-12 18:28       ` Christian Moe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6B1AD663-E844-4EBC-ABEC-759DF9973B2F@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=Emacs-orgmode@gnu.org \
    --cc=mail@christianmoe.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).