ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Combine \setupdelimitedtext with an author (define custom variable?)
@ 2024-06-06 10:30 Gerion Entrup
  2024-06-06 11:51 ` [NTG-context] " Hans Hagen via ntg-context
  2024-06-06 14:34 ` Wolfgang Schuster
  0 siblings, 2 replies; 9+ messages in thread
From: Gerion Entrup @ 2024-06-06 10:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1116 bytes --]

Hi,

I like to achieve something that looks like this:
```
\definedelimitedtext[extract][blockquote]
\setupdelimitedtext
  [extract]
  [leftmargin=1.5pc,
   style={\italic},
   before={\setupindenting[next]},
   after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] \tfx\italic{René Descartes} \stopalignment}]

\starttext
\startextract
    Cogito ergo sum.
\stopextract
\stoptext
```

So it should setup a quotation and mentions the author.
However, here the author is hardcoded within the blockquote. I would like it to use like this:
```
\definedelimitedtext[extract][blockquote]
\setupdelimitedtext
  [extract]
  [leftmargin=1.5pc,
   style={\italic},
   before={\setupindenting[next]},
   after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] \tfx\italic{\getcustomvariable{author}} \stopalignment}]

\starttext
\startextract[author=René Descartes]
    Cogito ergo sum.
\stopextract
\stoptext
```

Is there an easy way to achieve that?
I tried with \structureuservariable (like possible in \startchapter) but it does not work.

Best,
Gerion


[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)
  2024-06-06 10:30 [NTG-context] Combine \setupdelimitedtext with an author (define custom variable?) Gerion Entrup
@ 2024-06-06 11:51 ` Hans Hagen via ntg-context
  2024-06-06 22:36   ` Gerion Entrup
  2024-06-06 14:34 ` Wolfgang Schuster
  1 sibling, 1 reply; 9+ messages in thread
From: Hans Hagen via ntg-context @ 2024-06-06 11:51 UTC (permalink / raw)
  To: ntg-context; +Cc: Hans Hagen

On 6/6/2024 12:30 PM, Gerion Entrup wrote:
> Hi,
> 
> I like to achieve something that looks like this:
> ```
> \definedelimitedtext[extract][blockquote]
> \setupdelimitedtext
>    [extract]
>    [leftmargin=1.5pc,
>     style={\italic},
>     before={\setupindenting[next]},
>     after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] \tfx\italic{René Descartes} \stopalignment}]
> 
> \starttext
> \startextract
>      Cogito ergo sum.
> \stopextract
> \stoptext
> ```
> 
> So it should setup a quotation and mentions the author.
> However, here the author is hardcoded within the blockquote. I would like it to use like this:
> ```
> \definedelimitedtext[extract][blockquote]
> \setupdelimitedtext
>    [extract]
>    [leftmargin=1.5pc,
>     style={\italic},
>     before={\setupindenting[next]},
>     after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] \tfx\italic{\getcustomvariable{author}} \stopalignment}]
> 
> \starttext
> \startextract[author=René Descartes]
>      Cogito ergo sum.
> \stopextract
> \stoptext
> ```
> 
> Is there an easy way to achieve that?
> I tried with \structureuservariable (like possible in \startchapter) but it does not work.

not all constructs hav ethese user variables (yet)

i'll add an option for arguments tostart/stop so that you can do

\starttext

\definedelimitedtext
   [dextract]
   [blockquote]
   [leftmargin=1.5pc,
    style=italic,
    before=\setupindenting[next],
    after=\setups{extract:whatever}]

\definestartstop
   [extract]
   [arguments=yes,
    before=\setups{extract:start},
    after=\setups{extract:stop}]

\startsetups extract:start
     \startdextract
\stopsetups

\startsetups extract:stop
     \startstopparameter{author}
     \stopdextract
     \blank[1ex,samepage]
     \hrule
     \blank[1ex,samepage]
     \dontleavehmode
     \wordright{\itx\startstopparameter{author}}
\stopsetups

\starttext

\startextract[author=René Descartes]
     Cogito ergo sum.
\stopextract

\stoptext

but first i want Wolfgang to check the patch,

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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)
  2024-06-06 10:30 [NTG-context] Combine \setupdelimitedtext with an author (define custom variable?) Gerion Entrup
  2024-06-06 11:51 ` [NTG-context] " Hans Hagen via ntg-context
