emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [patch, ox] Unnumbered headlines


From: Rasmus
Subject: Re: [O] [patch, ox] Unnumbered headlines
Date: Tue, 23 Sep 2014 02:35:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Hi,

Another couple of small changes.

Random observation: the patch is "almost" neutral due to the
headline-id function:

        88 insertions(+), 72 deletions(-)

Nicolas Goaziou <address@hidden> writes:

> I think it would be nice to keep "sec-NUM", with NUM matching current
> numbering, for numbered headlines. I'm not against a simple global
> counter for unnumbered headlines:
>
>   \label{sec-1}
>   \label{unnumbered-1}
>   \label{sec-2}
>   \label{unnumbered-2}
>
> or in the following example
>
>   * H1
>   ** H2
>      :PROPERTIES:
>      :UNNUMBERED: t
>      :END:
>   *** H3
>   *** H4
>   * H5
>   ** H6
>
> the labelling scheme
>
>  \label{sec-1}
>  \label{unnumbered-1}
>  \label{unnumbered-2}
>  \label{unnumbered-3}
>  \label{sec-2}
>  \label{sec-2-1}

Using this file:

    * h1
    :PROPERTIES:
    :CUSTOM_ID: h1
    :END:
    ** h2
    :PROPERTIES:
    :unnumbered: t
    :CUSTOM_ID: h2
    :END:
    *** h3
    *** h4
    * h5
    :PROPERTIES:
    :CUSTOM_ID: h5
    :END:
    [[*h1]] [[#h2]] [[*h4]] [[#h5]]
    ** h6

The output is now

    \section{h1}
    \label{sec-1}
    \subsection*{h2}
    \label{unnumbered-1}
    \subsubsection*{h3}
    \label{unnumbered-2}
    \subsubsection*{h4}
    \label{unnumbered-3}
    \section{h5}
    \label{sec-2}
    \ref{sec-1} \hyperref[unnumbered-1]{h2} \hyperref[unnumbered-3]{h4} 
\ref{sec-2}
    \subsection{h6}
    \label{sec-2-1}


Which I think is quite good.

I don't know if the global unnumbered counter is made in the best way.
I add another plist to info with the number.  This approach is cleaner
than before since it's the numbering of unnumbered headlines is not in
`org-export--collect-headline-numbering' which is complicated enough
as it is.

An alternative approach could be to just "count" the unnumbered
headlines place in the tree every time.

> Actually, there was a small bug in the code, now fixed. `latex' back-end
> is expected to use "hyperref" when headline in unnumbered.

Right I see.  The attached patch should merge against master.

>> To be clear: you are happy if it uses the \hyperref[·]{·} in LaTeX,
>> but not \ref{·} for unnumbered?
>
> You are the LaTeX expert. Isn't it reasonable?

It seems to work well, yes.

So I guess we should let the patch hang for a while and see if someone
cares to test it.  

Of course I'd appreciate more comments/bug reports.

Should I write tests for the new behavior?  If so, tests for each
backend or only for vanilla-ox functions?

Cheers,
Rasmus

--
If you can mix business and politics wonderful things can happen!

Attachment: 0001-ox-Support-unnumbered-headlines-via-property.patch
Description: Text Data


reply via email to

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