Re: [NTG-context] Source Code with Bolded Keywords
Yves Cloutier schrieb am 14.03.2020 um 16:54: Hello, I am trying to typeset source code for a custom programming language and would like to have the keywords in bold text. I tried following the example found here regarding verbatim displays: https://www.contextgarden.net/Verbatim_text#Displayed_text Specifically the C example, however this does not seem to work. No formatting is applied to my keywords. Can you provide a minimal example what you have tried. Just wondering if the way to do it has changed or if there are other examples I could look at to compare with what I'm doing. \starttext \starttyping[escape=yes] This is /BTEX\bf formatted/ETEX text. \stoptyping \starttyping[escape={<<,>>}] This is <<\bf formatted>> text. \stoptyping \starttyping[escape={}] This is text. \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 ___
[NTG-context] Source Code with Bolded Keywords
Hello, I am trying to typeset source code for a custom programming language and would like to have the keywords in bold text. I tried following the example found here regarding verbatim displays: https://www.contextgarden.net/Verbatim_text#Displayed_text Specifically the C example, however this does not seem to work. No formatting is applied to my keywords. Just wondering if the way to do it has changed or if there are other examples I could look at to compare with what I'm doing. Regards, yc ___ 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] Why do I see the outline of the green box in this METAPOST code?
Code:vardef Foo(expr w, h, lh) = save pth; path pth; save pthtwo; path pthtwo; save pththree; path pththree; save pic; picture pic; pth = fullsquare xysized (w, h); pthtwo = fullsquare xysized (2*lh, lh) shifted (-w/2, 2.5*lh); pththree = fullsquare xysized (2*lh, lh) shifted (-w/2, lh); fill pth withcolor green; fill pthtwo withcolor yellow; fill pththree withcolor yellow; pic := image ( draw pth; draw pthtwo; draw pththree; ); % setbounds pic to pth; picenddef ;Call:\startMPpagepicture s ; s := Foo(8cm, 2cm, 0.25cm);draw s;drawdot center leftboundary s withpen pencircle scaled 2 withcolor green;drawdot center rightboundary s withpen pencircle scaled 2 withcolor blue;drawdot point .25 along topboundary s withpen pencircle scaled 2 withcolor yellow;drawdot .25[llcorner s, lrcorner s] withpen pencircle scaled 2 withcolor magenta;drawdot origin withpen pencircle scaled 4 withcolor red;\stopMPpageOutput: PastedGraphic-1.pdf Description: Adobe PDF document Why is the outline of the green box visible in the yellow boxes? And how can I prevent this from happening?___ 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] Why does this METAPOST vardef 'save' statement fail?
Answering myself: pth2 is not a valid variable name. Digits are not allowed. > On 14 Mar 2020, at 15:45, Gerben Wierda wrote: > > I have this vardef: > > vardef Foo(expr w, h) = >save pth; path pth; >%save pth2; path pth2; >save pic; picture pic; >pth = fullsquare xysized (w, h); >%pth2 = fullsquare xysized (h/4, h/8) >pic := image ( >draw pth; >%draw pth2 shifted (-w/2, -h/4); >% all kind of stuff here >); >setbounds pic to pth; >pic > enddef ; > > As soon as I uncomment the bold line (first comment) a mtxrun fails. Whatever > I try, a single save statement, etc., I fail in getting a second local > variable. The METAPOST manual is no help. > > The error shown is: > > metapost log> ! Extra tokens will be flushed. > metapost log> > metapost log>2 > metapost log> Foo->...h;path.pth;save.pth2 > metapost log> > ;path.pth2;save.pic;pictur... > metapost log> <*> ... ; s := Foo(8cm, 2cm) > metapost log> ; draw s; > drawdot center l... > metapost log> > > Why? > > G > ___ > 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] Why does this METAPOST vardef 'save' statement fail?
I have this vardef: vardef Foo(expr w, h) = save pth; path pth; %save pth2; path pth2; save pic; picture pic; pth = fullsquare xysized (w, h); %pth2 = fullsquare xysized (h/4, h/8) pic := image ( draw pth; %draw pth2 shifted (-w/2, -h/4); % all kind of stuff here ); setbounds pic to pth; pic enddef ; As soon as I uncomment the bold line (first comment) a mtxrun fails. Whatever I try, a single save statement, etc., I fail in getting a second local variable. The METAPOST manual is no help. The error shown is: metapost log> ! Extra tokens will be flushed. metapost log> metapost log>2 metapost log> Foo->...h;path.pth;save.pth2 metapost log> ;path.pth2;save.pic;pictur... metapost log> <*> ... ; s := Foo(8cm, 2cm) metapost log> ; draw s; drawdot center l... metapost log> Why? G___ 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 I share METAPOST vardefs over multiple pages?
> On 13 Mar 2020, at 14:59, Hans Hagen wrote: > > On 3/13/2020 2:33 PM, Aditya Mahajan wrote: >> On Fri, 13 Mar 2020, Taco Hoekwater wrote: >>> Hi, >>> >>> >>> On 13 Mar 2020, at 12:53, Gerben Wierda wrote: Suppose I have this code: Can I reuse that varied across follow-up MPPages? >>> >>> Sure, put the vardef inside \startMPinclusions: >> or \startMPdefinitions ... \stopMPdefinitions (don't remember what is the >> difference between inclusions and definitions, now). > definitions: once > inclusions : every time That is not quite clear to me (ambiguous because of a lack of experience). Does ‘once’ mean, valid in just one page or valid in all following pages? G ___ 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 ___