@ 2024-06-06 14:34 ` Wolfgang Schuster
  2024-06-06 14:50   ` Hans Hagen via ntg-context
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Wolfgang Schuster @ 2024-06-06 14:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Gerion Entrup

Gerion Entrup schrieb am 06.06.2024 um 12:30:
> Hi,
> 
> I like to achieve something that looks like this:
> ```
> \definedelimitedtext[extract][blockquote]
> \setupdelimitedtext
>    [extract]
>    [leftmargin=1.5pc,
>     style={\italic},
>     before={\setupindenting[next]},
>     after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] \tfx\italic{René Descartes} \stopalignment}]
> 
> \starttext
> \startextract
>      Cogito ergo sum.
> \stopextract
> \stoptext
> ```
> 
> So it should setup a quotation and mentions the author.
> However, here the author is hardcoded within the blockquote. I would like it to use like this:
> ```
> \definedelimitedtext[extract][blockquote]
> \setupdelimitedtext
>    [extract]
>    [leftmargin=1.5pc,
>     style={\italic},
>     before={\setupindenting[next]},
>     after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] \tfx\italic{\getcustomvariable{author}} \stopalignment}]
> 
> \starttext
> \startextract[author=René Descartes]
>      Cogito ergo sum.
> \stopextract
> \stoptext
> ```
> 
> Is there an easy way to achieve that?
> I tried with \structureuservariable (like possible in \startchapter) but it does not work.

\startsetups [userdata:extract]
     \startnarrower
         \setupindenting[next]
         \getuserdata
         \hairline
         \dontleavehmode\wordright{\itx\userdataparameter{author}}
     \stopnarrower
\stopsetups

\defineuserdataalternative
   [extract]
   [renderingsetup=userdata:extract]

\defineuserdata
   [extract]
   [style=italic,
    alternative=extract]

\starttext

\startextract[author=René Descartes]
     Cogito ergo sum.
\stopextract

\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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)
  2024-06-06 14:34 ` Wolfgang Schuster
@ 2024-06-06 14:50   ` Hans Hagen via ntg-context
  2024-06-06 20:07   ` Gerion Entrup
  2024-06-17 11:04   ` Gerion Entrup
  2 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen via ntg-context @ 2024-06-06 14:50 UTC (permalink / raw)
  To: ntg-context; +Cc: Hans Hagen

On 6/6/2024 4:34 PM, Wolfgang Schuster wrote:
> Gerion Entrup schrieb am 06.06.2024 um 12:30:
>> Hi,
>>
>> I like to achieve something that looks like this:
>> ```
>> \definedelimitedtext[extract][blockquote]
>> \setupdelimitedtext
>>    [extract]
>>    [leftmargin=1.5pc,
>>     style={\italic},
>>     before={\setupindenting[next]},
>>     after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
>> \tfx\italic{René Descartes} \stopalignment}]
>>
>> \starttext
>> \startextract
>>      Cogito ergo sum.
>> \stopextract
>> \stoptext
>> ```
>>
>> So it should setup a quotation and mentions the author.
>> However, here the author is hardcoded within the blockquote. I would 
>> like it to use like this:
>> ```
>> \definedelimitedtext[extract][blockquote]
>> \setupdelimitedtext
>>    [extract]
>>    [leftmargin=1.5pc,
>>     style={\italic},
>>     before={\setupindenting[next]},
>>     after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] 
>> \tfx\italic{\getcustomvariable{author}} \stopalignment}]
>>
>> \starttext
>> \startextract[author=René Descartes]
>>      Cogito ergo sum.
>> \stopextract
>> \stoptext
>> ```
>>
>> Is there an easy way to achieve that?
>> I tried with \structureuservariable (like possible in \startchapter) 
>> but it does not work.
> 
> \startsetups [userdata:extract]
>      \startnarrower
>          \setupindenting[next]
>          \getuserdata
>          \hairline
>          \dontleavehmode\wordright{\itx\userdataparameter{author}}
>      \stopnarrower
> \stopsetups
> 
> \defineuserdataalternative
>    [extract]
>    [renderingsetup=userdata:extract]
> 
> \defineuserdata
>    [extract]
>    [style=italic,
>     alternative=extract]
> 
> \starttext
> 
> \startextract[author=René Descartes]
>      Cogito ergo sum.
> \stopextract
> 
> \stoptext
ah, i start forgetting about these mechanisms ... i added this example 
to th etest suite

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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)
  2024-06-06 14:34 ` Wolfgang Schuster
  2024-06-06 14:50   ` Hans Hagen via ntg-context
