From: Nick Dokos <nicholas.dokos@hp.com>
To: Noorul Islam K M <noorul@noorul.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org,
Jambunathan K <kjambunathan@gmail.com>,
Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: Re: Internal links in LaTeX export
Date: Fri, 29 Oct 2010 03:20:50 -0400 [thread overview]
Message-ID: <21518.1288336850@gamaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Noorul Islam K M <noorul@noorul.com> of "Fri, 29 Oct 2010 10:31:12 +0530." <871v79h9t3.fsf@noorul.maa.corp.collab.net>
Noorul Islam K M <noorul@noorul.com> wrote:
> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
> > On Oct 29, 2010, at 5:22 AM, Jambunathan K wrote:
> >
> >> "Thomas S. Dye" <tsd@tsdye.com> 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
next prev parent reply other threads:[~2010-10-29 7:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-28 20:06 Internal links in LaTeX export Thomas S. Dye
2010-10-28 20:18 ` Sébastien Vauban
2010-10-28 20:44 ` Thomas S. Dye
2010-10-28 21:01 ` Jambunathan K
2010-10-28 21:19 ` Thomas S. Dye
2010-10-28 22:35 ` Nick Dokos
2010-10-29 0:20 ` Thomas S. Dye
2010-10-29 1:30 ` Jambunathan K
2010-10-29 2:04 ` Thomas S. Dye
2010-10-29 3:22 ` [SOLVED] " Jambunathan K
2010-10-29 3:58 ` Carsten Dominik
2010-10-29 5:01 ` Noorul Islam K M
2010-10-29 6:38 ` Tom Dye
2010-10-29 7:20 ` Nick Dokos [this message]
2010-10-29 7:51 ` Noorul Islam
2010-10-29 8:34 ` Nick Dokos
2010-11-13 5:55 ` [Accepted] " Carsten Dominik
2010-10-29 3:28 ` Nick Dokos
2010-10-29 5:46 ` Nick Dokos
2010-10-29 10:17 ` Jambunathan K
2010-10-30 19:56 ` suvayu ali
2010-11-02 7:35 ` Jambunathan K
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=21518.1288336850@gamaville.dokosmarshall.org \
--to=nicholas.dokos@hp.com \
--cc=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=kjambunathan@gmail.com \
--cc=noorul@noorul.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).