[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,0) -- urcorner multipars[1] ; draw p ; \stopuseMPgraphic % Watch how i moved the before/after bla
[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: Why overbar is so big
Looks fine to me. Current version: 2023.08.10 02:59 Running on Linux. What fonts are you using? On Fri, Aug 11, 2023 at 12:38 PM Xavier B. wrote: > If you run > > \starttext > > Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod > tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim > veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea > commodo consequat. Duis aute irure dolor in reprehenderit in voluptate > velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat > cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id > est laborum. > $\overbar{OA} = 4,2$ > \stoptext > > Then the overbar has the bar in a very long altitude. > Can you please, see the output attached. > > Thanks in advance, > Xavier > > PS: I use context version:mtx-context | ConTeXt Process Management 1.04 > mtx-context | > mtx-context | main context file: > /usr/share/texmf-dist/tex/context/base/mkiv/context.mkiv > mtx-context | current version: 2023.03.10 12:15 > mtx-context | main context file: > /usr/share/texmf-dist/tex/context/base/mkxl/context.mkxl > mtx-context | current version: 2023.03.10 12:15 > > ___ > 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 > > ___ 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] Why overbar is so big
If you run \starttext Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. $\overbar{OA} = 4,2$ \stoptext Then the overbar has the bar in a very long altitude. Can you please, see the output attached. Thanks in advance, Xavier PS: I use context version:mtx-context | ConTeXt Process Management 1.04 mtx-context | mtx-context | main context file: /usr/share/texmf-dist/tex/context/base/mkiv/context.mkiv mtx-context | current version: 2023.03.10 12:15 mtx-context | main context file: /usr/share/texmf-dist/tex/context/base/mkxl/context.mkxl mtx-context | current version: 2023.03.10 12:15 c.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: upload
That works Hans, thank you. line 802 in core-env should be: > > \permanent\tolerant\protected\def\setupenv >{\syst_variables_set\getrawparameters[\s!environment]} > > (seems i forgot that one when doing some cleanup) > > 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] Re: How to override parts of a typescript
On 8/11/2023 6:19 PM, Vincent Hennebert wrote: Say I want to use the Adobe Source font family in my document. They are installed on my system, but the file names are different to what’s in the typescript file provided with the ConTeXt distribution. If I do this: \starttypescript [serif] [source] [name] \definefontsynonym [Serif] [file:SourceSerif4-Regular] [features=default] \definefontsynonym [SerifItalic] [file:SourceSerif4-It] [features=default] \definefontsynonym [SerifBold] [file:SourceSerif4-Bold] [features=default] \definefontsynonym [SerifBoldItalic] [file:SourceSerif4-BoldIt] [features=default] \stoptypescript \setupbodyfont[source] \starttext I want this text to be typeset in Adobe Source Serif. \stoptext Then I get what I want. The question is: can I move the \start/stoptypescript code into its own typescript file that would somehow refer to the official one and override only what’s needed? Or is the only solution to just copy the whole file and tweak what I need? I found some thread in the mailing list archive relating to this but it’s more than 15 years old. Maybe things have changed since then. Here is a cheat: \definefontfile[file:SourceSerifPro-Regular][file:SourceSerif4-Regular] before you enable the bodyfont (can be in your document style). 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] How to override parts of a typescript
Say I want to use the Adobe Source font family in my document. They are installed on my system, but the file names are different to what’s in the typescript file provided with the ConTeXt distribution. If I do this: \starttypescript [serif] [source] [name] \definefontsynonym [Serif] [file:SourceSerif4-Regular] [features=default] \definefontsynonym [SerifItalic] [file:SourceSerif4-It] [features=default] \definefontsynonym [SerifBold] [file:SourceSerif4-Bold] [features=default] \definefontsynonym [SerifBoldItalic] [file:SourceSerif4-BoldIt] [features=default] \stoptypescript \setupbodyfont[source] \starttext I want this text to be typeset in Adobe Source Serif. \stoptext Then I get what I want. The question is: can I move the \start/stoptypescript code into its own typescript file that would somehow refer to the official one and override only what’s needed? Or is the only solution to just copy the whole file and tweak what I need? I found some thread in the mailing list archive relating to this but it’s more than 15 years old. Maybe things have changed since then. Thanks, Vincent ___ 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 ___