From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Re: Internal links in LaTeX export Date: Fri, 29 Oct 2010 03:20:50 -0400 Message-ID: <21518.1288336850@gamaville.dokosmarshall.org> References: <54309AAF-34E2-47F9-9DF2-236DC9BBFA69@tsdye.com> <80y69i5avh.fsf@mundaneum.com> <8439CC4F-8895-43F1-BE6A-D8E5A491A908@tsdye.com> <81tyk6117u.fsf@gmail.com> <18647.1288305308@alphaville.usa.hp.com> <25705B2C-189C-47A3-B6DC-71026E1DAC09@tsdye.com> <81r5f9g4z2.fsf@gmail.com> <3E9A955C-3A21-42CE-BE35-D638FF310E57@tsdye.com> <81zktxllju.fsf@gmail.com> <871v79h9t3.fsf@noorul.maa.corp.collab.net> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=34785 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBjGg-0002ru-Uc for emacs-orgmode@gnu.org; Fri, 29 Oct 2010 03:20:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PBjGe-0008Nr-RX for emacs-orgmode@gnu.org; Fri, 29 Oct 2010 03:20:54 -0400 Received: from vms173013pub.verizon.net ([206.46.173.13]:50261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PBjGe-0008Ni-Kw for emacs-orgmode@gnu.org; Fri, 29 Oct 2010 03:20:52 -0400 Received: from gamaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173013.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LB1002W3J2QCJ60@vms173013.mailsrvcs.net> for emacs-orgmode@gnu.org; Fri, 29 Oct 2010 02:20:51 -0500 (CDT) In-reply-to: Message from Noorul Islam K M of "Fri, 29 Oct 2010 10:31:12 +0530." <871v79h9t3.fsf@noorul.maa.corp.collab.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Noorul Islam K M Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org, Jambunathan K , Carsten Dominik Noorul Islam K M wrote: > Carsten Dominik writes: > > > On Oct 29, 2010, at 5:22 AM, Jambunathan K wrote: > > > >> "Thomas S. Dye" 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