Re: [NTG-context] Fontawesome in lmtx
On Fri, 10 Apr 2020, kaddour kardio wrote: Hi, if there any changes in the interface for using symbols? I tried today the example from Aditya's Blog but it shows no symbols: \definetypeface[mainfont][rm][specserif][Linux Libertine O][default] \definetypeface[mainfont][mm][math] [TeX Gyre Pagella Math][default] \definetypeface[mainfont][tt][mono] [Dejavu Mono][default] [rscale=0.8, features=none] \setupbodyfont[mainfont,11pt] \usesymbols[fontawesome] \define\FA{\dosingleargument\doFA} \def\doFA[#1]{\inlinedbox {\scale[height=1em]{\symbol[fontawesome][#1]}}} \starttext Checked box \FA[check-square-o] Unchecked box \FA[square-o] \stoptext i use luamtetex for archlinux with all luatex modules linked to lmtx folder The names of the symbols have changed in fontaweson 5.0. Try: \FA[check] \FA[check_empty] 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] Fontawesome in lmtx
On 4/11/2020 10:48 AM, Aditya Mahajan wrote: On Fri, 10 Apr 2020, kaddour kardio wrote: Hi, if there any changes in the interface for using symbols? I tried today the example from Aditya's Blog but it shows no symbols: \definetypeface[mainfont][rm][specserif][Linux Libertine O][default] \definetypeface[mainfont][mm][math] [TeX Gyre Pagella Math][default] \definetypeface[mainfont][tt][mono] [Dejavu Mono][default] [rscale=0.8, features=none] \setupbodyfont[mainfont,11pt] \usesymbols[fontawesome] \define\FA{\dosingleargument\doFA} \def\doFA[#1]{\inlinedbox {\scale[height=1em]{\symbol[fontawesome][#1]}}} \starttext Checked box \FA[check-square-o] Unchecked box \FA[square-o] \stoptext i use luamtetex for archlinux with all luatex modules linked to lmtx folder The names of the symbols have changed in fontaweson 5.0. Try: \FA[check] \FA[check_empty] fwiw, if you do: context --global symb-imp-fontawesome.mkiv you get a pdf file that shows all names and symbols 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] Geometric math symbols in Lucida OT
Hi all, I decided to switch to Lucida OpenType, but now I’ve another problem. In the Type1 variant, all geometric shapes (\square, \triangleright, \blacktriangleright, etc.) had the same size as math operators (\boxplus, \boxdot). This appears not to be the case any more in the OpenType variant, they are way too big! (See attachment.) Pagella and Latin Modern do this right. Is this a font issue or a ConTeXt issue? Anything I can do about this without redefining every symbol I need by hand? Cheers, Tim \startproduct test \setupbodyfont[lucidaot,10pt] $\square\boxtimes$ \stopproduct test.pdf Description: Binary data ___ 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] \placelist[chapter][counter=realpage] not working
Dear list, here you have the following sample: \setuppapersize[A6] \setupuserpagenumber[way=chapter] \starttext \placelist[chapter][counter=realpage] \dorecurse{5}{\chapter{Chapter}} \stoptext Why doesn’t \placelist[chapter] use the realpage counter? According to i-context.pdf, \placelist inherits from \setuplist (which also inherits from \setupcounter). I really need that, since the document I’m composing needs chapter and part page numbering independent from the whole document page numbering. Am I missing something or have I hit a bug? 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 ___
[NTG-context] running lua in metafun and in ConTeXt
Dear all, I draw Pascal’s triangle with the label of each point created by using lua functions. As you see in the code below, I defined fact(n) and combi(n,r) using lua. For the calculation tt, I used two different methods. Both are working well when I run the given code. But I got an error, when I added this code to a ConTeXt file composed product and components, and using the second method, i.e. combi(n,r). The first method is still working well. The error message is as following: metapost log> loading metafun, including plain.mp version 1.004 for metafun iv and xl metapost log> luatex warning > mplib: run script: [string "return mp.print(combi(0,0 ))"]:1: attempt to call a nil value (global 'combi') metapost log> >> tt metapost log> >> vacuous metapost log> ! Equation cannot be performed (numeric=vacuous). metapost log> metapost log>; metapost log> ...&decimal(0)&","&decimal(EXPR0)&" ))"); metapost log> now:=start+(EXPR0)*right*d... metapost log> now--(now+A);draw.now--(now+B);endfor metapost log> ; ENDFOR metapost log> <*> ...now+A); draw now -- (now+B); endfor; endfor metapost log> ;; I don’t know why the same code treated differently. I think that I have to do something more in luacode which I don’t know. Comments are wellcome! Best regards, Dalyoung %%% \startluacode function fact (n) if n <= 0 then return 1 else return n * fact(n-1) end end function combi(n,r) return fact(n)/(fact(r)*fact(n-r)) end \stopluacode \startbuffer[fig121] numeric n,r,s,u,dx,dy,tt; u := 1.8cm; path p, q; pair A,B,start,now; A := dir(210)*u; B := dir(-30)*u; dy := sind(30)*u; dx := 2*cosd(30)*u; for n=0 upto 4: start := n*dir(210)*u; for r=0 upto n: s := n-r; % tt := lua("mp.print(fact(" & decimal n & ")/(fact(" & decimal r & ")*fact(" & decimal s &" )))"); tt := lua("mp.print(combi(" & decimal n & "," & decimal r & " ))"); now := start+r*right*dx; dotlabel.top(textext("$\displaystyle {" & decimal n & "\choose" & decimal r & "} = "& decimal tt & "$"),now); draw now -- (now+A); draw now -- (now+B); endfor; endfor; \stopbuffer \starttext \switchtobodyfont[11pt] \processMPbuffer[fig121] \switchtobodyfont[12pt] \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] running lua in metafun and in ConTeXt
Hi Dalyoung, I tested your code: it works fine with both definitions of the variable tt in your code. I am using the current LMTX version 2020.04.08 14:38. Best regards: Otared > On 11 Apr 2020, at 14:32, Jeong Dal wrote: > > Dear all, > > I draw Pascal’s triangle with the label of each point created by using lua > functions. > As you see in the code below, I defined fact(n) and combi(n,r) using lua. > For the calculation tt, I used two different methods. > Both are working well when I run the given code. > > But I got an error, when I added this code to a ConTeXt file composed product > and components, > and using the second method, i.e. combi(n,r). The first method is still > working well. > The error message is as following: > > metapost log> loading metafun, including plain.mp version 1.004 for > metafun iv and xl > metapost log> > luatex warning > mplib: run script: [string "return mp.print(combi(0,0 > ))"]:1: attempt to call a nil value (global 'combi') > > metapost log> >> tt > metapost log> >> vacuous > metapost log> ! Equation cannot be performed (numeric=vacuous). > metapost log> > metapost log>; > metapost log> ...&decimal(0)&","&decimal(EXPR0)&" ))"); > metapost log> > now:=start+(EXPR0)*right*d... > metapost log> now--(now+A);draw.now--(now+B);endfor > metapost log> ; ENDFOR > metapost log> <*> ...now+A); draw now -- (now+B); endfor; endfor > metapost log> ;; > > I don’t know why the same code treated differently. > I think that I have to do something more in luacode which I don’t know. > Comments are wellcome! > > Best regards, > > Dalyoung > > %%% > > \startluacode > function fact (n) > if n <= 0 then > return 1 > else > return n * fact(n-1) > end > end > function combi(n,r) >return fact(n)/(fact(r)*fact(n-r)) > end > \stopluacode > \startbuffer[fig121] > numeric n,r,s,u,dx,dy,tt; u := 1.8cm; > path p, q; > pair A,B,start,now; > A := dir(210)*u; > B := dir(-30)*u; > dy := sind(30)*u; > dx := 2*cosd(30)*u; > for n=0 upto 4: >start := n*dir(210)*u; >for r=0 upto n: > s := n-r; > % tt := lua("mp.print(fact(" & decimal n & ")/(fact(" & decimal r & > ")*fact(" & decimal s &" )))"); > tt := lua("mp.print(combi(" & decimal n & "," & decimal r & " ))"); > > now := start+r*right*dx; > dotlabel.top(textext("$\displaystyle {" & decimal n & "\choose" & > decimal r & "} = "& decimal tt & "$"),now); > draw now -- (now+A); > draw now -- (now+B); >endfor; > endfor; > \stopbuffer > \starttext > \switchtobodyfont[11pt] > \processMPbuffer[fig121] > \switchtobodyfont[12pt] > \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] \placelist[chapter][counter=realpage] not working
Pablo Rodriguez schrieb am 11.04.2020 um 13:54: Dear list, here you have the following sample: \setuppapersize[A6] \setupuserpagenumber[way=chapter] \starttext \placelist[chapter][counter=realpage] \dorecurse{5}{\chapter{Chapter}} \stoptext Why doesn’t \placelist[chapter] use the realpage counter? According to i-context.pdf, \placelist inherits from \setuplist (which also inherits from \setupcounter). While \setuplist inherits values from \setupcounter doesn't mean it supports all of them and keys like "counter" work only when you create a new instance which uses the counter of another instance, e.g. you create two enumerations but both of them share one counter. Another problem is that you assume counter refers to the page value while it would make more sense to link it to the section value (or float number for figures or tables). I really need that, since the document I’m composing needs chapter and part page numbering independent from the whole document page numbering. Am I missing something or have I hit a bug? You can show the realpage value but there is no proper interface setting (e.g. \setuplist[chapter][pagenumber=realpage]) for this yet and I think it's better to do this. 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] \placelist[chapter][counter=realpage] not working
On 4/11/20 2:53 PM, Wolfgang Schuster wrote: > Pablo Rodriguez schrieb am 11.04.2020 um 13:54: >> [...] >> I really need that, since the document I’m composing needs chapter and >> part page numbering independent from the whole document page numbering. >> >> Am I missing something or have I hit a bug? > > You can show the realpage value but there is no proper interface setting > (e.g. \setuplist[chapter][pagenumber=realpage]) for this yet and I think > it's better to do this. Many thanks for your reply, Wolfgang. In that case, which would be the way to get the realpage value? Or is there any way to get a page counter that can be restarted, as userpage is? (I already use subpage for other purposes.) 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 ___
[NTG-context] offset for background overlay
Hello list, this MWE is a simplified version of a real case: \startuseMPgraphic{cell:triangle} path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth yscaled 2.5 OverlayHeight ; draw p withcolor red ; \stopuseMPgraphic \defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}] \starttext \bTABLE[frame=off] \bTR \bTD[nx=2,background=triangle,align=middle] \dontleavehmode a\crlf text \eTD \eTR \bTR[toffset=1mm] \bTD left \eTD \bTD right \eTD \eTR \eTABLE \stoptext The triangle is used as background of the 2-column wide cell of the first row. I want the triangle to go around the second row too, as if it were a frame for all the 3 cells. It means that it should be shifted down a bit. So I tried this: \startuseMPgraphic{cell:triangle} path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth yscaled 2.5 OverlayHeight ; draw p shifted (0,-3mm) withcolor red ; \stopuseMPgraphic ... but it does not work, because the content of the background is centered on the cell, so "shifted (0,-3mm)" has no effect. The only solution I found is drawing something above the triangle with a neutral color, so that the whole background is centered in the cell and the red triangle goes down: \startuseMPgraphic{cell:triangle} path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth yscaled 2.5 OverlayHeight ; fill p shifted (0,6mm) withcolor white ; % only to move the next one down draw p withcolor red ; \stopuseMPgraphic \defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}] \starttext \bTABLE[frame=off] \bTR \bTD[nx=2,background=triangle,align=middle] \dontleavehmode a\crlf text \eTD \eTR \bTR[toffset=1mm] \bTD left \eTD \bTD right \eTD \eTR \eTABLE \stoptext It's a dirty trick. I'm sure there's a cleaner way. Does anybody know it? Thanks, Massi ___ 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] running lua in metafun and in ConTeXt
Dear all, The problem is solved by using the namespace of lua as below: I am not sure what I did is the right way. If it is not the right way, please let me know. Thanks for reading. Best regards, Dalyoung \startluacode P={} combi = P function P.fact (n) if n <= 0 then return 1 else return n * P.fact(n-1) end end function P.ncr(n,r) return P.fact(n)/(P.fact(r)*P.fact(n-r)) end combi = { fact = fact, ncr = ncr, } \stopluacode \startbuffer[fig121] numeric n,r,s,u,dx,dy,tt; u := 1.8cm; path p, q; pair A,B,start,now; A := dir(210)*u; B := dir(-30)*u; dy := sind(30)*u; dx := 2*cosd(30)*u; for n=0 upto 4: start := n*dir(210)*u; for r=0 upto n: s := n-r; % tt := lua("mp.print(P.fact(" & decimal n & ")/(P.fact(" & decimal r & ")*P.fact(" & decimal s &" )))"); tt := lua("mp.print(P.ncr(" & decimal n & "," & decimal r & " ))"); now := start+r*right*dx; dotlabel.top(textext("$\displaystyle {" & decimal n & "\choose" & decimal r & "} = "& decimal tt & "$"),now); draw now -- (now+A); draw now -- (now+B); endfor; endfor; \stopbuffer ___ 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] Fontawesome in lmtx
To Aditya this works as expected thank you. To Hans when i run the command i get "deja vu sans" symbolset instead . Le sam. 11 avr. 2020 à 10:49, Hans Hagen a écrit : > On 4/11/2020 10:48 AM, Aditya Mahajan wrote: > > On Fri, 10 Apr 2020, kaddour kardio wrote: > > > >> Hi, if there any changes in the interface for using symbols? > >> I tried today the example from Aditya's Blog but it shows no symbols: > >> > >> \definetypeface[mainfont][rm][specserif][Linux Libertine O][default] > >> \definetypeface[mainfont][mm][math] [TeX Gyre Pagella Math][default] > >> \definetypeface[mainfont][tt][mono] [Dejavu Mono][default] [rscale=0.8, > >> features=none] > >> \setupbodyfont[mainfont,11pt] > >> \usesymbols[fontawesome] > >> > >> \define\FA{\dosingleargument\doFA} > >> \def\doFA[#1]{\inlinedbox > >>{\scale[height=1em]{\symbol[fontawesome][#1]}}} > >> > >> \starttext > >> Checked box \FA[check-square-o] > >> Unchecked box \FA[square-o] > >> \stoptext > >> i use luamtetex for archlinux with all luatex modules linked to lmtx > >> folder > > > > The names of the symbols have changed in fontaweson 5.0. Try: > > > > \FA[check] \FA[check_empty] > fwiw, if you do: > >context --global symb-imp-fontawesome.mkiv > > you get a pdf file that shows all names and symbols > > 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 > > ___ > -- Dr YAHYAOUI Mohamed Kaddour, cardiologue . ___ 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] Fontawesome in lmtx
this is a part of my log file. i have ttf-fontawesome installed in my system , maybe i should switch off to otf version? defining > unknown font 'fontawesome5brandsregular400', loading aborted fonts > defining > unable to define 'fontawesome5brandsregular400.otf' as 'thedefinedfont--0' fonts > defining > forced type 'otf' of 'fontawesome5brandsregular400' not found fonts > defining > font with asked name 'fontawesome5brandsregular400' is not found using lookup 'file' Le sam. 11 avr. 2020 à 16:12, kaddour kardio a écrit : > To Aditya this works as expected thank you. > To Hans when i run the command i get "deja vu sans" symbolset instead . > > Le sam. 11 avr. 2020 à 10:49, Hans Hagen a écrit : > >> On 4/11/2020 10:48 AM, Aditya Mahajan wrote: >> > On Fri, 10 Apr 2020, kaddour kardio wrote: >> > >> >> Hi, if there any changes in the interface for using symbols? >> >> I tried today the example from Aditya's Blog but it shows no symbols: >> >> >> >> \definetypeface[mainfont][rm][specserif][Linux Libertine O][default] >> >> \definetypeface[mainfont][mm][math] [TeX Gyre Pagella Math][default] >> >> \definetypeface[mainfont][tt][mono] [Dejavu Mono][default] [rscale=0.8, >> >> features=none] >> >> \setupbodyfont[mainfont,11pt] >> >> \usesymbols[fontawesome] >> >> >> >> \define\FA{\dosingleargument\doFA} >> >> \def\doFA[#1]{\inlinedbox >> >>{\scale[height=1em]{\symbol[fontawesome][#1]}}} >> >> >> >> \starttext >> >> Checked box \FA[check-square-o] >> >> Unchecked box \FA[square-o] >> >> \stoptext >> >> i use luamtetex for archlinux with all luatex modules linked to lmtx >> >> folder >> > >> > The names of the symbols have changed in fontaweson 5.0. Try: >> > >> > \FA[check] \FA[check_empty] >> fwiw, if you do: >> >>context --global symb-imp-fontawesome.mkiv >> >> you get a pdf file that shows all names and symbols >> >> 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 >> >> ___ >> > > > -- > Dr YAHYAOUI Mohamed Kaddour, cardiologue . > -- Dr YAHYAOUI Mohamed Kaddour, cardiologue . ___ 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] Fontawesome in lmtx
@Hans putting otf version of fontawesome instead of ttf version made it for the command context --global symb-imp-fontawesome.mkiv Thank you for your quick response. Le sam. 11 avr. 2020 à 16:20, kaddour kardio a écrit : > this is a part of my log file. > i have ttf-fontawesome installed in my system , maybe i should switch off > to otf version? > > defining > unknown font 'fontawesome5brandsregular400', loading > aborted > fonts > defining > unable to define > 'fontawesome5brandsregular400.otf' as 'thedefinedfont--0' > fonts > defining > forced type 'otf' of > 'fontawesome5brandsregular400' not found > fonts > defining > font with asked name > 'fontawesome5brandsregular400' is not found using lookup 'file' > > Le sam. 11 avr. 2020 à 16:12, kaddour kardio a > écrit : > >> To Aditya this works as expected thank you. >> To Hans when i run the command i get "deja vu sans" symbolset instead . >> >> Le sam. 11 avr. 2020 à 10:49, Hans Hagen a écrit : >> >>> On 4/11/2020 10:48 AM, Aditya Mahajan wrote: >>> > On Fri, 10 Apr 2020, kaddour kardio wrote: >>> > >>> >> Hi, if there any changes in the interface for using symbols? >>> >> I tried today the example from Aditya's Blog but it shows no symbols: >>> >> >>> >> \definetypeface[mainfont][rm][specserif][Linux Libertine O][default] >>> >> \definetypeface[mainfont][mm][math] [TeX Gyre Pagella Math][default] >>> >> \definetypeface[mainfont][tt][mono] [Dejavu Mono][default] >>> [rscale=0.8, >>> >> features=none] >>> >> \setupbodyfont[mainfont,11pt] >>> >> \usesymbols[fontawesome] >>> >> >>> >> \define\FA{\dosingleargument\doFA} >>> >> \def\doFA[#1]{\inlinedbox >>> >>{\scale[height=1em]{\symbol[fontawesome][#1]}}} >>> >> >>> >> \starttext >>> >> Checked box \FA[check-square-o] >>> >> Unchecked box \FA[square-o] >>> >> \stoptext >>> >> i use luamtetex for archlinux with all luatex modules linked to lmtx >>> >> folder >>> > >>> > The names of the symbols have changed in fontaweson 5.0. Try: >>> > >>> > \FA[check] \FA[check_empty] >>> fwiw, if you do: >>> >>>context --global symb-imp-fontawesome.mkiv >>> >>> you get a pdf file that shows all names and symbols >>> >>> 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 >>> >>> ___ >>> >> >> >> -- >> Dr YAHYAOUI Mohamed Kaddour, cardiologue . >> > > > -- > Dr YAHYAOUI Mohamed Kaddour, cardiologue . > -- Dr YAHYAOUI Mohamed Kaddour, cardiologue . ___ 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] running lua in metafun and in ConTeXt
On 4/11/2020 4:15 PM, Jeong Dal wrote: Dear all, The problem is solved by using the namespace of lua as below: I am not sure what I did is the right way. If it is not the right way, please let me know. Thanks for reading. Best regards, Dalyoung \startluacode P={} combi = P function P.fact (n) if n <= 0 then return 1 else return n * P.fact(n-1) end end function P.ncr(n,r) return P.fact(n)/(P.fact(r)*P.fact(n-r)) end combi = { fact = fact, ncr = ncr, } \stopluacode \startbuffer[fig121] numeric n,r,s,u,dx,dy,tt; u := 1.8cm; path p, q; pair A,B,start,now; A := dir(210)*u; B := dir(-30)*u; dy := sind(30)*u; dx := 2*cosd(30)*u; for n=0 upto 4: start := n*dir(210)*u; for r=0 upto n: s := n-r; % tt := lua("mp.print(P.fact(" & decimal n & ")/(P.fact(" & decimal r & ")*P.fact(" & decimal s &" )))"); tt := lua("mp.print(P.ncr(" & decimal n & "," & decimal r & " ))"); now := start+r*right*dx; dotlabel.top(textext("$\displaystyle {" & decimal n & "\choose" & decimal r & "} = "& decimal tt & "$"),now); draw now -- (now+A); draw now -- (now+B); endfor; endfor; \stopbuffer Sunday afternoon educational moment (that you can wikify), four variants: 1 : A more metafunish alternative of your example. 2 : The same but avoiding a temporary variable. 3 : Less code and clutter, the real deal. 4 : Idem, but permits more tuning at the TeX end. \unexpanded\def\MyWhatever#1#2#3% {$\displaystyle{#1\choose #2} = #3$} \startluacode local function fact(n) if n <= 0 then return 1 else return n * fact(n - 1) end end local function whatever(n,r) return fact(n) / (fact(r) * fact(n-r)) end MP.WhateverA = whatever function MP.WhateverB(n,r) mp.quoted("%.0f",whatever(n,r)) end function MP.WhateverC(n,r) mp.quoted([[$\displaystyle{%.0f\choose %.0f} = %.0f$]],n,r,whatever(n,r)) end function MP.WhateverD(n,r) mp.quoted([[\MyWhatever{%.0f}{%.0f}{%.0f}]],n,r,whatever(n,r)) end \stopluacode \startbuffer[fig121] numeric n, r, s, u, dx, dy, tt; path p, q ; pair A, B, start, now; u := 1.8cm; A := dir(210)*u; B := dir(-30)*u; dy := sind(30)*u; dx := 2*cosd(30)*u; for n = 0 upto 4: start := n*dir(210)*u; for r = 0 upto n: s := n - r; now := start + r*right*dx; draw (now + A) -- now -- (now + B); tt := lua.MP.WhateverA(n,r) ; dotlabel.top(textext("$\displaystyle {" & decimal n & "\choose" & decimal r & "} = "& decimal tt & "$"),now); dotlabel.top(textext("$\displaystyle {" & decimal n & "\choose" & decimal r & "} = "& lua.MP.WhateverB(n,r) & "$"),now); dotlabel.top(textext(lua.MP.WhateverC(n,r)),now); dotlabel.top(textext(lua.MP.WhateverD(n,r)),now); endfor; endfor; \stopbuffer \starttext {\switchtobodyfont[11pt]\processMPbuffer[fig121]} \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] offset for background overlay
On 4/11/2020 4:15 PM, mf wrote: Hello list, this MWE is a simplified version of a real case: \startuseMPgraphic{cell:triangle} path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth yscaled 2.5 OverlayHeight ; draw p withcolor red ; \stopuseMPgraphic \defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}] \starttext \bTABLE[frame=off] \bTR \bTD[nx=2,background=triangle,align=middle] \dontleavehmode a\crlf text \eTD \eTR \bTR[toffset=1mm] \bTD left \eTD \bTD right \eTD \eTR \eTABLE \stoptext here's a very ugly solution \startuseMPgraphic{cell:triangle} fill llcorner OverlayBox -- lrcorner OverlayBox -- (center bottomboundary OverlayBox shifted (0,\MPy{foo:2}-\MPh{foo:2}+\MPd{foo:2}-\MPy{foo:1})) -- cycle withcolor red ; setbounds currentpicture to OverlayBox ; \stopuseMPgraphic \defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}] \starttext \bTABLE[frame=off] \bTR \bTD[nx=2,align=middle,height=0pt,background=triangle]\xypos{foo:1}\eTD \eTR \bTR \bTD[nx=2,align=middle] \dontleavehmode a\crlf text \eTD \eTR \bTR[toffset=1mm] \bTD \hpos{foo:2}{\strut} left \eTD \bTD right \eTD \eTR \eTABLE \stoptext it is probably possible to get some info otherwise (more efficient) if really needed (if we add some helpers) 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] offset for background overlay
Hans Hagen schrieb am 11.04.2020 um 19:41: On 4/11/2020 4:15 PM, mf wrote: Hello list, this MWE is a simplified version of a real case: \startuseMPgraphic{cell:triangle} path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth yscaled 2.5 OverlayHeight ; draw p withcolor red ; \stopuseMPgraphic \defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}] \starttext \bTABLE[frame=off] \bTR \bTD[nx=2,background=triangle,align=middle] \dontleavehmode a\crlf text \eTD \eTR \bTR[toffset=1mm] \bTD left \eTD \bTD right \eTD \eTR \eTABLE \stoptext here's a very ugly solution \startuseMPgraphic{cell:triangle} fill llcorner OverlayBox -- lrcorner OverlayBox -- (center bottomboundary OverlayBox shifted (0,\MPy{foo:2}-\MPh{foo:2}+\MPd{foo:2}-\MPy{foo:1})) -- cycle withcolor red ; setbounds currentpicture to OverlayBox ; \stopuseMPgraphic \defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}] \starttext \bTABLE[frame=off] \bTR \bTD[nx=2,align=middle,height=0pt,background=triangle]\xypos{foo:1}\eTD \eTR \bTR \bTD[nx=2,align=middle] \dontleavehmode a\crlf text \eTD \eTR \bTR[toffset=1mm] \bTD \hpos{foo:2}{\strut} left \eTD \bTD right \eTD \eTR \eTABLE \stoptext it is probably possible to get some info otherwise (more efficient) if really needed (if we add some helpers) Simpler, put the table in a frame. \startuseMPgraphic{cell:triangle} draw llcorner OverlayBox -- lrcorner OverlayBox -- center topboundary OverlayBox -- cycle withcolor red ; \stopuseMPgraphic \defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}] \starttext \startframed[frame=off,offset=1ex,loffset=2ex,roffset=2ex,toffset=2ex,background=triangle] \bTABLE[frame=off] \bTR \bTD[nx=2,align=middle] a\crlf text \eTD \eTR \bTR[toffset=1mm] \bTD left \eTD \bTD right \eTD \eTR \eTABLE \stopframed \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] \type -- extra space in TABLE
Hi all, in the following code \starttext \type{6\az12}% \az = \anycommand \bTABLE \bTR\bTD\type{6\az12}\eTD\eTR \eTABLE \stoptext there is a different behaviour of \type: while its parametr in normal text is printed out as is (expected), in the TABLE the extra space is displayed after the command. Is it ok? How could I suppress the extra space? Best wishes Tomáš ___ 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] offset for background overlay
Thanks Hans and Wolfgang. @Wolfgang: your solution is clearer, but unfortunately it works only for this MWE. In the real case the triangle extends over 2 rows, but the table has more than 2 rows. I tried grouping the first two rows in a \bTABLEbody[background=triangle], but it doesn't work. @both: \setupoverlay[hoffset=...,voffset=...]? \setupframed[backgroundhoffset=...,backgroundvoffset=...] (\bTD inherits from \framed)? Or maybe a method in MP to set the bounding box of the resulting overlay? \setupframed has already a backgroundoffset option, whose value can be: - a DIMENSION (an offset that is both horizontal and vertical) - a "frame": what does it mean? (I looked into pack-rul.mkiv, with no results) Massi Il 11/04/20 20:11, Wolfgang Schuster ha scritto: Hans Hagen schrieb am 11.04.2020 um 19:41: On 4/11/2020 4:15 PM, mf wrote: Hello list, this MWE is a simplified version of a real case: \startuseMPgraphic{cell:triangle} path p ; p := unittriangle rotated 90 xscaled 2.5 OverlayWidth yscaled 2.5 OverlayHeight ; draw p withcolor red ; \stopuseMPgraphic \defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}] \starttext \bTABLE[frame=off] \bTR \bTD[nx=2,background=triangle,align=middle] \dontleavehmode a\crlf text \eTD \eTR \bTR[toffset=1mm] \bTD left \eTD \bTD right \eTD \eTR \eTABLE \stoptext here's a very ugly solution \startuseMPgraphic{cell:triangle} fill llcorner OverlayBox -- lrcorner OverlayBox -- (center bottomboundary OverlayBox shifted (0,\MPy{foo:2}-\MPh{foo:2}+\MPd{foo:2}-\MPy{foo:1})) -- cycle withcolor red ; setbounds currentpicture to OverlayBox ; \stopuseMPgraphic \defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}] \starttext \bTABLE[frame=off] \bTR \bTD[nx=2,align=middle,height=0pt,background=triangle]\xypos{foo:1}\eTD \eTR \bTR \bTD[nx=2,align=middle] \dontleavehmode a\crlf text \eTD \eTR \bTR[toffset=1mm] \bTD \hpos{foo:2}{\strut} left \eTD \bTD right \eTD \eTR \eTABLE \stoptext it is probably possible to get some info otherwise (more efficient) if really needed (if we add some helpers) Simpler, put the table in a frame. \startuseMPgraphic{cell:triangle} draw llcorner OverlayBox -- lrcorner OverlayBox -- center topboundary OverlayBox -- cycle withcolor red ; \stopuseMPgraphic \defineoverlay[triangle][{\uniqueMPgraphic{cell:triangle}}] \starttext \startframed[frame=off,offset=1ex,loffset=2ex,roffset=2ex,toffset=2ex,background=triangle] \bTABLE[frame=off] \bTR \bTD[nx=2,align=middle] a\crlf text \eTD \eTR \bTR[toffset=1mm] \bTD left \eTD \bTD right \eTD \eTR \eTABLE \stopframed \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] running lua in metafun and in ConTeXt
Dear Hans, Thank you for your nice code. lua.MP.Whatever is something! Have a nice weekend. Best regards, Dalyoung > 2020. 4. 12. 오전 2:08, Hans Hagen 작성: > > On 4/11/2020 4:15 PM, Jeong Dal wrote: >> Dear all, >> The problem is solved by using the namespace of lua as below: >> I am not sure what I did is the right way. >> If it is not the right way, please let me know. >> Thanks for reading. >> Best regards, >> Dalyoung >> \startluacode >> P={} >> combi = P >> function P.fact (n) >> if n <= 0 then >> return 1 >> else >> return n * P.fact(n-1) >> end >> end >> function P.ncr(n,r) >> return P.fact(n)/(P.fact(r)*P.fact(n-r)) >> end >> combi = { >> fact = fact, >> ncr = ncr, >> } >> \stopluacode >> \startbuffer[fig121] >> numeric n,r,s,u,dx,dy,tt; u := 1.8cm; >> path p, q; >> pair A,B,start,now; >> A := dir(210)*u; >> B := dir(-30)*u; >> dy := sind(30)*u; >> dx := 2*cosd(30)*u; >> for n=0 upto 4: >> start := n*dir(210)*u; >> for r=0 upto n: >> s := n-r; >> % tt := lua("mp.print(P.fact(" & decimal n & ")/(P.fact(" & decimal r & >> ")*P.fact(" & decimal s &" )))"); >> tt := lua("mp.print(P.ncr(" & decimal n & "," & decimal r & " ))"); >> now := start+r*right*dx; >> dotlabel.top(textext("$\displaystyle {" & decimal n & "\choose" & decimal r >> & "} = "& decimal tt & "$"),now); >> draw now -- (now+A); >> draw now -- (now+B); >> endfor; >> endfor; >> \stopbuffer > Sunday afternoon educational moment (that you can wikify), four variants: > > 1 : A more metafunish alternative of your example. > 2 : The same but avoiding a temporary variable. > 3 : Less code and clutter, the real deal. > 4 : Idem, but permits more tuning at the TeX end. > > \unexpanded\def\MyWhatever#1#2#3% > {$\displaystyle{#1\choose #2} = #3$} > > \startluacode > local function fact(n) >if n <= 0 then >return 1 >else >return n * fact(n - 1) >end > end > > local function whatever(n,r) > return fact(n) / (fact(r) * fact(n-r)) > end > > MP.WhateverA = whatever > > function MP.WhateverB(n,r) > mp.quoted("%.0f",whatever(n,r)) > end > > function MP.WhateverC(n,r) > mp.quoted([[$\displaystyle{%.0f\choose %.0f} = %.0f$]],n,r,whatever(n,r)) > end > > function MP.WhateverD(n,r) > mp.quoted([[\MyWhatever{%.0f}{%.0f}{%.0f}]],n,r,whatever(n,r)) > end > \stopluacode > > \startbuffer[fig121] >numeric n, r, s, u, dx, dy, tt; >path p, q ; pair A, B, start, now; >u := 1.8cm; >A := dir(210)*u; >B := dir(-30)*u; >dy := sind(30)*u; >dx := 2*cosd(30)*u; >for n = 0 upto 4: >start := n*dir(210)*u; >for r = 0 upto n: >s := n - r; >now := start + r*right*dx; >draw (now + A) -- now -- (now + B); > >tt := lua.MP.WhateverA(n,r) ; > >dotlabel.top(textext("$\displaystyle {" & decimal n & "\choose" & > decimal r & "} = "& decimal tt & "$"),now); > >dotlabel.top(textext("$\displaystyle {" & decimal n & "\choose" & > decimal r & "} = "& lua.MP.WhateverB(n,r) & "$"),now); > >dotlabel.top(textext(lua.MP.WhateverC(n,r)),now); > >dotlabel.top(textext(lua.MP.WhateverD(n,r)),now); > >endfor; >endfor; > \stopbuffer > > \starttext > >{\switchtobodyfont[11pt]\processMPbuffer[fig121]} > > \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] offset for background overlay
mf schrieb am 11.04.2020 um 23:59: Thanks Hans and Wolfgang. @Wolfgang: your solution is clearer, but unfortunately it works only for this MWE. In the real case the triangle extends over 2 rows, but the table has more than 2 rows. I tried grouping the first two rows in a \bTABLEbody[background=triangle], but it doesn't work. How about nested tables: \starttext \bTABLE[width=1cm,height=1cm] \bTR \bTD A \eTD \bTD B \eTD \bTD C \eTD \bTD E \eTD \eTR \bTR \bTD E \eTD \bTD[nc=2,nr=2,strut=no,align={middle,lohi}] {\bTABLE \bTR \bTD[nc=2] X \eTD \eTR \bTR \bTD Y \eTD \bTD Z \eTD \eTR \eTABLE} \eTD \bTD H \eTD \eTR \bTR \bTD I \eTD \bTD L \eTD \eTR \bTR \bTD M \eTD \bTD N \eTD \bTD O \eTD \bTD P \eTD \eTR \eTABLE \stoptext @both: \setupoverlay[hoffset=...,voffset=...]? \setupframed[backgroundhoffset=...,backgroundvoffset=...] (\bTD inherits from \framed)? Or maybe a method in MP to set the bounding box of the resulting overlay? setbounds in combination with leftenlarged, topenlarged etc. \setupframed has already a backgroundoffset option, whose value can be: - a DIMENSION (an offset that is both horizontal and vertical) - a "frame": what does it mean? (I looked into pack-rul.mkiv, with no results) ConTeXt uses the value from the frameoffset key for backgroundoffset. \startuseMPgraphic{frameborder} draw OverlayBox withcolor blue ; \stopuseMPgraphic \defineoverlay[frameborder][\useMPgraphic{frameborder}] \setupheader[state=high] \setupfooter[state=high] \starttext \setupframed [width=4cm, height=4cm, offset=1cm] \framed{} \framed[frame=off,background=frameborder]{} \framed[frameoffset=-5mm]{} \framed[frameoffset=-5mm,frame=off,background=frameborder]{} \framed[backgroundoffset=-5mm,frame=off,background=frameborder]{} \framed[frameoffset=-5mm,backgroundoffset=frame,frame=off,background=frameborder]{} \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 ___