emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Numbering only second-level headlines in export
@ 2018-02-28 16:04 Jarmo Hurri
  2018-02-28 20:09 ` Eric S Fraga
  0 siblings, 1 reply; 3+ messages in thread
From: Jarmo Hurri @ 2018-02-28 16:04 UTC (permalink / raw)
  To: emacs-orgmode


Greetings.

What - if any - would be the recommended way to implement numbering only
second-level headlines in an exported document with running numbering
(resets with first-level headline change)?

BTW, here is a full programming course (used to teach kids of different
ages) written almost entirely with org:

https://www.syk.fi/ohjelmointi/

The generation of the front page utilizes a couple of shell scripts,
some javascript and R, but it's all org otherwises. The entire source
code can be found here:

https://github.com/jarmohurri/ohjelmointi

All the best,

Jarmo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Numbering only second-level headlines in export
  2018-02-28 16:04 Numbering only second-level headlines in export Jarmo Hurri
@ 2018-02-28 20:09 ` Eric S Fraga
  2018-03-01  7:37   ` Jarmo Hurri
  0 siblings, 1 reply; 3+ messages in thread
From: Eric S Fraga @ 2018-02-28 20:09 UTC (permalink / raw)
  To: Jarmo Hurri; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1250 bytes --]

On Wednesday, 28 Feb 2018 at 18:04, Jarmo Hurri wrote:
> Greetings.
>
> What - if any - would be the recommended way to implement numbering only
> second-level headlines in an exported document with running numbering
> (resets with first-level headline change)?

You haven't said what export target you are using.  In any case, I would
suggest you look at using a counter.  See section 12.5 of the org manual
but specifically:

‘{{{n}}}’
‘{{{n(NAME)}}}’
‘{{{n(NAME,ACTION)}}}’
     This macro implements custom counters by returning the number of
     times the macro has been expanded so far while exporting the
     buffer.  You can create more than one counter using different NAME
     values.  If ACTION is ‘-’, previous value of the counter is held,
     i.e.  the specified counter is not incremented.  If the value is a
     number, the specified counter is set to that value.  If it is any
     other non-empty string, the specified counter is reset to 1.  You
     may leave NAME empty to reset the default counter.

I would turn off numbering of headings (num:nil option) and then have
the counter in each second level heading.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-191-g90607d

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Numbering only second-level headlines in export
  2018-02-28 20:09 ` Eric S Fraga
@ 2018-03-01  7:37   ` Jarmo Hurri
  0 siblings, 0 replies; 3+ messages in thread
From: Jarmo Hurri @ 2018-03-01  7:37 UTC (permalink / raw)
  To: emacs-orgmode


>> What - if any - would be the recommended way to implement numbering only
>> second-level headlines in an exported document with running numbering
>> (resets with first-level headline change)?
>
> You haven't said what export target you are using.  In any case, I would
> suggest you look at using a counter.  See section 12.5 of the org manual
> but specifically:
>
> ‘{{{n}}}’
> ‘{{{n(NAME)}}}’
> ‘{{{n(NAME,ACTION)}}}’
>      This macro implements custom counters by returning the number of
>      times the macro has been expanded so far while exporting the
>      buffer.  You can create more than one counter using different NAME
>      values.  If ACTION is ‘-’, previous value of the counter is held,
>      i.e.  the specified counter is not incremented.  If the value is a
>      number, the specified counter is set to that value.  If it is any
>      other non-empty string, the specified counter is reset to 1.  You
>      may leave NAME empty to reset the default counter.
>
> I would turn off numbering of headings (num:nil option) and then have
> the counter in each second level heading.

Brilliant, that worked like a charm on first trial. Thanks!

(BTW, my export target is html.)

Jarmo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-01  7:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28 16:04 Numbering only second-level headlines in export Jarmo Hurri
2018-02-28 20:09 ` Eric S Fraga
2018-03-01  7:37   ` Jarmo Hurri

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).