@ 2024-06-06 20:07   ` Gerion Entrup
  2024-06-17 11:04   ` Gerion Entrup
  2 siblings, 0 replies; 9+ messages in thread
From: Gerion Entrup @ 2024-06-06 20:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Wolfgang Schuster


[-- Attachment #1.1: Type: text/plain, Size: 2129 bytes --]

Am Donnerstag, 6. Juni 2024, 16:34:03 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 06.06.2024 um 12:30:
> > Hi,
> > 
> > I like to achieve something that looks like this:
> > ```
> > \definedelimitedtext[extract][blockquote]
> > \setupdelimitedtext
> >    [extract]
> >    [leftmargin=1.5pc,
> >     style={\italic},
> >     before={\setupindenting[next]},
> >     after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] \tfx\italic{René Descartes} \stopalignment}]
> > 
> > \starttext
> > \startextract
> >      Cogito ergo sum.
> > \stopextract
> > \stoptext
> > ```
> > 
> > So it should setup a quotation and mentions the author.
> > However, here the author is hardcoded within the blockquote. I would like it to use like this:
> > ```
> > \definedelimitedtext[extract][blockquote]
> > \setupdelimitedtext
> >    [extract]
> >    [leftmargin=1.5pc,
> >     style={\italic},
> >     before={\setupindenting[next]},
> >     after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] \tfx\italic{\getcustomvariable{author}} \stopalignment}]
> > 
> > \starttext
> > \startextract[author=René Descartes]
> >      Cogito ergo sum.
> > \stopextract
> > \stoptext
> > ```
> > 
> > Is there an easy way to achieve that?
> > I tried with \structureuservariable (like possible in \startchapter) but it does not work.
> 
> \startsetups [userdata:extract]
>      \startnarrower
>          \setupindenting[next]
>          \getuserdata
>          \hairline
>          \dontleavehmode\wordright{\itx\userdataparameter{author}}
>      \stopnarrower
> \stopsetups
> 
> \defineuserdataalternative
>    [extract]
>    [renderingsetup=userdata:extract]
> 
> \defineuserdata
>    [extract]
>    [style=italic,
>     alternative=extract]
> 
> \starttext
> 
> \startextract[author=René Descartes]
>      Cogito ergo sum.
> \stopextract
> 
> \stoptext

Really cool! Thank you. If I see it right, this is completely generic,
so with this it is possible to define any start<something> stop<something>
with completely variable arguments.

Gerion

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)
  2024-06-06 11:51 ` [NTG-context] " Hans Hagen via ntg-context
@ 2024-06-06 22:36   ` Gerion Entrup
  0 siblings, 0 replies; 9+ messages in thread
From: Gerion Entrup @ 2024-06-06 22:36 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 2516 bytes --]

Am Donnerstag, 6. Juni 2024, 13:51:53 MESZ schrieb Hans Hagen via ntg-context:
> On 6/6/2024 12:30 PM, Gerion Entrup wrote:
> > Hi,
> > 
> > I like to achieve something that looks like this:
> > ```
> > \definedelimitedtext[extract][blockquote]
> > \setupdelimitedtext
> >    [extract]
> >    [leftmargin=1.5pc,
> >     style={\italic},
> >     before={\setupindenting[next]},
> >     after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] \tfx\italic{René Descartes} \stopalignment}]
> > 
> > \starttext
> > \startextract
> >      Cogito ergo sum.
> > \stopextract
> > \stoptext
> > ```
> > 
> > So it should setup a quotation and mentions the author.
> > However, here the author is hardcoded within the blockquote. I would like it to use like this:
> > ```
> > \definedelimitedtext[extract][blockquote]
> > \setupdelimitedtext
> >    [extract]
> >    [leftmargin=1.5pc,
> >     style={\italic},
> >     before={\setupindenting[next]},
> >     after={\blank[1ex] \hrule \blank[1ex] \startalignment[flushright] \tfx\italic{\getcustomvariable{author}} \stopalignment}]
> > 
> > \starttext
> > \startextract[author=René Descartes]
> >      Cogito ergo sum.
> > \stopextract
> > \stoptext
> > ```
> > 
> > Is there an easy way to achieve that?
> > I tried with \structureuservariable (like possible in \startchapter) but it does not work.
> 
> not all constructs hav ethese user variables (yet)
> 
> i'll add an option for arguments tostart/stop so that you can do
> 
> \starttext
> 
> \definedelimitedtext
>    [dextract]
>    [blockquote]
>    [leftmargin=1.5pc,
>     style=italic,
>     before=\setupindenting[next],
>     after=\setups{extract:whatever}]
> 
> \definestartstop
>    [extract]
>    [arguments=yes,
>     before=\setups{extract:start},
>     after=\setups{extract:stop}]
> 
> \startsetups extract:start
>      \startdextract
> \stopsetups
> 
> \startsetups extract:stop
>      \startstopparameter{author}
>      \stopdextract
>      \blank[1ex,samepage]
>      \hrule
>      \blank[1ex,samepage]
>      \dontleavehmode
>      \wordright{\itx\startstopparameter{author}}
> \stopsetups
> 
> \starttext
> 
> \startextract[author=René Descartes]
>      Cogito ergo sum.
> \stopextract
> 
> \stoptext
> 
> but first i want Wolfgang to check the patch,

