[NTG-context] Re: Chapters without new page
On 9/14/2023 10:10 PM, Rik Kabel wrote: On 9/14/2023 5:49 PM, Jeroen wrote: In the \startbackmatter ... \stopbackmatter section i would like to have some chapters that are not automatically placed on a new page for the next chapter. Is there an easy way to suppress the new page for these chapters? Thanks, Jeroen Untried: 1. Define a new section head that clones chapter (\definehead[NPChapter][chapter]). 2. Modify the new section head so that it does not do a break (\setuphead[NPChapter][page=no]). 3. Use the new section head instead of \chapter or \startchapter. And, if you want them to appear in the table of contents, modify the combined list of section headers that go into the contents (\setupcombinedlist[content][list=chapter,NPChapter,...]). Perhaps add it to the pdf bookmarks as well (\placebookmarks...). -- RIk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
[NTG-context] Re: Chapters without new page
On 9/14/2023 5:49 PM, Jeroen wrote: In the \startbackmatter ... \stopbackmatter section i would like to have some chapters that are not automatically placed on a new page for the next chapter. Is there an easy way to suppress the new page for these chapters? Thanks, Jeroen Untried: 1. Define a new section head that clones chapter (\definehead[NPChapter][chapter]). 2. Modify the new section head so that it does not do a break (\setuphead[NPChapter][page=no]). 3. Use the new section head instead of \chapter or \startchapter. -- Rik___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
[NTG-context] Re: streams reversed?
Bruce, that was kind of you to reply. I think we both know that the streams mechanism, while 'workable' for the most part, is still in need of refinement. It is quite possible that what is causing my problem has less to do with 'streams' per se, and more to do with the use of this mechanism in a 'real book' using frontmatter, bodymatter etc. etc. Since it would be too long and complicated an MWE to place here in the list to demonstrate my problem, I will send you the file separately so you can see the issue: effectively, the streams have worked for frontmatter (Foreword), but when I get to Chapter 1 in bodymatter, they are reversed. You will see that. I can't work out why, but you might be able to see what is causing that. And of course, I have two other problems to work out before I could use this in a real production scenario: there is the one you have already alluded to of extra pages occasionally beforehand (hopefully easily solvable) but I can see another problem when the text is a lengthy one... and this is the result of synchronization: when one language (vi) takes up more space than the other (en), we get an awkward break at the end of the chapter in en, so that the last line can 'catch up' with the last paragraph (in vi). Maybe this one will be harder to solve! Julian On 14/9/23 20:14, Bruce Horrocks wrote: On 13 Sep 2023, at 07:47, jbf wrote: When I come to bodymatter and Chapter 1, again it works, except that the positions of the languages are reversed, so I end up with vi on the left and en on the right. By Chapter 2 we are back to the correct position once more (en left and vi right). I want to know why this is happening, and if I can prevent it happening. I've modified the sample code you got from Wolfgang to include chapter headings and it all looks fine to me[1] - the red text is all on the right hand side and the greeen text is all on the left. If this doesn't help and you still have problems then you'll need to post a sample that actually shows the problem. I'm using ConTeXt ver: 2023.09.04 19:15. \starttext \startoutputstream[one] \startcolor[red] \dorecurse{5}{\chapter{Stream One} \dorecurse{10}{\input knuth\par} } \stopcolor \stopoutputstream \startoutputstream[two] \startcolor[green] \dorecurse{5}{\chapter{Stream Two} \dorecurse{10}{\input zapf\par} } \stopcolor \stopoutputstream \synchronizestreams[one,two] \setbox\scratchboxone\outputstreambox[one] \setbox\scratchboxtwo\outputstreambox[two] \doloop {\ifvoid\scratchboxone \exitloop \else \setbox\scratchboxfour\vsplit\scratchboxone to \textheight \vbox to \vsize{\box\scratchboxfour\vss}% \setbox\scratchboxfive\vsplit\scratchboxtwo to \textheight \vbox to \vsize{\box\scratchboxfive\vss}% \fi} \stoptext [1] Apart from unnecessary blank pages at the beginning but that's a different problem so I'm not addressing that for now. — Bruce Horrocks Hampshire, UK ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
[NTG-context] Chapters without new page
In the \startbackmatter ... \stopbackmatter section i would like to have some chapters that are not automatically placed on a new page for the next chapter. Is there an easy way to suppress the new page for these chapters? Thanks, Jeroen ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
[NTG-context] Re: streams reversed?
On 13 Sep 2023, at 07:47, jbf wrote: > > When I come to bodymatter and Chapter 1, again it works, except that the > positions of the languages are reversed, so I end up with vi on the left and > en on the right. By Chapter 2 we are back to the correct position once more > (en left and vi right). > I want to know why this is happening, and if I can prevent it happening. I've modified the sample code you got from Wolfgang to include chapter headings and it all looks fine to me[1] - the red text is all on the right hand side and the greeen text is all on the left. If this doesn't help and you still have problems then you'll need to post a sample that actually shows the problem. I'm using ConTeXt ver: 2023.09.04 19:15. \starttext \startoutputstream[one] \startcolor[red] \dorecurse{5}{\chapter{Stream One} \dorecurse{10}{\input knuth\par} } \stopcolor \stopoutputstream \startoutputstream[two] \startcolor[green] \dorecurse{5}{\chapter{Stream Two} \dorecurse{10}{\input zapf\par} } \stopcolor \stopoutputstream \synchronizestreams[one,two] \setbox\scratchboxone\outputstreambox[one] \setbox\scratchboxtwo\outputstreambox[two] \doloop {\ifvoid\scratchboxone \exitloop \else \setbox\scratchboxfour\vsplit\scratchboxone to \textheight \vbox to \vsize{\box\scratchboxfour\vss}% \setbox\scratchboxfive\vsplit\scratchboxtwo to \textheight \vbox to \vsize{\box\scratchboxfive\vss}% \fi} \stoptext [1] Apart from unnecessary blank pages at the beginning but that's a different problem so I'm not addressing that for now. — Bruce Horrocks Hampshire, UK ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
[NTG-context] Re: Using structureuservariables before the heading
denis.ma...@unibe.ch schrieb am 12.09.2023 um 23:32: You need a box to get the author on a separate line. % \define[2]\ChapterCommand % {\vbox % {\structureuservariable{author} % \blank % #1\space#2}} \starttexdefinition protected ChapterCommand #1#2 \vbox\bgroup \structureuservariable{author} \blank #1\space#2 \egroup \stoptexdefinition Thank you so much, Wolfgang! Why do you need protected here? I’ve realized that \protected\def also helps a bit, but, of course, paragraph breaks are ignored there as well… You probably haven't noticed it yet but unlike the other predefined layouts for sections you don't have to write "alternative=command" to use the layout which is passed to the command key. To make this work ConTeXt has to check whether the argument of the command key is empty or not but this is problematic when you pass commands with arguments. When you try to example below you can see that the first definition of \Mycommand fails because \edef\CheckMycommand tries to expand its argument which causes problems because \Mycommand tries to read the following argument. To solve this problem you can use the \protected modifier when you create \Mycommand. \starttext \def\Mycommand#1{#1}% fails %\protected\def\Mycommand#1{#1}% works \edef\CheckMycommand{\Mycommand} \ifempty\CheckMycommand \tex{Mycommand} is empty \else \tex{Mycommand} has content \fi \stoptext If just found the following in the lowlevel-macros manual: «Traditional TEX has three prefixes that can be used with macros: \global, \outer and \long. The last two are no-op's in LuaMetaTEX and if you want to know what they do (did) you can look it up in the TEXbook.» So, \long is gone, but why is that? Is there a new mechanism that serves the same purpose? Other than using a vbox, I mean… The purpose of the \long modifier is to specify whether the argument of a command can or cannot contain multiple paragraph (either by an empty line or with \par). This was needed by TeX in the early days where memory was limited but not on the current machines. For a very long time ConTeXt made each command definition long by default (i.e. \def\...{...} behaved the same way as \long\def\...{...}) and as a result \long was dropped. \def\CommandA#1{#1} \long\def\CommandB#1{#1} \starttext \CommandA{xxx}% works \CommandA{xxx yyy}% fails because you have a empty line in the argument \CommandA{xxx\par yyy}%fails because you have \par in the argument \CommandB{xxx\par yyy}% works because \CommandB is \long \stoptext Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___