[NTG-context] suitable macros for Pandoc custom styles for paragraphs, spans and tables
Hello list, I started a topic in Pandoc discussions (see https://github.com/jgm/pandoc/discussions/10208) about custom styles in pandoc tables. This is the framework: - in Pandoc, some textual elements have a "custom-style" attribute, whose value becomes the name of a paragraph or character style in DOCX, ICML or ODT when exported to those formats - e.g. when you have a Span with custom-style="myStyle" around some inline text, you'll get a character style "myStyle" in those formats - for paragraphs, it's a bit different: since they have no attributes in Pandoc, you set the "custom-style" attribute of a surrounding Div element, then all the paragraphs inside it will get that custom paragraph style in DOCX, ICML or ODT - for DOCX output you may set a "custom-style" attribute also in tables Why not using that information about custom styles for ConTeXt output too? I started from the last ones (tables), suggesting that a Table element with a "custom-style" attribute set to "myStyle" could be output in ConTeXt as: \startxtable[myStyle] (Currently, tables converted to ConTeXt by Pandoc start only with a "\startxtable" line) That's doable, because ConTeXt does not terminate with an error, when it encounters a \startxtable[myStyle] not preceded by a \definextable[myStyle]. Then JGM, Pandoc's main author, replied that it would be weird having custom styles for tables and not for spans or paragraphs in ConTeXt output. Good point. In ConTeXt, there are many ways to specify what in Word and LibreOffice are "character" and "paragraph" styles. For example, \definehighlight is suitable for character styles. Badumont, in the pandoc discussion, suggested \definestartstop; good, though you should be careful not to specify a custom style with the same name of an existing environment (e.g. "narrower"); maybe a prefix like "CS" could be a workaround, so that "myStyle" becomes "CSmyStyle", and also "narrower" becomes a less dangerous "CSnarrower". Also, in this case, Pandoc should prepend a \definestartstop[CSmyStyle] before \startCSmyStyle, otherwise ConTeXt would terminate with an error (I think this is doable in Pandoc code, anyways). (BTW, the wiki says \definestartstop is "used to define block level commands": does it mean it can't be suitable for spans of inline text in a paragraph?) Any ideas to specify paragraph and character styles? Massi ___ 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 ___
[NTG-context] Breakable tcolorbox in ConTeXt
Hi, I am trying to reproduce the behaviour of the tcolorbox LaTeX package, more specifically breakable boxes (as illustrated here: https://tex.stackexchange.com/a/676607/123770). It works nicely out of the box (pun intended) using `\definetextbackground` and drawing the frame with MetaPost, using counters to keep track of whether the current text is at the top, middle, or bottom of the box. However, I'm having issues when one box ends and another starts on the same page (see more details below). From what I understand, the issue is that counters seem to be updated on a page-wide basis, so each MPgraphic ‘sees’ the values of counters at the end of the current page, which may not be right if another box modifies them. Would anyone know how to resolve this? Based on two answer on TeX StackExchange ( https://tex.stackexchange.com/a/486124/123770 , https://tex.stackexchange.com/questions/377234/context-frame-problems/377261#377261), the following code works well if there is no more than one box per page: ``` \definecounter[pageNumberTop] \definecounter[pageNumberBottom] \startuseMPgraphic{mp:axiomframe} begingroup; for i=1 upto nofmultipars : path p; p := ( llcorner multipars[i] -- lrcorner multipars[i] -- urcorner multipars[i] -- ulcorner multipars[i] -- cycle ) enlarged (EmWidth,EmWidth) ; fill p withcolor boxfillcolor ; % if the current page is the first one covered by the box... if (\pagenumber == \rawcountervalue[pageNumberTop]) : % ... if it is also the last one, the box fits entirely on the page; we thus draw the full frame if \rawcountervalue[pageNumberTop] == \rawcountervalue[pageNumberBottom] : draw p withpen pencircle scaled 2pt withcolor boxlinecolor ; % ... otherwise, don't draw the bottom line else : draw llcorner multipars[i] + (-EmWidth, -EmWidth) -- ulcorner multipars[i] + (-EmWidth, EmWidth) -- urcorner multipars[i] + (EmWidth, EmWidth) -- lrcorner multipars[i] + (EmWidth, -EmWidth) withpen pencircle scaled 2pt withcolor boxlinecolor ; fi ; picture pic; pic := textext.ulft("\tfd\symbol[info]"); pic := pic shifted ulcorner multipars[i]; fill bbox pic withcolor white; draw pic; % if the current page is the last one covered by the box, draw the left, bottom, and right lines elseif \pagenumber == \rawcountervalue[pageNumberBottom] : draw ulcorner multipars[i] + (-EmWidth, EmWidth) -- llcorner multipars[i] + (-EmWidth, -EmWidth) -- lrcorner multipars[i] + (EmWidth, -EmWidth) -- urcorner multipars[i] + (EmWidth, EmWidth) withpen pencircle scaled 2pt withcolor boxlinecolor ; % if the current page is neither the first one nor the last one, only draw the left and right lines else : draw llcorner multipars[i] - (EmWidth, EmWidth) -- ulcorner multipars[i] + (-EmWidth, EmWidth) withpen pencircle scaled 2pt withcolor boxlinecolor ; draw urcorner multipars[i] + (EmWidth, EmWidth) -- lrcorner multipars[i] + (EmWidth, -EmWidth) withpen pencircle scaled 2pt withcolor boxlinecolor ; fi ; endfor ; setbounds currentpicture to OverlayBox ; endgroup; \stopuseMPgraphic \definetextbackground [theoremFrame] [mp=mp:axiomframe, location=paragraph, backgroundcolor=green, framecolor=red, before={\setcounter[pageNumberTop][\pagenumber]}, after={\setcounter[pageNumberBottom][\pagenumber]}] \definestartstop [ColoredBox] [before={\blank[2em]\starttheoremFrame}, after={\stoptheoremFrame\blank[2em]}] ``` For instance, ``` \startColoredBox \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \stopColoredBox ``` correctly gives a box split over multiple pages, with the top part of the frame only drawn on the first page and the bottom part only drawn on the last one. It also works correctly when adding `\page` between boxes: ``` \starttext \startColoredBox \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \stopColoredBox \page \startColoredBox \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \stopColoredBox ``` However, the following gives an incorrect output: ``` \starttext \startColoredBox \input knuth \input knuth \input knuth \input knuth \input knuth \input knuth \input kn
[NTG-context] Re: Nāgarī for Academics
Thanks again, in fact both are useful in different situations. Jürgen - Nachricht von Wolfgang Schuster - Datum: Sat, 10 Aug 2024 18:22:50 +0200 Von: Wolfgang Schuster Antwort an: mailing list for ConTeXt users Betreff: [NTG-context] Re: Nāgarī for Academics An: mailing list for ConTeXt users , Otared Kavian Otared Kavian schrieb am 10.08.2024 um 17:56: On 10 Aug 2024, at 11:59, Jürgen Hanneder via ntg-context wrote: Does it work if you say {\language[sa]yoga} That's it!! Hi Jürgen, You may also define a command like (or a shorter name…) \define[1]\sanskrit{\start\language[sa]#1\stop} \definestartstop [sanskrit] [style={\language[sa]}] 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 ___ - Ende der Nachricht von Wolfgang Schuster - --- Prof. Dr. Juergen Hanneder Philipps-Universitaet Marburg FG Indologie u. Tibetologie Deutschhausstr.12 35032 Marburg Germany Tel. 0049-6421-28-24930 hanne...@staff.uni-marburg.de ___ 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 ___
[NTG-context] Re: Nāgarī for Academics
> From: Wolfgang Schuster > Subject: Re: [NTG-context] Re: Nāgarī for Academics > Date: 10 August 2024 at 18:22:50 CEST > To: mailing list for ConTeXt users , Otared Kavian > > > > > Otared Kavian schrieb am 10.08.2024 um 17:56: >>> […] >> >> \define[1]\sanskrit{\start\language[sa]#1\stop} > > \definestartstop [sanskrit] [style={\language[sa]}] Indeed… much more elegant and efficient ! Thanks Wolfgang ! Best regards: Otared Otared Kavian e-mail: ota...@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://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 ___
[NTG-context] Re: Nāgarī for Academics
Otared Kavian schrieb am 10.08.2024 um 17:56: On 10 Aug 2024, at 11:59, Jürgen Hanneder via ntg-context wrote: Does it work if you say {\language[sa]yoga} That's it!! Hi Jürgen, You may also define a command like (or a shorter name…) \define[1]\sanskrit{\start\language[sa]#1\stop} \definestartstop [sanskrit] [style={\language[sa]}] 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 ___
[NTG-context] Re: Use headcommand in \definedescription together with \definehighlight (now: \definestartstop)
Am Freitag, 28. Juni 2024, 11:59:19 MESZ schrieb Wolfgang Schuster: > Gerion Entrup schrieb am 28.06.2024 um 11:40: > > > Do you know, why the groupedcommand solution does not work? > > The command and the environment which are created by \definestartstop > can't be interchanged when you use the before/after and left/right keys. > > begin example > \usemodule[visual] > > \definestartstop >[Example] >[before={\par\leftaligned{\tttf [before]}\par}, > after={\par\leftaligned{\tttf [after]}\par}, >left={{\tttf [left]}}, > right={{\tttf [right]}}] > > \starttext > > \fakewords{10}{20} > \startExample > \fakewords{10}{20} > \stopExample > \fakewords{10}{20} > > \blank > > \fakewords{3}{5} > \Example{\fakewords{3}{5}} > \fakewords{3}{5} > > \stoptext > end example > > Wolfgang > Ok, thanks for the explanation (I have added the example to the wiki). Gerion signature.asc Description: This is a digitally signed message part. ___ 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 ___
[NTG-context] Re: Use headcommand in \definedescription together with \definehighlight (now: \definestartstop)
Gerion Entrup schrieb am 28.06.2024 um 11:40: Do you know, why the groupedcommand solution does not work? The command and the environment which are created by \definestartstop can't be interchanged when you use the before/after and left/right keys. begin example \usemodule[visual] \definestartstop [Example] [before={\par\leftaligned{\tttf [before]}\par}, after={\par\leftaligned{\tttf [after]}\par}, left={{\tttf [left]}}, right={{\tttf [right]}}] \starttext \fakewords{10}{20} \startExample \fakewords{10}{20} \stopExample \fakewords{10}{20} \blank \fakewords{3}{5} \Example{\fakewords{3}{5}} \fakewords{3}{5} \stoptext end example 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 ___
[NTG-context] Re: Use headcommand in \definedescription together with \definehighlight (now: \definestartstop)
Am Donnerstag, 27. Juni 2024, 22:19:02 MESZ schrieb Wolfgang Schuster: > Gerion Entrup schrieb am 25.06.2024 um 08:41: > > Am Dienstag, 25. Juni 2024, 00:09:09 MESZ schrieb Wolfgang Schuster: > >> Gerion Entrup schrieb am 24.06.2024 um 23:57: > >>> Am Montag, 24. Juni 2024, 21:20:19 MESZ schrieb Aditya Mahajan: > >>>> On Mon, 24 Jun 2024, Gerion Entrup wrote: > >>>> > >>>>> Hi, > >>>>> > >>>>> I was in the process to convert an itemize part to a description and > >>>>> wanted to simplify the code in the same move. > >>>>> I discovered headcommand for that, but struggled to set the text in an > >>>>> highlight _and_ make a colon at the end. > >>>> Not sure what exactly you want, but how about: > >>>> > >>>> \definehighlight[hl][style={\m{>}\,\switchtobodyfont[tt]}] > >>>> % This is the wrong way to define such a command as '>' is not part of > >>>> the style. I have left this definition just for comparison with the soln > >>>> below. > >>> Is there a better way to define a highlight that sets a style (color, > >>> font) _and_ a prefix (symbol)? > >>> Another way, I know of, would be just a plain def, something like > >>> \def{\hl}{\groupedcommand{>\,\switchtobodyfont[tt]}{}}, but actually I > >>> want to define a highlight (just with an additional prefix). > >> > >> 1. ConTeXt already uses \hl as name for a existing command. > >> > >> 2. Use \definestartstop: > >> > >> \definestartstop [gerion] [style=mono,left={›\thinspace}] > >> > >> \starttext > >> > >> text > >> > >> \gerion{text} > >> > >> \stoptext > >> > >>>> \definedescription[category][ > >>>> alternative=top, > >>>> headstyle=bold, > >>>> width=broad, > >>>> ] > >>>> > >>>> \definedescription[desc][ > >>>> width=fit, > >>>> distance={\widthofstring{~}}, > >> > >> distance=\spaceamount, > >> > >> Wolfgang > > > > This seems to be much better but does not lead to the wanted result. The > > full example now is: > > ``` > > \definestartstop[myhl][style=mono,left={›\thinspace}] > > > > \definedescription[categorie][ > > alternative=top, > > headstyle=bold, > > width=broad, > > ] > > > > \definedescription[desc][ > > width=broad, > > distance=\spaceamount, > > headcommand={\groupedcommand{\startmyhl}{\stopmyhl :}}, > > headstyle=, > > before={\startpacked}, > > after={\stoppacked}, > > alternative=hanging > > ] > > > > \starttext > > > > This is a \myhl{highlight}. > > > > Some listings > > > > \startcategorie{Itemize} > > \startitemize[packed] > > \item \myhl{first}: one > > \item \myhl{second}: two > > \stopitemize > > \stopcategorie > > > > Now the same as desc: > > \startcategorie{Desc} > > \startdesc{first} one \stopdesc > > \startdesc{second} two \stopdesc > > \stopcategorie > > > > \stoptext > > ``` > > > > This adopts the correct style in \startdesc \stopdesc and sets the colon > > but omits the › (the left part). > > You can do the following in the next version. > > 1. Add "arguments=yes" to \definestartstop to enable the optional > argument for the new command. > > 2. Use the new commands with the "headcommand" key and apply ":" as > right delimiter for the content of \Highlight. > > \definestartstop >[Highlight] >[arguments=yes, > style=mono, > left={›\thinspace}] > > \definedescription >[description] >[ width=broad, >distance=\spaceamount, > headcommand=\Highlight[right=:], > alternative=hanging] > > \starttext > > This is a \Highlight{highlight}. > > \startdescription[title={Lorem ipsum}] > \samplefile{lorem} > \stopdescription > > \stoptext > > Wolfgang Thanks, that will work. Do you know, why the groupedcommand solution does not work? Gerion signature.asc Description: This is a digitally signed message part. ___ 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 ___
[NTG-context] Re: Use headcommand in \definedescription together with \definehighlight (now: \definestartstop)
Gerion Entrup schrieb am 25.06.2024 um 08:41: Am Dienstag, 25. Juni 2024, 00:09:09 MESZ schrieb Wolfgang Schuster: Gerion Entrup schrieb am 24.06.2024 um 23:57: Am Montag, 24. Juni 2024, 21:20:19 MESZ schrieb Aditya Mahajan: On Mon, 24 Jun 2024, Gerion Entrup wrote: Hi, I was in the process to convert an itemize part to a description and wanted to simplify the code in the same move. I discovered headcommand for that, but struggled to set the text in an highlight _and_ make a colon at the end. Not sure what exactly you want, but how about: \definehighlight[hl][style={\m{>}\,\switchtobodyfont[tt]}] % This is the wrong way to define such a command as '>' is not part of the style. I have left this definition just for comparison with the soln below. Is there a better way to define a highlight that sets a style (color, font) _and_ a prefix (symbol)? Another way, I know of, would be just a plain def, something like \def{\hl}{\groupedcommand{>\,\switchtobodyfont[tt]}{}}, but actually I want to define a highlight (just with an additional prefix). 1. ConTeXt already uses \hl as name for a existing command. 2. Use \definestartstop: \definestartstop [gerion] [style=mono,left={›\thinspace}] \starttext text \gerion{text} \stoptext \definedescription[category][ alternative=top, headstyle=bold, width=broad, ] \definedescription[desc][ width=fit, distance={\widthofstring{~}}, distance=\spaceamount, Wolfgang This seems to be much better but does not lead to the wanted result. The full example now is: ``` \definestartstop[myhl][style=mono,left={›\thinspace}] \definedescription[categorie][ alternative=top, headstyle=bold, width=broad, ] \definedescription[desc][ width=broad, distance=\spaceamount, headcommand={\groupedcommand{\startmyhl}{\stopmyhl :}}, headstyle=, before={\startpacked}, after={\stoppacked}, alternative=hanging ] \starttext This is a \myhl{highlight}. Some listings \startcategorie{Itemize} \startitemize[packed] \item \myhl{first}: one \item \myhl{second}: two \stopitemize \stopcategorie Now the same as desc: \startcategorie{Desc} \startdesc{first} one \stopdesc \startdesc{second} two \stopdesc \stopcategorie \stoptext ``` This adopts the correct style in \startdesc \stopdesc and sets the colon but omits the › (the left part). You can do the following in the next version. 1. Add "arguments=yes" to \definestartstop to enable the optional argument for the new command. 2. Use the new commands with the "headcommand" key and apply ":" as right delimiter for the content of \Highlight. \definestartstop [Highlight] [arguments=yes, style=mono, left={›\thinspace}] \definedescription [description] [ width=broad, distance=\spaceamount, headcommand=\Highlight[right=:], alternative=hanging] \starttext This is a \Highlight{highlight}. \startdescription[title={Lorem ipsum}] \samplefile{lorem} \stopdescription \stoptext Wolfgang Highlight.pdf Description: Adobe PDF document ___ 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 ___
[NTG-context] Re: Use headcommand in \definedescription together with \definehighlight (now: \definestartstop)
Am Dienstag, 25. Juni 2024, 00:09:09 MESZ schrieb Wolfgang Schuster: > Gerion Entrup schrieb am 24.06.2024 um 23:57: > > Am Montag, 24. Juni 2024, 21:20:19 MESZ schrieb Aditya Mahajan: > >> On Mon, 24 Jun 2024, Gerion Entrup wrote: > >> > >>> Hi, > >>> > >>> I was in the process to convert an itemize part to a description and > >>> wanted to simplify the code in the same move. > >>> I discovered headcommand for that, but struggled to set the text in an > >>> highlight _and_ make a colon at the end. > >> Not sure what exactly you want, but how about: > >> > >> \definehighlight[hl][style={\m{>}\,\switchtobodyfont[tt]}] > >> % This is the wrong way to define such a command as '>' is not part of the > >> style. I have left this definition just for comparison with the soln below. > > Is there a better way to define a highlight that sets a style (color, font) > > _and_ a prefix (symbol)? > > Another way, I know of, would be just a plain def, something like > > \def{\hl}{\groupedcommand{>\,\switchtobodyfont[tt]}{}}, but actually I want > > to define a highlight (just with an additional prefix). > > 1. ConTeXt already uses \hl as name for a existing command. > > 2. Use \definestartstop: > > \definestartstop [gerion] [style=mono,left={›\thinspace}] > > \starttext > > text > > \gerion{text} > > \stoptext > > >> \definedescription[category][ > >>alternative=top, > >>headstyle=bold, > >> width=broad, > >> ] > >> > >> \definedescription[desc][ > >>width=fit, > >>distance={\widthofstring{~}}, > > distance=\spaceamount, > > Wolfgang This seems to be much better but does not lead to the wanted result. The full example now is: ``` \definestartstop[myhl][style=mono,left={›\thinspace}] \definedescription[categorie][ alternative=top, headstyle=bold, width=broad, ] \definedescription[desc][ width=broad, distance=\spaceamount, headcommand={\groupedcommand{\startmyhl}{\stopmyhl :}}, headstyle=, before={\startpacked}, after={\stoppacked}, alternative=hanging ] \starttext This is a \myhl{highlight}. Some listings \startcategorie{Itemize} \startitemize[packed] \item \myhl{first}: one \item \myhl{second}: two \stopitemize \stopcategorie Now the same as desc: \startcategorie{Desc} \startdesc{first} one \stopdesc \startdesc{second} two \stopdesc \stopcategorie \stoptext ``` This adopts the correct style in \startdesc \stopdesc and sets the colon but omits the › (the left part). Gerion mwe.pdf Description: Adobe PDF document signature.asc Description: This is a digitally signed message part. ___ 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 ___
[NTG-context] Re: Use headcommand in \definedescription together with \definehighlight
Gerion Entrup schrieb am 24.06.2024 um 23:57: Am Montag, 24. Juni 2024, 21:20:19 MESZ schrieb Aditya Mahajan: On Mon, 24 Jun 2024, Gerion Entrup wrote: Hi, I was in the process to convert an itemize part to a description and wanted to simplify the code in the same move. I discovered headcommand for that, but struggled to set the text in an highlight _and_ make a colon at the end. Not sure what exactly you want, but how about: \definehighlight[hl][style={\m{>}\,\switchtobodyfont[tt]}] % This is the wrong way to define such a command as '>' is not part of the style. I have left this definition just for comparison with the soln below. Is there a better way to define a highlight that sets a style (color, font) _and_ a prefix (symbol)? Another way, I know of, would be just a plain def, something like \def{\hl}{\groupedcommand{>\,\switchtobodyfont[tt]}{}}, but actually I want to define a highlight (just with an additional prefix). 1. ConTeXt already uses \hl as name for a existing command. 2. Use \definestartstop: \definestartstop [gerion] [style=mono,left={›\thinspace}] \starttext text \gerion{text} \stoptext \definedescription[category][ alternative=top, headstyle=bold, width=broad, ] \definedescription[desc][ width=fit, distance={\widthofstring{~}}, distance=\spaceamount, 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 ___
[NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)
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 signature.asc Description: This is a digitally signed message part. ___ 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 ___
[NTG-context] Re: Combine \setupdelimitedtext with an author (define custom variable?)
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 ___
[NTG-context] Re: After using a custom command in the title, the table of contents is not generated properly
ai2472206...@yeah.net schrieb am 05.06.2024 um 16:03: As described, here is example: % \def\cmd#1{{\tt\textslash #1}} \def\cmdii#1{\tt #1} \def\cmdiii#1{\rm #1} You can use \definehighlight to create a custom command for a style. The case where you want a slash before the text you have to use \definestartstop which allows you to set something before and after \definestartstop [cmdi] [style=\tt,left=\textslash] \definehighlight [cmdii] [style=\tt] \definehighlight [cmdiii] [style=\rm] 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 ___
[NTG-context] Re: error with definestartstop and startmode
On Sun, 17 Dec 2023, Wolfgang Schuster wrote: > Peter Münster schrieb am 17.12.2023 um 10:09: > > On Sat, Dec 16 2023, Hans Hagen via ntg-context wrote: > > > >> \usemodule[abbreviations-logos] > >> \defineblock [H] [before=\startcolor[blue],after=\stopcolor] > >> \keepblocks[H] > > Thanks for this solution. > > > > Is there also something for inline-mode? Example: > > > > test \beginH TEST\endH test > > You can create different versions of your environment and let context choose > one whether the mode is enabled or disabled. > > %\enablemode[H] > > \startmode [H] > \definestartstop [H] [color=blue] > \stopmode > > \startnotmode [H] > \define\startH{\ignoreupto\stopH} > \stopnotmode > > \starttext > > xxx \startH yyy \stopH zzz > > \stoptext I do something similar: \definebuffer[H] \startmode[H] \definestartstop[H][color=blue] \stopmode Aditya___ 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 ___
[NTG-context] Re: error with definestartstop and startmode
Peter Münster schrieb am 17.12.2023 um 10:09: On Sat, Dec 16 2023, Hans Hagen via ntg-context wrote: \usemodule[abbreviations-logos] \defineblock [H] [before=\startcolor[blue],after=\stopcolor] \keepblocks[H] Thanks for this solution. Is there also something for inline-mode? Example: test \beginH TEST\endH test You can create different versions of your environment and let context choose one whether the mode is enabled or disabled. %\enablemode[H] \startmode [H] \definestartstop [H] [color=blue] \stopmode \startnotmode [H] \define\startH{\ignoreupto\stopH} \stopnotmode \starttext xxx \startH yyy \stopH zzz \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 ___
[NTG-context] Re: error with definestartstop and startmode
On Sat, Dec 16 2023, Hans Hagen via ntg-context wrote: > \usemodule[abbreviations-logos] > \defineblock [H] [before=\startcolor[blue],after=\stopcolor] > \keepblocks[H] Thanks for this solution. Is there also something for inline-mode? Example: test \beginH TEST\endH test TIA, -- Peter ___ 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 ___
[NTG-context] Re: error with definestartstop and startmode
On 12/16/2023 9:17 AM, Peter Münster wrote: Hi, I get an "runaway error" with the following example: --8<---cut here---start----->8--- \definestartstop[H][color=blue, before={\startmode[h]}, after={\stopmode}] \starttext test \startH TEST \stopH \stoptext --8<---cut here---end--->8--- How could I create such start-stop pair please? doesn't work because \stopmode is a delimiter when shipped \usemodule[abbreviations-logos] \defineblock [H] [before=\startcolor[blue],after=\stopcolor] \keepblocks[H] \starttext test \beginH TEST \endH test \stoptext 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 ___
[NTG-context] error with definestartstop and startmode
Hi, I get an "runaway error" with the following example: --8<---cut here---start----->8--- \definestartstop[H][color=blue, before={\startmode[h]}, after={\stopmode}] \starttext test \startH TEST \stopH \stoptext --8<---cut here---end--->8--- How could I create such start-stop pair please? TIA for any hints, -- Peter ___ 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 ___
[NTG-context] Re: how to define an environment with key=value arguments
Henning Hraban Ramm schrieb am 08.09.2023 um 12:22: Hi, for an involved image placement (full page image starting each chapter, several stacked elements), I’d like an environment that accepts key-value arguments, like \startMyFigure[page=left,title={My caption}] \externalfigure[dummy]… \stopMyFigure I don’t think that a real float makes sense, even if the interface looks similar, since it’s always a full page in a fixed place, I need no numbering and can place the caption myself. Does it make sense to use \definestartstop? How would I “plugin“ the argument handling? Or should I better define start and stop separately? \def\startMyFigure[#1]{ % e.g. use utilities.parsers.settings_to_hash(#1) } \def\stopMyFigure{} Probably I’ll need to catch the content (\externalfigure, might become more) and use it in a \setlayer – so perhaps something like \definebuffer[MyFigure] \define\stopMyFigure{% \setlayer[page]{\getMyFigure}}} } ? But then I don’t know how to handle the arguments. Probably it makes most sense to do it in Lua, like \startluacode interfaces.implement { name = "startMyFigure", public = true, arguments = {"hash",}, actions = function(h, a) -- … end, } \stopluacode But I didn’t find how to do environments. When you just need an environment with a optional argument to pass user values you can use the userdata environment but be aware that you have some limitations (like verbatim) because the mechanism uses a buffer to store the content. For images (and other content) which are placed on a separate page at the start of a chapter you can use the pageinjection mechanism which was added for this purpose. 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 ___
[NTG-context] how to define an environment with key=value arguments
Hi, for an involved image placement (full page image starting each chapter, several stacked elements), I’d like an environment that accepts key-value arguments, like \startMyFigure[page=left,title={My caption}] \externalfigure[dummy]… \stopMyFigure I don’t think that a real float makes sense, even if the interface looks similar, since it’s always a full page in a fixed place, I need no numbering and can place the caption myself. Does it make sense to use \definestartstop? How would I “plugin“ the argument handling? Or should I better define start and stop separately? \def\startMyFigure[#1]{ % e.g. use utilities.parsers.settings_to_hash(#1) } \def\stopMyFigure{} Probably I’ll need to catch the content (\externalfigure, might become more) and use it in a \setlayer – so perhaps something like \definebuffer[MyFigure] \define\stopMyFigure{% \setlayer[page]{\getMyFigure}}} } ? But then I don’t know how to handle the arguments. Probably it makes most sense to do it in Lua, like \startluacode interfaces.implement { name = "startMyFigure", public= true, arguments = {"hash",}, actions = function(h, a) -- … end, } \stopluacode But I didn’t find how to do environments. Hraban ___ 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: Pass string into text background graphic
On 8/12/2023 7:19 PM, Thangalin wrote: Thanks Hans. The \newinteger approach would always increment the value, regardless of conditionals within the MetaPost code (i.e., it was like legend := "\ConcurrentTextGet" would always invoke the macro just be referencing the MPgraphic and nothing would prevent its execution). This meant that the Get indexes would not correspond to the Set indexes. Switching to \definenumber resolved the issue. There were a few other oddities, such as the "Get" counter incrementing twice. Here's the code: you could remove the \localcontrolled around the advance \definenumber[ConcurrentTextSetCounter][prefix=no] \definenumber[ConcurrentTextGetCounter][prefix=no] \setnumber[ConcurrentTextSetCounter][0] \setnumber[ConcurrentTextGetCounter][0] % Map each label as global key/value pairs. \def\ConcurrentTextSet#1{% \incrementnumber[ConcurrentTextSetCounter]% \setxvariable {concurrent} {text:\rawcountervalue[ConcurrentTextSetCounter]} {#1}} % Account for the counter incrementing twice and the index being 1-based. \def\ConcurrentTextGet{% \incrementnumber[ConcurrentTextGetCounter]% \getvariable {concurrent} why twice ? you only have to typeset the text once, right? {text:\number\numexpr1+\rawcountervalue[ConcurrentTextGetCounter]/2\relax}} \startuseMPgraphic{GraphicConcurrent} numeric index; index := 1; % Differentiate between new text blocks and those crossing pages. if (multikind[ index ] = "single") or (multikind[ index ] = "first"): string legend; legend := "\ConcurrentTextGet"; % For new text blocks, write the title. picture p; p := textext.rt( legend ) shifted ulcorner multipars[ index ] shifted (1cm, 0); % Draw the horizontal rule only for the initial text block. draw ulcorner multipars[ index ] shifted (1mm + xpart lrcorner p, 0) -- urcorner multipars[ index ]; % Draw the vertical rule for the initial text block. draw llcorner multipars[ index ] -- ulcorner multipars[ index ] -- ulcorner multipars[ index ] shifted (9mm, 0); draw p; else: % Draw only the vertical rule only when crossing page boundaries. draw llcorner multipars[ index ] -- ulcorner multipars[ index ]; fi \stopuseMPgraphic \definetextbackground[TextConcurrentFrame][ mp=GraphicConcurrent, frame=off, topoffset=1em, leftoffset=1em, before=\blank[2*big], after=\blank, location=paragraph, ] \startsetups concurrent:before \ConcurrentTextSet{% % Be sure to format "a.m." and other special phrases. \expandafter\TextReplacement{% \xmlatt{\getvariable{div}{concurrent}}{data-title}% } } \startTextConcurrentFrame \stopsetups \startsetups concurrent:after \stopTextConcurrentFrame \stopsetups \definestartstop[concurrent][ before=\directsetup{concurrent:before}, after=\directsetup{concurrent:after} ] This allows for typesetting a wider range of pandoc-style Markdown annotations, such as: ::: {.concurrent title="Terminal Berth 5, 3:17 a.m."} text goes here ::: With these changes, the titles now only appear at the start of the demarcated text, in any combination of "concurrent" annotation instances spanning any number of pages. Much appreciated. Cheers! P.S. The following line requires KeenWrite themes: \expandafter\TextReplacement{ ... } For details, see: - https://github.com/DaveJarvis/keenwrite-themes/blob/main/xhtml/xml-blocks.tex - https://github.com/DaveJarvis/keenwrite-themes/blob/main/boschet/replace.tex ___ 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 ___ -- - 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 ___
[NTG-context] Re: Pass string into text background graphic
Thanks Hans. The \newinteger approach would always increment the value, regardless of conditionals within the MetaPost code (i.e., it was like legend := "\ConcurrentTextGet" would always invoke the macro just be referencing the MPgraphic and nothing would prevent its execution). This meant that the Get indexes would not correspond to the Set indexes. Switching to \definenumber resolved the issue. There were a few other oddities, such as the "Get" counter incrementing twice. Here's the code: \definenumber[ConcurrentTextSetCounter][prefix=no] \definenumber[ConcurrentTextGetCounter][prefix=no] \setnumber[ConcurrentTextSetCounter][0] \setnumber[ConcurrentTextGetCounter][0] % Map each label as global key/value pairs. \def\ConcurrentTextSet#1{% \incrementnumber[ConcurrentTextSetCounter]% \setxvariable {concurrent} {text:\rawcountervalue[ConcurrentTextSetCounter]} {#1}} % Account for the counter incrementing twice and the index being 1-based. \def\ConcurrentTextGet{% \incrementnumber[ConcurrentTextGetCounter]% \getvariable {concurrent} {text:\number\numexpr1+\rawcountervalue[ConcurrentTextGetCounter]/2\relax}} \startuseMPgraphic{GraphicConcurrent} numeric index; index := 1; % Differentiate between new text blocks and those crossing pages. if (multikind[ index ] = "single") or (multikind[ index ] = "first"): string legend; legend := "\ConcurrentTextGet"; % For new text blocks, write the title. picture p; p := textext.rt( legend ) shifted ulcorner multipars[ index ] shifted (1cm, 0); % Draw the horizontal rule only for the initial text block. draw ulcorner multipars[ index ] shifted (1mm + xpart lrcorner p, 0) -- urcorner multipars[ index ]; % Draw the vertical rule for the initial text block. draw llcorner multipars[ index ] -- ulcorner multipars[ index ] -- ulcorner multipars[ index ] shifted (9mm, 0); draw p; else: % Draw only the vertical rule only when crossing page boundaries. draw llcorner multipars[ index ] -- ulcorner multipars[ index ]; fi \stopuseMPgraphic \definetextbackground[TextConcurrentFrame][ mp=GraphicConcurrent, frame=off, topoffset=1em, leftoffset=1em, before=\blank[2*big], after=\blank, location=paragraph, ] \startsetups concurrent:before \ConcurrentTextSet{% % Be sure to format "a.m." and other special phrases. \expandafter\TextReplacement{% \xmlatt{\getvariable{div}{concurrent}}{data-title}% } } \startTextConcurrentFrame \stopsetups \startsetups concurrent:after \stopTextConcurrentFrame \stopsetups \definestartstop[concurrent][ before=\directsetup{concurrent:before}, after=\directsetup{concurrent:after} ] This allows for typesetting a wider range of pandoc-style Markdown annotations, such as: ::: {.concurrent title="Terminal Berth 5, 3:17 a.m."} text goes here ::: With these changes, the titles now only appear at the start of the demarcated text, in any combination of "concurrent" annotation instances spanning any number of pages. Much appreciated. Cheers! P.S. The following line requires KeenWrite themes: \expandafter\TextReplacement{ ... } For details, see: - https://github.com/DaveJarvis/keenwrite-themes/blob/main/xhtml/xml-blocks.tex - https://github.com/DaveJarvis/keenwrite-themes/blob/main/boschet/replace.tex concurrent.pdf Description: Adobe PDF document ___ 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: Pass string into text background graphic
On 8/11/2023 9:57 PM, Thangalin wrote: Hi list, I'm attempting to make a stylized border around paragraphs that can span pages. The border runs along the side and the top. (Ideally the top border wouldn't repeat, but that's a minor issue.) The issue I'm having is that the title for the text doesn't always appear. Instead, there's a small gap along the top border where the title should be. Am I going about this the wrong way? % SOT \startbuffer[demo] Text Goes Here Different Text Goes Here \stopbuffer \startxmlsetups xml:xhtml \xmlsetsetup{\xmldocument}{*}{-} \xmlsetsetup{\xmldocument}{html|body}{xml:*} \xmlsetsetup{\xmldocument}{div}{xml:*}\stopxmlsetups \xmlregistersetup{xml:xhtml} \startxmlsetups xml:html \xmlflush{#1}\stopxmlsetups \startxmlsetups xml:body \xmlflush{#1}\stopxmlsetups \startxmlsetups xml:div \setvariable{div}{\xmlatt{#1}{class}}{#1} \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop\stopxmlsetups \startusableMPgraphic{GraphicConcurrent} begingroup; string legend; picture title; picture border; picture bg; numeric tw; numeric th; legend := \MPstring{concurrent}; title := nullpicture; border := nullpicture; bg := textext( "\strut " & legend ); tw := xpart lrcorner bg - xpart llcorner bg; th := ypart ulcorner bg - ypart llcorner bg; addto title also image( fill unitsquare xysized (tw + 8, th) shifted ulcorner multipars[1] shifted 28 right shifted 8 down withcolor white; draw textext.drt( legend ) shifted ulcorner multipars[1] shifted 32 right shifted 3 down; ); addto border also image( for i = 1 upto nofmultipars: draw llcorner multipars[i] -- ulcorner multipars[i] shifted 8 down .. ulcorner multipars[i] shifted 8 right -- urcorner multipars[i] withpen pencircle scaled 0.75 withcolor black; endfor; ); draw image( draw border; draw title; ); endgroup;\stopusableMPgraphic \definetextbackground[TextConcurrentFrame][ mp=GraphicConcurrent, frame=off, topoffset=1em, leftoffset=1em, location=paragraph, ] \definestartstop[concurrent][ before={% \blank[big]% LEGEND: \xmlatt{\getvariable{div}{concurrent}}{data-title}% \blank[big]% \setMPtext{concurrent}{\xmlatt{\getvariable{div}{concurrent}}{data-title}} \startTextConcurrentFrame}, after={\stopTextConcurrentFrame\blank[big]}, ] \starttext \xmlprocessbuffer{main}{demo}{}\stoptext % EOT If I change the following line: legend := \MPstring{concurrent}; to: legend := "some string"; Then the title "some string" is repeated. It seems like the value for \MPstring{concurrent} is being cached in some situations and ignored in others. Essentially, I'm trying to visually offset multiple paragraphs using a left-hand vertical rule along with a top horizontal rule that has a title. Each new "concurrent" section needs its own header that doesn't repeat. Is there a ConTeXt-way to accomplish this feat? There's always a way out but not always a pretty one. One problem is that these graphics are done later, when a page gets assembled, so you get the current value at that time. Then there is grouping so you need to assign global. Now, there can be caching but you use expanded string so that's not the issue. % draw image ( draw rawtextext(legend) notcached) ; That is seldom needed. So below is a solution. When you cross pages with a frame you need to make sure the text is done once. I let you figure that out (after all you came this far so i guess you know). For historic reasons (mkii / performance) it's not the easiest mechanism. % We store each one independent: \newinteger\ConcurrentTextSetCounter \newinteger\ConcurrentTextGetCounter \protected\def\ConcurrentTextSet#1% {\global\advance\ConcurrentTextSetCounter\plusone \setxvariable {concurrent} {text:\the\ConcurrentTextSetCounter} {#1}} \def\ConcurrentTextGet % we want full expansion here {\localcontrolled{\global\advance\ConcurrentTextGetCounter\plusone}% \getvariable {concurrent} {text:\the\ConcurrentTextGetCounter}} % We also use the helpers (so at least we can see what we do): \startuseMPgraphic{GraphicConcurrent}{text} % % {mpos:region:draw} % draw_multi_pars ; string legend ; legend := "\ConcurrentTextGet"; show legend; % draw image ( draw rawtextext(legend) notcached) ; picture p ; p := textext.rt(legend) shifted ulcorner multipars[1] shifted (1cm,0) ; draw llcorner multipars[1] -- ulcorner multipars[1] -- ulcorner multipars[1] shifted (9mm,0) ; draw ulcorner multipars[1] shifted (1mm + xpart lrcorner p
[NTG-context] Pass string into text background graphic
Hi list, I'm attempting to make a stylized border around paragraphs that can span pages. The border runs along the side and the top. (Ideally the top border wouldn't repeat, but that's a minor issue.) The issue I'm having is that the title for the text doesn't always appear. Instead, there's a small gap along the top border where the title should be. Am I going about this the wrong way? % SOT \startbuffer[demo] Text Goes Here Different Text Goes Here \stopbuffer \startxmlsetups xml:xhtml \xmlsetsetup{\xmldocument}{*}{-} \xmlsetsetup{\xmldocument}{html|body}{xml:*} \xmlsetsetup{\xmldocument}{div}{xml:*}\stopxmlsetups \xmlregistersetup{xml:xhtml} \startxmlsetups xml:html \xmlflush{#1}\stopxmlsetups \startxmlsetups xml:body \xmlflush{#1}\stopxmlsetups \startxmlsetups xml:div \setvariable{div}{\xmlatt{#1}{class}}{#1} \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop\stopxmlsetups \startusableMPgraphic{GraphicConcurrent} begingroup; string legend; picture title; picture border; picture bg; numeric tw; numeric th; legend := \MPstring{concurrent}; title := nullpicture; border := nullpicture; bg := textext( "\strut " & legend ); tw := xpart lrcorner bg - xpart llcorner bg; th := ypart ulcorner bg - ypart llcorner bg; addto title also image( fill unitsquare xysized (tw + 8, th) shifted ulcorner multipars[1] shifted 28 right shifted 8 down withcolor white; draw textext.drt( legend ) shifted ulcorner multipars[1] shifted 32 right shifted 3 down; ); addto border also image( for i = 1 upto nofmultipars: draw llcorner multipars[i] -- ulcorner multipars[i] shifted 8 down .. ulcorner multipars[i] shifted 8 right -- urcorner multipars[i] withpen pencircle scaled 0.75 withcolor black; endfor; ); draw image( draw border; draw title; ); endgroup;\stopusableMPgraphic \definetextbackground[TextConcurrentFrame][ mp=GraphicConcurrent, frame=off, topoffset=1em, leftoffset=1em, location=paragraph, ] \definestartstop[concurrent][ before={% \blank[big]% LEGEND: \xmlatt{\getvariable{div}{concurrent}}{data-title}% \blank[big]% \setMPtext{concurrent}{\xmlatt{\getvariable{div}{concurrent}}{data-title}} \startTextConcurrentFrame}, after={\stopTextConcurrentFrame\blank[big]}, ] \starttext \xmlprocessbuffer{main}{demo}{}\stoptext % EOT If I change the following line: legend := \MPstring{concurrent}; to: legend := "some string"; Then the title "some string" is repeated. It seems like the value for \MPstring{concurrent} is being cached in some situations and ignored in others. Essentially, I'm trying to visually offset multiple paragraphs using a left-hand vertical rule along with a top horizontal rule that has a title. Each new "concurrent" section needs its own header that doesn't repeat. Is there a ConTeXt-way to accomplish this feat? Cheers! t.pdf Description: Adobe PDF document ___ 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: Map XML attributes to variables, dynamically
On 8/10/2023 10:50 AM, Hans Hagen via ntg-context wrote: On 8/10/2023 10:37 AM, Hans Hagen wrote: On 8/10/2023 10:14 AM, Thangalin wrote: Here's an MWE: attached the more final version - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - % follow up on mail discussion with T \startbuffer[demo] Text Goes Here Different Text Goes Here \stopbuffer \startxmlsetups xml:xhtml \xmlsetsetup{\xmldocument}{*}{-} \xmlsetsetup{\xmldocument}{html|body|div}{xml:*} \stopxmlsetups \xmlregistersetup{xml:xhtml} \startxmlsetups xml:html \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:body \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:div \setupstartstop [\xmlatt{#1}{class}] [title=\xmlatt{#1}{data-title}]% \start[\xmlatt{#1}{class}]% \xmlflush{#1} \stop \blank used wherever needed: \namedstartstopparameter{concurrent}{title} \blank \stopxmlsetups \definestartstop [concurrent] [before=\startsection[title={TITLE: \namedstartstopparameter{concurrent}{title}}], after=\stopsection]% \starttext \xmlprocessbuffer{main}{demo}{} \stoptext ___ 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: Map XML attributes to variables, dynamically
On 8/10/2023 10:37 AM, Hans Hagen wrote: On 8/10/2023 10:14 AM, Thangalin wrote: Here's an MWE: % SOT \startbuffer[demo] Text Goes Here Different Text Goes Here \stopbuffer \startxmlsetups xml:xhtml \xmlsetsetup{\xmldocument}{*}{-} \xmlsetsetup{\xmldocument}{html|body}{xml:*} \xmlsetsetup{\xmldocument}{div}{xml:*} \stopxmlsetups \xmlregistersetup{xml:xhtml} \startxmlsetups xml:html \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:body \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:div \setvariable{div}{\xmlatt{#1}{class}}{#1} \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop \stopxmlsetups \definestartstop[concurrent][ before={TITLE: \xmlatt{\getvariable {div} {concurrent} {title}}}, ] \starttext \xmlprocessbuffer{main}{demo}{} \stoptext % EOT It doesn't look like the variables are taking, regardless of whether {title} or {data-title} are used. \startxmlsetups xml:div \setvariable{div}{\xmlatt{#1}{class}}{#1} \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop \stopxmlsetups \definestartstop [concurrent] [before={TITLE: \xmlatt{\getvariable{div}{concurrent}}{data-title}}] -- watch the braces -- use data-title and not title Hans You can actually do this: \startxmlsetups xml:div \setupstartstop [\xmlatt{#1}{class}] [before={TITLE: \xmlatt{#1}{data-title}}]% \start[\xmlatt{#1}{class}]% \xmlflush{#1} \stop \stopxmlsetups \definestartstop [concurrent] and you then can also do \namedstartstopparameter{concurrent}{before} when needed, which save you the intermediate variable because it's already in before, so from that it's a natural step to \startxmlsetups xml:div \setupstartstop [\xmlatt{#1}{class}] [title=\xmlatt{#1}{data-title}, before={TITLE: \namedstartstopparameter{concurrent}{title}}]% \start[\xmlatt{#1}{class}]% \xmlflush{#1} \stop \stopxmlsetups \definestartstop [concurrent] and then with: \namedstartstopparameter{concurrent}{title} (i'll add this example to the test suite as demo) - 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 ___
[NTG-context] Re: Map XML attributes to variables, dynamically
On 8/10/2023 10:14 AM, Thangalin wrote: Here's an MWE: % SOT \startbuffer[demo] Text Goes Here Different Text Goes Here \stopbuffer \startxmlsetups xml:xhtml \xmlsetsetup{\xmldocument}{*}{-} \xmlsetsetup{\xmldocument}{html|body}{xml:*} \xmlsetsetup{\xmldocument}{div}{xml:*} \stopxmlsetups \xmlregistersetup{xml:xhtml} \startxmlsetups xml:html \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:body \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:div \setvariable{div}{\xmlatt{#1}{class}}{#1} \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop \stopxmlsetups \definestartstop[concurrent][ before={TITLE: \xmlatt{\getvariable {div} {concurrent} {title}}}, ] \starttext \xmlprocessbuffer{main}{demo}{} \stoptext % EOT It doesn't look like the variables are taking, regardless of whether {title} or {data-title} are used. \startxmlsetups xml:div \setvariable{div}{\xmlatt{#1}{class}}{#1} \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop \stopxmlsetups \definestartstop [concurrent] [before={TITLE: \xmlatt{\getvariable{div}{concurrent}}{data-title}}] -- watch the braces -- use data-title and not title 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 ___
[NTG-context] Re: Map XML attributes to variables, dynamically
Here's an MWE: % SOT \startbuffer[demo] Text Goes Here Different Text Goes Here \stopbuffer \startxmlsetups xml:xhtml \xmlsetsetup{\xmldocument}{*}{-} \xmlsetsetup{\xmldocument}{html|body}{xml:*} \xmlsetsetup{\xmldocument}{div}{xml:*} \stopxmlsetups \xmlregistersetup{xml:xhtml} \startxmlsetups xml:html \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:body \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:div \setvariable{div}{\xmlatt{#1}{class}}{#1} \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop \stopxmlsetups \definestartstop[concurrent][ before={TITLE: \xmlatt{\getvariable {div} {concurrent} {title}}}, ] \starttext \xmlprocessbuffer{main}{demo}{} \stoptext % EOT It doesn't look like the variables are taking, regardless of whether {title} or {data-title} are used. On Thu, Aug 10, 2023 at 12:44 AM Hans Hagen wrote: > On 8/10/2023 9:10 AM, Thangalin wrote: > > > Environments for the DIV element gets translated using: > > > > \startxmlsetups xml:div > > \setvariable {div} {\xmlatt{#1}{class}} {#1} > > >\start[\xmlatt{#1}{class}]\xmlflush{#1}\stop > > \stopxmlsetups > > \setMPtext{1}{\usermap[concurrent.title]} > > \setMPtext{2}{\usermap[concurrent.location]} > > \setMPtext{1}{% >\xmlatt {\getvariable {div} {concurrent} {title}% > } > > > I can verify the attribute values exist by exporting them to the > document: > something like that .. untested as no mwe > > 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 > > ___ > ___ 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] Map XML attributes to variables, dynamically
Hello! A Markdown document resembles the following: ::: {.concurrent title="Berth 5" location="San Diego"} Text Goes Here ::: ::: {.concurrent title="Road" location="Beale AFB"} Different Text Goes Here ::: The XHTML generated from that document resembles: Text Goes Here Different Text Goes Here Environments for the DIV element gets translated using: \startxmlsetups xml:div \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop \stopxmlsetups This creates "\startconcurrent" and "\stopconcurrent", which are later defined using "\definestartstop[concurrent]". I'd like to dynamically define all the data- attributes to make key/value pairs accessible from the document. For example, I have this: \definestartstop[concurrent][ before={% \blank[big]% \setMPtext{1}{Berth 5}% \startTextConcurrentFrame}, after={\stopTextConcurrentFrame\blank[big]}, ] I'd like to replace \setMPText calls with a reference to a dynamically created variable reference. For example: \setMPtext{1}{\usermap[concurrent.title]} \setMPtext{2}{\usermap[concurrent.location]} I can verify the attribute values exist by exporting them to the document: \startxmlsetups xml:div title:\xmlatt{#1}{data-title} location:\xmlatt{#1}{data-location} \start[\xmlatt{#1}{class}]\xmlflush{#1}\stop \stopxmlsetups How would you change the xml:div setup to create a map of its attributes as key/value pairs? 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 ___
[NTG-context] Parallel columns using start/stop setups
Two concurrent situations can happen, which I'd like to typeset as two parallel columns while keeping the overall page layout (i.e., headers, footers, margins, and such). current version: 2023.07.18 22:07 I'd like to find a way to set up start/stop environments, if possible, to come up with a general-purpose solution (i.e., the prose itself is not changed). Here are a few examples. In the first, a "concurrent" environment is created with two "timelines": % SOT \definestartstop[concurrent][ before={\startcolumns[n=2, align={verytolerant,stretch}, separator=rule]}, after=\stopcolumns, ] \definestartstop[timelinea][ after=\column, ] \definestartstop[timelineb][] \starttext \startconcurrent \starttimelinea \dorecurse{5}{\input ward} \stoptimelinea \starttimelineb \dorecurse{5}{\input knuth} \stoptimelineb \stopconcurrent \stoptext % EOT The ward and knuth texts end up in the same column because one is shorter than the other. Here's another attempt: % SOT \defineparagraphs[concurrent][n=2] \definestartstop[timelinea][ before=\concurrent, after=\concurrent, ] \definestartstop[timelineb][ before=\concurrent, ] \starttext \startconcurrent \starttimelinea \dorecurse{5}{\input ward} \stoptimelinea \starttimelineb \dorecurse{5}{\input knuth} \stoptimelineb \stopconcurrent \stoptext % EOT This loses much of the input text. Can this be accomplished using LMTX and what would be the best approach? Would this setupparagraphs, definecolumnset, synchronizestreams, or possibly incomplete/experimental functionality? 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 ___
Re: [NTG-context] Problem with \stoptabulate
Sorry everyone, ignore me, it doesn't work. (Got my test files mixed up - aargh!) > On 21 Mar 2023, at 11:06, Bruce Horrocks via ntg-context > wrote: > > > Thanks Julian - I tried a startstop environment originally but it didn't work. > > The answer turns out to be trivial - just needed to use \long\def for > \stoptabulate so the following appears to work: > > \def\startMyExample{\starttabulate[|r|c|l|p|]} > \long\def\stopMyExample{\stoptabulate} %% long def required here > \def\MyExampleItem#1#2#3{\NC #1 \NC \rightarrow \NC #2 \NC #3 \NC\NR} > > \starttext > Here are some examples... > > \startMyExample > \MyExampleItem{before}{after}{change before into after} > \MyExampleItem{straw}{gold}{Rumpelstiltskin} > \stoptabulate > > \stoptext > > >> On 21 Mar 2023, at 05:23, jbf via ntg-context wrote: >> >> Not sure if this helps, Bruce, but there is \definestartstop >> >> Julian >> >> On 21/3/23 10:34, Bruce Horrocks via ntg-context wrote: >>> I have a technical manual style document that requires a lot of examples to >>> be included. >>> >>> They can easily be typeset with a table so I thought I would save myself >>> some typing by defining macros for the various bits of a tabulate table. >>> Thus I have: >>> >>> \def\startMyExample{\starttabulate[|r|c|l|p|]} >>> \def\stopMyExample{\stoptabulate} >>> \def\MyExampleItem#1#2#3{\NC #1 \NC \rightarrow \NC #2 \NC #3 \NC\NR} >>> >>> \starttext >>> Here are some examples... >>> >>> \startMyExample >>> \MyExampleItem{before}{after}{change before into after} >>> \MyExampleItem{straw}{gold}{Rumpelstiltskin} >>> \stopMyExample >>> %\stoptabulate >>> >>> \stoptext >>> >>> The problem is that \stopMyExample doesn't work - the \stoptabulate isn't >>> recognised and I get an end of file reached error. If use a straight >>> \stoptabulate then it works as expected. That's fine but it would be nice, >>> from an aesthetic point of view, to have start & stop 'paired' commands in >>> the source. >>> >>> Presumably some sort of deep ConTeXt fu is going on - can anyone explain it >>> please? >>> >>> Regards, >>> — >>> Bruce Horrocks >>> Hampshire, UK > > — > 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 > ___ — 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 ___
Re: [NTG-context] Problem with \stoptabulate
Thanks Julian - I tried a startstop environment originally but it didn't work. The answer turns out to be trivial - just needed to use \long\def for \stoptabulate so the following appears to work: \def\startMyExample{\starttabulate[|r|c|l|p|]} \long\def\stopMyExample{\stoptabulate} %% long def required here \def\MyExampleItem#1#2#3{\NC #1 \NC \rightarrow \NC #2 \NC #3 \NC\NR} \starttext Here are some examples... \startMyExample \MyExampleItem{before}{after}{change before into after} \MyExampleItem{straw}{gold}{Rumpelstiltskin} \stoptabulate \stoptext > On 21 Mar 2023, at 05:23, jbf via ntg-context wrote: > > Not sure if this helps, Bruce, but there is \definestartstop > > Julian > > On 21/3/23 10:34, Bruce Horrocks via ntg-context wrote: >> I have a technical manual style document that requires a lot of examples to >> be included. >> >> They can easily be typeset with a table so I thought I would save myself >> some typing by defining macros for the various bits of a tabulate table. >> Thus I have: >> >> \def\startMyExample{\starttabulate[|r|c|l|p|]} >> \def\stopMyExample{\stoptabulate} >> \def\MyExampleItem#1#2#3{\NC #1 \NC \rightarrow \NC #2 \NC #3 \NC\NR} >> >> \starttext >> Here are some examples... >> >> \startMyExample >> \MyExampleItem{before}{after}{change before into after} >> \MyExampleItem{straw}{gold}{Rumpelstiltskin} >> \stopMyExample >> %\stoptabulate >> >> \stoptext >> >> The problem is that \stopMyExample doesn't work - the \stoptabulate isn't >> recognised and I get an end of file reached error. If use a straight >> \stoptabulate then it works as expected. That's fine but it would be nice, >> from an aesthetic point of view, to have start & stop 'paired' commands in >> the source. >> >> Presumably some sort of deep ConTeXt fu is going on - can anyone explain it >> please? >> >> Regards, >> — >> Bruce Horrocks >> Hampshire, UK — 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 ___
Re: [NTG-context] Problem with \stoptabulate
Not sure if this helps, Bruce, but there is \definestartstop Julian On 21/3/23 10:34, Bruce Horrocks via ntg-context wrote: I have a technical manual style document that requires a lot of examples to be included. They can easily be typeset with a table so I thought I would save myself some typing by defining macros for the various bits of a tabulate table. Thus I have: \def\startMyExample{\starttabulate[|r|c|l|p|]} \def\stopMyExample{\stoptabulate} \def\MyExampleItem#1#2#3{\NC #1 \NC \rightarrow \NC #2 \NC #3 \NC\NR} \starttext Here are some examples... \startMyExample \MyExampleItem{before}{after}{change before into after} \MyExampleItem{straw}{gold}{Rumpelstiltskin} \stopMyExample %\stoptabulate \stoptext The problem is that \stopMyExample doesn't work - the \stoptabulate isn't recognised and I get an end of file reached error. If use a straight \stoptabulate then it works as expected. That's fine but it would be nice, from an aesthetic point of view, to have start & stop 'paired' commands in the source. Presumably some sort of deep ConTeXt fu is going on - can anyone explain it please? Regards, — 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] Definestartstop, Narrower, and Blockquotej
I get a decidedly odd (or, at least, unexpected by me) result from this, based on the example on the contextgarden page for definestartstop: \starttext \defineblank[ExtractDistance][3pt] \definestartstop[Extract][ style=slanted, before={\blank[ExtractDistance] \setupnarrower[left=2in,right=1in] \startnarrower[left,right] \noindent}, after={\stopnarrower \blank[ExtractDistance] \indenting[next]}] %Now the following commands are available: \startExtract and \stopExtract \starttext The extract from Knuth \startExtract \input knuth \stopExtract \stoptext But now, blockquote is altered: \startblockquote \input lorem \stopblockquote But not narrower itself: \startnarrower \input lorem \stopnarrower \stoptext ___ 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 ___
Re: [NTG-context] Switching fonts changes framedtext justification
Works flawlessly, thank you! Here's a demo with left and right speech bubbles: \definefont [TextFontEmoji] [OpenSansEmoji] \startuseMPgraphic{TextBubble}{side} z1 = (0, 0) ; z2 = (OverlayWidth, 0) ; z3 = (OverlayWidth, OverlayHeight) ; z4 = (0, OverlayHeight) ; offset := 1 ; tail := 1 ; % Flip the tail's location and direction. if \MPvar{side} = 1: offset := 5 ; tail := -1 ; fi (offset/6)[x1,x2] = x8 + .25cm * tail = x7 + .25cm = x9 - .25cm ; y7 = 0cm ; y8 = -.5cm ; y9 = 0cm ; path p ; p = (z1--z7--z8--z9--z2--z3--z4--cycle) cornered .25cm ; draw p withpen pencircle scaled 0.75 ; setbounds currentpicture to OverlayBox ; \stopuseMPgraphic \defineframedtext[TextBubbleFrame][ style=TextFontEmoji, frame=off, width=.618\textwidth, autowidth=force, offset=.75em, after={\blank[2*big]}, ] % Receive text (left-facing). \defineoverlay[TextBubbleRxOverlay][\useMPgraphic{TextBubble}{side=0}] \defineframedtext[TextBubbleRxFrame][TextBubbleFrame][ background=TextBubbleRxOverlay, location=left, ] % Send text (right-facing). \defineoverlay[TextBubbleTxOverlay][\useMPgraphic{TextBubble}{side=1}] \defineframedtext[TextBubbleTxFrame][TextBubbleFrame][ background=TextBubbleTxOverlay, location=right, ] % Map XHTML class names to start/stop environments. \definestartstop[bubblerx][ before={\startnarrower\startTextBubbleRxFrame}, after={\stopTextBubbleRxFrame\stopnarrower}, ] \definestartstop[bubbletx][ before={\startnarrower\startTextBubbleTxFrame}, after={\stopTextBubbleTxFrame\stopnarrower}, ] \starttext \startbubblerx Welcome to the future, human 👽! \input zapf \stopbubblerx \startbubbletx Welcome to the future, human 👽! \input zapf \stopbubbletx \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] help with facing page image
> On 7 Mar 2022, at 03:49, jbf via ntg-context wrote: > > I wonder if someone can help me untangle the current little mess I seem to be > creating! > > Author wants an image on facing page to each of 10 chapters in the bodypart > of the document. Assume that everything else is working properly for this > document (double-sided etc.), but other than before chapter 1, I can't seem > to get my facing page image to appear where it should! > A simpler solution as you only have 10 chapters might be to 'manually' add the facing page rather than fiddle with the definition of \startchapter. For example: \definestartstop [ChapterPreface] [ before={\setups{ChapterPrefaceSetup}}, after={\page} ] % which gives you the commands \startChapterPreface ... \stopChapterPreface which I put immediately before \startchapter in the text. % Then use a setup to prepare the page for your image (you may only need \page[left] but also remember you need to stop page headers/footers etc from the previous chapter) \startsetups ChapterPrefaceSetup \page[left] \setupheader[state=empty] % etc \stopsetups % If the page setup is complicated then you might need another setup to clean it up afterwards. In this example there is just the "after=" in the definition. % Now you can print your images by using: \starttext \startChapterPreface \externalfigure[cow.pdf] \stopChapterPreface \startchapter[title={firstchapter}} ... \stopchapter \startChapterPreface \externalfigure[another_cow.pdf] \stopChapterPreface \startchapter{title={second chapter}] ... \stopchapter \stoptext Hope this helps. — 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Odd Font Behavior in startstop Group
Michael Urban via ntg-context schrieb am 05.02.2022 um 20:28: I am experiencing an odd behavior switching text styles in a defined startstop group ("blockquote"). I get different behavior depending on whether the switchtobodyfont in the startstop definition includes the dummy {\it } and {\bf } text. If they are not there, the italic and boldface switches in the second blockquote revert to the gyreschola body font of the main text; but this only happens if there is an earlier blockquote with no style changes. This is with: [...] Do I need a newer version of ConTeXt, or am I doing something wrong? Fonts in ConTeXt are always perilous, alas. For me, anyway. \definefallbackfamily[story][serif][notoserif][range={greekandcoptic,greekextended},force=yes] \definefontfamily[story][serif][TeX Gyre Schola] The following two font settings are wrong, you're passing the name of a typescript for the third argument while \definefontfamily expects the family name of a font. Even though the usage of the command is wrong you didn't notice it because as a fallback \definefontfamily uses the Latin Modern version of the requested style when no font was found. \definefontfamily[story][sans][modern] \definefontfamily[story][mono][modern] The correct settings for both settings are \definefontfamily [story] [sans] [Latin Modern Sans] \definefontfamily [story] [mono] [Latin Modern Mono] [features=none] with the "features=none" for the mono font to ensure no ligatures are formed. An alternative for \definefontfamily is to use \definetypeface and choose a predefined typescript for the Latin Modern family. You can either use \definetypeface [story] [ss] [sans] [modern] [default] \definetypeface [story] [ss] [mono] [modern] [default] which uses the 10pt optical size even for smaller and bigger sizes or you enable optical sizes with the following typescript \definetypeface [story] [ss] [sans] [modern-designsize] [default] \definetypeface [story] [ss] [mono] [modern-designsize] [default] \definefontfamily[story][mm][TeX Gyre Pagella Math] I recommend to load the math font with the provided typescript because they ensure existing patches (e.g. spacing corrections) for the selected font are applied. \definetypeface [story] [mm] [math] [pagella] [default] \setupbodyfont[story,11pt] \definestartstop[blockquote] [ before={ \blank \startnarrower \setupwhitespace[2pt] \setupindenting[none] \switchtobodyfont[termes]{\it }{\bf }% This is so weird. Put a comment marker after [termes] for a different result }, after={ \stopnarrower \blank \indenting[next]}, ]% ConTeXt already provides a blockquote-environment which can be configured to have the same style as your custom environment. \startsetups [blockquote:style] \switchtobodyfont[termes] \setupwhitespace[2pt] \stopsetups \setupdelimitedtext [blockquote] [spacebefore=big, style=\directsetup{blockquote:style}, indenting=none, indentnext=yes] Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Odd Font Behavior in startstop Group
On Sunday, February 6, 2022 12:58:06 AM IST Michael Urban via ntg-context wrote: > Do I need a newer version of ConTeXt, or am I doing something wrong? > Fonts in ConTeXt are always perilous, alas. For me, anyway. (pre)loading the typescripts 'fixes' the issue. \usebodyfont[termes] See below a modified version of your MWE: \definefallbackfamily[story][serif][notoserif] [range={greekandcoptic,greekextended},force=yes] \definefontfamily[story][serif][TeX Gyre Schola] \definefontfamily[story][sans][modern] \definefontfamily[story][mono][modern] \definefontfamily[story][mm][TeX Gyre Pagella Math] \setupbodyfont[story,11pt] \usebodyfont[termes] \definestartstop [blockquote] [before={\blank\startnarrower\setupwhitespace[2pt]\setupindenting[none]}, style={\switchtobodyfont[termes]}, after={\stopnarrower\blank\indenting[next]}] \starttext \input knuth \startblockquote \input knuth \stopblockquote this is normal text \par {\bf this is bold} \par {\it this is italics} \startblockquote this is normal text \par {\bf this is bold} \par {\it this is italics} \stopblockquote \stoptext Best, Sreeram ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Odd Font Behavior in startstop Group
I am experiencing an odd behavior switching text styles in a defined startstop group ("blockquote"). I get different behavior depending on whether the switchtobodyfont in the startstop definition includes the dummy {\it } and {\bf } text. If they are not there, the italic and boldface switches in the second blockquote revert to the gyreschola body font of the main text; but this only happens if there is an earlier blockquote with no style changes. This is with: $ context --version mtx-context | ConTeXt Process Management 1.03 mtx-context | mtx-context | main context file: /usr/local/texlive/texmf-local/tex/context/base/mkiv/context.mkiv mtx-context | current version: 2020.03.10 14:44 mtx-context | main context file: /usr/local/texlive/texmf-local/tex/context/base/mkiv/context.mkxl mtx-context | current version: 2020.03.10 14:44 Do I need a newer version of ConTeXt, or am I doing something wrong? Fonts in ConTeXt are always perilous, alas. For me, anyway. \definefallbackfamily[story][serif][notoserif][range={greekandcoptic,greekextended},force=yes] \definefontfamily[story][serif][TeX Gyre Schola] \definefontfamily[story][sans][modern] \definefontfamily[story][mono][modern] \definefontfamily[story][mm][TeX Gyre Pagella Math] \setupbodyfont[story,11pt] \definestartstop[blockquote] [ before={ \blank \startnarrower \setupwhitespace[2pt] \setupindenting[none] \switchtobodyfont[termes]{\it }{\bf }% This is so weird. Put a comment marker after [termes] for a different result }, after={ \stopnarrower \blank \indenting[next]}, ]% \starttext \chapter{Testing} \input ward \startblockquote \input knuth \stopblockquote \input zapf {\it This is what Italic letters look like.} {\bf And these are bold.} \startblockquote This is what it said, in {\it Italic} and {\bf bold} letters: \bgroup \it\noindent This is what Italic letters look like here. \egroup \bgroup \bf\noindent This is what Bold letters look like here. \egroup \stopblockquote \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Can modes be used for content control?
On Wed, 17 Nov 2021 10:56:46 -0700, Aditya Mahajan via ntg-context wrote: But you don't have to directly use the modes. The following will work: \definestartstop[abridged] % By default, don't show the unabridged text \definebuffer[unabridged][local=yes, nested=yes] \startmode[unabridged] % In the unabridged mode, show the abridged text \definestartstop[unabridged] \stopmode \starttext \startabridged \input knuth \startunabridged \startblockquote \input ward \stopblockquote \stopunabridged \input zapf \stopabridged Excellent, many thanks! Starting to get the feel of the matter now. Will put together some tests.. Best wishes -- Idris Samawi Hamid, Professor Department of Philosophy Colorado State University Fort Collins, CO 80512 ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Can modes be used for content control?
On 11/17/2021 6:56 PM, Aditya Mahajan via ntg-context wrote: On Tue, 16 Nov 2021, Idris Samawi Hamid ادريس سماوي حامد wrote: Hi Aditya, Many thanks; see below: On Tue, 16 Nov 2021 17:23:59 -0700, Aditya Mahajan via ntg-context wrote: On Tue, 16 Nov 2021, Idris Samawi Hamid ادريس سماوي حامد via ntg-context wrote: Dear gang, For creating/authoring content in ConTeXt: Can modes or the like be used for content control? For example, someone wants to write at least two versions of a book managed from a single file. So, e.g., we may have a) abridged content b) unabridged content - includes a) c) abridged content + translation d) unabridged content + translation [:] One can author and organize this in XML - pre-ConteXt - but perhaps one prefers to write in ConTeXt (take advantage of shortcuts etc.). So maybe \defineparagraphs[unabridged] \defineparagraphs[abridged] \defineparagraphs[translation] Then one authors the complete work in a single project, but you can produce a variety of versions, depending on the mode chosen: \definemode[unabridged] etc. Can one do this in context? Yes! This is what I do (for solutions in homework assignments): \definebuffer[solution][local=yes,nested=yes] \startmode[solution] \defineenumeration[solution][fancy setup...] \stopmode Then, in the main tex file: \startsolution ... \stopsolution By default, gives the version without solution. Compile with --mode=solution to get the version with solution. The same thing should work in your case by defining two modes: unabridged and translation. And then use --mode=unabridged,translate etc to get multiple modes. Here's a working sample: === % \definebuffer[unabridged] % \definebuffer[abridged] \setupwhitespace[big] \starttext \startmode[unabridged] \input knuth \startblockquote \input ward \stopblockquote % \startmode[abridged] % \input knuth % \stopmode \stopmode \startmode[abridged] \input knuth \stopmode % \startmode[abridged] % \input zapf % \stopmode \stoptext === Unfortunately - as pointed out on the wiki - modes cannot be nested. But you don't have to directly use the modes. The following will work: \definestartstop[abridged] % By default, don't show the unabridged text \definebuffer[unabridged][local=yes, nested=yes] \startmode[unabridged] % In the unabridged mode, show the abridged text \definestartstop[unabridged] \stopmode \starttext \startabridged \input knuth \startunabridged \startblockquote \input ward \stopblockquote \stopunabridged \input zapf \stopabridged Blocks are a better mechanism, but I still prefer modes here because I find the \beginblock ... \endblock syntax to be a bit awkward in a context document. it also depends on usage ... you can have blocks and delay them or reuse them or call them up later etc .. so you can code answers with questions and then call them up in an appendix - 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Can modes be used for content control?
On Tue, 16 Nov 2021, Idris Samawi Hamid ادريس سماوي حامد wrote: > Hi Aditya, > > Many thanks; see below: > > On Tue, 16 Nov 2021 17:23:59 -0700, Aditya Mahajan via ntg-context > wrote: > > > On Tue, 16 Nov 2021, Idris Samawi Hamid ادريس سماوي حامد via ntg-context > > wrote: > > > > > Dear gang, > > > > > > For creating/authoring content in ConTeXt: Can modes or the like be used > > > for content control? For example, someone wants to write at least two > > > versions of a book managed from a single file. So, e.g., we may have > > > > > > a) abridged content > > > b) unabridged content - includes a) > > > c) abridged content + translation > > > d) unabridged content + translation > > > [:] > > > > > > One can author and organize this in XML - pre-ConteXt - but perhaps one > > > prefers to write in ConTeXt (take advantage of shortcuts etc.). So maybe > > > > > > \defineparagraphs[unabridged] > > > \defineparagraphs[abridged] > > > \defineparagraphs[translation] > > > > > > Then one authors the complete work in a single project, but you can > > > produce a variety of versions, depending on the mode chosen: > > > > > > \definemode[unabridged] > > > etc. > > > > > > Can one do this in context? > > > > Yes! > > > > This is what I do (for solutions in homework assignments): > > > > \definebuffer[solution][local=yes,nested=yes] > > > > \startmode[solution] > > \defineenumeration[solution][fancy setup...] > > \stopmode > > > > Then, in the main tex file: > > > > > > \startsolution > > ... > > \stopsolution > > > > > > By default, gives the version without solution. Compile with --mode=solution > > to get the version with solution. The same thing should work in your case by > > defining two modes: unabridged and translation. And then use > > --mode=unabridged,translate etc to get multiple modes. > > Here's a working sample: > > === > % \definebuffer[unabridged] > % \definebuffer[abridged] > > \setupwhitespace[big] > > \starttext > \startmode[unabridged] > \input knuth > > \startblockquote > \input ward > \stopblockquote > > % \startmode[abridged] > % \input knuth > % \stopmode > \stopmode > > \startmode[abridged] > \input knuth > \stopmode > > % \startmode[abridged] > % \input zapf > % \stopmode > \stoptext > === > > Unfortunately - as pointed out on the wiki - modes cannot be nested. But you don't have to directly use the modes. The following will work: \definestartstop[abridged] % By default, don't show the unabridged text \definebuffer[unabridged][local=yes, nested=yes] \startmode[unabridged] % In the unabridged mode, show the abridged text \definestartstop[unabridged] \stopmode \starttext \startabridged \input knuth \startunabridged \startblockquote \input ward \stopblockquote \stopunabridged \input zapf \stopabridged Blocks are a better mechanism, but I still prefer modes here because I find the \beginblock ... \endblock syntax to be a bit awkward in a context document. Aditya___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Solved: Book setup with LHS-side quotes before chapters/parts, header/footer issues, TOC, etc.
Thanks to Wolfgang Schuster and Bruce Horrocks I have now a working solution. I ended up following Bruce’s suggestion of doing a left hand side (LHS) page opposite the first (RHS) chapter or part page differently than using after/before modifications of the \chapter and \part setups as I had been doing years ago (but that book did not have parts and was done in mkii) The modification of \chapter and \part setups with before= and after= never worked in the \component setup in LMTX. Creating a separate command to run immediately before a \chapter or \part, as suggested by Bruce, was simpler and and turned out to be more robust. So, this single file example also works when \components are used. The only issues I have now left are very minimal. In the table of contents, the abstract for a part has some extra whitespace above, which the chapter abstracts don’t have. But that is not really a problem. And getting the part title somewhere more centred on its page is also left as an issue for later. Example file. In a project/component setup: everything before the \starttext goes into the environment file, the rest in the product file. %%% %%% Sections that have a LHS preface with a quote %%% \startsetups SectionLHSPageSetup \page[left] \setupheader[state=empty] \start \startalignment[left,nothyphenated] \startnarrower[4*left] \tf\it \stopsetups \definestartstop [SectionLHSPage] [ before={\setups{SectionLHSPageSetup}}, after={\stopnarrower \stopalignment\stop}] \define[1]\SectionPrequote{\startSectionLHSPage #1\stopSectionLHSPage} %%% %%% part is managed here %%% \defineconversionset [part] [Romannumerals] [numbers] \setuplabeltext[en][partlabel=Part~] \setuphead [part] [sectionsegments=part, bodypartlabel=partlabel, appendixlabel=, sectionconversionset=part, page=yes, header=empty, footer=empty, placehead=yes] \definelist[parttext] \setuplist[parttext][margin=1.3em,pagecommand=\gobbleoneargument] \define[1]\PartAbstract{\writetolist[parttext]{}{\start\itx#1\stop}} %%% %%% chapter is managed here %%% \definetext [chapterfooter] % name [footer]% vertical location [pagenumber]% content \setuplabeltext[en][appendixchapterlabel=Appendix~] \setuphead [chapter] [page=yes, header=empty, bodypartlabel=, appendixlabel=appendixchapterlabel, footer=chapterfooter, sectionsegments=chapter, before={\blank[force,2*big]}, after={\blank[3*big]}] \definelist[chaptertext] \setuplist[chaptertext][margin=1.3em,pagecommand=\gobbleoneargument] \define[1]\ChapterAbstract{\writetolist[chaptertext]{}{\start\itx#1\stop}} \defineresetset [default] [0,0] [1] \setupcombinedlist [content] [list={part,parttext,chapter,chaptertext}] \starttext \startfrontmatter \completecontent \SectionPrequote{If you think good architecture is expensive, try bad architecture\crlf {\tf Brian Foote and Joseph Yoder}} \startchapter[title={One}] \dorecurse{7}{\input tufte \par \input knuth} \stopchapter \stopfrontmatter \startbodymatter \dorecurse{3}{ \SectionPrequote{The world is not \rationals, it is \reals\crlf {\tf Gerben Wierda}} \part{Title title title} \PartAbstract{This is a part abstract.} \dorecurse{2}{ \SectionPrequote{If you think good architecture is expensive, try bad architecture\crlf {\tf Brian Foote and Joseph Yoder}} \startchapter[title={Two}] \ChapterAbstract{This is a chapter abstract.} \dorecurse{5}{\input tufte \par \input knuth} \stopchapter } } \stopbodymatter \startappendices \defineresetset[default][0,1][1] %% reset , chapter, but not part \setuphead[part][number=no] \SectionPrequote{The world is not \rationals, it is \reals\crlf {\tf Gerben Wierda}} \part{Title title title} \PartAbstract{This is a part abstract.} \dorecurse{2}{ \SectionPrequote{If you think good architecture is expensive, try bad architecture\crlf {\tf Brian Foote and Joseph Yoder}} \startchapter[title={Two}] \ChapterAbstract{This is a chapter abstract.} \dorecurse{5}{\input tufte \par \input knuth} \stopchapter } \stopappendices \stoptext In a component setup, a part component may look like this: \startcomponent p_partone \product prd_book \project project_book \SectionPrequote{The world is not \rationals, it is \reals\crlf {\tf Gerben Wierda}} \part{Title title title} \PartAbstract{This is a part abstract for a normal part.} \component c_chapter \component c_chapter \stopcomponent and a chapter component like this: \startcomponent c_chapter \product prd_book \project project_book \starttext \SectionPrequote{If you think good architecture is expensive, try bad architecture\crlf {\tf Brian Foote and Joseph Yoder}} \chapter{An Inconvenient Truth} \ChapterAbstract{This is a chapter abstract.} \setupindenting[next] \placeinitial I{\kap{\bf n the half}} century or so that human kind has had IT, the IT sector has increasingly wrestled with the fact that IT projects often fail in one
Re: [NTG-context] TikZ in buffers: My struggle with \definestartstop
Thanks Hans! That works great. I understand it all and it is working in my book, so even better. I did not know you could \typsetbuffer[a,b,c]. I will be using that again. In case anyone finds this in the future, trying to solve a similar issue, my final version is below, including my \marginTikZ command. Gavin \setuppapersize[letter] \setuplayout[ backspace=90pt, % Horizontal layout leftmargin=36pt, % 1/2 in leftmargindistance=9pt, % 3/8 in width=306pt, % 4 1/4 in rightmargindistance=27pt, % 3/8 in rightmargin=144pt, % 2 in ] \startbuffer[starttikz] \usemodule[tikz]% Lots of setup can go here! \startTEXpage \starttikzpicture \stopbuffer \startbuffer[stoptikz] \stoptikzpicture \stopTEXpage \stopbuffer \define[2]\marginTikZ{ \startplacefigure[location=margin, reference=fig:#1, title={#2}] \typesetbuffer[starttikz,#1,stoptikz] \stopplacefigure } \starttext \startbuffer[BlueCircle] \draw[thick,blue] (0,0) circle (2cm)node{Ti{\it k}Z!}; \stopbuffer \marginTikZ{BlueCircle}{Ti{\it k}Z drew this blue circle\dots slowly.} \startbuffer[RedCircle] \draw[thick,red] (0,0) circle (2cm)node{Ti{\it k}Z!}; \stopbuffer \marginTikZ{RedCircle}{Ti{\it k}Z drew this red circle\dots slowly.} Take a look at the blue circle in \in{figure}[fig:BlueCircle] and the red circle in \in{figure}[fig:RedCircle] \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] TikZ in buffers: My struggle with \definestartstop
On 7/8/2021 7:55 PM, Gavin wrote: Hello, I have a book containing many margin figures drawn with TikZ, which is very slow. By putting the TikZ code in a buffer and using \typesetbuffer only altered TikZ code is executed on each run, saving tremendous time. This means the code containsmany constructions like this, which I would like to simplify: \startbuffer[BlueCircle] \usemodule[tikz]% Actually this is many lines to load environments, define fonts, etc. \startTEXpage \starttikzpicture \draw[thick,blue] (0,0) circle (1.5cm)node{Ti{\it k}Z!}; \stoptikzpicture \stopTEXpage \stopbuffer \placefigure[margin][fig:BlueCircle] % location, label {Ti{\it k}Z drew this blue circle\dots slowly.} % caption text {\hbox{\typesetbuffer[BlueCircle]}} My plan is to replace the first block with a new \startTikZbuffer…\stop…, which is defined using \definestartstop to include all of the stuff around the TikZ code. Then I will replace the second block with a new command, \marginTikZ, which has three arguments: a label, a caption, and the TikZ code. This command will use my new \startTikZbuffer to create the buffer before using \placefigure to put it in the margin. Only the \marginTikZ command will appear throughout the book. I’d like to do this in two steps because I will also have \textTikZ and \wideTikZ for diagrams in the text block and diagrams spanning the full page with. All of these can use the same \startTikZbuffer. However, I cannot get the \startTikZbuffer to work as expected. I put a small working example below. Removing the “This method works” block and adding the "This method fails” block causes the an error that I cannot decipher: "Use of \page_fitting_start doesn't match its definition." Any advice is appreciated. Maybe I am doing this entirely the wrong way. A couple notes: I considered using \definebuffer, but this doesn’t allow me to create named buffers, which seems like a deal breaker. I considered using \definefloat, but it don’t allow me include before and after commands, as far as I can tell. \starttext \input knuth \startbuffer[starttikz] \usemodule[tikz] \startTEXpage \starttikzpicture \stopbuffer \startbuffer[stoptikz] \stoptikzpicture \stopTEXpage \stopbuffer \protected\def\MyTikzBuffer#1{\typesetbuffer[starttikz,BlueCircle,stoptikz]} \startbuffer[BlueCircle] \draw [thick,blue] (0,0) circle (1.5cm)node{Ti{\it k}Z!}; \stopbuffer \startplacefigure[location=margin,reference=fig:BlueCircle,title={Example A.}] \typesetbuffer[starttikz,BlueCircle,stoptikz] \stopplacefigure \startplacefigure[location=margin,reference=fig:BlueCircle,title={Example B.}] \MyTikzBuffer{BlueCircle} \stopplacefigure \input knuth \stoptext - 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] TikZ in buffers: My struggle with \definestartstop
Hello, I have a book containing many margin figures drawn with TikZ, which is very slow. By putting the TikZ code in a buffer and using \typesetbuffer only altered TikZ code is executed on each run, saving tremendous time. This means the code containsmany constructions like this, which I would like to simplify: \startbuffer[BlueCircle] \usemodule[tikz]% Actually this is many lines to load environments, define fonts, etc. \startTEXpage \starttikzpicture \draw[thick,blue] (0,0) circle (1.5cm)node{Ti{\it k}Z!}; \stoptikzpicture \stopTEXpage \stopbuffer \placefigure[margin][fig:BlueCircle] % location, label {Ti{\it k}Z drew this blue circle\dots slowly.}% caption text {\hbox{\typesetbuffer[BlueCircle]}} My plan is to replace the first block with a new \startTikZbuffer…\stop…, which is defined using \definestartstop to include all of the stuff around the TikZ code. Then I will replace the second block with a new command, \marginTikZ, which has three arguments: a label, a caption, and the TikZ code. This command will use my new \startTikZbuffer to create the buffer before using \placefigure to put it in the margin. Only the \marginTikZ command will appear throughout the book. I’d like to do this in two steps because I will also have \textTikZ and \wideTikZ for diagrams in the text block and diagrams spanning the full page with. All of these can use the same \startTikZbuffer. However, I cannot get the \startTikZbuffer to work as expected. I put a small working example below. Removing the “This method works” block and adding the "This method fails” block causes the an error that I cannot decipher: "Use of \page_fitting_start doesn't match its definition." Any advice is appreciated. Maybe I am doing this entirely the wrong way. A couple notes: I considered using \definebuffer, but this doesn’t allow me to create named buffers, which seems like a deal breaker. I considered using \definefloat, but it don’t allow me include before and after commands, as far as I can tell. ConTeXt version: 2021.07.06 18:49 Same results with MkIV and LMTX. Thanks! Gavin \setuppapersize[letter] \setuplayout[ backspace=90pt, % Horizontal layout leftmargin=36pt, % 1/2 in leftmargindistance=9pt, % 3/8 in width=306pt, % 4 1/4 in rightmargindistance=27pt, % 3/8 in rightmargin=144pt, % 2 in ] \definestartstop[TikZbuffer][ before={\startbuffer[\tikzname]\usemodule[tikz]\startTEXpage\starttikzpicture}, after={\stoptikzpicture\stopTEXpage\stopbuffer}, ] \starttext \input knuth % This method works: \startbuffer[BlueCircle] \usemodule[tikz] \startTEXpage \starttikzpicture \draw[thick,blue] (0,0) circle (1.5cm)node{Ti{\it k}Z!}; \stoptikzpicture \stopTEXpage \stopbuffer % This method fails: %\def\tikzname{BlueCircle} %\startTikZbuffer % \draw[thick,blue] (0,0) circle (1.5cm)node{Ti{\it k}Z!}; %\stopTikZbuffer \placefigure[margin][fig:BlueCircle] % location, label {Ti{\it k}Z drew this blue circle\dots slowly.}% caption text {\hbox{\typesetbuffer[BlueCircle]}} \input knuth \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] color conversion eats note
Steffen Wolfrum schrieb am 27.06.2021 um 15:55: uncommenting the following \setupcolors changes magenta to black when running luatex. but when running luametatex the footnote is crippled to «error»: \starttext \definestartstop[UL][color=magenta] %\setupcolors[state=stop,conversion=never]% <- bw with lualatex, but «error» with luametatex? \input ward \footnote{foo foo \startUL{}foo\stopUL{} foo foo foo foo foo \startUL{}foo\stopUL{} error} \stoptext Don't use extra stuff (e.g. footnotes) when they aren't necessary to reproduce the error. %\setupcolors[cmyk=no,rgb=no,conversion=no] %\setupcolors[state=stop,conversion=no] \setcolormodel[none] \starttext \dorecurse{20}{\convertnumber{word}{#1} }% \color[red]{not a number} \dorecurse{20}{\convertnumber{word}{#1} } \stoptext Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] color conversion eats note
uncommenting the following \setupcolors changes magenta to black when running luatex. but when running luametatex the footnote is crippled to «error»: \starttext \definestartstop[UL][color=magenta] %\setupcolors[state=stop,conversion=never]% <- bw with lualatex, but «error» with luametatex? \input ward \footnote{foo foo \startUL{}foo\stopUL{} foo foo foo foo foo \startUL{}foo\stopUL{} error} \stoptext Steffen ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Calculating Best Box Width?
On 6/9/2021 7:30 PM, Michael Urban wrote: I am not especially facile with ConTeXt, and it has been years since I did anything complex with TeX, so I am hoping someone could help me with this. The following is probably not great code, but it shows what I am trying to do. The problems are twofold: a benign problem is that I get underfull hbox errors (\dontcomplain notwithstanding). But the other problem is that with text of a certain size, the final line is much shorter than the others. Is there some clever way to repeatedly typeset the text (e.g., put it in an hbox, measure the width, and repeatedly try .5, .333, .25 of the hbox width until it fits in the allocated space)? How to go about this? \defineblank[EpigraphDistance][3pt] \definestartstop[EpigraphText][ style=\ssa, before={\blank[EpigraphDistance] \setupnarrower[left=.25\textwidth,right=0pt] \startnarrower[left,right] \setupalign[flushright,nothyphenated,broad] \dontcomplain \noindent}, after={\stopalignment\stopnarrower \blank[EpigraphDistance] \indenting[next]}] \long\def\epigraph#1#2#3{% \startEpigraphText #1 \par \stopEpigraphText \ifx\hfuzz#3\hfuzz \rightaligned{\ssa\sl --- #2} \else \rightaligned{\ssa\sl --- #2, \tf\ssa\symbol[leftquote]#3\symbol[rightquote]} \fi } \starttext Testing epigraph \epigraph{% para \quotation{My birthday-present!} he whispered to himself, as he had often done in the endless dark days. \quotation{That's what we\unknown} }{J.R.R. Tolkien}{The Hobbit} That was an epigraph. \stoptext I assume that when you see some trickery that you can do the rest yourself. \starttext First we typeset the box ad one line and then flush it in a vertical box (paragraph). We can of course also typeset each time. When we're okay with the fit (naturalwidth == less than max width) we quit. We can assume that spaces have enough stretch to deal with the close fit. \protected\def\makeitfit#1#2#3% {\begingroup \hsize#1\relax \setbox\scratchboxone\hbox\bgroup#3\egroup \doloop {% \setbox\scratchboxtwo\vbox\bgroup\unhcopy\scratchboxone\egroup \scratchdimenone\boxlinenw\scratchboxtwo\boxlines\scratchboxtwo \scratchdimentwo\boxlinewd\scratchboxtwo\boxlines\scratchboxtwo \ifdim\scratchdimenone<\scratchdimentwo \advance\hsize-#2\relax \else \unhbox\scratchboxone \exitloop \fi }% \endgroup} This variant is more neat as it returns the to b eused width. It doesn't flush the content. \protected\def\guessbestwidth#1#2#3% no \protected when no \dimexpr {\beginlocalcontrol \begingroup \hsize#1\relax \setbox\scratchboxone\hbox\bgroup#3\egroup \doloop {% \setbox\scratchboxtwo\vbox\bgroup\unhcopy\scratchboxone\egroup \scratchcounter\boxlines\scratchboxtwo % n of lines \scratchdimenone\boxlinenw\scratchboxtwo\scratchcounter \scratchdimentwo\boxlinewd\scratchboxtwo\scratchcounter \ifdim\scratchdimenone<\scratchdimentwo \advance\hsize-#2\relax \else \exitloop \fi }% % \normalexpanded{\endgroup\endlocalcontrol\the\hsize}} \normalexpanded{\endgroup\endlocalcontrol\dimexpr\the\hsize\relax}} Here are some tests: \makeitfit{10cm}{1mm}{\input{ward}} \hsize \guessbestwidth{10cm}{1mm}{\input{ward}} \input{ward} \the\guessbestwidth{10cm}{1mm}{\input{ward}} \stoptext The mechanisms used are relatively simple: - good old tex primitives - few scratch registers - a loop that we quit - the boxlines mechanism discussed in some manual (i admit that i already had forgotten about it) - and in the last example some local processing magic which makes sure that all these calculations are unseen One can then of course try to make it more compact: \protected\def\guessbestwidth#1#2#3% {\beginlocalcontrol \begingroup \hsize#1\relax \setbox\scratchboxone\hbox\bgroup#3\egroup \doloop {% \setbox\scratchboxtwo\vbox\bgroup\unhcopy\scratchboxone\egroup \scratchcounter\boxlines\scratchboxtwo \ifdim\boxlinenw\scratchboxtwo\scratchcounter<\boxlinewd\scratchboxtwo\scratchcounter \advance\hsize-#2\relax \else \exitloop \fi }% \normalexpanded{\endgroup\endlocalcontrol\dimexpr\the\hsize\relax}} And of course you now need to wikify it. 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://
[NTG-context] Calculating Best Box Width?
I am not especially facile with ConTeXt, and it has been years since I did anything complex with TeX, so I am hoping someone could help me with this. The following is probably not great code, but it shows what I am trying to do. The problems are twofold: a benign problem is that I get underfull hbox errors (\dontcomplain notwithstanding). But the other problem is that with text of a certain size, the final line is much shorter than the others. Is there some clever way to repeatedly typeset the text (e.g., put it in an hbox, measure the width, and repeatedly try .5, .333, .25 of the hbox width until it fits in the allocated space)? How to go about this? \defineblank[EpigraphDistance][3pt] \definestartstop[EpigraphText][ style=\ssa, before={\blank[EpigraphDistance] \setupnarrower[left=.25\textwidth,right=0pt] \startnarrower[left,right] \setupalign[flushright,nothyphenated,broad] \dontcomplain \noindent}, after={\stopalignment\stopnarrower \blank[EpigraphDistance] \indenting[next]}] \long\def\epigraph#1#2#3{% \startEpigraphText #1 \par \stopEpigraphText \ifx\hfuzz#3\hfuzz \rightaligned{\ssa\sl --- #2} \else \rightaligned{\ssa\sl --- #2, \tf\ssa\symbol[leftquote]#3\symbol[rightquote]} \fi } \starttext Testing epigraph \epigraph{% para \quotation{My birthday-present!} he whispered to himself, as he had often done in the endless dark days. \quotation{That's what we\unknown} }{J.R.R. Tolkien}{The Hobbit} That was an epigraph. \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Making text disappear depending on mode
On 2/4/2021 3:59 PM, Axel Kielhorn wrote: Hello, I’m currently writing an article for „Die TeXnische Komödie“ and discovers that my code is not working. When the mode „change“ is set, the text should appear with a red line on the side, that part is working. When the mode is not set, it should disappear, that’s the part that is not working. My idea was to put the text into a buffer and ignore it, that didn’t work. % !TEX TS-program = ConTeXt (LuaTeX 1.0.9) % !TEX encoding = UTF-8 Unicode %\enablemode[change] % Paragraph removed \definestartstop[ChangePR][ before={\doifmodeelse{change} {\startsidebar[rulecolor=red]} {}}, after={\doifmodeelse{change} {\stopsidebar} {}}, ] % Paragraph removed %\definestartstop[ChangePR][ % before={\doifmodeelse{change} %{\startsidebar[rulecolor=red]} %{\startbuffer[ignore]}}, % after={\doifmodeelse{change} %{\stopsidebar} %{\stopbuffer}}, % ] \starttext Before \startChangePR \input knuth \stopChangePR After \stoptext \defineblock [ChangePR] \defineblock [ChangeRP] \setupblock [ChangePR] [before={\startsidebar[rulecolor=red]}, after={\blank[overlay]\stopsidebar}] \setupblock [ChangeRP] [before={\startsidebar[rulecolor=green]}, after={\blank[overlay]\stopsidebar}] % \hideblocks[ChangePR] \keepblocks[ChangePR] % \keepblocks[ChangePR,ChangeRP] \enablemode[wipe] \doifelsemode {wipe} { \definebuffer[ChangePP] } { \definestartstop [ChangePP] [before={\startsidebar[rulecolor=red]}, after={\blank[overlay]\stopsidebar}] } \starttext Before \beginChangePR \input knuth \endChangePR Inbetween \beginChangeRP \input knuth \endChangeRP After \startChangePP \input knuth \stopChangePP Done \stoptext - 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Making text disappear depending on mode
Hello, I’m currently writing an article for „Die TeXnische Komödie“ and discovers that my code is not working. When the mode „change“ is set, the text should appear with a red line on the side, that part is working. When the mode is not set, it should disappear, that’s the part that is not working. My idea was to put the text into a buffer and ignore it, that didn’t work. % !TEX TS-program = ConTeXt (LuaTeX 1.0.9) % !TEX encoding = UTF-8 Unicode %\enablemode[change] % Paragraph removed \definestartstop[ChangePR][ before={\doifmodeelse{change} {\startsidebar[rulecolor=red]} {}}, after={\doifmodeelse{change} {\stopsidebar} {}}, ] % Paragraph removed %\definestartstop[ChangePR][ % before={\doifmodeelse{change} %{\startsidebar[rulecolor=red]} %{\startbuffer[ignore]}}, % after={\doifmodeelse{change} %{\stopsidebar} %{\stopbuffer}}, % ] \starttext Before \startChangePR \input knuth \stopChangePR After \stoptext Greetings Axel ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] [startstop]
Like this? \usemodule[annotation] %Thanks for this module, Wolfgang \defineannotation[zzz] \define[2]\AnnotationCommand {\doifelse{\placeannotationtitle}{}{}{\hrule\bf\placeannotationtitle\par}#2\blank[10mm]} \setupannotation[zzz] [alternative=command, command=\AnnotationCommand, text=] \starttext \startzzz{a} Hola \stopzzz \startzzz{b} Chao \stopzzz \startzzz Hola de nuevo \stopzzz \stoptext Jairo El vie, 22 de ene. de 2021 a la(s) 12:51, Floris van Manen (v...@klankschap.nl) escribió: > I'd like to create a start/stop command with a parameter > > > > \startzzz[a] > one two three > \stopzzz > > \startzzz[b] > one two three > \stopzzz > > > How do i define/pass the tag parameter in the definition? > This does not work (obviously) > > \definestartstop[zzz][ > before={\hrule\bf tag\blank}, > after={\blank[10mm]} > ] > > > I cannot find it in the documentation > > .F > > ___ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / > http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > > ___ > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] [startstop]
I'd like to create a start/stop command with a parameter \startzzz[a] one two three \stopzzz \startzzz[b] one two three \stopzzz How do i define/pass the tag parameter in the definition? This does not work (obviously) \definestartstop[zzz][ before={\hrule\bf tag\blank}, after={\blank[10mm]} ] I cannot find it in the documentation .F ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Typesetting without interpunctation and interword space
On 11/22/2020 11:55 AM, juh wrote: Hi all, I want to typeset poems in a special way. I want to achieve something like Capitalis quadrata which was used by the Romans in stone. See here: https://de.wikipedia.org/wiki/Capitalis_quadrata#/media/Datei:Capitalis_Quadrata1.png One stream of letters without spaces and interpunctation. The input files I have to use are written as usually: This is a line, that is a line, and a third line as well I want to typeset the whole poem in the Capitalis quadrata way: THISISALINETHATIS ALINEANDATHIRDLIN EASWELL The whole poem forms one block of upper case letters. No interword spacing. I guess that I can make my hands dirty with lua and write a filter that skips all interpunctation and spaces, converts the whole text to lower- or uppercase and after this use a special font with nice upper case letters. But I need a special hyphenation that hyphenates just were the line ends. Any hints how to achieve this? An lmtx solution: \starttext \definestartstop [CapitalisQuadrata] [setups=foo] \startsetups foo \pushoverloadmode % needed when protection enabled \def\obeyedline{\removepunctuation\endgraf} \obeylines \nospacing \WORD \popoverloadmode \stopsetups \start[CapitalisQuadrata] This is a line, that is a line, and a third line as well \stop \stoptext - 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Typing efficiency
Hi, Sounds like a job for the blocks mechanism more so than buffers: \defineblock[entext] \defineblock[nltext] \defineselector [language] [max=2,n=1] \startmode[en] \setupselector[language][n=1] \keepblocks[entext] \stopmode \startmode[nl] \setupselector[language][n=2] \keepblocks[nltext] \stopmode \starttext \startsection[title=\select{language}{English title}{Dutch title}] \beginentext This is English text. \endentext \beginnltext This is Dutch text. \endnltext \stopsection \stoptext Best wishes, Taco > On 4 Sep 2020, at 14:02, Jan Willem Flamma wrote: > > Dear list member, > > Following up from: > https://www.mail-archive.com/ntg-context@ntg.nl/msg94719.html > > The below MWE works but how can I avoid having to type > \startmode[en] > \getbuffer[en] > \stopmode > \startmode[nl] > \getbuffer[nl] > \stopmode > > after every block of text? > > I tried to define a new start/stop pair as follows: > \definestartstop[Bufen][ > before={\startmode[en] > \startbuffer[en]}, > after={\stopbuffer > \getbuffer[en] > \stopmode}] > > but that fails. > > No doubt a clever solution exists that minimizes the typing. > > Kind regards, > Jan Willem > > > === > \setupinteraction[state=start] > > %\enablemode[nl] > \enablemode[en] > > \defineselector [language] [max=2,n=1] > \startmode[en] > \setupselector[language][n=1] > \stopmode > \startmode[nl] > \setupselector[language][n=2] > \stopmode > > \starttext > > \startsection[title=\select{language}{English title}{Dutch title}] > > \startbuffer[en] > This is English text. > \stopmode > \stopbuffer > \startbuffer[nl] > This is Dutch text. > \stopbuffer > > \startmode[en] > \getbuffer[en] > \stopmode > \startmode[nl] > \getbuffer[nl] > \stopmode > > \stopsection > > \stoptext > > > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ Taco Hoekwater Elvenkind BV ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Typing efficiency
Dear list member, Following up from:https://www.mail-archive.com/ntg-context@ntg.nl/msg94719.html The below MWE works but how can I avoid having to type \startmode[en] \getbuffer[en] \stopmode \startmode[nl] \getbuffer[nl] \stopmode after every block of text? I tried to define a new start/stop pair as follows:\definestartstop[Bufen][ before={\startmode[en] \startbuffer[en]}, after={\stopbuffer \getbuffer[en] \stopmode}] but that fails. No doubt a clever solution exists that minimizes the typing. Kind regards,Jan Willem ===\setupinteraction[state=start] %\enablemode[nl]\enablemode[en] \defineselector [language] [max=2,n=1]\startmode[en] \setupselector[language][n=1]\stopmode\startmode[nl] \setupselector[language][n=2]\stopmode \starttext \startsection[title=\select{language}{English title}{Dutch title}] \startbuffer[en] This is English text. \stopmode \stopbuffer \startbuffer[nl] This is Dutch text. \stopbuffer \startmode[en] \getbuffer[en] \stopmode \startmode[nl] \getbuffer[nl] \stopmode \stopsection \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] start/stop executed conditionally on mode ?
Dear list, I have seen the use of blocks mechanism with and without a start/stop combination. It is not clear to me in which cases it is required to also include a start/stop combination in this mechanism. \beginquestion\startquestionQuestion A\stopquestion\endquestion\beginanswer\startanswerAnswer A\stopanswer\endanswer Regards,Jan Willem Flamma From: Hans HagenSent: Tuesday, 9 June 2020 09:37To: mailing list for ConTeXt users; Fabrice LSubject: Re: [NTG-context] start/stop executed conditionally on mode ? On 6/8/2020 9:53 PM, Fabrice L wrote:> > >> Le 7 juin 2020 à 23:19, Aditya Mahajan >> > a écrit :>> >> On Sun, 7 Jun 2020, Fabrice L wrote:>> >>> Dear List,>>> >>> I would like to insert a page using (ideally) start/stop >>> instructions. The problem is that this page should be inserted only >>> in a certain mode. Consulting the mailing list, I thought the >>> following code was working, but it’s not ! The code is executed in >>> the mode as expected, but the following instructions ("Some other >>> text... » in the exemple) is not typeset.>>> >>> Here is a minimal (not working!) example:>>> >>> % >>> \unexpanded\def\StartQuestionsList{>>> \startmode[ClassRoom] \page[yes] Here are some questions: \blank>>> }>>> \unexpanded\def\StopQuestionsList{>>> \page[yes] \stopmode>>> }>>> \definestartstop[Questions][>>> before=\StartQuestionsList,>>> after=\StopQuestionsList>>> ]>>> >>> >>> \startQuestions>>> Question A….>>> Question B….>>> \stopQuestions>>> >>> Some other text...>>> % One of the oldest mechanism available ... blocks: \enablemode[classroom] % comment this \defineblock[Question] \doifmode {classroom} { \keepblocks[Question]} \starttext Text A \beginQuestion Question A…. \endQuestion Text B \beginQuestion Question B…. \endQuestion \page \doifnotmode {classroom} { \useblocks[Question] } \stoptext - 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 / http://www.ntg.nl/mailman/listinfo/ntg-contextwebpage : http://www.pragma-ade.nl / http://context.aanhet.netarchive : https://bitbucket.org/phg/context-mirror/commits/wiki : http://contextgarden.net___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] start/stop executed conditionally on mode ?
> Le 9 juin 2020 à 03:37, Hans Hagen a écrit : > > On 6/8/2020 9:53 PM, Fabrice L wrote: >>> Le 7 juin 2020 à 23:19, Aditya Mahajan >> <mailto:adit...@umich.edu>> a écrit : >>> >>> On Sun, 7 Jun 2020, Fabrice L wrote: >>> >>>> Dear List, >>>> >>>> I would like to insert a page using (ideally) start/stop instructions. The >>>> problem is that this page should be inserted only in a certain mode. >>>> Consulting the mailing list, I thought the following code was working, but >>>> it’s not ! The code is executed in the mode as expected, but the following >>>> instructions ("Some other text... » in the exemple) is not typeset. >>>> >>>> Here is a minimal (not working!) example: >>>> >>>> % >>>> \unexpanded\def\StartQuestionsList{ >>>> \startmode[ClassRoom] \page[yes] Here are some questions: \blank >>>> } >>>> \unexpanded\def\StopQuestionsList{ >>>> \page[yes] \stopmode >>>> } >>>> \definestartstop[Questions][ >>>> before=\StartQuestionsList, >>>> after=\StopQuestionsList >>>> ] >>>> >>>> >>>> \startQuestions >>>> Question A…. >>>> Question B…. >>>> \stopQuestions >>>> >>>> Some other text... >>>> % > One of the oldest mechanism available ... blocks: > > \enablemode[classroom] % comment this > > \defineblock[Question] > > \doifmode {classroom} { >\keepblocks[Question] > } > > \starttext > >Text A > >\beginQuestion >Question A…. >\endQuestion > >Text B > >\beginQuestion >Question B…. >\endQuestion > >\page > >\doifnotmode {classroom} { >\useblocks[Question] >} > > \stoptext You are right of course... In fact I already use blocks, for another purpose, but I did not think about this solution because I needed a lot of formatting (these blocks should occupy whole page, different background color…), but blocks can adapt to my current need (I have try this morning) using the \setupblock[][before=..,after=…] command. And there is a bonus; I can « collect » these blocks and put them all together at the end of my courses notes, this is perfect. ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] start/stop executed conditionally on mode ?
On 6/8/2020 9:53 PM, Fabrice L wrote: Le 7 juin 2020 à 23:19, Aditya Mahajan <mailto:adit...@umich.edu>> a écrit : On Sun, 7 Jun 2020, Fabrice L wrote: Dear List, I would like to insert a page using (ideally) start/stop instructions. The problem is that this page should be inserted only in a certain mode. Consulting the mailing list, I thought the following code was working, but it’s not ! The code is executed in the mode as expected, but the following instructions ("Some other text... » in the exemple) is not typeset. Here is a minimal (not working!) example: % \unexpanded\def\StartQuestionsList{ \startmode[ClassRoom] \page[yes] Here are some questions: \blank } \unexpanded\def\StopQuestionsList{ \page[yes] \stopmode } \definestartstop[Questions][ before=\StartQuestionsList, after=\StopQuestionsList ] \startQuestions Question A…. Question B…. \stopQuestions Some other text... % One of the oldest mechanism available ... blocks: \enablemode[classroom] % comment this \defineblock[Question] \doifmode {classroom} { \keepblocks[Question] } \starttext Text A \beginQuestion Question A…. \endQuestion Text B \beginQuestion Question B…. \endQuestion \page \doifnotmode {classroom} { \useblocks[Question] } \stoptext - 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] start/stop executed conditionally on mode ?
Fabrice L schrieb am 08.06.2020 um 21:53: Thanks to Aditya, I have succeeded, but it was not trivial for me. So, in case somebody someday would need a detailed solution, here is a minimal example, and an explanation. A buffer « Questions » is defined. If in « ClassRoom » mode, a start/stop « Questions » is also defined. So when ConTeXt encounters the \startQuestions / \stopQuestions, if the « ClassRoom » mode is enabled, the buffer is processed (with some format if needed - framed here for the example), and if the mode « ClassRoom » is disabled, then nothing is process. You can add as many \startQuestions / \stopQuestions you wish. Let me give a better explanation. The line \definebuffer [Questions] serves two purposes: 1. It create a Questions environment (\startQuestions ... \stopQuestions) 2. I gobbles the content of the environment. When you enable the ClassRoom mode ConTeXt encounters this line \definestartstop [Questions] which redefines the Questions environment which uses now the startstop-mechanism but the previously created environment buffer based environment no longer exists. The reason for this redefinition is to keep the content of the environment in the document although you could have used other methods to achieve the same as \definestartstop. Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] start/stop executed conditionally on mode ?
> Le 7 juin 2020 à 23:19, Aditya Mahajan a écrit : > > On Sun, 7 Jun 2020, Fabrice L wrote: > >> Dear List, >> >> I would like to insert a page using (ideally) start/stop instructions. The >> problem is that this page should be inserted only in a certain mode. >> Consulting the mailing list, I thought the following code was working, but >> it’s not ! The code is executed in the mode as expected, but the following >> instructions ("Some other text... » in the exemple) is not typeset. >> >> Here is a minimal (not working!) example: >> >> % >> \unexpanded\def\StartQuestionsList{ >> \startmode[ClassRoom] \page[yes] Here are some questions: \blank >> } >> \unexpanded\def\StopQuestionsList{ >> \page[yes] \stopmode >> } >> \definestartstop[Questions][ >> before=\StartQuestionsList, >> after=\StopQuestionsList >> ] >> >> >> \startQuestions >> Question A…. >> Question B…. >> \stopQuestions >> >> Some other text... >> % >> >> >> So to be clear, I would like the result in the « ClassRoom » mode to be: >> % >> Here are some questions: >> >> Question A…. >> Question B…. >> >> Some other text... >> % >> >> Otherwise to be: >> % >> Some other text... >> % > > If you only set `ClassRoom` mode at compile time (rather than setting and > unsetting it the middle of the document), then you can do: > > \definebuffer[Questions] > > \startmode[ClassRoom] > \define\StopQuestionsList {...} > > \definestartstop[Questions][...] > \stopmode > Thanks to Aditya, I have succeeded, but it was not trivial for me. So, in case somebody someday would need a detailed solution, here is a minimal example, and an explanation. A buffer « Questions » is defined. If in « ClassRoom » mode, a start/stop « Questions » is also defined. So when ConTeXt encounters the \startQuestions / \stopQuestions, if the « ClassRoom » mode is enabled, the buffer is processed (with some format if needed - framed here for the example), and if the mode « ClassRoom » is disabled, then nothing is process. You can add as many \startQuestions / \stopQuestions you wish. % -- \definebuffer[Questions] \enablemode[ClassRoom] % Try "On / Off » to process "\startQuestions / \stopQuestions » or not. \startmode[ClassRoom] \definestartstop[Questions][before={\startframedtext\red},after={\stopframedtext\blue}] \stopmode \starttext Before... \startQuestions The content of the buffer ! \stopQuestions After... \stoptext % -- Thanks Aditya ! Fabrice. > Aditya___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / > http://www.ntg.nl/mailman/listinfo/ntg-context > <http://www.ntg.nl/mailman/listinfo/ntg-context> > webpage : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / > http://context.aanhet.net <http://context.aanhet.net/> > archive : https://bitbucket.org/phg/context-mirror/commits/ > <https://bitbucket.org/phg/context-mirror/commits/> > wiki : http://contextgarden.net <http://contextgarden.net/> > ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] start/stop executed conditionally on mode ?
Dear Aditya, > Le 7 juin 2020 à 23:19, Aditya Mahajan a écrit : > > On Sun, 7 Jun 2020, Fabrice L wrote: > >> Dear List, >> >> I would like to insert a page using (ideally) start/stop instructions. The >> problem is that this page should be inserted only in a certain mode. >> Consulting the mailing list, I thought the following code was working, but >> it’s not ! The code is executed in the mode as expected, but the following >> instructions ("Some other text... » in the exemple) is not typeset. >> >> Here is a minimal (not working!) example: >> >> % >> \unexpanded\def\StartQuestionsList{ >> \startmode[ClassRoom] \page[yes] Here are some questions: \blank >> } >> \unexpanded\def\StopQuestionsList{ >> \page[yes] \stopmode >> } >> \definestartstop[Questions][ >> before=\StartQuestionsList, >> after=\StopQuestionsList >> ] >> >> >> \startQuestions >> Question A…. >> Question B…. >> \stopQuestions >> >> Some other text... >> % >> >> >> So to be clear, I would like the result in the « ClassRoom » mode to be: >> % >> Here are some questions: >> >> Question A…. >> Question B…. >> >> Some other text... >> % >> >> Otherwise to be: >> % >> Some other text... >> % > > If you only set `ClassRoom` mode at compile time (rather than setting and > unsetting it the middle of the document), then you can do: > > \definebuffer[Questions] > > \startmode[ClassRoom] > \define\StopQuestionsList {...} > > \definestartstop[Questions][...] > \stopmode > Thanks for your answer, I will try that. Fabrice, ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] start/stop executed conditionally on mode ?
On Sun, 7 Jun 2020, Fabrice L wrote: Dear List, I would like to insert a page using (ideally) start/stop instructions. The problem is that this page should be inserted only in a certain mode. Consulting the mailing list, I thought the following code was working, but it’s not ! The code is executed in the mode as expected, but the following instructions ("Some other text... » in the exemple) is not typeset. Here is a minimal (not working!) example: % \unexpanded\def\StartQuestionsList{ \startmode[ClassRoom] \page[yes] Here are some questions: \blank } \unexpanded\def\StopQuestionsList{ \page[yes] \stopmode } \definestartstop[Questions][ before=\StartQuestionsList, after=\StopQuestionsList ] \startQuestions Question A…. Question B…. \stopQuestions Some other text... % So to be clear, I would like the result in the « ClassRoom » mode to be: % Here are some questions: Question A…. Question B…. Some other text... % Otherwise to be: % Some other text... % If you only set `ClassRoom` mode at compile time (rather than setting and unsetting it the middle of the document), then you can do: \definebuffer[Questions] \startmode[ClassRoom] \define\StopQuestionsList {...} \definestartstop[Questions][...] \stopmode Aditya___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] start/stop executed conditionally on mode ?
Dear List, I would like to insert a page using (ideally) start/stop instructions. The problem is that this page should be inserted only in a certain mode. Consulting the mailing list, I thought the following code was working, but it’s not ! The code is executed in the mode as expected, but the following instructions ("Some other text... » in the exemple) is not typeset. Here is a minimal (not working!) example: % \unexpanded\def\StartQuestionsList{ \startmode[ClassRoom] \page[yes] Here are some questions: \blank } \unexpanded\def\StopQuestionsList{ \page[yes] \stopmode } \definestartstop[Questions][ before=\StartQuestionsList, after=\StopQuestionsList ] \startQuestions Question A…. Question B…. \stopQuestions Some other text... % So to be clear, I would like the result in the « ClassRoom » mode to be: % Here are some questions: Question A…. Question B…. Some other text... % Otherwise to be: % Some other text... % Thanks for any help ! Fabrice.___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Styling of included buffers or files
Marco Patzer schrieb am 17.05.2020 um 19:04: On Sun, 17 May 2020 18:16:13 +0200 "Jan U. Hasecke" wrote: I am currently writing a text where I want to include text snippets either by including files or including buffers. What is the best way to style all these included buffers? I know that I can do something like this: \startcolumns \getbuffer[Muenchen] \stopcolumns Or do something with \defineparagraph Is it somehow possible to apply styles to all buffers that gets included via \getbuffer by defining a special getbuffer-style? \setupbuffer has before and after keys which can be used. Example: \setupbuffer [before=\blank\blackrule\startnarrower\BufferStyle, after=\stopnarrower\blackrule\blank] [...] \definehighlight [BufferStyle] [style=smallitalic, color=blue] Use the highlight-environment or create a new startstop-environment to apply style and color settings to the buffer. \definestartstop [BufferStyle] [style=smallitalic, color=blue] \setupbuffer [before={... \startBufferStyle ...}, after={... \stopBufferStyle ...}] Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Capitalize first word of first line within \startlines
On 3/4/2020 5:09 PM, Thangalin wrote: Looking to uppercase the first word of a poem: \setupindenting[yes, 0.75em] \setupinitial[ state=start, n=2, distance=\zeropoint, ] % This does not appear to work? \definealternativestyle[PoemFirstWord][\WORD][] \definefirstline[PoemFirstLine][ alternative=word, style=PoemFirstWord, n=1, ] \definestartstop[poem][ before={\startlines \setfirstline[PoemFirstLine] \placeinitial}, after={\stoplines}, ] \setuplines[indenting=odd] \starttext \startpoem Some say the world will end in fire, Some say in ice. From what I've tasted of desire I hold with those who favor fire. But if it had to perish twice, I think I know enough of hate To say that for destruction ice Is also great, And would suffice. \stoppoem \stoptext Any ideas why the first word is not capitalized? because it is not applied to that stretch ... but i will send you something to play with ... kind of braindead trivial piece of code but it needs testing a bit 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Capitalize first word of first line within \startlines
Looking to uppercase the first word of a poem: \setupindenting[yes, 0.75em] \setupinitial[ state=start, n=2, distance=\zeropoint, ] % This does not appear to work? \definealternativestyle[PoemFirstWord][\WORD][] \definefirstline[PoemFirstLine][ alternative=word, style=PoemFirstWord, n=1, ] \definestartstop[poem][ before={\startlines \setfirstline[PoemFirstLine] \placeinitial}, after={\stoplines}, ] \setuplines[indenting=odd] \starttext \startpoem Some say the world will end in fire, Some say in ice. From what I've tasted of desire I hold with those who favor fire. But if it had to perish twice, I think I know enough of hate To say that for destruction ice Is also great, And would suffice. \stoppoem \stoptext Any ideas why the first word is not capitalized? Thank you! ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Fwd: Re: Spurious newlines at beginning of startstop pair
Hans, thanks for your answer. But two questions: First: Am I right to assume that the important part is `\GetPar`. The rest is syntactic sugar to make to code more ConTeXt-like, right? Second: For some reasons I have not received your message. It wasn't in the Spam folder and I usually receive mails from the list. Any ideas? Are there some known problems? Best, Denis On 11/27/2019 2:17 PM, Denis Maier wrote: > Hi, > I have this file: > > -- > \newdimen\cslhangindent > \cslhangindent=1.5em > \definestartstop [cslreferences] [ > before={% > \setupnarrower[left=\cslhangindent] > \startnarrower[left]% > \setupindenting[-\leftskip,yes,first]% > \indentation% >}, >after=\stopnarrower, > ] > > \starttext > > \section{Some title} > > \input ward > > \section{References} > > \startcslreferences > > \dorecurse{10}{\dorecurse{10}{This is a Test. }\par} > > \stopcslreferences > > \stoptext > -- > > The skip after the `\section{References}` is bigger than after > `\section{Some title}`. Why is that? If I delete the empty line after > `\startcslreferences`, the skips are identical. > > Is there a way to take care of this through `\definestartstop`? you need to get rid of the empty line \definenarrower[whatever][left=1.5em] \definestartstop [cslreferences] [before={% \startwhatever[left] \setupindenting[-\leftskip,yes,first] \indentation \GetPar }, after=\stopwhatever] \showframe \starttext \section{Some title} \input ward \section{References} \startcslreferences \dorecurse{10}{\dorecurse{10}{This is a Test. }\par} \stopcslreferences \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Spurious newlines at beginning of startstop pair
On 11/27/2019 2:17 PM, Denis Maier wrote: Hi, I have this file: -- \newdimen\cslhangindent \cslhangindent=1.5em \definestartstop [cslreferences] [ before={% \setupnarrower[left=\cslhangindent] \startnarrower[left]% \setupindenting[-\leftskip,yes,first]% \indentation% }, after=\stopnarrower, ] \starttext \section{Some title} \input ward \section{References} \startcslreferences \dorecurse{10}{\dorecurse{10}{This is a Test. }\par} \stopcslreferences \stoptext -- The skip after the `\section{References}` is bigger than after `\section{Some title}`. Why is that? If I delete the empty line after `\startcslreferences`, the skips are identical. Is there a way to take care of this through `\definestartstop`? you need to get rid of the empty line \definenarrower[whatever][left=1.5em] \definestartstop [cslreferences] [before={% \startwhatever[left] \setupindenting[-\leftskip,yes,first] \indentation \GetPar }, after=\stopwhatever] \showframe \starttext \section{Some title} \input ward \section{References} \startcslreferences \dorecurse{10}{\dorecurse{10}{This is a Test. }\par} \stopcslreferences \stoptext - 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Spurious newlines at beginning of startstop pair
Hi, I have this file: -- \newdimen\cslhangindent \cslhangindent=1.5em \definestartstop [cslreferences] [ before={% \setupnarrower[left=\cslhangindent] \startnarrower[left]% \setupindenting[-\leftskip,yes,first]% \indentation% }, after=\stopnarrower, ] \starttext \section{Some title} \input ward \section{References} \startcslreferences \dorecurse{10}{\dorecurse{10}{This is a Test. }\par} \stopcslreferences \stoptext -- The skip after the `\section{References}` is bigger than after `\section{Some title}`. Why is that? If I delete the empty line after `\startcslreferences`, the skips are identical. Is there a way to take care of this through `\definestartstop`? Best, Denis ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Documentation of change / Evolving documents
> Am 29.09.2019 um 10:50 schrieb Wolfgang Schuster > : > > Henning Hraban Ramm schrieb am 29.09.2019 um 10:36: >>> Am 2019-09-29 um 08:59 schrieb Axel Kielhorn : >>> >>> But I would prefer to write >>> >>> \startChangeA{V. 2.0} >>> Mit den Befehlen \type{\Changea}, \type{\Changer} und \type{\Changec} >>> werden hinzugefügte, gelöschte oder geänderte Satzteile gekennzeichnet. Der >>> Befehl \type{\Changec} hat zwei Argumente: alter Text und neuer Text. >>> \stopChangeA >> See https://wiki.contextgarden.net/Command/definestartstop > > Another option: https://wiki.contextgarden.net/Command/startuserdata > > Wolfgang Thanks! I’ll look into next weekend. Greetings Axel ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Documentation of change / Evolving documents
Henning Hraban Ramm schrieb am 29.09.2019 um 10:36: Am 2019-09-29 um 08:59 schrieb Axel Kielhorn : But I would prefer to write \startChangeA{V. 2.0} Mit den Befehlen \type{\Changea}, \type{\Changer} und \type{\Changec} werden hinzugefügte, gelöschte oder geänderte Satzteile gekennzeichnet. Der Befehl \type{\Changec} hat zwei Argumente: alter Text und neuer Text. \stopChangeA See https://wiki.contextgarden.net/Command/definestartstop Another option: https://wiki.contextgarden.net/Command/startuserdata Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Documentation of change / Evolving documents
> Am 2019-09-29 um 08:59 schrieb Axel Kielhorn : > > But I would prefer to write > > \startChangeA{V. 2.0} > Mit den Befehlen \type{\Changea}, \type{\Changer} und \type{\Changec} werden > hinzugefügte, gelöschte oder geänderte Satzteile gekennzeichnet. Der Befehl > \type{\Changec} hat zwei Argumente: alter Text und neuer Text. > \stopChangeA See https://wiki.contextgarden.net/Command/definestartstop > Or maybe: > \startChangeA[version={V. 2.0}] This could help: https://wiki.contextgarden.net/System_Macros/Handling_Arguments > Once this is fixed I’d like to translate it to english and put it into the > Wiki. Looking forward to it. Grüßlinge, Hraban --- https://www.fiee.net http://wiki.contextgarden.net https://www.dreiviertelhaus.de GPG Key ID 1C9B22FD ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] option=tex in setuptyping causes the background to be drawn twice
Hans Hagen schrieb am 28.04.2019 um 18:42: On 4/28/2019 5:56 PM, Aditya Mahajan wrote: On Sun, 28 Apr 2019, Wolfgang Schuster wrote: The problem are these settings in buff-imp-default.mkiv: \setupstartstop [DefaultSnippet] [\c!before={\typingparameter\c!before}, \c!after={\typingparameter\c!after}, \c!style={\typingparameter\c!style}] In buff-imp-tex.mkiv these values are inherited: \definestartstop [TexSnippet] [DefaultSnippet] So I can fix this locally by resetting before and after keys for TexSnippet. What would be a good fix in buff-imp-default? I assume Wolfgang will cook up a patch ... The best solution is to remove the values from all three keys because for now each of them is applies twice (even the style). \setuptyping [before=\hairline, after=\hairline, style=\tt\em] \starttext \starttyping[option=tex] \donothing \stoptyping \stoptext Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] option=tex in setuptyping causes the background to be drawn twice
On 4/28/2019 5:56 PM, Aditya Mahajan wrote: On Sun, 28 Apr 2019, Wolfgang Schuster wrote: The problem are these settings in buff-imp-default.mkiv: \setupstartstop [DefaultSnippet] [\c!before={\typingparameter\c!before}, \c!after={\typingparameter\c!after}, \c!style={\typingparameter\c!style}] In buff-imp-tex.mkiv these values are inherited: \definestartstop [TexSnippet] [DefaultSnippet] So I can fix this locally by resetting before and after keys for TexSnippet. What would be a good fix in buff-imp-default? I assume Wolfgang will cook up a 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] option=tex in setuptyping causes the background to be drawn twice
On Sun, 28 Apr 2019, Wolfgang Schuster wrote: The problem are these settings in buff-imp-default.mkiv: \setupstartstop [DefaultSnippet] [\c!before={\typingparameter\c!before}, \c!after={\typingparameter\c!after}, \c!style={\typingparameter\c!style}] In buff-imp-tex.mkiv these values are inherited: \definestartstop [TexSnippet] [DefaultSnippet] So I can fix this locally by resetting before and after keys for TexSnippet. What would be a good fix in buff-imp-default? Aditya___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] option=tex in setuptyping causes the background to be drawn twice
The problem are these settings in buff-imp-default.mkiv: \setupstartstop [DefaultSnippet] [\c!before={\typingparameter\c!before}, \c!after={\typingparameter\c!after}, \c!style={\typingparameter\c!style}] In buff-imp-tex.mkiv these values are inherited: \definestartstop [TexSnippet] [DefaultSnippet] Wolfgang Aditya Mahajan schrieb am 28.04.2019 um 17:00: Hi, The following minimal example: \definetextbackground [EXAMPLE] [ location=paragraph, rulethickness=1pt, leftoffset=5em, rightoffset=0mm, ] \setuptyping[option=tex, before=\startEXAMPLE, after=\stopEXAMPLE] \starttext \starttyping A = B + C \stoptyping \stoptext gives the attached output where the background is repeated twice. The bug is present with both mkiv and ltmx. Aditya ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] problems with "pagecomment"
I see. Thanks for the explanation. So the following works: --- \unprotect \setvalue{startNotes}% {\global\settrue\c_page_comment_enabled \grabbufferdatadirect{pagecomment}{startpagecomment}{stopNotes}} \protect \def\stopNotes{} -- What does the second argument to \grabbufferdatadirect mean? Nothing changes when I modify that. The point of redefining the pagecomment environment for me was to style it a bit: add \righttoleft at the beginning, and surround the content in startstopnarrower. How can I inject prepend/append to a buffer's content? The solution I can think of is to use a different buffer "pagecomment_internal" in the above definition, and then build buffer "pagecomment" using that. Thanks, ~MHB On Sat, Apr 27, 2019 at 1:24 AM Wolfgang Schuster < wolfgang.schuster.li...@gmail.com> wrote: > Mohammad Hossein Bateni schrieb am 27.04.2019 um 05:16: > > Hi, > > > > Look at the following MWE: > > > > > > \setuppagecomment[state=start,location=right] > > %\definestartstop[Notes] > > %[before=\startpagecomment,after=\stoppagecomment] > > \def\startNotes{\startpagecomment} > > \def\stopNotes{\stoppagecomment} > > > > \starttext > > \input knuth > > \startpagecomment > > Hello > > \stoppagecomment > > \page > > \input tufte > > \startNotes > > Testing > > \stopNotes > > \stoptext > > > > > > This snippet does not compile. Page comments work when I use the > > commands \startpagecomment and \stoppagecomment directly (like in the > > first page), but when I invoke via macros (as in the second page), > > ConTeXt produces errors. > > > > What is wrong there? > > The pagecomment environment uses the buffer mechanism to store the content > of the environment but a limitation of buffers is that you can't put > them into other > commands because the scan for a certain delimiter, e.g. \stoppagecomment. > > Wolfgang > > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] problems with "pagecomment"
Mohammad Hossein Bateni schrieb am 27.04.2019 um 05:16: Hi, Look at the following MWE: \setuppagecomment[state=start,location=right] %\definestartstop[Notes] %[before=\startpagecomment,after=\stoppagecomment] \def\startNotes{\startpagecomment} \def\stopNotes{\stoppagecomment} \starttext \input knuth \startpagecomment Hello \stoppagecomment \page \input tufte \startNotes Testing \stopNotes \stoptext This snippet does not compile. Page comments work when I use the commands \startpagecomment and \stoppagecomment directly (like in the first page), but when I invoke via macros (as in the second page), ConTeXt produces errors. What is wrong there? The pagecomment environment uses the buffer mechanism to store the content of the environment but a limitation of buffers is that you can't put them into other commands because the scan for a certain delimiter, e.g. \stoppagecomment. Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] problems with "pagecomment"
Hi, Look at the following MWE: \setuppagecomment[state=start,location=right] %\definestartstop[Notes] %[before=\startpagecomment,after=\stoppagecomment] \def\startNotes{\startpagecomment} \def\stopNotes{\stoppagecomment} \starttext \input knuth \startpagecomment Hello \stoppagecomment \page \input tufte \startNotes Testing \stopNotes \stoptext This snippet does not compile. Page comments work when I use the commands \startpagecomment and \stoppagecomment directly (like in the first page), but when I invoke via macros (as in the second page), ConTeXt produces errors. What is wrong there? Thanks! ~MHB ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] \definetextbackground does not fill tables within
Floating objects (\placetable, \placefigure, ... and footnotes, etc.) do not inherit the text background, for indeed, imagine that it floats to another location. Here, you use location=force, so one might expect it to use the text background... In fact, side floats, location=left and location=right, do get the text background color, so there is a *kludge* possible there: \startplacetable [location=right] ... \stopplacetable \flushsidefloats ... (incomplete example) Alan P.S. Hans: maybe location=force ought to work similarly with respect to text backgrounds as location=left or location=right. On Mon, 13 Aug 2018 21:37:45 + dxpubl...@posteo.net wrote: > Hi, > > I have simple document which I define my \definetextbackground: > \startteoria and \stopteoria (see below). When I use it and put table > within, the table does not get filled with color. Any solution? > > Thanks in advance, > Xavier > > \definecolor[teoriacolor][lightgray] > > \definetextbackground[bteoria][ > frame=off, > location=paragraph, > background=color, > backgroundcolor=teoriacolor, % fins aquí provat: > http://www.mail-archive.com/ntg-context%40ntg.nl/msg78014.html > %width=broad, > %corner=round, > %radius=5ex, > leftoffset=10pt,rightoffset=10pt, > topoffset=10pt,bottomoffset=10pt > %offset=-5pt > ] > > \definestartstop[teoria][before={\begingroup\blank[big]\testpage[2]\starttextbackground[bteoria]},after={\stoptextbackground\blank[big]\endgroup}] > > > \starttext > > \startteoria > \input tufte > > \placetable[force,none][taula:teoria:1]{Recopilació de dades. Conceptes > fonamentals}{ > \starttable[|l|p(.6\textwidth)|] > \NC Població: \NC Són {\em tots} els elements que són objecte d'estudi > \NC \FR > \HL > \NC Mostra: \NC La {\em part} de la població de la qual recopilem les > dades i estudiam. > > Poques vegades coincideix amb la població. Una bona mostra necessita ser > suficientment heterogènia per a poder representar la població. > > Es pot determinar el tamany mínim necessari per a què una mostra tengui > la representativitat necessària amb un marge d'error. \NC \MR > \HL > \NC Grandària: \NC {\em Nombre} d'elements de la població o de la > mostra. \NC \MR > \HL > \NC Variable estadística: \NC Cadascuna de les {\em propietats} o > característiques que volem estudiar d'un conjunt de dades. \NC \LR > \stoptable} > > Existeixen dues branques de l'estadística: > > \startitemize > \item L'{\em estadística descriptiva}, que simplement descriu i > interpreta les característiques del grup d'estudi, tal com és. Fa un > {\em retrat} de la població. > \item L'{\em estadística inferencial} que intenta fer prediccions i > justificar que la mostra s'adeqüa a la població, de manera que les > característiques de la mostra siguin les mateixes que les > característiques de la població. > \stopitemize > > > \stopteoria > > \stoptext > > > > > Result (see pdf file) ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] \definetextbackground does not fill tables within
Hi, I have simple document which I define my \definetextbackground: \startteoria and \stopteoria (see below). When I use it and put table within, the table does not get filled with color. Any solution? Thanks in advance, Xavier \definecolor[teoriacolor][lightgray] \definetextbackground[bteoria][ frame=off, location=paragraph, background=color, backgroundcolor=teoriacolor, % fins aquí provat: http://www.mail-archive.com/ntg-context%40ntg.nl/msg78014.html %width=broad, %corner=round, %radius=5ex, leftoffset=10pt,rightoffset=10pt, topoffset=10pt,bottomoffset=10pt %offset=-5pt ] \definestartstop[teoria][before={\begingroup\blank[big]\testpage[2]\starttextbackground[bteoria]},after={\stoptextbackground\blank[big]\endgroup}] \starttext \startteoria \input tufte \placetable[force,none][taula:teoria:1]{Recopilació de dades. Conceptes fonamentals}{ \starttable[|l|p(.6\textwidth)|] \NC Població: \NC Són {\em tots} els elements que són objecte d'estudi \NC \FR \HL \NC Mostra: \NC La {\em part} de la població de la qual recopilem les dades i estudiam. Poques vegades coincideix amb la població. Una bona mostra necessita ser suficientment heterogènia per a poder representar la població. Es pot determinar el tamany mínim necessari per a què una mostra tengui la representativitat necessària amb un marge d'error. \NC \MR \HL \NC Grandària: \NC {\em Nombre} d'elements de la població o de la mostra. \NC \MR \HL \NC Variable estadística: \NC Cadascuna de les {\em propietats} o característiques que volem estudiar d'un conjunt de dades. \NC \LR \stoptable} Existeixen dues branques de l'estadística: \startitemize \item L'{\em estadística descriptiva}, que simplement descriu i interpreta les característiques del grup d'estudi, tal com és. Fa un {\em retrat} de la població. \item L'{\em estadística inferencial} que intenta fer prediccions i justificar que la mostra s'adeqüa a la població, de manera que les característiques de la mostra siguin les mateixes que les característiques de la població. \stopitemize \stopteoria \stoptext Result (see pdf file) prova.pdf Description: Adobe PDF document ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] tex error Argument of \titlecmd has an extra }
ywidth ; v := \overlayheight ; hdelta := .15u ; vdelta := .03v ; drawoptions (withpen pensquare scaled 2pt) ; randomseed := day + time*epsilon ; show time * epsilon ; for i :=1 upto 128 : ccc := (uniformdeviate (1), uniformdeviate (1), uniformdeviate (1)) ; p := (uniformdeviate (u), uniformdeviate (v)) ; h0 := (xpart (p) - uniformdeviate (hdelta) , ypart (p)) ; h1 := (xpart (p) + uniformdeviate (hdelta) , ypart (p)) ; v0 := (xpart (p), ypart (p) - uniformdeviate (vdelta)) ; v1 := (xpart (p), ypart (p) + uniformdeviate (vdelta)) ; draw h0 -- h1 withcolor transparent(1,.4,ccc) ; draw v0 -- v1 withcolor transparent(1,.4,ccc) ; endfor ; \stopuseMPgraphic \startsetups BG \defineoverlay[bg][\useMPgraphic{crux}] \setupbackgrounds[page][background=bg] \stopsetups \definestartstop[BG][commands=\setups{BG}] % misc \setupheadtext[en][pubs=] \setupheadtext[en][content=] \setupheadtext[en][index=] \setuplabeltext[en][figure=??\;] \setuplabeltext[en][table=??\;] \setupcaptions[style=\tfx,headstyle=\normal] % \setupmathematics[autopunctuation=no] % ascii \asciimode \stopenvironment the project-openstack-source-analysis.tex file content is below: \environment env-plain \starttext \startBG \setuplayout[normal] \startstandardmakeup \midaligned{\CruxFramed{\ssd OpenStack}} \vfil \stopstandardmakeup \stopBG \startfrontmatter \setuplayout[reset] \setuppagenumbering[conversion=romannumerals] \setuppagenumber[number=1] \completecontent %\completelistoffigures %\completelistoftables \stopfrontmatter \startbodymatter \setuppagenumbering[conversion=numbers] \setuppagenumber[number=1] \setups{Text} \component component-01-openstack-outline \component component-02-openstack-nova \page \setups{Empty} \stopbodymatter \startappendices \setups{Appendices} \title{} \placepublications \title{} \placeindex \page \setups{Empty} \stopappendices \startbackmatter \stopbackmatter \stoptext___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Spurious space in \definestartstop
Henri Menke <mailto:henrime...@gmail.com> 30. Januar 2018 um 21:46 On Tue, 2018-01-30 at 21:24 +0100, Wolfgang Schuster wrote: Henri Menke 30. Januar 2018 um 21:12 On Tue, 2018-01-30 at 11:58 +0100, Hans Hagen wrote: On 1/30/2018 11:34 AM, Henri Menke wrote: On 01/30/2018 09:17 PM, Hans Hagen wrote: On 1/30/2018 2:54 AM, Henri Menke wrote: Dear list, the title says it all. Please add \ignorespaces in a place you deem appropriate. MWE is below. sometimes you will also add \removeuwantedspaces in the stop I'm confused. Does that mean there is going to be a fix? no, why should there be? spaces are never ignored after the last [...] that is checked for unless a command has an explicit \ignorespaces I'm not convinced. Both "before" and "commands" see a \relax and therefore \ignorespaces is dropped. I can put \removeunwantedspaces there but that deletes the space before \start. The \framed command correctly drops the space after the options. --- \definestartstop [spurious space a] [before=\ignorespaces, after=\removeunwantedspaces] \definestartstop [spurious space b] [before=\removeunwantedspaces, after=\removeunwantedspaces] \starttext Hello Foo Bar World Hello \start[spurious space a] Foo Bar \stop\ World % ^^^ neither space^^^ is skipped Hello \start[spurious space b] Foo Bar \stop\ World % ^^^ skips this space ^^^ instead of this Hello \startframed[offset=overlay] Foo Bar \stopframed\ World % That's the behaviour I'm looking for. \stoptext You assume \start[<...>] ... \stop is linked to \definestartstop but this isn’t the case, what the environment does is to generate a start-command with the argument but this works for every environment, e.g. \start[itemize] ... \stop does the same as \startitemize ... \stopitemize. I'm not asking to add \ignorespaces to the definition of \start. I'm rather asking, where I have to but \ignorespaces in the setup to eat the space after the options I pass to \start. Why do use insinst on the use of \start, when you create a new command/environment with \definestartstop you get additional commands for the instance where the space at the begin of the environment are gobbled. \definestartstop[Highlight][style=italic,color=red] \starttext Text \Highlight{Text} Text \blank \input ward\par \startHighlight \input ward \stopHighlight \input ward \stoptext To answer your question where you can add \ignorespace, there is no way to add it. Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Spurious space in \definestartstop
Might I add that the use of a command containing spaces in its name is spurious. Try: \definestartstop[spuriusspacea] \startspuriusspacea ... \stopspuriuspsacea, and then come up with a better name! Alan On Tue, 30 Jan 2018 21:24:41 +0100 Wolfgang Schuster wrote: > > Henri Menke <mailto:henrime...@gmail.com> > > 30. Januar 2018 um 21:12 > > On Tue, 2018-01-30 at 11:58 +0100, Hans Hagen wrote: > >> On 1/30/2018 11:34 AM, Henri Menke wrote: > >>> On 01/30/2018 09:17 PM, Hans Hagen wrote: > >>>> On 1/30/2018 2:54 AM, Henri Menke wrote: > >>>>> Dear list, > >>>>> > >>>>> the title says it all. Please add \ignorespaces in a place you > >>>>> deem appropriate. MWE is below. > >>>> sometimes you will also add \removeuwantedspaces in the stop > >>> I'm confused. Does that mean there is going to be a fix? > >> no, why should there be? spaces are never ignored after the last > >> [...] that is checked for unless a command has an explicit > >> \ignorespaces > > > > I'm not convinced. Both "before" and "commands" see a \relax and > > therefore \ignorespaces is dropped. I can put > > \removeunwantedspaces there but that deletes the space before > > \start. The \framed command correctly drops the space after the > > options. > > > > --- > > > > \definestartstop > >[spurious space a] > >[before=\ignorespaces, > > after=\removeunwantedspaces] > > > > \definestartstop > >[spurious space b] > >[before=\removeunwantedspaces, > > after=\removeunwantedspaces] > > > > \starttext > > > > Hello Foo Bar World > > > > Hello \start[spurious space a] Foo Bar \stop\ World > > % ^^^ neither space^^^ is skipped > > > > Hello \start[spurious space b] Foo Bar \stop\ World > > % ^^^ skips this space ^^^ instead of this > > > > Hello \startframed[offset=overlay] Foo Bar \stopframed\ World > > % That's the behaviour I'm looking for. > > > > \stoptext > > > You assume \start[<...>] ... \stop is linked to \definestartstop but > this isn’t the case, > what the environment does is to generate a start-command with the > argument but this works for every environment, e.g. > \start[itemize] ... \stop does the same > as \startitemize ... \stopitemize. > > Adding the \ignorespace is not an option in this case because it > would effect > all environments which you use with the argument for \start. > > Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Spurious space in \definestartstop
On Tue, 2018-01-30 at 21:24 +0100, Wolfgang Schuster wrote: > > > Henri Menke 30. Januar 2018 um 21:12 > > On Tue, 2018-01-30 at 11:58 +0100, Hans Hagen wrote: > > > On 1/30/2018 11:34 AM, Henri Menke wrote: > > > > On 01/30/2018 09:17 PM, Hans Hagen wrote: > > > > > On 1/30/2018 2:54 AM, Henri Menke wrote: > > > > > > Dear list, > > > > > > > > > > > > the title says it all. Please add \ignorespaces in a place you deem > > > > > > appropriate. MWE is below. > > > > > sometimes you will also add \removeuwantedspaces in the stop > > > > I'm confused. Does that mean there is going to be a fix? > > > no, why should there be? spaces are never ignored after the last [...] > > > that is checked for unless a command has an explicit \ignorespaces > > I'm not convinced. Both "before" and "commands" see a \relax and therefore > > \ignorespaces is dropped. I can put \removeunwantedspaces there but that > > deletes the space before \start. The \framed command correctly drops the > > space > > after the options. > > > > --- > > > > \definestartstop > > [spurious space a] > > [before=\ignorespaces, > > after=\removeunwantedspaces] > > > > \definestartstop > > [spurious space b] > > [before=\removeunwantedspaces, > > after=\removeunwantedspaces] > > > > \starttext > > > > Hello Foo Bar World > > > > Hello \start[spurious space a] Foo Bar \stop\ World > > % ^^^ neither space ^^^ is skipped > > > > Hello \start[spurious space b] Foo Bar \stop\ World > > % ^^^ skips this space ^^^ instead of this > > > > Hello \startframed[offset=overlay] Foo Bar \stopframed\ World > > % That's the behaviour I'm looking for. > > > > \stoptext > > > You assume \start[<...>] ... \stop is linked to \definestartstop but this > isn’t the case, > what the environment does is to generate a start-command with the argument > but this works for every environment, e.g. \start[itemize] ... \stop does the > same > as \startitemize ... \stopitemize. I'm not asking to add \ignorespaces to the definition of \start. I'm rather asking, where I have to but \ignorespaces in the setup to eat the space after the options I pass to \start. > > Adding the \ignorespace is not an option in this case because it would effect > all environments which you use with the argument for \start. > > Wolfgang > __ > _ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > __ > _ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Spurious space in \definestartstop
Henri Menke <mailto:henrime...@gmail.com> 30. Januar 2018 um 21:12 On Tue, 2018-01-30 at 11:58 +0100, Hans Hagen wrote: On 1/30/2018 11:34 AM, Henri Menke wrote: On 01/30/2018 09:17 PM, Hans Hagen wrote: On 1/30/2018 2:54 AM, Henri Menke wrote: Dear list, the title says it all. Please add \ignorespaces in a place you deem appropriate. MWE is below. sometimes you will also add \removeuwantedspaces in the stop I'm confused. Does that mean there is going to be a fix? no, why should there be? spaces are never ignored after the last [...] that is checked for unless a command has an explicit \ignorespaces I'm not convinced. Both "before" and "commands" see a \relax and therefore \ignorespaces is dropped. I can put \removeunwantedspaces there but that deletes the space before \start. The \framed command correctly drops the space after the options. --- \definestartstop [spurious space a] [before=\ignorespaces, after=\removeunwantedspaces] \definestartstop [spurious space b] [before=\removeunwantedspaces, after=\removeunwantedspaces] \starttext Hello Foo Bar World Hello \start[spurious space a] Foo Bar \stop\ World % ^^^ neither space^^^ is skipped Hello \start[spurious space b] Foo Bar \stop\ World % ^^^ skips this space ^^^ instead of this Hello \startframed[offset=overlay] Foo Bar \stopframed\ World % That's the behaviour I'm looking for. \stoptext You assume \start[<...>] ... \stop is linked to \definestartstop but this isn’t the case, what the environment does is to generate a start-command with the argument but this works for every environment, e.g. \start[itemize] ... \stop does the same as \startitemize ... \stopitemize. Adding the \ignorespace is not an option in this case because it would effect all environments which you use with the argument for \start. Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Spurious space in \definestartstop
On Tue, 2018-01-30 at 11:58 +0100, Hans Hagen wrote: > On 1/30/2018 11:34 AM, Henri Menke wrote: > > > > On 01/30/2018 09:17 PM, Hans Hagen wrote: > > > > > > On 1/30/2018 2:54 AM, Henri Menke wrote: > > > > > > > > Dear list, > > > > > > > > the title says it all. Please add \ignorespaces in a place you deem > > > > appropriate. MWE is below. > > > sometimes you will also add \removeuwantedspaces in the stop > > I'm confused. Does that mean there is going to be a fix? > no, why should there be? spaces are never ignored after the last [...] > that is checked for unless a command has an explicit \ignorespaces I'm not convinced. Both "before" and "commands" see a \relax and therefore \ignorespaces is dropped. I can put \removeunwantedspaces there but that deletes the space before \start. The \framed command correctly drops the space after the options. --- \definestartstop [spurious space a] [before=\ignorespaces, after=\removeunwantedspaces] \definestartstop [spurious space b] [before=\removeunwantedspaces, after=\removeunwantedspaces] \starttext Hello Foo Bar World Hello \start[spurious space a] Foo Bar \stop\ World % ^^^ neither space^^^ is skipped Hello \start[spurious space b] Foo Bar \stop\ World % ^^^ skips this space ^^^ instead of this Hello \startframed[offset=overlay] Foo Bar \stopframed\ World % That's the behaviour I'm looking for. \stoptext > > > > > > > > > > > > > Cheers, Henri > > > > > > > > --- > > > > > > > > \definestartstop > > > > [spurious space] > > > > > > > > \starttext > > > > > > > > Hello World > > > > > > > > Hello \start[spurious space] World \stop > > > > % ^^^ spurious space here! > > > > > > > > \stoptext > > > > > > > > ___ > > > > If your question is of interest to others as well, please add an entry > > > > to the Wiki! > > > > > > > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-c > > > > ontext > > > > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > > > > archive : https://bitbucket.org/phg/context-mirror/commits/ > > > > wiki : http://contextgarden.net > > > > > > > > ___ > > > > > > > > > > > ___ > > If your question is of interest to others as well, please add an entry to > > the Wiki! > > > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-conte > > xt > > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > > archive : https://bitbucket.org/phg/context-mirror/commits/ > > wiki : http://contextgarden.net > > > > ___ > > > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Spurious space in \definestartstop
On 1/30/2018 11:34 AM, Henri Menke wrote: On 01/30/2018 09:17 PM, Hans Hagen wrote: On 1/30/2018 2:54 AM, Henri Menke wrote: Dear list, the title says it all. Please add \ignorespaces in a place you deem appropriate. MWE is below. sometimes you will also add \removeuwantedspaces in the stop I'm confused. Does that mean there is going to be a fix? no, why should there be? spaces are never ignored after the last [...] that is checked for unless a command has an explicit \ignorespaces Cheers, Henri --- \definestartstop [spurious space] \starttext Hello World Hello \start[spurious space] World \stop % ^^^ spurious space here! \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___ -- - 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Spurious space in \definestartstop
On 01/30/2018 09:17 PM, Hans Hagen wrote: > On 1/30/2018 2:54 AM, Henri Menke wrote: >> Dear list, >> >> the title says it all. Please add \ignorespaces in a place you deem >> appropriate. MWE is below. > > sometimes you will also add \removeuwantedspaces in the stop I'm confused. Does that mean there is going to be a fix? > >> Cheers, Henri >> >> --- >> >> \definestartstop >> [spurious space] >> >> \starttext >> >> Hello World >> >> Hello \start[spurious space] World \stop >> % ^^^ spurious space here! >> >> \stoptext >> ___ >> If your question is of interest to others as well, please add an entry to >> the Wiki! >> >> maillist : ntg-context@ntg.nl / >> http://www.ntg.nl/mailman/listinfo/ntg-context >> webpage : http://www.pragma-ade.nl / http://context.aanhet.net >> archive : https://bitbucket.org/phg/context-mirror/commits/ >> wiki : http://contextgarden.net >> ___ >> > > ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Spurious space in \definestartstop
On 1/30/2018 2:54 AM, Henri Menke wrote: Dear list, the title says it all. Please add \ignorespaces in a place you deem appropriate. MWE is below. sometimes you will also add \removeuwantedspaces in the stop Cheers, Henri --- \definestartstop [spurious space] \starttext Hello World Hello \start[spurious space] World \stop % ^^^ spurious space here! \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___ -- - 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Spurious space in \definestartstop
Dear list, the title says it all. Please add \ignorespaces in a place you deem appropriate. MWE is below. Cheers, Henri --- \definestartstop [spurious space] \starttext Hello World Hello \start[spurious space] World \stop % ^^^ spurious space here! \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Word and character count excluding TeX-directives
On 2018-01-16 09:26, Dr. Thomas Möbius wrote: \definestartstop [abstract] [style=bold, after={\blank[big]}] \starttext \title{My title: example of a word and character count} {\strut\tfx Formal guidelines: word count of abstract: $x$, character count of main text: $x$, character count of figure captions: $x$.} \blank \startabstract This is the abstract. Read this and that. \stopabstract % start of the main text Some random text with formulas \startformula y = α + βx + ε, \quad ε \sim N(0,σ^2) \stopformula And there are also figures with captions. \startplacefigure[ location=bottom, title={Residual plot with time $t$ on the x-axis and residuals $e_{jt}$ on the y-axis}, reference={fig:subject-residual}] \externalfigure[residuals][height=.242\textheight] \stopplacefigure And some more text with $x$ and $y$ and $z$, and \placeformula \startformula \startalign \NC a =\NC b \NR \NC c =\NC d \NR \stopalign \stopformula And stop. \stoptext Try something based on this: \startluacode userdata = userdata or { } function userdata.wordcount(listname) filename = file.addsuffix(tex.jobname,"words") if lfs.isfile(filename) then local w = dofile(filename) if w then if type(w.categories[listname]) == "table" then context(w.categories[listname].total) else context(w.total) end context.par() end end end \stopluacode \def\wordcount{% \dosingleempty\dowordcount} \def\dowordcount[#1]{% \ctxlua{userdata.wordcount("#1")}} \setupspellchecking[state=start,method=2] \ctxlua{languages.words.threshold=1} \definestartstop [abstract] [style=bold, after={\blank[big]}] \starttext \setupspellchecking[list=abstract] \startabstract This is the abstract. Read this and that. \stopabstract \setupspellchecking[list=main] Some random text with formulas \startformula y = α + βx + ε, \quad ε \sim N(0,σ^2) \stopformula And there are also figures with captions. \setupspellchecking[list=figures] \startplacefigure[ location=bottom, title={Residual plot with time $t$ on the x-axis and residuals $e_{jt}$ on the y-axis}, reference={fig:subject-residual}] \externalfigure[residuals][height=.242\textheight] \stopplacefigure \setupspellchecking[list=main] And some more text with $x$ and $y$ and $z$, and \placeformula \startformula \startalign \NC a =\NC b \NR \NC c =\NC d \NR \stopalign \stopformula And stop. \setupspellchecking[state=stop] \title{My title: example of a word and character count} Abstract: \wordcount[abstract] Main: \wordcount[main] Figures: \wordcount[figures] Wordcount: \wordcount \stoptext -- Rik ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Word and character count excluding TeX-directives
To meet some formal guidelines, I need to provide a word count of my abstract and a character count of the main text, and a character count of all the text appearing in figure captions. Is this possible (maybe using some lua-magic)? Thank you! Thomas Minimal example: \definestartstop [abstract] [style=bold, after={\blank[big]}] \starttext \title{My title: example of a word and character count} {\strut\tfx Formal guidelines: word count of abstract: $x$, character count of main text: $x$, character count of figure captions: $x$.} \blank \startabstract This is the abstract. Read this and that. \stopabstract % start of the main text Some random text with formulas \startformula y = α + βx + ε, \quad ε \sim N(0,σ^2) \stopformula And there are also figures with captions. \startplacefigure[ location=bottom, title={Residual plot with time $t$ on the x-axis and residuals $e_{jt}$ on the y-axis}, reference={fig:subject-residual}] \externalfigure[residuals][height=.242\textheight] \stopplacefigure And some more text with $x$ and $y$ and $z$, and \placeformula \startformula \startalign \NC a =\NC b \NR \NC c =\NC d \NR \stopalign \stopformula And stop. \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] type and typing comments for TeX and Lua
On 12/20/2017 8:45 PM, Pablo Rodriguez wrote: On 12/20/2017 12:53 PM, Hans Hagen wrote: On 12/18/2017 11:50 PM, Pablo Rodriguez wrote: [...] % Differs per lexer: \definestartstop [XmlSnippetComment] [color=, style=] I’m afraid that the scite module isn’t an option for me. Then you need to configure the highligheters yourself Many thanks for your reply, Hans. I don’t mind to set up the highlighters myself, but the problem is the following. XmlSnippetComment only contains the text inside the comment, but not the marks (). LuaSnippetComment contains the marker (only --), but not the text. TexSnippetComment contains the marker (%), but not the text. Would it be possible that there are two SnippetComments for all lexers: SnippetCommentMark and SnippetCommentText? very low priority ... there is some logic behind these that i don't want to break 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] type and typing comments for TeX and Lua
On 12/20/2017 12:53 PM, Hans Hagen wrote: > On 12/18/2017 11:50 PM, Pablo Rodriguez wrote: >> [...] > % Differs per lexer: > > \definestartstop > [XmlSnippetComment] > [color=, > style=] > >> I’m afraid that the scite module isn’t an option for me. > > Then you need to configure the highligheters yourself Many thanks for your reply, Hans. I don’t mind to set up the highlighters myself, but the problem is the following. XmlSnippetComment only contains the text inside the comment, but not the marks (). LuaSnippetComment contains the marker (only --), but not the text. TexSnippetComment contains the marker (%), but not the text. Would it be possible that there are two SnippetComments for all lexers: SnippetCommentMark and SnippetCommentText? Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] type and typing comments for TeX and Lua
On 12/18/2017 11:50 PM, Pablo Rodriguez wrote: Hans, sorry for insisting, but I really need this. I have the following sample: \definetype[context][option=tex] \definetype[lua][option=lua] \starttext \startTEXpage[offset=2em] a \TEX\ inline comment: \context{ag%befe} \Lua\ inline comment: \lua{agb --efe} \startTEX This is text. % a comment, not \comment \stopTEX \startXML This is text. \stopXML \startLUA if code=="code" then --this is a comment \stopLUA \stopTEXpage \stoptext Would it be possible that all comments in type and typing (at least, for Lua, XML and TeX) would have the same formatting for the whole comment contents, including the comment signs? Sorry, but with the current output, it is hard to see (for total newbies) what is part of the comment and what not. And the text editor will display something different. It depends on the lexer ... % \usemodule[scite] % use editor logic % DIffers per lexer: \definestartstop [XmlSnippetComment] [color=, style=] I’m afraid that the scite module isn’t an option for me. Then you need to configure the highligheters yourself 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Extend is indented after section (2nd try)
[This is a second try at sending this message, after I got the not that I'm on the mailing list now.] Hello, When I'm using an exdent after a section command, the first line of the exdented paragraph is indented, instead of exdented. Here's an example: = \definestartstop [exdent] [before={\startnarrower[left]\setupindenting[-\leftskip,yes]}, after=\stopnarrower] \starttext \startcolumns[n=2] \section{Heading 1} Some text. \startexdent This sentence needs to be long enough to wrap at least once. This sentence needs to be long enough to wrap at least once. \stopexdent \section{Heading 2} \startexdent This sentence needs to be long enough to wrap at least once. This sentence needs to be long enough to wrap at least once. \stopexdent \stoptext = The paragraph after "Heading 2" is indented. If I delete the text "Some text." after "Heading 1", the exdented paragraph is is also indented instead of exdented. What can I do to prevent this? -- T. Kurt Bond, tkurtb...@gmail.com and http://consp.org/~tkb ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___