For me, Wolfgang's answer fulfills all my needs.
So, from my point of view, this is not needed anymore.
Thank you for your effort anyway!

Gerion

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)
  2024-06-06 14:34 ` Wolfgang Schuster
  2024-06-06 14:50   ` Hans Hagen via ntg-context
  2024-06-06 20:07   ` Gerion Entrup
@ 2024-06-17 11:04   ` Gerion Entrup
  2024-06-17 19:20     ` Wolfgang Schuster
  2 siblings, 1 reply; 9+ messages in thread
From: Gerion Entrup @ 2024-06-17 11:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4776 bytes --]

Am Donnerstag, 6. Juni 2024, 16:34:03 MESZ schrieb Wolfgang Schuster:
> \startsetups [userdata:extract]
>      \startnarrower
>          \setupindenting[next]
>          \getuserdata
>          \hairline
>          \dontleavehmode\wordright{\itx\userdataparameter{author}}
>      \stopnarrower
> \stopsetups
> 
> \defineuserdataalternative
>    [extract]
>    [renderingsetup=userdata:extract]
> 
> \defineuserdata
>    [extract]
>    [style=italic,
>     alternative=extract]
> 
> \starttext
> 
> \startextract[author=René Descartes]
>      Cogito ergo sum.
> \stopextract
> 
> \stoptext
> 
> Wolfgang
> 

I tried to combine this with the code of the mail thread: "setuphead in connection with the command argument" but had not luck.
ConTeXt always stops with:
```
close source    > level 1, order 2, name './mwe.tex'
tex error       > runaway error: end of file encountered
mtx-context     | fatal error: return code: 1
```

Here is the MWE:
```
\startsetups [userdata:extract]
	\getuserdata
	\hairline
	\itx\userdataparameter{author}
\stopsetups

% original definition (also does not work)
% \startsetups [userdata:extract]
%      \startnarrower
%          \setupindenting[next]
%          \getuserdata
%          \hairline
%          \dontleavehmode\wordright{\itx\userdataparameter{author}}
%      \stopnarrower
% \stopsetups

\defineuserdataalternative
   [extract]
   [renderingsetup=userdata:extract]

\defineuserdata
   [extract]
   [style=italic,
    alternative=extract]

\defineframed[chapter_frame][
	width=\textwidth,
	align=flushright,
	offset=0pt,
	rulethickness=0pt
]

\startsetups[my_chapter]
	\startlocalheadsetup
		\startframed[chapter_frame]
			\blank[2cm]
			\startfont[Serif sa 8]
				\color[darkgray]{\headnumbercontent}
			\stopfont
			\blank[5mm]
			\startfont[SerifBold sa 2]
				\color[m-indigo-800]{\headtextcontent}
			\stopfont
			\blank[1cm]
			\startfont[SerifBold sa 1.5]
				\color[m-indigo-800]{\structureuservariable{subtitle}}
			\stopfont
			\blank[3cm]
			\startextract[author={\structureuservariable{quoteauthor}}]
				\structureuservariable{quote}
			\stopextract
		\stopframed
	\stoplocalheadsetup
