[NTG-context] memoir-style chapter heading
Am completely new to using Metafun, which I presume I would need to use to achieve a Hansen Memoir-style Chapter heading (chapter title overlayed on a large lightgray number). Of course, I am assuming I would need to use Metafun to create this... So my first question is to ask if I could achieve the same effect without Metafun? I have read through the Metafun manual, and I think I can understand how to overlay text on a graphic (MP), but it would be currently beyond me to draw numbers of the kind we find in, say, the Memoir examples. Has anyone created such an example? I was keenly looking for one in the manual and elsewhere, in terms of ConTeXt/Metafun commands, but could not find one. But I'd be quite prepared to 'have a go' at this, if I had some pointers of just where to start! I assume I would have to \defineoverlay[number] and then add text on top \framed (but without the frame borders). Am I at least correct about this? Julian ___ 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] A dumb question about MetaFun
I found another workaround, but I'm going to try this. Thank you, Keith, and thank you, Taco. Cordially, Jairo :) El dom., 16 de ago. de 2020 3:36 p. m., Taco Hoekwater escribió: > > > > On 16 Aug 2020, at 21:09, Keith McKay wrote: > > > > Jairo > > > > Try > > > > draw unitsquare scaled 1cm shifted (xcm, ycm); > > > > Page 11 of the manual metafun-p.pdf is your friend here. My recent > conversation with Taco on this list will be usefull as well. > > Also: > > \starttext > \startMPpage > % puts the center of the bbox of path p at the point t > primarydef p centered t = > hide(xshift := xpart t - (xpart urcorner p + xpart llcorner p)/2 ; > yshift := ypart t - (ypart urcorner p + ypart llcorner p)/2 ; ) > p shifted (xshift,yshift) > enddef; > > draw fullsquare scaled 2cm shifted (50,3) centered (100,100); > > % just for reference: > drawdot origin withpen pencircle scaled 10 withcolor red; > drawdot (100,100) withpen pencircle scaled 10 withcolor green; > \stopMPpage > \stoptext > > (I thought there was a metafun definition for that but I cannot find it). > > Best wishes, > Taco > > ___ > 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] A dumb question about MetaFun
> On 16 Aug 2020, at 21:09, Keith McKay wrote: > > Jairo > > Try > > draw unitsquare scaled 1cm shifted (xcm, ycm); > > Page 11 of the manual metafun-p.pdf is your friend here. My recent > conversation with Taco on this list will be usefull as well. Also: \starttext \startMPpage % puts the center of the bbox of path p at the point t primarydef p centered t = hide(xshift := xpart t - (xpart urcorner p + xpart llcorner p)/2 ; yshift := ypart t - (ypart urcorner p + ypart llcorner p)/2 ; ) p shifted (xshift,yshift) enddef; draw fullsquare scaled 2cm shifted (50,3) centered (100,100); % just for reference: drawdot origin withpen pencircle scaled 10 withcolor red; drawdot (100,100) withpen pencircle scaled 10 withcolor green; \stopMPpage \stoptext (I thought there was a metafun definition for that but I cannot find it). Best wishes, Taco ___ 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] A dumb question about MetaFun
Jairo Try draw unitsquare scaled 1cm shifted (xcm, ycm); Page 11 of the manual metafun-p.pdf is your friend here. My recent conversation with Taco on this list will be usefull as well. Best Wishes Keith On 16/08/2020 18:06, Jairo A. del Rio wrote: Hi list! A simple question: is there an equivalent of thetextext for a normal picture (an "image(draw ... ;)")? I want to move the center of a picture to an specific point, like this: \startMPpage draw thetextext("\tttf hello", origin) ; draw unitsquare scaled 1cm; \stopMPpage The "hello" is centered at the origin. I want to achieve the same result for pictures. I've seen such a command some time ago, but I've forgotten and I cannot find it again in documentation. Thanks and sorry for any inconvenience. Regards, Jairo :) ___ 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] A dumb question about MetaFun
Hi list! A simple question: is there an equivalent of thetextext for a normal picture (an "image(draw ... ;)")? I want to move the center of a picture to an specific point, like this: \startMPpage draw thetextext("\tttf hello", origin) ; draw unitsquare scaled 1cm; \stopMPpage The "hello" is centered at the origin. I want to achieve the same result for pictures. I've seen such a command some time ago, but I've forgotten and I cannot find it again in documentation. Thanks and sorry for any inconvenience. Regards, Jairo :) ___ 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] reading a single element from XML
On 8/16/20 11:46 AM, Taco Hoekwater wrote: > \xmlfilter is your friend: > > \startxmlsetups xml:initialize >\xmlsetsetup{#1}{html}{xml:gen} > \stopxmlsetups > > \xmlregistersetup{xml:initialize} > > \startxmlsetups xml:gen > \xmlfilter{#1}{/**/span[@class='special']/command(xml:special)} > \stopxmlsetups > > \startxmlsetups xml:special >\bgroup\bfd\ssd\xmlflush{#1}\egroup > \stopxmlsetups Many thanks for your reply, Taco. This was extremely handy and helpful (it is also the first time I understand what \xmlfilter is used for). My final solution required nesting filters, which worked perfectly fine (included below). Many thanks for your help, Pablo Just for the record: \startbuffer[demo] This is One a paragraph. This is another paragraph. This is another Two paragraph. This is another Three paragraph. This is another Four paragraph. This is A a paragraph. This is another paragraph. This is another B paragraph. This is another C paragraph. This is another D paragraph. \stopbuffer \startxmlsetups xml:initialize \xmlsetsetup{#1}{html}{xml:gen} \stopxmlsetups \xmlregistersetup{xml:initialize} \startxmlsetups xml:gen \xmlfilter{#1}{/**/div/command(xml:chapter)} \stopxmlsetups \startxmlsetups xml:chapter \startsection[title=\xmlatt{#1}{id}] \startitemize[packed] \xmlfilter{#1}{**/span[@class='special']/command(xml:special)} \stopitemize \stopsection \stopxmlsetups \startxmlsetups xml:special \startitem\xmlflush{#1}\stopitem \stopxmlsetups \starttext \xmlprocessbuffer{main}{demo}{} \stoptext -- 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] Missing graphic in MPpage when viewing in Apple MAC Preview or GIMP 2.10 but not Adobe
Thanks Taco! I have been playing about with an example from this site https://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.html which was originally for a square and I obviously didn't get my angles right. Thanks for spotting it. I'm beginning to appreciate where the Fun in MetaFun comes from. Best Wishes Keith On 15/08/2020 18:35, Taco Hoekwater wrote: Hi Keith, It took me a while before I saw it, but I think you wanted to type in z0 = (60,60); z1 = z0 rotated 120; z2 = z0 rotated 240; instead of z0 = (60,60); z1 = z0 rotated 120; z2 = z1 rotated 240; because the latter puts z2 at z0, resulting in a path that is a straight line. The fact that AR displays anything at all is probably some form of correction like "fill of empty path == single pixel line”. Best wishes, Taco On 15 Aug 2020, at 17:39, Keith McKay wrote: Dear List I have come across a problem which I don't think is due to ConTeXt but I'm hopping the great and the good of this list may be able to explain what is going on. The code below produces an MPpage with a shaded background and two graphics along with a line of outlined text. When I view in Adobe (or the output from TeXworks) I see everything as it should be. However, I wanted to convert the MPpage to a jpeg file and when I opened the pdf in either Apple MAC Preview or Gimp 2.10 the two graphics are missing, and I have no idea why. Could someone explain a way round this? Here is the code. Thanks Keith %% system > system > ConTeXt ver: 2020.07.29 18:36 LMTX fmt: 2020.7.29 int: english/english system > %%% \setuppapersize [A5, portrait] \usecolors[crayola] \starttext \startMPpage StartPage; width := PaperWidth ; height := PaperHeight ; unit := cm ; definecolor [ name = "MyColor1", r = 0.781, g = 0.5, b = 0.5 ] ; definecolor [ name = "MyColor3", r = 1, g = 1, b = 0.7983 ] ; draw lmt_shade [ path = unitsquare xscaled 14.8cm yscaled 21cm, direction = "up", alternative = "linear", colors = { "MyColor1", "MyColor3" }, ] ; z0 = (60,60); z1 = z0 rotated 120; z2 = z1 rotated 240; path carre; carre = z0--z1--z2--cycle; picture pic; pic := image( numeric d; d := 0.0005; for i=1 step -d until d: fill carre scaled i shifted (3.9cm,17cm) withcolor((1 + i)*(\MPcolor{VividTangerine})) ; fill carre rotated (45) scaled i shifted (3.9cm,17cm) withcolor((1 + i)*(\MPcolor{VividTangerine})) ; fill carre rotated (90) scaled i shifted (3.9cm,17cm) withcolor((1 + i)*(\MPcolor{VividTangerine})) ; fill carre rotated (135) scaled i shifted (3.9cm,17cm) withcolor((1 + i)*(\MPcolor{VividTangerine})) ; fill carre rotated (180) scaled i shifted (3.9cm,17cm) withcolor((1 + i)*(\MPcolor{VividTangerine})) ; fill carre rotated (225) scaled i shifted (3.9cm,17cm) withcolor((1 + i)*(\MPcolor{VividTangerine})) ; endfor;); draw pic rotatedaround(center pic, 270); draw pic rotatedaround(center pic, 90) shifted (7cm,-13cm) ; draw lmt_outline [ text = "Page 18" kind = "draw", drawcolor = "VividTangerine", ] xsized TextWidth shifted (1cm,7.67cm); StopPage; \stopMPpage \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 ___ ___ 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] reading a single element from XML
\xmlfilter is your friend: \startxmlsetups xml:initialize \xmlsetsetup{#1}{html}{xml:gen} \stopxmlsetups \xmlregistersetup{xml:initialize} \startxmlsetups xml:gen \xmlfilter{#1}{/**/span[@class='special']/command(xml:special)} \stopxmlsetups \startxmlsetups xml:special \bgroup\bfd\ssd\xmlflush{#1}\egroup \stopxmlsetups Best wishes, Taco > On 16 Aug 2020, at 11:02, Pablo Rodriguez wrote: > > Dear list, > > I have the following sample: > > \startbuffer[demo] > > > >This is Only a paragraph. >This is another paragraph. >This is another paragraph. >This is another paragraph. >This is another paragraph. > > > > \stopbuffer > > \startxmlsetups xml:initialize >\xmlsetsetup{#1}{*}{-} > >\xmlsetsetup{#1} > {html|body|div|p} > {xml:flush} > >\xmlsetsetup{#1} > {html/**/span[@class='special']} > {xml:special} > \stopxmlsetups > > \xmlregistersetup{xml:initialize} > > \startxmlsetups xml:flush >\xmlflush{#1} > \stopxmlsetups > > \startxmlsetups xml:special >\bgroup\bfd\ssd\xmlflush{#1}\egroup > \stopxmlsetups > > \starttext >\xmlprocessbuffer{main}{demo}{} > \stoptext > > How can I select only ? I mean, how can I have > "Only" and nothing more in the output PDF document? > > I thought that lpath "html/**/span[@class='special']" would work, but I > don’t know what I’m missing. > > 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 > ___ 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] reading a single element from XML
Dear list, I have the following sample: \startbuffer[demo] This is Only a paragraph. This is another paragraph. This is another paragraph. This is another paragraph. This is another paragraph. \stopbuffer \startxmlsetups xml:initialize \xmlsetsetup{#1}{*}{-} \xmlsetsetup{#1} {html|body|div|p} {xml:flush} \xmlsetsetup{#1} {html/**/span[@class='special']} {xml:special} \stopxmlsetups \xmlregistersetup{xml:initialize} \startxmlsetups xml:flush \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:special \bgroup\bfd\ssd\xmlflush{#1}\egroup \stopxmlsetups \starttext \xmlprocessbuffer{main}{demo}{} \stoptext How can I select only ? I mean, how can I have "Only" and nothing more in the output PDF document? I thought that lpath "html/**/span[@class='special']" would work, but I don’t know what I’m missing. 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] About documented code
Jairo A. del Rio schrieb am 15.08.2020 um 16:24: Hi list! I have some questions about the template used by module documentation. When I apply context --extra=module t-mymodule.mkvi --autopdf I obtain a nice file, but, among other things, 1) the cover page seems to be a bit... greenish? So I want to know how to customize it, at least at a minimum, and 2) \showframe is enabled by default. How to disable it? Maybe 1) can answer 2) too. Thank you very much. There is no way to change the color of the title page from your module itself, the only way is to change the value module (s-module-basic.mkiv) which is used to create the formatted source. The same has to be done to disable the frame where you have to comment the \showframe line in the module mentioned above. 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 ___