emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Numbering only *some* subheadings?
@ 2015-04-30  2:45 Matt Price
  2015-04-30  7:50 ` Christian Moe
  2015-04-30  9:16 ` Rasmus
  0 siblings, 2 replies; 3+ messages in thread
From: Matt Price @ 2015-04-30  2:45 UTC (permalink / raw)
  To: Org Mode

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

I would like to number only a single subset of subheadings in an html
export, so that, e.g.,

* Introduction
lorem ipsum
* Coiurse Requirements
lorem ipsum
* Course Outline
** Introduction
some long multi paragraph text.
** Origins of the French Revolution
more text. Readings.
** Liberty, Equality, Fraternity?
... etc

becomes:

Introduction

Course Requirements

Course Outline

1. Introduction
bla bla bla
2. Origins of hte French Revolution
bla bla bla.
Readings:  bla bla bla
3. Liberty, Eaquality, Fraternity

... etc

Is this possible? Anyone have a suggestion?

Thanks as always,
Matt

[-- Attachment #2: Type: text/html, Size: 1016 bytes --]

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

* Re: Numbering only *some* subheadings?
  2015-04-30  2:45 Numbering only *some* subheadings? Matt Price
@ 2015-04-30  7:50 ` Christian Moe
  2015-04-30  9:16 ` Rasmus
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Moe @ 2015-04-30  7:50 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode



You can do the opposite and number only the topmost headings, e.g. with

#+OPTIONS: num:1

but I don't think Org has a way to number only sub-headings. In HTML
export, you can get there with CSS hacks. For the exact example you
gave,

#+HTML_HEAD: <style>.section-number-2 {display: none;}</style>

should hide heading numbering for the top heading level (add
more CSS if you have more heading levels). It won't fix the TOC, though;
with numbered headline export, the numbers are hardcoded in the TOC.

You could export without heading numbering, and add numbering to both
headlines and TOC items with CSS, but it's more involved. Again, for
your simple example you could do something like this.

#+OPTIONS: num:nil
#+HTML_HEAD: <style>h3::before {counter-increment: subheadnum; 
#+HTML_HEAD:                    content: counter(subheadnum) ". "}
#+HTML_HEAD:        h2 {counter-reset: subheadnum}
#+HTML_HEAD:        #text-table-of-contents ul ul {list-style-type: decimal}</style>

Yours,
Christian



Matt Price writes:

> I would like to number only a single subset of subheadings in an html
> export, so that, e.g.,
>
> * Introduction
> lorem ipsum
> * Coiurse Requirements
> lorem ipsum
> * Course Outline
> ** Introduction
> some long multi paragraph text.
> ** Origins of the French Revolution
> more text. Readings.
> ** Liberty, Equality, Fraternity?
> ... etc
>
> becomes:
>
> Introduction
>
> Course Requirements
>
> Course Outline
>
> 1. Introduction
> bla bla bla
> 2. Origins of hte French Revolution
> bla bla bla.
> Readings:  bla bla bla
> 3. Liberty, Eaquality, Fraternity
>
> ... etc
>
> Is this possible? Anyone have a suggestion?
>
> Thanks as always,
> Matt

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

* Re: Numbering only *some* subheadings?
  2015-04-30  2:45 Numbering only *some* subheadings? Matt Price
  2015-04-30  7:50 ` Christian Moe
@ 2015-04-30  9:16 ` Rasmus
  1 sibling, 0 replies; 3+ messages in thread
From: Rasmus @ 2015-04-30  9:16 UTC (permalink / raw)
  To: emacs-orgmode

Hi Matt,

Matt Price <moptop99@gmail.com> writes:

> Is this possible? Anyone have a suggestion?

It is not possible in Org since one of the basic assumptions of the
UNNUMBERED property is that it is inherited from parent(s).  I think this
is the right design choice in most cases.  Perhaps it should be possible
to explicitly override this choice with something like the following:

* Course Outline
:PROPERTIES:
:UNNUMBERED: t
:END:
** Introduction
:PROPERTIES:
:UNNUMBERED: nil
:END:
some long multi paragraph text.
** Origins of the French Revolution
:PROPERTIES:
:UNNUMBERED: nil
:END:
more text. Readings.

Or introduce an explicit NUMBERED property (probably easier in code).
However, the numbering will likely be complicated as they are no longer
sub-numbered according to parent (i.e. the correct numbering is not 0.1,
0.2, 0.3 but 1, 2, 3).

Do you think this is generally useful or is this a one-off document?

—Rasmus

-- 
To err is human. To screw up 10⁶ times per second, you need a computer

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

end of thread, other threads:[~2015-04-30  9:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-30  2:45 Numbering only *some* subheadings? Matt Price
2015-04-30  7:50 ` Christian Moe
2015-04-30  9:16 ` Rasmus

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