\stopsetups

\defineheadalternative[chap][renderingsetup=my_chapter]

\setuphead[title, chapter][
	alternative=chap,
	after={\page[yes]},
	sectionsegments=2:2,
	header=high,
	footer=high,
	style=
]

\starttext

% embedded startextract into startchapter does not work
\startchapter[title=Foo][subtitle=bla, quoteauthor={René Descartes}, quote={%
	Cogito ergo sum.
}]
\stopchapter

\startextract[author=René Descartes]
	Cogito ergo sum.
\stopextract

\stoptext
```



I also tried to combine it less interleaved, but it fails with the same error:
```
\startsetups [userdata:extract]
	\getuserdata
	\hairline
	\itx\userdataparameter{author}
\stopsetups

% original definition (also does not work)
% \startsetups [userdata:extract]
%      \startnarrower
%          \setupindenting[next]
%          \getuserdata
%          \hairline
%          \dontleavehmode\wordright{\itx\userdataparameter{author}}
%      \stopnarrower
% \stopsetups

\defineuserdataalternative
   [extract]
   [renderingsetup=userdata:extract]

\defineuserdata
   [extract]
   [style=italic,
    alternative=extract]

\defineframed[chapter_frame][
	width=\textwidth,
	align=flushright,
	offset=0pt,
	rulethickness=0pt
]
\defineframed[chapter_quote][
	width=\textwidth,
	align=flushright,
	offset=0pt,
	rulethickness=0pt
]

\startsetups[my_chapter]
	\startlocalheadsetup
		\startframed[chapter_frame]
			\blank[2cm]
			\startfont[Serif sa 8]
				\color[darkgray]{\headnumbercontent}
			\stopfont
			\blank[5mm]
			\startfont[SerifBold sa 2]
				\color[m-indigo-800]{\headtextcontent}
			\stopfont
			\blank[1cm]
			\startfont[SerifBold sa 1.5]
				\color[m-indigo-800]{\structureuservariable{subtitle}}
			\stopfont
			\blank[3cm]
			\startframed[chapter_quote]
				\structureuservariable{quote}
			\stopframed
		\stopframed
	\stoplocalheadsetup
\stopsetups

\defineheadalternative[chap][renderingsetup=my_chapter]

\setuphead[title, chapter][
	alternative=chap,
	after={\page[yes]},
	sectionsegments=2:2,
	header=high,
	footer=high,
	style=
]

\starttext

% embedded startextract into startchapter does not work
\startchapter[title=Foo][subtitle=bla, quote={%
	\startextract[author=René Descartes]
		Cogito ergo sum.
	\stopextract
}]
\stopchapter

\startchapter[title=Foo][subtitle=bla, quote={bla}]

\startextract[author=René Descartes]
	Cogito ergo sum.
\stopextract

\stopchapter

\stoptext
```

Do you know where the problem is?


Gerion

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)
  2024-06-17 11:04   ` Gerion Entrup
@ 2024-06-17 19:20     ` Wolfgang Schuster
  2024-06-18  7:57       ` Gerion Entrup
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2024-06-17 19:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Gerion Entrup

Gerion Entrup schrieb am 17.06.2024 um 13:04:
> Am Donnerstag, 6. Juni 2024, 16:34:03 MESZ schrieb Wolfgang Schuster:
>> [...]
>>
>> Wolfgang
>>
> 
> I tried to combine this with the code of the mail thread: "setuphead in connection with the command argument" but had not luck.
> ConTeXt always stops with:
> ```
> close source    > level 1, order 2, name './mwe.tex'
> tex error       > runaway error: end of file encountered
> mtx-context     | fatal error: return code: 1
> ```
> 
> Here is the MWE:
> ```
> [...]
> 
> \startsetups[my_chapter]
> 	\startlocalheadsetup
> 		\startframed[chapter_frame]
> 			\blank[2cm]
> 			\startfont[Serif sa 8]
> 				\color[darkgray]{\headnumbercontent}
> 			\stopfont
> 			\blank[5mm]
> 			\startfont[SerifBold sa 2]
> 				\color[m-indigo-800]{\headtextcontent}
> 			\stopfont
> 			\blank[1cm]
> 			\startfont[SerifBold sa 1.5]
> 				\color[m-indigo-800]{\structureuservariable{subtitle}}
> 			\stopfont
> 			\blank[3cm]
> 			\startextract[author={\structureuservariable{quoteauthor}}]
> 				\structureuservariable{quote}
> 			\stopextract
> 		\stopframed
> 	\stoplocalheadsetup
> \stopsetups

The userdata environment uses the buffer mechanism of Context which has 
a few limitations where you can use it, e.g. putting the environment in 
the arguments of other commands (like the setup-environment above) 
fails. One way to avoid this is to replace the \startextract ... 
\stopextract in this case with the code for the quoted text, another way 
is to put all content in a buffer and just load the buffer in the 
setups-environment.

\startbuffer[my_chapter]
	\startlocalheadsetup
		\startframed[chapter_frame]
			...
		\stopframed
	\stoplocalheadsetup
\stopbuffer

\startsetups[my_chapter]
   \getbuffer[my_chapter]
\stopsetups

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)
  2024-06-17 19:20     ` Wolfgang Schuster
