emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: juh <juh+org-mode@mailbox.org>
To: Jason Ross <jasonross1024@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Configuring ox-context
Date: Thu, 23 Dec 2021 08:24:25 +0100	[thread overview]
Message-ID: <bbea0e9132321b411077c4579e4f56535e5bf92b.camel@mailbox.org> (raw)
In-Reply-To: <10f190b3-ec80-3305-6ec7-506bc596244d@gmail.com>

Am Mittwoch, dem 22.12.2021 um 10:37 -0800 schrieb Jason Ross:
> 
> Thank you for bringing this up. I'd like to discuss this a bit with
> you
> before implementing such a feature.
> 
> I'm not sure how an implementation of this would look to the end
> user.
> ConTeXt has the following system:
> https://wiki.contextgarden.net/Command/_section
> 
> \part                   highest level of sectioning
> \chapter                level 2
> \section                level 3
> \subsection             level 4
> \subsubsection          level 5
> \subsubsubsection       level 6
> \subsubsubsubsection    level 7
> \title                  level 2, unnumbered
> \subject                level 3, unnumbered
> \subsubject             level 4, unnumbered
> \subsubsubject          level 5, unnumbered
> \subsubsubsubject       level 6, unnumbered
> \subsubsubsubsubject    level 7, unnumbered
> 
> 
> So there are a couple of questions that need to be answered:
> 
> 1. There's no "level 1, unnumbered" sectioning command in ConTeXt.
>     How should this be handled?
> 2. How does the user specify which sectioning scheme to use?
> 
> Question (1) implies that the user may need to choose their highest
> level to be either a part or a chapter in order to have unnumbered
> level 1 sections. Things start to get complicated if we do that.

I think that the scheme is conventional, and grown up with books and
LaTeX we are accustomed to it. The chapter-title scheme seems to be
from ConTeXt and I don't know the real reason behind this.

For me the part-chapter-section line is the book oriented sectioning
(with or without numbering) as books can have parts, often have
chapters and sometimes sections.

The title-subject line is the magazine oriented line, because articles
in  a magazine or essays in a collection only have titles and subjects,
and they are complete units which could be published elsewhere.

(Sometimes I use titles to mark special chapters that don't appear in
the table of contents.)

I don't think that what we do is always logical and consistent in
itself. But it might be a good memory hook to organize different items
such as books with chapters, articles and independent essays collected
in a book.

To get a broader view on this, we should discuss it in the ConTeXt
mailinglist. 

I am deploying a production chain with Markdown-Pandoc-ConTeXt in my
organization. AFAIK Pandoc only produces the part-chapter-section line
while the highest level is configurable. So if we ever need a title-
subject scheme we will have to use filters.

> To avoid these questions, I went with the simplest implementation
> possible and just concatenated "sub"*n with either "section" or
> "subject" to create a sectioning command of depth n.
> 
> My understanding is that the sectioning commands are flexible enough
> that any desired result in the output pdf can be produced by
> modifying
> the sectioning commands in the preamble. However, if you are using
> existing environments that rely on those specific names you are out
> of
> luck.
> 

Yes I think they are flexible enough and I can customize my styles, but
I would prefer to have a solution which can be used with the usual
sectioning of ConTeXt.

My proposal would be 

1.) to have a switch for using 
	(a) the part-chapter-section line or 
	(b) the title-subject-line on export. 

2.) to have a customization for (a) similiar to pandocs "top-level-
division"



> For your purposes, if you need a fix _right now_, consider overriding
> the definition of `org-context--get-headline-command` to something
> like this:
> 
> #+begin_src elisp
> (defun org-context--get-headline-command (headline info)
>    "Create a headline name with the correct depth.
> HEADLINE is the headline object. INFO is a plist containing
> contextual information."
>    (let* ((level (org-export-get-relative-level headline info))
>           (numberedp (org-export-numbered-headline-p headline info))
>           (hname
>            (cond
>             ((and (= 1 level) numberedp) "chapter")
>             ((= 1 level) "title")
>             (t (let ((prefix (apply 'concat (make-list (+ level (-
> 2)) 
> "sub")))
>                      (suffix (if numberedp "section" "subject")))
>                  (concat prefix suffix)))))
>           (notoc (org-export-excluded-from-toc-p headline info)))
>      (if notoc
>          (format "%sNoToc" hname)
>        hname)))
> #+end_src
> 
> 
Thanks a lot. I will try this the next days.

> 
> 
> This is fixed on the "develop" branch as of today. I missed a
> comma...

Great.

juh



  reply	other threads:[~2021-12-23  7:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 15:50 Configuring ox-context juh
2021-12-21 16:19 ` Jason Ross
2021-12-21 17:55   ` juh
2021-12-21 18:04     ` Jason Ross
2021-12-21 18:36       ` juh
2021-12-21 18:56         ` juh
2021-12-21 19:05           ` Jason Ross
2021-12-22 11:24             ` juh
2021-12-22 18:37               ` Jason Ross
2021-12-23  7:24                 ` juh [this message]
2021-12-23 20:16                   ` Denis Maier
2021-12-24 16:36                     ` Jason Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bbea0e9132321b411077c4579e4f56535e5bf92b.camel@mailbox.org \
    --to=juh+org-mode@mailbox.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=jasonross1024@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).