From mboxrd@z Thu Jan 1 00:00:00 1970 From: Noorul Islam Subject: Re: Re: Internal links in LaTeX export Date: Fri, 29 Oct 2010 13:21:16 +0530 Message-ID: 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> <21518.1288336850@gamaville.dokosmarshall.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=42610 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PBjk7-0003MC-FP for emacs-orgmode@gnu.org; Fri, 29 Oct 2010 03:51:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PBjk6-0005bA-0S for emacs-orgmode@gnu.org; Fri, 29 Oct 2010 03:51:19 -0400 Received: from mail-gx0-f169.google.com ([209.85.161.169]:37419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PBjk5-0005b5-Pm for emacs-orgmode@gnu.org; Fri, 29 Oct 2010 03:51:17 -0400 Received: by gxk2 with SMTP id 2so389475gxk.0 for ; Fri, 29 Oct 2010 00:51:17 -0700 (PDT) In-Reply-To: <21518.1288336850@gamaville.dokosmarshall.org> 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: nicholas.dokos@hp.com Cc: emacs-orgmode@gnu.org, Jambunathan K , Carsten Dominik On Fri, Oct 29, 2010 at 12:50 PM, Nick Dokos wrote: > 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. =A0It 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. =A0It appears the LaTe= X >> >>> export process no longer distinguishes internal and external links, >> >>> as >> >>> I believe it used to do. >> >>> >> >> >> >> This is the problematic commit: >> >> >> >> commit f5918bdcc05d7924dc204b57307023eb1ef011f0 >> >> parent =A0 =A0 df5894cdcb10819560f003c5b94b8f5f2b7d33cf >> >> Date: =A0 Sun Oct 17 08:29:51 2010 +0000 >> >> >> >> =A0 =A0LaTeX 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 li= st will be used." >> =A0 =A0:group 'org-export-latex >> =A0 =A0:type 'string) >> >> -(defcustom org-export-latex-hyperref-format "\\href{%s}{%s}" >> +(defcustom org-export-latex-href-format "\\href{%s}{%s}" >> + =A0"A printf format string to be applied to href links. >> +The format must contain two %s instances. =A0The first will be filled w= ith >> +the link, the second with the link description." >> + =A0:group 'org-export-latex >> + =A0:type 'string) >> + >> +(defcustom org-export-latex-hyperref-format "\\hyperref[%s]{%s}" >> =A0 =A0"A printf format string to be applied to hyperref links. >> =A0The format must contain two %s instances. =A0The first will be filled= with >> =A0the link, the second with the link description." >> @@ -2016,10 +2023,10 @@ The conversion is made depending of STRING-BEFOR= E and STRING-AFTER." >> =A0 =A0 =A0 =A0 =A0 =A0 (insert (format >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(org-export-get-coderef-forma= t path desc) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(cdr (assoc path org-export-c= ode-refs))))) >> - =A0 =A0 =A0 =A0 =A0(radiop (insert (format "\\hyperref[%s]{%s}" >> + =A0 =A0 =A0 =A0 =A0(radiop (insert (format org-export-latex-hyperref-f= ormat >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(= org-solidify-link-text raw-path) desc))) >> =A0 =A0 =A0 =A0 =A0 =A0((not type) >> - =A0 =A0 =A0 =A0 =A0 (insert (format "\\hyperref[%s]{%s}" >> + =A0 =A0 =A0 =A0 =A0 (insert (format org-export-latex-hyperref-format >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (org-remove-init= ial-hash >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(org-solidify= -link-text raw-path)) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 desc))) >> @@ -2030,7 +2037,7 @@ The conversion is made depending of STRING-BEFORE = and STRING-AFTER." >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; a LaTeX issue, but we here implement a wo= rk-around anyway. >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq path (org-export-latex-protect-amp pat= h) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 desc (org-export-latex-protect-a= mp desc))) >> - =A0 =A0 =A0 =A0 =A0 (insert (format org-export-latex-hyperref-format p= ath desc))) >> + =A0 =A0 =A0 =A0 =A0 (insert (format org-export-latex-href-format path = desc))) >> >> =A0 =A0 =A0 =A0 =A0 =A0((functionp (setq fnc (nth 2 (assoc type org-link= -protocols)))) >> =A0 =A0 =A0 =A0 =A0 =A0 ;; The link protocol has a function for formatti= ng 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? > For the same thing I get this --8<---------------cut here---------------end--------------->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-- Thanks and Regards Noorul