@ 2024-06-18  7:57       ` Gerion Entrup
  0 siblings, 0 replies; 9+ messages in thread
From: Gerion Entrup @ 2024-06-18  7:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Wolfgang Schuster


[-- Attachment #1.1: Type: text/plain, Size: 2056 bytes --]

Am Montag, 17. Juni 2024, 21:20:19 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 17.06.2024 um 13:04:
> > Am Donnerstag, 6. Juni 2024, 16:34:03 MESZ schrieb Wolfgang Schuster:
> >> [...]
> >>
> >> Wolfgang
> >>
> > 
> > I tried to combine this with the code of the mail thread: "setuphead in connection with the command argument" but had not luck.
> > ConTeXt always stops with:
> > ```
> > close source    > level 1, order 2, name './mwe.tex'
> > tex error       > runaway error: end of file encountered
> > mtx-context     | fatal error: return code: 1
> > ```
> > 
> > Here is the MWE:
> > ```
> > [...]
> > 
> > \startsetups[my_chapter]
> > 	\startlocalheadsetup
> > 		\startframed[chapter_frame]
> > 			\blank[2cm]
> > 			\startfont[Serif sa 8]
> > 				\color[darkgray]{\headnumbercontent}
> > 			\stopfont
> > 			\blank[5mm]
> > 			\startfont[SerifBold sa 2]
> > 				\color[m-indigo-800]{\headtextcontent}
> > 			\stopfont
> > 			\blank[1cm]
> > 			\startfont[SerifBold sa 1.5]
> > 				\color[m-indigo-800]{\structureuservariable{subtitle}}
> > 			\stopfont
> > 			\blank[3cm]
> > 			\startextract[author={\structureuservariable{quoteauthor}}]
> > 				\structureuservariable{quote}
> > 			\stopextract
> > 		\stopframed
> > 	\stoplocalheadsetup
> > \stopsetups
> 
> The userdata environment uses the buffer mechanism of Context which has 
> a few limitations where you can use it, e.g. putting the environment in 
> the arguments of other commands (like the setup-environment above) 
> fails. One way to avoid this is to replace the \startextract ... 
> \stopextract in this case with the code for the quoted text, another way 
> is to put all content in a buffer and just load the buffer in the 
> setups-environment.
> 
> \startbuffer[my_chapter]
> 	\startlocalheadsetup
> 		\startframed[chapter_frame]
> 			...
> 		\stopframed
> 	\stoplocalheadsetup
> \stopbuffer
> 
> \startsetups[my_chapter]
>    \getbuffer[my_chapter]
> \stopsetups
> 
> Wolfgang
> 

Thanks, I solved it by embedding the extract code directly (more less).

Gerion

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-06-18  8:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-06 10:30 [NTG-context] Combine \setupdelimitedtext with an author (define custom variable?) Gerion Entrup
2024-06-06 11:51 ` [NTG-context] " Hans Hagen via ntg-context
2024-06-06 22:36   ` Gerion Entrup
2024-06-06 14:34 ` Wolfgang Schuster
2024-06-06 14:50   ` Hans Hagen via ntg-context
2024-06-06 20:07   ` Gerion Entrup
2024-06-17 11:04   ` Gerion Entrup
2024-06-17 19:20     ` Wolfgang Schuster
2024-06-18  7:57       ` Gerion Entrup

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).