* [NTG-context] Protect the lettrine @ 2023-06-13 2:43 Thangalin via ntg-context 2023-06-13 8:29 ` Otared Kavian via ntg-context 0 siblings, 1 reply; 11+ messages in thread From: Thangalin via ntg-context @ 2023-06-13 2:43 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Thangalin [-- Attachment #1.1: Type: text/plain, Size: 899 bytes --] I'm using KeenWrite Themes (specifically, Boschet) to typeset a chapter wherein the first letter is a lettrine. When the first paragraph is too short, the second paragraph overlaps the lettrine. % SOT \setupinitial[n=2] \setuphead[chapter][ after={\placeinitial}, page=no, ] \starttext \chapter{one} Kermit Ruffins Meet me at the second line. \chapter{two} \input knuth Meet me at the second line. \stoptext % EOT Produces: https://i.stack.imgur.com/kNDqw.png How would you instruct ConTeXt to "protect" the lettrine such that regardless of whether the first paragraph spans multiple lines, a short first paragraph will still prevent the second paragraph from overlapping the lettrine? That is, the setups should work in both cases, without any knowledge about the first paragraph length being added between \starttext and \stoptext. ConTeXt LMTX version: 2023.06.04 18:58 Thank you! [-- Attachment #1.2: Type: text/html, Size: 1221 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [NTG-context] Protect the lettrine 2023-06-13 2:43 [NTG-context] Protect the lettrine Thangalin via ntg-context @ 2023-06-13 8:29 ` Otared Kavian via ntg-context 2023-06-13 21:01 ` Thangalin via ntg-context 0 siblings, 1 reply; 11+ messages in thread From: Otared Kavian via ntg-context @ 2023-06-13 8:29 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Otared Kavian [-- Attachment #1.1: Type: text/plain, Size: 2131 bytes --] Hi, Adding \hfill\break to the short line solves the issue, but probably there is a better way to achieve the correct result. \setupinitial[n=2] \setuphead[chapter][ after={\placeinitial}, page=no, ] \starttext \chapter{one} Kermit Ruffins \hfill\break % <--- Meet me at the second line. \chapter{two} \input knuth Meet me at the second line. \stoptext Best regards: Otared > On 13 Jun 2023, at 04:43, Thangalin via ntg-context <ntg-context@ntg.nl> wrote: > > I'm using KeenWrite Themes (specifically, Boschet) to typeset a chapter wherein the first letter is a lettrine. When the first paragraph is too short, the second paragraph overlaps the lettrine. > > % SOT > \setupinitial[n=2] > > \setuphead[chapter][ > after={\placeinitial}, > page=no, > ] > > \starttext > \chapter{one} > Kermit Ruffins > > Meet me at the second line. > > \chapter{two} > \input knuth > > Meet me at the second line. > \stoptext > % EOT > > Produces: https://i.stack.imgur.com/kNDqw.png <https://i.stack.imgur.com/kNDqw.png> > > How would you instruct ConTeXt to "protect" the lettrine such that regardless of whether the first paragraph spans multiple lines, a short first paragraph will still prevent the second paragraph from overlapping the lettrine? > > That is, the setups should work in both cases, without any knowledge about the first paragraph length being added between \starttext and \stoptext. > > ConTeXt LMTX version: 2023.06.04 18:58 > > Thank you! > ___________________________________________________________________________________ > 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 > ___________________________________________________________________________________ Otared Kavian e-mail: otared@gmail.com Phone: +33 6 88 26 70 95 [-- Attachment #1.2: Type: text/html, Size: 4682 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [NTG-context] Protect the lettrine 2023-06-13 8:29 ` Otared Kavian via ntg-context @ 2023-06-13 21:01 ` Thangalin via ntg-context 2023-06-13 21:11 ` Thangalin via ntg-context 2023-06-14 2:32 ` linguafalsa--- via ntg-context 0 siblings, 2 replies; 11+ messages in thread From: Thangalin via ntg-context @ 2023-06-13 21:01 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Thangalin [-- Attachment #1.1: Type: text/plain, Size: 3156 bytes --] Thanks Otared, Unfortunately, that's adding content between \starttext and \stoptext, which isn't tenable in my situation. The user is writing in Markdown, which is automatically converted to XHTML then passed to ConTeXt, and so the setups need to account for this scenario without modifying the source document. Cheers! On Tue, Jun 13, 2023 at 1:30 AM Otared Kavian via ntg-context < ntg-context@ntg.nl> wrote: > Hi, > > Adding \hfill\break to the short line solves the issue, but probably there > is a better way to achieve the correct result. > > \setupinitial[n=2] > > \setuphead[chapter][ > after={\placeinitial}, > page=no, > ] > > \starttext > \chapter{one} > Kermit Ruffins \hfill\break % <--- > > Meet me at the second line. > > \chapter{two} > \input knuth > > Meet me at the second line. > \stoptext > > > Best regards: Otared > > On 13 Jun 2023, at 04:43, Thangalin via ntg-context <ntg-context@ntg.nl> > wrote: > > I'm using KeenWrite Themes (specifically, Boschet) to typeset a chapter > wherein the first letter is a lettrine. When the first paragraph is too > short, the second paragraph overlaps the lettrine. > > % SOT > \setupinitial[n=2] > > \setuphead[chapter][ > after={\placeinitial}, > page=no, > ] > > \starttext > \chapter{one} > Kermit Ruffins > > Meet me at the second line. > > \chapter{two} > \input knuth > > Meet me at the second line. > \stoptext > % EOT > > Produces: https://i.stack.imgur.com/kNDqw.png > > How would you instruct ConTeXt to "protect" the lettrine such that > regardless of whether the first paragraph spans multiple lines, a short > first paragraph will still prevent the second paragraph from overlapping > the lettrine? > > That is, the setups should work in both cases, without any knowledge about > the first paragraph length being added between \starttext and \stoptext. > > ConTeXt LMTX version: 2023.06.04 18:58 > > Thank you! > > ___________________________________________________________________________________ > 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 > > ___________________________________________________________________________________ > > > Otared Kavian > e-mail: otared@gmail.com <otared@gmail.com> > Phone: +33 6 88 26 70 95 > > > > > > ___________________________________________________________________________________ > 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 > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 5237 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [NTG-context] Protect the lettrine 2023-06-13 21:01 ` Thangalin via ntg-context @ 2023-06-13 21:11 ` Thangalin via ntg-context 2023-06-14 2:32 ` linguafalsa--- via ntg-context 1 sibling, 0 replies; 11+ messages in thread From: Thangalin via ntg-context @ 2023-06-13 21:11 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Thangalin [-- Attachment #1.1: Type: text/plain, Size: 3628 bytes --] Here's the output I'm looking to achieve: https://i.stack.imgur.com/XeZQS.png Note how the second line honours the lettrine's width and padding, in the same way that the second line of the first paragraph in Knuth's quote respects the width and padding. On Tue, Jun 13, 2023 at 2:01 PM Thangalin <thangalin@gmail.com> wrote: > Thanks Otared, > > Unfortunately, that's adding content between \starttext and \stoptext, > which isn't tenable in my situation. The user is writing in Markdown, which > is automatically converted to XHTML then passed to ConTeXt, and so the > setups need to account for this scenario without modifying the source > document. > > Cheers! > > On Tue, Jun 13, 2023 at 1:30 AM Otared Kavian via ntg-context < > ntg-context@ntg.nl> wrote: > >> Hi, >> >> Adding \hfill\break to the short line solves the issue, but probably >> there is a better way to achieve the correct result. >> >> \setupinitial[n=2] >> >> \setuphead[chapter][ >> after={\placeinitial}, >> page=no, >> ] >> >> \starttext >> \chapter{one} >> Kermit Ruffins \hfill\break % <--- >> >> Meet me at the second line. >> >> \chapter{two} >> \input knuth >> >> Meet me at the second line. >> \stoptext >> >> >> Best regards: Otared >> >> On 13 Jun 2023, at 04:43, Thangalin via ntg-context <ntg-context@ntg.nl> >> wrote: >> >> I'm using KeenWrite Themes (specifically, Boschet) to typeset a chapter >> wherein the first letter is a lettrine. When the first paragraph is too >> short, the second paragraph overlaps the lettrine. >> >> % SOT >> \setupinitial[n=2] >> >> \setuphead[chapter][ >> after={\placeinitial}, >> page=no, >> ] >> >> \starttext >> \chapter{one} >> Kermit Ruffins >> >> Meet me at the second line. >> >> \chapter{two} >> \input knuth >> >> Meet me at the second line. >> \stoptext >> % EOT >> >> Produces: https://i.stack.imgur.com/kNDqw.png >> >> How would you instruct ConTeXt to "protect" the lettrine such that >> regardless of whether the first paragraph spans multiple lines, a short >> first paragraph will still prevent the second paragraph from overlapping >> the lettrine? >> >> That is, the setups should work in both cases, without any knowledge >> about the first paragraph length being added between \starttext and >> \stoptext. >> >> ConTeXt LMTX version: 2023.06.04 18:58 >> >> Thank you! >> >> ___________________________________________________________________________________ >> 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 >> >> ___________________________________________________________________________________ >> >> >> Otared Kavian >> e-mail: otared@gmail.com <otared@gmail.com> >> Phone: +33 6 88 26 70 95 >> >> >> >> >> >> ___________________________________________________________________________________ >> 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 >> >> ___________________________________________________________________________________ >> > [-- Attachment #1.2: Type: text/html, Size: 5957 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [NTG-context] Protect the lettrine 2023-06-13 21:01 ` Thangalin via ntg-context 2023-06-13 21:11 ` Thangalin via ntg-context @ 2023-06-14 2:32 ` linguafalsa--- via ntg-context 2023-06-14 3:46 ` Thangalin via ntg-context 1 sibling, 1 reply; 11+ messages in thread From: linguafalsa--- via ntg-context @ 2023-06-14 2:32 UTC (permalink / raw) To: ntg-context; +Cc: linguafalsa On Tue, Jun 13, 2023 at 02:01:14PM -0700, Thangalin via ntg-context wrote: > Thanks Otared, > > Unfortunately, that's adding content between \starttext and \stoptext, > which isn't tenable in my situation. The user is writing in Markdown, which > is automatically converted to XHTML then passed to ConTeXt, and so the > setups need to account for this scenario without modifying the source > document. > Yeah yeah yeah, tenable. A lot of things aren't tenable. Anyhow, What source document are you talking about here? You're already sourcing the lines after chapter one. As a matter of fact, if you weren't sourcing, then you'd have zilch, nada, zero, empty, null, void, an space, a separation, an abstract Just define Kermit Muffins and it should be good to go \setupinitial[n=2] \def\KermitMuffins{\vbox{Kermit Muffins\par\hskip 1.3cm \tfd Meet me at the second line}} \setuphead[chapter][ after={\placeinitial}, page=no, ] \starttext \chapter{one} \KermitMuffins \chapter{two} \input knuth Meet me at the second line. \stoptext > Cheers! > > On Tue, Jun 13, 2023 at 1:30 AM Otared Kavian via ntg-context < > ntg-context@ntg.nl> wrote: > > > Hi, > > > > Adding \hfill\break to the short line solves the issue, but probably there > > is a better way to achieve the correct result. > > > > \setupinitial[n=2] > > > > \setuphead[chapter][ > > after={\placeinitial}, > > page=no, > > ] > > > > \starttext > > \chapter{one} > > Kermit Ruffins \hfill\break % <--- > > > > Meet me at the second line. > > > > \chapter{two} > > \input knuth > > > > Meet me at the second line. > > \stoptext > > > > > > Best regards: Otared > > > > On 13 Jun 2023, at 04:43, Thangalin via ntg-context <ntg-context@ntg.nl> > > wrote: > > > > I'm using KeenWrite Themes (specifically, Boschet) to typeset a chapter > > wherein the first letter is a lettrine. When the first paragraph is too > > short, the second paragraph overlaps the lettrine. > > > > % SOT > > \setupinitial[n=2] > > > > \setuphead[chapter][ > > after={\placeinitial}, > > page=no, > > ] > > > > \starttext > > \chapter{one} > > Kermit Ruffins > > > > Meet me at the second line. > > > > \chapter{two} > > \input knuth > > > > Meet me at the second line. > > \stoptext > > % EOT > > > > Produces: https://i.stack.imgur.com/kNDqw.png > > > > How would you instruct ConTeXt to "protect" the lettrine such that > > regardless of whether the first paragraph spans multiple lines, a short > > first paragraph will still prevent the second paragraph from overlapping > > the lettrine? > > > > That is, the setups should work in both cases, without any knowledge about > > the first paragraph length being added between \starttext and \stoptext. > > > > ConTeXt LMTX version: 2023.06.04 18:58 > > > > Thank you! > > > > ___________________________________________________________________________________ > > 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 > > > > ___________________________________________________________________________________ > > > > > > Otared Kavian > > e-mail: otared@gmail.com <otared@gmail.com> > > Phone: +33 6 88 26 70 95 > > > > > > > > > > > > ___________________________________________________________________________________ > > 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 > ___________________________________________________________________________________ -- ... an anecdote from IBM's Yorktown Heights Research Center. When a programmer used his new computer terminal, all was fine when he was sitting down, but he couldn't log in to the system when he was standing up. That behavior was 100 percent repeatable: he could always log in when sitting and never when standing. Most of us just sit back and marvel at such a story; how could that terminal know whether the poor guy was sitting or standing? Good debuggers, though, know that there has to be a reason. Electrical theories are the easiest to hypothesize: was there a loose wire under the carpet, or problems with static electricity? But electrical problems are rarely consistently reproducible. An alert IBMer finally noticed that the problem was in the terminal's keyboard: the tops of two keys were switched. When the programmer was seated he was a touch typist and the problem went unnoticed, but when he stood he was led astray by hunting and pecking. -- "Programming Pearls" column, by Jon Bentley in CACM February 1985 ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [NTG-context] Protect the lettrine 2023-06-14 2:32 ` linguafalsa--- via ntg-context @ 2023-06-14 3:46 ` Thangalin via ntg-context 2023-06-14 17:43 ` linguafalsa--- via ntg-context 0 siblings, 1 reply; 11+ messages in thread From: Thangalin via ntg-context @ 2023-06-14 3:46 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Thangalin [-- Attachment #1.1: Type: text/plain, Size: 7487 bytes --] Thank you for taking the time to reply, linguafalsa, I appreciate it. The source document is written in Markdown using KeenWrite, my Markdown editor. Inserting typesetting instructions into the document would defeat the software's architecture, hence being untenable. After the Markdown is transformed into XHTML, a specific theme instructs ConTeXt how to typeset the XHTML. Here's a video showing how theme selection works: https://youtu.be/3QpX70O5S30?list=PLB-WIt1cZYLm1MMx2FBG9KWzPIoWZMKu_&t=14 I hope this explains the situation more clearly about why changing the code between \starttext and \stoptext isn't an option, as you've done with introducing and using a macro. Greets! On Tue, Jun 13, 2023 at 7:33 PM linguafalsa--- via ntg-context < ntg-context@ntg.nl> wrote: > On Tue, Jun 13, 2023 at 02:01:14PM -0700, Thangalin via ntg-context wrote: > > Thanks Otared, > > > > Unfortunately, that's adding content between \starttext and \stoptext, > > which isn't tenable in my situation. The user is writing in Markdown, > which > > is automatically converted to XHTML then passed to ConTeXt, and so the > > setups need to account for this scenario without modifying the source > > document. > > > > Yeah yeah yeah, tenable. A lot of things aren't tenable. Anyhow, > What source document are you talking about here? > > You're already sourcing the lines after chapter one. As a matter of > fact, if you weren't sourcing, then you'd have zilch, nada, zero, empty, > null, void, an space, a separation, an abstract > > Just define Kermit Muffins and it should be good to go > > > \setupinitial[n=2] > > \def\KermitMuffins{\vbox{Kermit Muffins\par\hskip 1.3cm \tfd Meet me at > the second line}} > > \setuphead[chapter][ > after={\placeinitial}, > page=no, > ] > > \starttext > \chapter{one} > \KermitMuffins > > \chapter{two} > \input knuth > > Meet me at the second line. > \stoptext > > > > > Cheers! > > > > On Tue, Jun 13, 2023 at 1:30 AM Otared Kavian via ntg-context < > > ntg-context@ntg.nl> wrote: > > > > > Hi, > > > > > > Adding \hfill\break to the short line solves the issue, but probably > there > > > is a better way to achieve the correct result. > > > > > > \setupinitial[n=2] > > > > > > \setuphead[chapter][ > > > after={\placeinitial}, > > > page=no, > > > ] > > > > > > \starttext > > > \chapter{one} > > > Kermit Ruffins \hfill\break % <--- > > > > > > Meet me at the second line. > > > > > > \chapter{two} > > > \input knuth > > > > > > Meet me at the second line. > > > \stoptext > > > > > > > > > > > > > Best regards: Otared > > > > > > On 13 Jun 2023, at 04:43, Thangalin via ntg-context < > ntg-context@ntg.nl> > > > wrote: > > > > > > I'm using KeenWrite Themes (specifically, Boschet) to typeset a chapter > > > wherein the first letter is a lettrine. When the first paragraph is too > > > short, the second paragraph overlaps the lettrine. > > > > > > % SOT > > > \setupinitial[n=2] > > > > > > \setuphead[chapter][ > > > after={\placeinitial}, > > > page=no, > > > ] > > > > > > \starttext > > > \chapter{one} > > > Kermit Ruffins > > > > > > Meet me at the second line. > > > > > > \chapter{two} > > > \input knuth > > > > > > Meet me at the second line. > > > \stoptext > > > % EOT > > > > > > Produces: https://i.stack.imgur.com/kNDqw.png > > > > > > How would you instruct ConTeXt to "protect" the lettrine such that > > > regardless of whether the first paragraph spans multiple lines, a short > > > first paragraph will still prevent the second paragraph from > overlapping > > > the lettrine? > > > > > > That is, the setups should work in both cases, without any knowledge > about > > > the first paragraph length being added between \starttext and > \stoptext. > > > > > > ConTeXt LMTX version: 2023.06.04 18:58 > > > > > > Thank you! > > > > > > > ___________________________________________________________________________________ > > > 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 > > > > > > > ___________________________________________________________________________________ > > > > > > > > > Otared Kavian > > > e-mail: otared@gmail.com <otared@gmail.com> > > > Phone: +33 6 88 26 70 95 > > > > > > > > > > > > > > > > > > > ___________________________________________________________________________________ > > > 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 > > > ___________________________________________________________________________________ > > > -- > ... an anecdote from IBM's Yorktown Heights Research Center. When a > programmer used his new computer terminal, all was fine when he was sitting > down, but he couldn't log in to the system when he was standing up. That > behavior was 100 percent repeatable: he could always log in when sitting > and > never when standing. > > Most of us just sit back and marvel at such a story; how could that > terminal > know whether the poor guy was sitting or standing? Good debuggers, though, > know that there has to be a reason. Electrical theories are the easiest to > hypothesize: was there a loose wire under the carpet, or problems with > static > electricity? But electrical problems are rarely consistently reproducible. > An alert IBMer finally noticed that the problem was in the terminal's > keyboard: the tops of two keys were switched. When the programmer was > seated > he was a touch typist and the problem went unnoticed, but when he stood he > was > led astray by hunting and pecking. > -- "Programming Pearls" column, by Jon Bentley in CACM > February 1985 > > > ___________________________________________________________________________________ > 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 > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 11319 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [NTG-context] Protect the lettrine 2023-06-14 3:46 ` Thangalin via ntg-context @ 2023-06-14 17:43 ` linguafalsa--- via ntg-context 2023-06-14 21:32 ` Thangalin via ntg-context 0 siblings, 1 reply; 11+ messages in thread From: linguafalsa--- via ntg-context @ 2023-06-14 17:43 UTC (permalink / raw) To: ntg-context; +Cc: linguafalsa On Tue, Jun 13, 2023 at 08:46:59PM -0700, Thangalin via ntg-context wrote: > Thank you for taking the time to reply, linguafalsa, I appreciate it. > > The source document is written in Markdown using KeenWrite, my Markdown > editor. Inserting typesetting instructions into the document would defeat > the software's architecture, hence being untenable. After the Markdown is > transformed into XHTML, a specific theme instructs ConTeXt how to typeset > the XHTML. Never heard of it (keenwrite), but your request is indeed, valid all along. I haven't checked the code that lmtx uses but by just looking at the bare macros, it seems as if `\forgetplaceinitial` is limited in what it can and can't do. I think it's reasonable the way it was implemented but nevertheless this is something that ought to be looked at rather than ignore it or put aside for later I didn't see the video, it's distracting, but as I said, is a valid request on your part Perhaps `\setuphead` can have such of a feature in the future — that of different settings for different chapters, and if one exists now, I'm just simply unaware of, but either way, you're dealing mainly here with a table and tabskips and whatnot. It seems that there's one feature for subsubsections, written in lua, but this is entirely different Even with something as the following I just wouldn't know how to specify it to apply it concurrently for each particular chapter thereafter and dissuade it from subsequently applying it to where not otherwise. I just don't know. \setuphead[chapter][ after={\placeinitial\vbox to 1cm{\relax {K{\hskip 2pt \lower 5pt \hbox{ermit MUffins \vbox to -0.055cm {\hskip -2.8cm \raise 1pt \hbox{meet me at the second line}}}}}}}, page=no, %] \starttext \startchapter[1] \stopchapter \forgetinitial \par \startchapter[2] \input knuth \stopchapter \stoptext > > Here's a video showing how theme selection works: > > https://youtu.be/3QpX70O5S30?list=PLB-WIt1cZYLm1MMx2FBG9KWzPIoWZMKu_&t=14 > > I hope this explains the situation more clearly about why changing the code > between \starttext and \stoptext isn't an option, as you've done with > introducing and using a macro. > > Greets! take care Tangalin Carlos > > On Tue, Jun 13, 2023 at 7:33 PM linguafalsa--- via ntg-context < > ntg-context@ntg.nl> wrote: > > > On Tue, Jun 13, 2023 at 02:01:14PM -0700, Thangalin via ntg-context wrote: > > > Thanks Otared, > > > > > > Unfortunately, that's adding content between \starttext and \stoptext, > > > which isn't tenable in my situation. The user is writing in Markdown, > > which > > > is automatically converted to XHTML then passed to ConTeXt, and so the > > > setups need to account for this scenario without modifying the source > > > document. > > > > > > > Yeah yeah yeah, tenable. A lot of things aren't tenable. Anyhow, > > What source document are you talking about here? > > > > You're already sourcing the lines after chapter one. As a matter of > > fact, if you weren't sourcing, then you'd have zilch, nada, zero, empty, > > null, void, an space, a separation, an abstract > > > > Just define Kermit Muffins and it should be good to go > > > > > > \setupinitial[n=2] > > > > \def\KermitMuffins{\vbox{Kermit Muffins\par\hskip 1.3cm \tfd Meet me at > > the second line}} > > > > \setuphead[chapter][ > > after={\placeinitial}, > > page=no, > > ] > > > > \starttext > > \chapter{one} > > \KermitMuffins > > > > \chapter{two} > > \input knuth > > > > Meet me at the second line. > > \stoptext > > > > > > > > > Cheers! > > > > > > On Tue, Jun 13, 2023 at 1:30 AM Otared Kavian via ntg-context < > > > ntg-context@ntg.nl> wrote: > > > > > > > Hi, > > > > > > > > Adding \hfill\break to the short line solves the issue, but probably > > there > > > > is a better way to achieve the correct result. > > > > > > > > \setupinitial[n=2] > > > > > > > > \setuphead[chapter][ > > > > after={\placeinitial}, > > > > page=no, > > > > ] > > > > > > > > \starttext > > > > \chapter{one} > > > > Kermit Ruffins \hfill\break % <--- > > > > > > > > Meet me at the second line. > > > > > > > > \chapter{two} > > > > \input knuth > > > > > > > > Meet me at the second line. > > > > \stoptext > > > > > > > > > > > > > > > > > > > > Best regards: Otared > > > > > > > > On 13 Jun 2023, at 04:43, Thangalin via ntg-context < > > ntg-context@ntg.nl> > > > > wrote: > > > > > > > > I'm using KeenWrite Themes (specifically, Boschet) to typeset a chapter > > > > wherein the first letter is a lettrine. When the first paragraph is too > > > > short, the second paragraph overlaps the lettrine. > > > > > > > > % SOT > > > > \setupinitial[n=2] > > > > > > > > \setuphead[chapter][ > > > > after={\placeinitial}, > > > > page=no, > > > > ] > > > > > > > > \starttext > > > > \chapter{one} > > > > Kermit Ruffins > > > > > > > > Meet me at the second line. > > > > > > > > \chapter{two} > > > > \input knuth > > > > > > > > Meet me at the second line. > > > > \stoptext > > > > % EOT > > > > > > > > Produces: https://i.stack.imgur.com/kNDqw.png > > > > > > > > How would you instruct ConTeXt to "protect" the lettrine such that > > > > regardless of whether the first paragraph spans multiple lines, a short > > > > first paragraph will still prevent the second paragraph from > > overlapping > > > > the lettrine? > > > > > > > > That is, the setups should work in both cases, without any knowledge > > about > > > > the first paragraph length being added between \starttext and > > \stoptext. > > > > > > > > ConTeXt LMTX version: 2023.06.04 18:58 > > > > > > > > Thank you! > > > > > > > > > > ___________________________________________________________________________________ > > > > 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 > > > > > > > > > > ___________________________________________________________________________________ > > > > > > > > > > > > Otared Kavian > > > > e-mail: otared@gmail.com <otared@gmail.com> > > > > Phone: +33 6 88 26 70 95 > > > > > > > > > > > > > > > > > > > > > > > > > > ___________________________________________________________________________________ > > > > 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 > > > > > ___________________________________________________________________________________ > > > > > > -- > > ... an anecdote from IBM's Yorktown Heights Research Center. When a > > programmer used his new computer terminal, all was fine when he was sitting > > down, but he couldn't log in to the system when he was standing up. That > > behavior was 100 percent repeatable: he could always log in when sitting > > and > > never when standing. > > > > Most of us just sit back and marvel at such a story; how could that > > terminal > > know whether the poor guy was sitting or standing? Good debuggers, though, > > know that there has to be a reason. Electrical theories are the easiest to > > hypothesize: was there a loose wire under the carpet, or problems with > > static > > electricity? But electrical problems are rarely consistently reproducible. > > An alert IBMer finally noticed that the problem was in the terminal's > > keyboard: the tops of two keys were switched. When the programmer was > > seated > > he was a touch typist and the problem went unnoticed, but when he stood he > > was > > led astray by hunting and pecking. > > -- "Programming Pearls" column, by Jon Bentley in CACM > > February 1985 > > > > > > ___________________________________________________________________________________ > > 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 > ___________________________________________________________________________________ -- If graphics hackers are so smart, why can't they get the bugs out of fresh paint? ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [NTG-context] Protect the lettrine 2023-06-14 17:43 ` linguafalsa--- via ntg-context @ 2023-06-14 21:32 ` Thangalin via ntg-context 2023-06-15 6:35 ` Max Chernoff via ntg-context 0 siblings, 1 reply; 11+ messages in thread From: Thangalin via ntg-context @ 2023-06-14 21:32 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Thangalin [-- Attachment #1.1: Type: text/plain, Size: 1092 bytes --] It's a tough problem for sure. I'm wondering if there's a general solution? That is, a way to tell ConTeXt to "protect the lettrine" regardless of the source document text? Nothing can be hard-coded because the setups (take a look at keenwrite themes https://github.com/DaveJarvis/keenwrite-themes/tree/main/boschet) don't "know" anything about the source document text. That's why I stated that nothing between \starttext and \stoptext may change. In effect, we don't know if the text is going to be "Kermit Ruffins" or "Yankee Doodle Dandy" or "We believe these truths to be self-evident." All we know is that we want the first letter to be a lettrine and the subsequent paragraph not to overlap the lettrine. Cheers! > \setuphead[chapter][ > after={\placeinitial\vbox to 1cm{\relax {K{\hskip 2pt \lower 5pt > \hbox{ermit MUffins \vbox to -0.055cm {\hskip -2.8cm \raise 1pt \hbox{meet > me at the second > line}}}}}}}, > page=no, > %] > > \starttext > > \startchapter[1] > \stopchapter > > \forgetinitial \par > > \startchapter[2] > \input knuth > \stopchapter > > \stoptext > > [-- Attachment #1.2: Type: text/html, Size: 1652 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [NTG-context] Protect the lettrine 2023-06-14 21:32 ` Thangalin via ntg-context @ 2023-06-15 6:35 ` Max Chernoff via ntg-context 2023-06-16 18:25 ` Hans Hagen via ntg-context 0 siblings, 1 reply; 11+ messages in thread From: Max Chernoff via ntg-context @ 2023-06-15 6:35 UTC (permalink / raw) To: ntg-context; +Cc: Max Chernoff Hi Dave, > How would you instruct ConTeXt to "protect" the lettrine such that > regardless of whether the first paragraph spans multiple lines, a short > first paragraph will still prevent the second paragraph from overlapping > the lettrine? > Here's the output I'm looking to achieve: > > https://i.stack.imgur.com/XeZQS.png > > Note how the second line honours the lettrine's width and padding, in the > same way that the second line of the first paragraph in Knuth's quote > respects the width and padding. Here's a questionable Lua-based solution: \startluacode userdata.hangindent = 0 function userdata.post_lettrine(head) nodes.tasks.disableaction("finalizers", "userdata.post_lettrine") if tex.prevgraf < math.abs(tex.hangafter) then userdata.hangindent = tex.hangindent nodes.tasks.enableaction("processors", "userdata.next_par") end return head end nodes.tasks.appendaction("finalizers", "before", "userdata.post_lettrine") nodes.tasks.disableaction("finalizers", "userdata.post_lettrine") function userdata.next_par(head) nodes.tasks.disableaction("processors", "userdata.next_par") if head.next.id == node.id("glue") and head.next.subtype == 20 then head.next.width = userdata.hangindent end return head end nodes.tasks.appendaction("processors", "before", "userdata.next_par") nodes.tasks.disableaction("processors", "userdata.next_par") local default = typesetters.initials.actions.default function typesetters.initials.actions.default(...) nodes.tasks.enableaction("finalizers", "userdata.post_lettrine") return default(...) end \stopluacode \setupinitial[n=2] [...] Normally manipulating nodes inside the callbacks is the wrong way to do something, but in this case, that's exactly how the standard initial code works. We need to modify the "default" alternative since "\setupinitial" provides no way for us to set a different alternative. A better solution would be to provide a new alternative so we wouldn't need to make questionable overrides to the base code. -- Max ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [NTG-context] Protect the lettrine 2023-06-15 6:35 ` Max Chernoff via ntg-context @ 2023-06-16 18:25 ` Hans Hagen via ntg-context 2023-06-26 1:52 ` Thangalin via ntg-context 0 siblings, 1 reply; 11+ messages in thread From: Hans Hagen via ntg-context @ 2023-06-16 18:25 UTC (permalink / raw) To: ntg-context; +Cc: Hans Hagen On 6/15/2023 8:35 AM, Max Chernoff via ntg-context wrote: > Hi Dave, > >> How would you instruct ConTeXt to "protect" the lettrine such that >> regardless of whether the first paragraph spans multiple lines, a short >> first paragraph will still prevent the second paragraph from overlapping >> the lettrine? > >> Here's the output I'm looking to achieve: >> >> https://i.stack.imgur.com/XeZQS.png >> >> Note how the second line honours the lettrine's width and padding, in the >> same way that the second line of the first paragraph in Knuth's quote >> respects the width and padding. > > Here's a questionable Lua-based solution: > > \startluacode > userdata.hangindent = 0 > function userdata.post_lettrine(head) > nodes.tasks.disableaction("finalizers", "userdata.post_lettrine") > > if tex.prevgraf < math.abs(tex.hangafter) then > userdata.hangindent = tex.hangindent > nodes.tasks.enableaction("processors", "userdata.next_par") > end > > return head > end > nodes.tasks.appendaction("finalizers", "before", "userdata.post_lettrine") > nodes.tasks.disableaction("finalizers", "userdata.post_lettrine") > > > function userdata.next_par(head) > nodes.tasks.disableaction("processors", "userdata.next_par") > > if head.next.id == node.id("glue") and > head.next.subtype == 20 > then > head.next.width = userdata.hangindent > end > > return head > end > nodes.tasks.appendaction("processors", "before", "userdata.next_par") > nodes.tasks.disableaction("processors", "userdata.next_par") > > > local default = typesetters.initials.actions.default > function typesetters.initials.actions.default(...) > nodes.tasks.enableaction("finalizers", "userdata.post_lettrine") > return default(...) > end > \stopluacode > > \setupinitial[n=2] > > [...] > > Normally manipulating nodes inside the callbacks is the wrong way to do > something, but in this case, that's exactly how the standard initial > code works. > > We need to modify the "default" alternative since "\setupinitial" > provides no way for us to set a different alternative. A better solution > would be to provide a new alternative so we wouldn't need to make > questionable overrides to the base code. Indeed, and it might also sort of fragile due to the prevgraf although we can assume sane usage. All this stuff is also a bit order sensitive. I'll added this: \setupinitial[n=2,continue=yes] But I'll also cheat a bit by adding a prevdepth field to the parstate that remembers the previous one (as it gets lost otherwise). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [NTG-context] Protect the lettrine 2023-06-16 18:25 ` Hans Hagen via ntg-context @ 2023-06-26 1:52 ` Thangalin via ntg-context 0 siblings, 0 replies; 11+ messages in thread From: Thangalin via ntg-context @ 2023-06-26 1:52 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Thangalin [-- Attachment #1.1: Type: text/plain, Size: 769 bytes --] Thanks Hans. I've updated the wiki. I'm wondering if there's a way to also control the indenting? Max's solution removed any indenting, allowing the text for the second paragraph to be flush. It looks a little strange to see text indented next to a drop-cap. The test case is the same, but with the addition of an indenting setup: % SOT \setupinitial[n=2, continue=yes] \setupindenting[medium, yes] \setuphead[chapter][ after={\placeinitial}, page=no, ] \starttext \chapter{one} Kermit Ruffins Meet me at the second line. \chapter{two} \input knuth Meet me at the second line. \stoptext % EOT This produces an unintended side-effect, as well, whereby the following chapter heading is indented. See https://i.ibb.co/n8cMkM9/unintended-indented.png Cheers! [-- Attachment #1.2: Type: text/html, Size: 1084 bytes --] [-- Attachment #2: Type: text/plain, Size: 496 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-06-26 1:53 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-06-13 2:43 [NTG-context] Protect the lettrine Thangalin via ntg-context 2023-06-13 8:29 ` Otared Kavian via ntg-context 2023-06-13 21:01 ` Thangalin via ntg-context 2023-06-13 21:11 ` Thangalin via ntg-context 2023-06-14 2:32 ` linguafalsa--- via ntg-context 2023-06-14 3:46 ` Thangalin via ntg-context 2023-06-14 17:43 ` linguafalsa--- via ntg-context 2023-06-14 21:32 ` Thangalin via ntg-context 2023-06-15 6:35 ` Max Chernoff via ntg-context 2023-06-16 18:25 ` Hans Hagen via ntg-context 2023-06-26 1:52 ` Thangalin via ntg-context
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 NNTP newsgroup(s).