From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: LaTeX export of section links Date: Fri, 20 Nov 2009 07:42:56 -0500 Message-ID: <87aayhqsdr.fsf@gollum.intra.norang.ca> References: <873a49e8g6.fsf@missioncriticalit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NBSpf-0005af-NI for emacs-orgmode@gnu.org; Fri, 20 Nov 2009 07:43:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NBSpb-0005YY-Ek for emacs-orgmode@gnu.org; Fri, 20 Nov 2009 07:43:23 -0500 Received: from [199.232.76.173] (port=48461 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NBSpb-0005YV-1c for emacs-orgmode@gnu.org; Fri, 20 Nov 2009 07:43:19 -0500 Received: from plane.gmane.org ([80.91.229.3]:35065) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NBSpa-0005V6-Ae for emacs-orgmode@gnu.org; Fri, 20 Nov 2009 07:43:18 -0500 Received: from public by plane.gmane.org with local (Exim 4.63) (envelope-from ) id 1NBSpS-0002Fo-TU for emacs-orgmode@gnu.org; Fri, 20 Nov 2009 13:43:10 +0100 In-Reply-To: <873a49e8g6.fsf@missioncriticalit.com> (Francesco Pizzolante's message of "Fri\, 20 Nov 2009 12\:34\:17 +0100") 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: Francesco Pizzolante Cc: mailing-list-org-mode Francesco Pizzolante writes: > Hi, > > I have a few questions about links to sections. > > I've read that it is better to user IDs and CUSTOM_IDs to links to section... > > Here's a small example with 4 cases: > > --8<---------------cut here---------------start------------->8--- > * First > :PROPERTIES: > :CUSTOM_ID: heading-a > :END: > > Hello Toto! > > * Second > # <> > > Hello Tata! > > * Third > #+CUSTOM_ID: heading-c > > Hello Titi! > > * Fourth > #+ID: heading-d > > Hello Tete! > > [[heading-a]] > [[heading-b]] > [[heading-c]] > [[heading-d]] > --8<---------------cut here---------------end--------------->8--- > > Which give the following LaTeX code: > > --8<---------------cut here---------------start------------->8--- > \section{First} > \label{sec-1} > \label{heading-a} > > > Hello Toto! > > \section{Second} > \label{sec-2} > \label{heading-b} > > > Hello Tata! > > \section{Third} > \label{sec-3} > > > Hello Titi! > > \section{Fourth} > \label{sec-4} > > > Hello Tete! > > \hyperref[sec-1]{heading-a} > \hyperref[sec-2]{heading-b} > \hyperref[sec-3]{heading-c} > \hyperref[sec-4]{heading-d} > --8<---------------cut here---------------end--------------->8--- > > The first and second cases both generate labels which are not used in LaTeX. > > The third and fourth cases are very elegant as they use only aliases (which > are dropped from the LaTeX code). > > My questions are: > > - what's the difference between using ID and CUSTOM_ID? > > - the cases "Third" and "Fourth" are the more elegant from my point of view. > Is this the right way of doing? > > - what's the difference between cases "First" and "Second" (I mean between > using PROPERTIES and # <>)? > > - in the documentation (section 4.2), we talk about "CUSTOM_ID property" does > it mean that we should use it as in case 1? I use the CUSTOM_ID property for HTML exports (not LaTeX). The ID property is automatically generated for me when I link to a task and is a unique identifier for that heading across all of my org files. ,---- | * Some Task | :PROPERTIES: | :ID: 1329fa08-3c1d-4b73-b984-bef414b0dd3d | :END: `---- This allows me to have more than one 'Some Task' in my files and each will have a unique ID so that linking to it finds the correct one. CUSTOM_IDs are a way to create links using a user-defined name. I use this for my org-mode document at http://doc.norang.ca/org-mode.html so that I can reference a section by name such as http://doc.norang.ca/org-mode.html#Publishing If I later insert a section before Publishing the link still goes to the correct place. Without the CUSTOM_ID property I get a link like http://doc.norang.ca/org-mode.html#sec-13 which may stop working if the document sections are moved around. I'm not sure what this buys you in LaTeX since I don't think the CUSTOM_ID names are exposed in the links (correct me if I'm wrong). I don't think the #+CUSTOM_ID: name #+ID: name forms are valid. These should be properties. The above names are probably just ignored during the export process. HTH, Bernt