emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: Internal links in LaTeX export


From: Nick Dokos
Subject: Re: [Orgmode] Re: Internal links in LaTeX export
Date: Fri, 29 Oct 2010 03:20:50 -0400

Noorul Islam K M <address@hidden> wrote:

> Carsten Dominik <address@hidden> writes:
> 
> > On Oct 29, 2010, at 5:22 AM, Jambunathan K wrote:
> >
> >> "Thomas S. Dye" <address@hidden> writes:
> >>
> >>> Aloha Jambunathan K.,
> >>>
> >>> Yes, thanks for that suggestion.  It should work on your example, but
> >>> it breaks external links, like this:
> >>>
> >>> \hyperref[http://www.ctan.org/tex-archive/macros/latex/contrib/koma-script/
> >>> ]{KOMA-script}
> >>>
> >>> External links require the \href{}{} command.  It appears the LaTeX
> >>> export process no longer distinguishes internal and external links,
> >>> as
> >>> I believe it used to do.
> >>>
> >>
> >> This is the problematic commit:
> >>
> >> commit f5918bdcc05d7924dc204b57307023eb1ef011f0
> >> parent     df5894cdcb10819560f003c5b94b8f5f2b7d33cf
> >> Date:   Sun Oct 17 08:29:51 2010 +0000
> >>
> >>    LaTeX export: use org-export-latex-hyperref-format
> >
> > I have just reverted this commit.
> >
> > - Carsten
> >
> Looks like time to change the variable name which is actually confusing.
> 
> Since href and hyperref are two different things, I renamed the existing
> `org-export-latex-hyperref-format' variable as
> `org-export-latex-href-format' and introduced a new one
> `org-export-latex-hyperref-format'.
> 
> * org-latex.el (org-export-latex-hyperref-format): New option.
> (org-export-latex-href-format): Renamed the existing variable
> `org-export-latex-hyperref-format' as `org-export-latex-href-format'
> (org-export-latex-links): Use `org-export-latex-hyperref-format' and 
> `org-export-latex-href-format'
> 
> Thanks and Regards
> Noorul
> 
> diff --git a/lisp/org-latex.el b/lisp/org-latex.el
> index cdc240c..8f0e0ea 100644
> --- a/lisp/org-latex.el
> +++ b/lisp/org-latex.el
> @@ -295,7 +295,14 @@ markup defined, the first one in the association list 
> will be used."
>    :group 'org-export-latex
>    :type 'string)
>  
> -(defcustom org-export-latex-hyperref-format "\\href{%s}{%s}"
> +(defcustom org-export-latex-href-format "\\href{%s}{%s}"
> +  "A printf format string to be applied to href links.
> +The format must contain two %s instances.  The first will be filled with
> +the link, the second with the link description."
> +  :group 'org-export-latex
> +  :type 'string)
> +
> +(defcustom org-export-latex-hyperref-format "\\hyperref[%s]{%s}"
>    "A printf format string to be applied to hyperref links.
>  The format must contain two %s instances.  The first will be filled with
>  the link, the second with the link description."
> @@ -2016,10 +2023,10 @@ The conversion is made depending of STRING-BEFORE and 
> STRING-AFTER."
>             (insert (format
>                      (org-export-get-coderef-format path desc)
>                      (cdr (assoc path org-export-code-refs)))))
> -          (radiop (insert (format "\\hyperref[%s]{%s}"
> +          (radiop (insert (format org-export-latex-hyperref-format
>                                    (org-solidify-link-text raw-path) desc)))
>            ((not type)
> -           (insert (format "\\hyperref[%s]{%s}"
> +           (insert (format org-export-latex-hyperref-format
>                             (org-remove-initial-hash
>                              (org-solidify-link-text raw-path))
>                             desc)))
> @@ -2030,7 +2037,7 @@ The conversion is made depending of STRING-BEFORE and 
> STRING-AFTER."
>               ;; a LaTeX issue, but we here implement a work-around anyway.
>               (setq path (org-export-latex-protect-amp path)
>                     desc (org-export-latex-protect-amp desc)))
> -           (insert (format org-export-latex-hyperref-format path desc)))
> +           (insert (format org-export-latex-href-format path desc)))
>  
>            ((functionp (setq fnc (nth 2 (assoc type org-link-protocols))))
>             ;; The link protocol has a function for formatting the link
> 

I don't think this patch is correct. I just pulled "Org-mode version
7.01trans (release_7.01h.882.g750f.dirty)" to get Carsten's revert of
the previous patch and tested against the following org file:

--8<---------------cut here---------------start------------->8---

* Foo
Here is a link to section Bar: [[Bar]]

* Bar

And here is an external link: [[http://www.google.com][google]]
--8<---------------cut here---------------end--------------->8---

When I export to LaTeX, I get this:

--8<---------------cut here---------------start------------->8---
...
\section{Foo}
\label{sec-1}

Here is a link to section Bar: \hyperref[sec-2]{Bar}
\section{Bar}
\label{sec-2}


And here is an external link: \href{http://www.google.com}{google}
...
--8<---------------cut here---------------end--------------->8---

which I believe is correct - Tom?

After I apply the patch, I get this LaTeX output:

--8<---------------cut here---------------start------------->8---
...
\section{Foo}
\label{sec-1}

Here is a link to section Bar: \href{sec-2}{Bar}
\section{Bar}
\label{sec-2}


And here is an external link: \href{http://www.google.com}{google}
...
--8<---------------cut here---------------end--------------->8---

which is wrong. Did you test the patch and if so, how?

Nick



reply via email to

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