Dear all, this configuration does not work. #+begin_src emacs-lisp (use-package ox-context :straight (ox-context :type git :host github :repo "Jason-S-Ross/ox-context") :config (add-to-list 'org-context-presets-alist '("book" . (:literal "\n\\environment juh.env-garamond \n\\environment juh.env-garamond-trimsize5-8 \n\\environment juh.env-makeups \n\\environment juh.env-umbruch \n\\environment juh.env-heading \n\\environment juh.env-layout \n\\environment juh.env-header-footer \n\\environment juh.env-ligaturen" :template "report" :snippets ("title-article"))))) #+end_src test.org: #+title: Test #+context_preset: book #+context_snippet: title-snippet I get an export but the styles are not applied. Any hints? juh
On 12/21/21 7:50 AM, juh wrote:
> Dear all,
>
> this configuration does not work.
>
> #+begin_src emacs-lisp
> (use-package ox-context
> :straight (ox-context :type git :host github :repo
> "Jason-S-Ross/ox-context")
> :config
> (add-to-list 'org-context-presets-alist
> '("book" .
> (:literal "\n\\environment juh.env-garamond
> \n\\environment juh.env-garamond-trimsize5-8
> \n\\environment juh.env-makeups
> \n\\environment juh.env-umbruch
> \n\\environment juh.env-heading
> \n\\environment juh.env-layout
> \n\\environment juh.env-header-footer
> \n\\environment juh.env-ligaturen"
> :template "report"
> :snippets ("title-article")))))
> #+end_src
>
> test.org:
>
> #+title: Test
> #+context_preset: book
> #+context_snippet: title-snippet
>
> I get an export but the styles are not applied.
>
> Any hints?
> juh
Your configuration looks correct to me.
Can you verify that the lines
\environment juh.env-garamond
\environment juh.env-garamond-trimsize5-8
\environment juh.env-makeups
\environment juh.env-umbruch
\environment juh.env-heading
\environment juh.env-layout
\environment juh.env-header-footer
\environment juh.env-ligaturen
appear in the file "test.mkiv" that gets generated?
Thanks,
Jason
[-- Attachment #1: Type: text/plain, Size: 4112 bytes --] On 21.12.21 17:19, Jason Ross wrote: > > Your configuration looks correct to me. > > Can you verify that the lines > > \environment juh.env-garamond > \environment juh.env-garamond-trimsize5-8 > \environment juh.env-makeups > \environment juh.env-umbruch > \environment juh.env-heading > \environment juh.env-layout > \environment juh.env-header-footer > \environment juh.env-ligaturen > > appear in the file "test.mkiv" that gets generated? Yes: %=============================================================================== % Preset Commands %=============================================================================== \environment juh.env-garamond \environment juh.env-garamond-trimsize5-8 \environment juh.env-makeups \environment juh.env-umbruch \environment juh.env-heading \environment juh.env-layout \environment juh.env-header-footer \environment juh.env-ligaturen When I manually run the mkiv file I get this. open source > level 1, order 2, name './test.mkiv' open source > level 2, order 3, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-garamond.tex' selectfont > the requested font 'TypographyTribute' has no files for the 'tf' alternative, Latin Modern is used instead. close source > level 2, order 3, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-garamond.tex' open source > level 2, order 4, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-garamond-trimsize5-8.tex' close source > level 2, order 4, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-garamond-trimsize5-8.tex' open source > level 2, order 5, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-makeups.tex' setup > error in line 50, namespace 'layout', instance 'coverpage', key 'setups:coverpage,' close source > level 2, order 5, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-makeups.tex' open source > level 2, order 6, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-umbruch.tex' close source > level 2, order 6, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-umbruch.tex' open source > level 2, order 7, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-heading.tex' close source > level 2, order 7, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-heading.tex' open source > level 2, order 8, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-layout.tex' modules > 'layout' is loaded open source > level 3, order 9, name '/home/juh/juh.context/tex/texmf-context/tex/context/modules/mkiv/m-layout.mkiv' close source > level 3, order 9, name '/home/juh/juh.context/tex/texmf-context/tex/context/modules/mkiv/m-layout.mkiv' fonts > beware: no fonts are loaded yet, using 'lm mono' in box close source > level 2, order 9, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-layout.tex' open source > level 2, order 10, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-header-footer.tex' close source > level 2, order 10, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-header-footer.tex' open source > level 2, order 11, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-ligaturen.tex' close source > level 2, order 11, name '/home/juh/juh.context/tex/texmf-local/juh.context-styles/juh.env-ligaturen.tex' fonts > preloading latin modern fonts (second stage) fonts > defining > font 'lmroman12-regular', feature 'locl', script 'latn', no language 'dflt' fonts > 'fallback modern-designsize rm 12pt' is loaded There is an error with juh.env-makeups.tex which does not show up, when I use the environment in an other context. I removed it and got no change in layout. I attached the intermediate mkiv-file and the log. [-- Attachment #2: test.zip --] [-- Type: application/zip, Size: 5654 bytes --]
On 12/21/21 9:55 AM, juh wrote:
> Yes:
>
> %===============================================================================
>
> % Preset Commands
> %===============================================================================
>
> \environment juh.env-garamond
>
> \environment juh.env-garamond-trimsize5-8
>
> \environment juh.env-makeups
>
> \environment juh.env-umbruch
>
> \environment juh.env-heading
>
> \environment juh.env-layout
>
> \environment juh.env-header-footer
>
> \environment juh.env-ligaturen
>
> When I manually run the mkiv file I get this.
>
> There is an error with juh.env-makeups.tex which does not show up, when
> I use the environment in an other context. I removed it and got no
> change in layout.
>
> I attached the intermediate mkiv-file and the log.
There is a problem on the ConTeXt side of things. ox-context just calls
the ConTeXt process on the output file (it's exactly equivalent to
calling `context test.mkiv` from the terminal).
Jason
On 21.12.21 19:04, Jason Ross wrote:
> There is a problem on the ConTeXt side of things. ox-context just calls
> the ConTeXt process on the output file (it's exactly equivalent to
> calling `context test.mkiv` from the terminal)
Very strange. I have to dig deeper.
Thanks!
juh
Am Dienstag, dem 21.12.2021 um 19:36 +0100 schrieb juh Ok, one thing solved. I normally call context with --mode=trimsize to activate the given trimsize. Can I set this in org-mode? When I manually compile test.mkiv I get the right page dimensions but the layout is scrambled. Maybe interferences with the default settings? Sorry, but I am still trying to understand what is going on in the background of emacs export. juh
On 12/21/21 10:56 AM, juh wrote:
> Am Dienstag, dem 21.12.2021 um 19:36 +0100 schrieb juh
>
> Ok, one thing solved.
>
> I normally call context with --mode=trimsize to activate the given
> trimsize. Can I set this in org-mode?
>
> When I manually compile test.mkiv I get the right page dimensions but
> the layout is scrambled. Maybe interferences with the default
> settings?
>
> Sorry, but I am still trying to understand what is going on in the
> background of emacs export.
>
>
> juh
Try `(setq org-context-pdf-process '("context --mode=trimsize %f"))`
to set this as the default.
Jason
Hi Ross,
Am Dienstag, dem 21.12.2021 um 11:05 -0800 schrieb Jason Ross:
> Try `(setq org-context-pdf-process '("context --mode=trimsize %f"))`
> to set this as the default.
thanks a lot. The team "emacs org-mode ox-context" seems to be quite
flexible. :-)
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.
One more thing.
#+begin_quote
results in the verbatim line
OrgBlockQuoteEnumEmpty 1
in the pdf and a very indented quote block.
In html export I get an normal indented blockquote.
Merry Chrismas and a happy new year!
juh
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 > > OrgBlockQuoteEnumEmpty 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
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
What do you think about using context's structurelevels instead? That
would allow users to define their own mappings.
Denis
Am 23.12.2021 um 08:24 schrieb juh:
> 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
>
>
>
On 12/23/21 12:16 PM, Denis Maier wrote:
> What do you think about using context's structurelevels instead? That
> would allow users to define their own mappings.
>
> Denis
That looks like a brilliant solution. I'll have to give it a deeper look
to know for sure though - table of contents commands need the headline
names in order to set up the depth properly. I don't know if there is a
workaround for this in ConTeXt. But, I think this would satisfy Juh's
needs as well. Adding \definesectionlevels to the preamble would allow
them to have whatever sectioning scheme they want.
Jason