[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Configuring ox-context
From: |
Jason Ross |
Subject: |
Re: Configuring ox-context |
Date: |
Wed, 22 Dec 2021 10:37:39 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 |
On 12/22/21 3:24 AM, juh wrote:
In the meantime I debugged my context styles and discovered that ox-
context starts with section not with chapters. My styles are always
book styles starting at chapter level. *feeling a little dumb*
I browsed through the code and found no hint for a book-like preset or
a switch to start at chapter level. I made a feature request about
this.
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.
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.
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
One more thing.
#+begin_quote
results in the verbatim line
OrgBlockQuoteEnuÂmEmpty 1
in the pdf and a very indented quote block.
In html export I get an normal indented blockquote.
This is fixed on the "develop" branch as of today. I missed a comma...
Thanks,
Jason
- Configuring ox-context, juh, 2021/12/21
- Re: Configuring ox-context, Jason Ross, 2021/12/21
- Re: Configuring ox-context, juh, 2021/12/21
- Re: Configuring ox-context, Jason Ross, 2021/12/21
- Re: Configuring ox-context, juh, 2021/12/21
- Re: Configuring ox-context, juh, 2021/12/21
- Re: Configuring ox-context, Jason Ross, 2021/12/21
- Re: Configuring ox-context, juh, 2021/12/22
- Re: Configuring ox-context,
Jason Ross <=
- Re: Configuring ox-context, juh, 2021/12/23
- Re: Configuring ox-context, Denis Maier, 2021/12/23
- Re: Configuring ox-context, Jason Ross, 2021/12/24