Re: [NTG-context] How to write readable source files?
On 2021-05-29, Hans Hagen wrote: > so what does vim expect? isn't there some kind of common format for lexers? The output I need is very simple: syn keyword Group1 ... syn keyword Group2 ... ... where Group1, Group2, ... define arbitrary groups of keywords. For instance, for MetaFun I currently have `mpDef` (MetaPost def macro), `mpVardef` (MetaPost vardef), `mpPrimaryDef`, `mpSecondaryDef`, `mpTertiaryDef`, `mpCommand`, `mpConstant`, `mpVariable`, `mpType`, `mpNewInternal`, and a few others. An excerpt from the current syntax file looks like this: ... " mp-base.mpiv syn keyword mpNumExp graypart syn keyword mpType graycolor greycolor syn keyword mpConstant cyan magenta yellow " mp-butt.mpiv syn keyword mpDef predefinedbutton some_button syn keyword mpConstant context_butt " mp-char.mpiv syn keyword mpDef flow_begin_chart flow_begin_sub_chart syn keyword mpDef flow_chart_draw_comment flow_chart_draw_exit ... syn keyword mpVardef flow_xy_on_grid flow_xy_right flow_xy_top syn keyword mpVardef flow_y_on_grid syn keyword mpVariable flow_arrowtip flow_chart_background_color syn keyword mpVariable flow_chart_offset flow_comment_offset syn keyword mpVariable flow_connection_arrow_size ... This fine-grained classification allows for great flexibility when defining syntax highlighting, because each group can have different properties (and the user can customize that), although by default several groups are highlighted in the same way (e.g., all macros have the same highlighting by default). Nicola ___ 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] Shading and transparency
On Thu, 12 Jul 2018 22:59:05 +0200 Hans Hagen wrote: > hm, I'm puzzled as a shade doesn't go between colors + transparent > but from one color to another (in the same color space) and > transparency is just a different mechanism > > maybe it was some side effect of chosen values / vectors that gave > the combined impression (which is why i want to see the pdf made by > context that you use as reference) I just checked some older projects and the older versions. I used a mix between - linear_shade… - withshading("linear"… - withshademethod "linear" … depending on the age of the project. And I fail to find a project using transparent shading where the transparency is done in context. I could not get it working now on the older versions. Maybe you're right and it has never worked the way I thought it had. Sorry for the noise. > \setupbackgrounds [page] [background=color, backgroundcolor=lightgray] > > \starttext > > \startuseMPgraphic{test} > graycolor white; white := 1 ; > fill OverlayBox > withshademethod "linear" > withshadedirection shadedup > withshadefactor 1.5 > withshadecolors (.85white,white) >% withtransparency (multiplytransparent,.7) > withtransparency (normaltransparent,.7) > \stopuseMPgraphic > > \defineoverlay[test][\useMPgraphic{test}] > > \framed >[align=middle,background={foreground,test}] >{\samplefile{sapolsky}} > > \stoptext That's basically shading to the background colour, which gives the impression of transparency. I've been using that. Works most of the time. But it's not the same. See the attached file and compare. I guess I'll keep using the external file overlay then. > > Just run the first example with an old context version. The file > > gradient-t from my last mail was created using inkscape as I don't > > want a single project to depend on two different context versions. > you're kidding ... i have no old context on my machine Silly me :) Marco 0nC.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 ___
Re: [NTG-context] Shading and transparency
On 7/12/2018 10:08 PM, Marco Patzer wrote: On Thu, 12 Jul 2018 11:21:45 +0200 Hans Hagen wrote: For the old implementation (pre 2016-ish) I had a working solution because shading to transparent colours just worked (at least in my case of a simple transparent shade, nothing fancy), but not so any longer. With the new implementation I couldn't get it working. But we discussed that at some point in the past. I believe the gist of it was “shade-to-transparent is gone”. i'm not ssure what shade to transparency means I mean a shade from a colour (e.g. black) to transparent. For instance this used to work pre 2016: \setupbackgrounds [page] [background=color, backgroundcolor=lightgray] \definecolor [trans] [a=multiply, t=1, s=1] \starttext \startMPcode path p; p:=fullsquare xyscaled (5cm, 5cm); fill p withshading("linear", ulcorner p, llcorner p) withfromshadecolor \MPcolor{white} withtoshadecolor \MPcolor{trans}; \stopMPcode \stoptext The shade goes from white to transparent (here lightgray, that's the page colour). I assume you have an older context laying around to run the example above. ... shades can be transparent currently Yes, but the *whole* shade is made transparent. Currently I don't know a way to shade from e.g. black to transparent (no colour). The colour involved in the shading can't have transparency, or if they do one has to use \MPcoloronly to get rid of the transparency part. hm, I'm puzzled as a shade doesn't go between colors + transparent but from one color to another (in the same color space) and transparency is just a different mechanism maybe it was some side effect of chosen values / vectors that gave the combined impression (which is why i want to see the pdf made by context that you use as reference) anyway, it helps to be in the same color space \setupbackgrounds [page] [background=color, backgroundcolor=lightgray] \starttext \startuseMPgraphic{test} graycolor white; white := 1 ; fill OverlayBox withshademethod "linear" withshadedirection shadedup withshadefactor 1.5 withshadecolors (.85white,white) % withtransparency (multiplytransparent,.7) withtransparency (normaltransparent,.7) \stopuseMPgraphic \defineoverlay[test][\useMPgraphic{test}] \framed [align=middle,background={foreground,test}] {\samplefile{sapolsky}} \stoptext So the above old syntax roughly translated to the current implementation: \setupbackgrounds [page] [background=color, backgroundcolor=lightgray] \definecolor [trans] [a=multiply, t=1, s=1] \starttext \startMPcode path p; p:=fullsquare xyscaled (5cm, 5cm); fill p withshademethod "linear" withshadevector (3, 0) %% since "trans" contains transparency, one has to use \MPcoloronly withshadecolors (white, \MPcoloronly{trans}) withtransparency (.5, .5) %% withtransparency \MPtransparency{trans} ; \stopMPcode \stoptext .. so how did that old file (uncompressed pdf) look like then Just run the first example with an old context version. The file gradient-t from my last mail was created using inkscape as I don't want a single project to depend on two different context versions. you're kidding ... i have no old context on my machine 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] bad argument #1 to 'gsub'
Hey folks, This code, as far as I remember, was working fine a few days ago but now craps out with: system begin file Source/Handbook.tex at line 1 system begin file Source/Environment at line 2 ! LuaTeX error ...text/tex/texmf-context/tex/context/base/data-env.lua:234: bad argument #1 to 'gsub' (string expected, got nil). system tex error on line 1 in file Source/Handbook.tex: LuaTeX error ... 1 \startproduct Handbook 2 \environment Source/Environment /Makefile - CONTEXT_PRODUCT = Source/Handbook.tex ALL_SOURCE = $(shell find Source/ -type f -name '*.tex' -exec echo {} \; | sed 's/ /\\ /g') OUTPUT = Handbook.pdf CONTEXT_OPTIONS = --purgeresult --nonstopmode all: $(OUTPUT) Makefile $(OUTPUT): $(ALL_SOURCE) context $(CONTEXT_PRODUCT) --result=$(OUTPUT) $(CONTEXT_OPTIONS) clean: @ context --purgeall --nonstopmode --noconsole # /dev/null @ rm -vf $(OUTPUT) Handbook.pdf -- /Source/Environment.tex - \startenvironment Environment % Speedup typescripting considerably at the cost of using additional memory... \preloadtypescripts %\usemodule[units,simplefonts] \usemodule[units] % Setup PDF metadata... \setupinteraction [state=start, color=red, title=Handbook] % Show the PDF bookmarks and expand to the chapter and section level... \placebookmarks[chapter,section,subsection,subsubsection][chapter,section] \setupinteractionscreen[option=bookmark] \setupbackgrounds [rightpage] [background=] % Set compression level, default is 3, so set to maximum... \setupbackend [level=9] \setupsystem [\c!random=\v!big] \setuplayout [\c!location=\v!middle, \c!style=\ss, \c!backspace=2.5cm, \c!topspace=1.5cm, \c!width=16cm, \c!margindistance=.25cm, \c!margin=2.5cm, \c!height=\v!middle] % re-defined because the default rscale=1.075 for modern doesn't % look right \starttypescript [palatino] \definetypeface [palatino] [rm] [serif] [palatino] [default] \definetypeface [palatino] [ss] [sans] [modern] [default] \definetypeface [palatino] [tt] [mono] [modern] [default] \definetypeface [palatino] [mm] [math] [palatino] [default] \stoptypescript \usetypescript[palatino][ec] \setupbodyfont[palatino,11pt] %\setupbodyfont[ubuntu,11pt][file:ubuntu-r][features=default] \definefontsynonym[chapternumberfont][RegularBold] \definefontsynonym[chaptertextfont] [RegularBold] \definebodyfont[11pt][rm][bfe=RegularBold at 30pt] \definebodyfont[11pt][rm][bft=RegularBold at 30pt] %\setmainfont[Ubuntu] %\switchtobodyfont[11pt] \definelayout [fullpage] [\c!backspace=0pt, \c!topspace=0pt, \c!width=\v!middle, \c!height=\v!middle, \c!header=0pt, \c!footer=0pt] \setuppagenumbering [\c!alternative=\v!doublesided] \def\startchapter#1% {\chapter[#1]{#1}\index{#1}} \def\startsection#1% {\section[#1]{#1}\index{#1}} \def\startsubsection#1% {\subsection[#1]{#1}\index{#1}} \def\startsubsubsection#1% {\subsubsection[#1]{#1}\index{#1}} \def\StartTimelineDate#1% {\subsubsubject{\bf #1}} \def\StopTimelineDate% { \crlf } \def\StartTimelineDocument% { \crlf \startframedtext[width=broad,bottom=\vss,top= \vss,align=right,corner=round] \it } \def\StopTimelineDocument% { \stopframedtext \crlf } % Usage: \href{http://www.someurl.com}{Text} \def\href#1#2{\useURL[#2][{#2}][][{#1}]\goto{\url[#2]}[url(#1)]} \def\ahref#1{\color[linkcolor]{\ttx \href{#1}{#1}}} \def\fullahref#1{\color[linkcolor]{\ttx \href{#1}{#1}}} \def\mailto#1{\useURL[#1][mailto:#1][][#1]\from[{#1}]} \def\MailTo#1#2{\useURL[#1][mailto:#1][][#2]\from[{#1}]} \def\ShellExample#1 { \blank \startframedtext[width=broad,bottom=\vss,top= \vss,align=right,corner=round] \tt {#1} \stopframedtext \blank } \def\startexample {\blank \begingroup} \def\stopexample {\endgroup \blank} \def\startreality {\blank \page[\v!preference] \begingroup} \def\stopreality {\relax \endgroup \blank} \defineframedtext [MiniFile] [\c!width=25em, \c!offset=0.25ex, \c!bodyfont=7pt, \c!background=\v!color, \c!backgroundcolor=GrayColor, \c!backgroundoffset=.25ex, \c!frame=\v!off, \c!before=, \c!after=] % Number formulae etc. using the chapter number... \setupnumbering [way=bychapter] \setuppagenumbering [\c!location=] \setuptolerance [\v!verytolerant,\v!stretch] \setupblank [\v!medium] \setupwhitespace [\v!medium] \setuptyping [\c!blank=\v!medium] \setupheadertexts [\v!margin] [][\hfill\pagenumber\hfill] \setupfootertexts [\v!margin] [][{\hfill\doifnotmode{*\v!frontpart}{\getmarking[\v!chapter\v! number]}\hfill}] \setupheadertexts [\v!text] [][{\hfill\getmarking[\v!chapter]\hfill}] %\setupfootertexts % [\v!text] % [][{\hfill\getmarking[\v!section]\hfill}] \setupbodyfontenvironment [default] [em=italic
Re: [NTG-context] Problem with chem module
On Sat, 2011-06-18 at 11:32 +0200, Hans Hagen wrote: minimal complete file needed as we need to see what is your font setup Hey Hans, The line containing the problematic chemical line is this one: \chemical{CO_2,PLUS,H_2,PLUS,GIVES,PLUS,O_2,PLUS,CO} The error is: ! Math error: parameter \Umathlimit_below_vgap\textstyle is not set. My environment follows: % The environment file is used to setup the typesetting that relate to % any product, but at present, just the crew handbook... \startenvironment Environment \preloadtypescripts \usemodule[units,chemic] % Setup PDF metadata... \setupinteraction [state=start, color=red, title=Handbook, subtitle=Bazaar revision \cldcontext{os.resultofbzr revno}] % Show the PDF bookmarks and expand to the chapter and section level... \placebookmarks[chapter,section,subsection][chapter,section] \setupinteractionscreen[option=bookmark] \setupbackgrounds [rightpage] [background=] % Set compression level, default is 3, so set to maximum... \setupbackend [level=9] \setupsystem [\c!random=\v!big] \setuplayout [\c!location=\v!middle, \c!style=\ss, \c!backspace=2.5cm, \c!topspace=1.5cm, \c!width=16cm, \c!margindistance=.25cm, \c!margin=2.5cm, \c!height=\v!middle] % re-defined because the default rscale=1.075 for modern doesn't % look right \starttypescript [palatino] \definetypeface [palatino] [rm] [serif] [palatino] [default] \definetypeface [palatino] [ss] [sans] [modern] [default] \definetypeface [palatino] [tt] [mono] [modern] [default] \definetypeface [palatino] [mm] [math] [palatino] [default] \stoptypescript \usetypescript[palatino][ec] \setupbodyfont[palatino,11pt] \definefontsynonym[chapternumberfont][RegularBold] \definefontsynonym[chaptertextfont] [RegularBold] \definebodyfont[11pt][rm][bfe=RegularBold at 30pt] \definebodyfont[11pt][rm][bft=RegularBold at 30pt] \definelayout [fullpage] [\c!backspace=0pt, \c!topspace=0pt, \c!width=\v!middle, \c!height=\v!middle, \c!header=0pt, \c!footer=0pt] \setuppagenumbering [\c!alternative=\v!doublesided] \def\startchapter#1% {\chapter[#1]{#1}\index{#1}\bookmark{#1}} \def\startsection#1% {\section[#1]{#1}\index{#1}\bookmark{#1}} \def\startsubsection#1% {\subsection[#1]{#1}\index{#1}\bookmark{#1}} \def\startsubsubsection#1% {\subsubsection[#1]{#1}\index{#1}\bookmark{#1}} \def \href#1#2{\useURL[#2][{#2}][][{#1}]\goto{\url[#2]}[url(#1)]} \def\ahref#1{\color[linkcolor]{\ttx \href{#1}{#1}}} \def\fullahref#1{\color[linkcolor]{\ttx \href{#1}{#1}}} \def\startexample {\blank \begingroup} \def\stopexample {\endgroup \blank} \def\startreality {\blank \page[\v!preference] \begingroup} \def\stopreality {\relax \endgroup \blank} \defineframedtext [MiniFile] [\c!width=25em, \c!offset=0.25ex, \c!bodyfont=7pt, \c!background=\v!color, \c!backgroundcolor=GrayColor, \c!backgroundoffset=.25ex, \c!frame=\v!off, \c!before=, \c!after=] % Number formulae etc. using the chapter number... \setupnumbering [way=bychapter] \setuppagenumbering [\c!location=] \setuptolerance [\v!verytolerant,\v!stretch] \setupblank [\v!medium] \setupwhitespace [\v!medium] \setuptyping [\c!blank=\v!medium] \setupheadertexts [\v!margin] [][\hfill\pagenumber\hfill] \setupfootertexts [\v!margin] [][{\hfill\doifnotmode{*\v!frontpart}{\getmarking[\v!chapter\v! number]}\hfill}] \setupheadertexts [\v!text] [][{\hfill\getmarking[\v!chapter]\hfill}] \setupfootertexts [\v!text] [][{\hfill\getmarking[\v!section]\hfill}] \setupbodyfontenvironment [default] [em=italic] \setupsectionblock[\v!frontpart] [\c!page=\v!yes] \setupsectionblock[\v!bodypart] [\c!page=\v!yes] \setupsectionblock[\v!appendix] [\c!page=\v!yes] \setupsectionblock[\v!frontpart] [\c!before=,\c!after=] \setuphead [\v!chapter] [\c!command=\PlaceSection, \c!page=\v!yes, \c!before=, \c!header=\v!nomarking, \c!style=\bfd] \setuphead [\v!title] [\c!command=\PlaceSection, \c!page=\v!right, \c!before=, \c!header=\v!nomarking, \c!style=\bfd] \setuphead [\v!section] [\c!command=\PlaceSection, \c!inbetween=, \c!style=\bfb] \setuphead [\v!subsection] [\c!command=\PlaceSection, \c!before=\blank, \c!style=\bfa] \setuphead [\v!subsubsection] [\c!command=\PlaceSection, \c!before=\blank, \c!style=\bsa] \def\PlaceSection#1#2% {\goodbreak \vbox {\localheadsetup \begstrut \inleftmargin{\hbox to \leftmarginwidth{\hss#1\hss}}% #2}} \setupcaptions[width=14cm,align=right] \setMPtext{text}{some test text
Re: [NTG-context] ConTeXt-ifying Kile
] \definetabulate[name][name][text] \definetext[name][position][text][text][text] # \definetextbackground \definetextposition[name][settings] # \definetextvariable[settings][???][???] \definetype[name][settings] # \definetypeface \definetyping[file|typing|name][settings] \defineversion[name][numbers] # \defineXMLargument # \defineXMLcommand # \defineXMLenvironment # \defineXMLenvironmentsave # \defineXMLgrouped # \defineXMLgsave # \defineXMLgstore # \defineXMLignore # \defineXMLnested # \defineXMLpickup # \defineXMLprocess # \defineXMLsave # \defineXMLsavecontent # \defineXMLsingular # \defineXMLstore # \defXMLstring \description{text}text \determineheadnumber[section] \determinelistcharacteristics[names][settings] # \digits \disableinteractionmenu[position|name][references] # \disablemode # \doglobal # \dogotopar # \doif # \doifcommon # \doifcommonelse # \doifdefined # \doifdefinedelse # \doifelse # \doifelsenothing # \doifelsevalue # \doiffieldelse # \doifflagged # \doifinset # \doifinsetelse # \doifmode # \doifmodeelse # \doifnextcharelse # \doifnot # \doifnotcommon # \doifnotflagged # \doifnothing # \doifnotinsetelse # \doifnotmode # \doifnotvalue # \doifsomething # \doiftext # \doiftextelse # \doifundefined # \doifundefinedelse # \doifvalue # \doifXMLdata # \doifXMLdataelse # \doifXMLop # \doifXMLparelse # \doloop # \donothing # \dontleavehmode \donttest # \dorecurse # \dostepwiserecurse # \dowithnextbox # \dowithnextboxcontent # \empty \emptylines[number] # \emptytoks # \enablemode # \endstrut \enumeration # \environment # \EQ # \eTABLE # \eTABLEbody # \eTABLEfoot # \eTABLEhead # \eTABLEnext # \eTD # \eTH # \eTR # \exitloop # \expanded \externalfigure[file][settings] \field[name] \fieldstack[name][names][settings] \fillinfield[text]{text} \fillinline[settings] \fillinrules[settings]{text}{text} \fillintext[settings]{text}{text} \fitfield[name] \fixedspaces # \FLOWchart # \flushcollector # \flushlayer # \flushXMLelement \followprofile{text}[text] \followprofileversion{text}[text][text] \followversion{text}[text] \footnote[reference]{text} \footnotetext[reference]{text} \forceblocks[names][names] # \forgetall # \FR \fraction{text}{text} \framed[settings]{text} \framedtext[settings] \from[reference] \getbuffer[name] # \getfiguredimensionsonly # \getmarking[name][options] # \getvalue # \getvariable # \globalletvalue \godown[dimension] \goto{text}{text}[references] \gotobox{text}[references] \graycolor[text] \grid[options] # \gsaveXMLasdata \hairline \head[references] \headnumber[section] \headtext{text} # \hfilll \hideblocks[names][names] \high{text} # \HL \hl[number] # \hpos # \hspace # \ifconditional # \ifdefined # \iftrialtypesetting # \ifundefined \in{text}{text}[reference] # \includeFLOWchart # \includemenu # \increment \indentation \indenting[options] \inframed[settings]{text} \ininner[+|-|low][reference]{text} \inleft[+|-|low][reference]{text} \inline[reference] \inmargin[+|-|low][reference]{text} \inothermargin[+|-|low][reference]{text} \inouter[+|-|low][reference]{text} \inright[+|-|low][reference]{text} \installlanguage[name][options] \interactionbar[settings] \interactionbuttons[settings][names] \item[references] \items[settings]{text} \its[references] \keepblocks[names][all|names] \labeling[reference] \labels[name] \labeltext{text} \language[language code] \leftaligned{text} # \letgvalue # \letvalue \listsymbol[name]{text} # \loadmapfile \loadsorts \loadsynonyms # \localhsize \logfields \lohi[low]{text}{text} \low{text} # \LR \mainlanguage[language code] \mar[references]{text} \marginrule[number]{text} \margintext[+|-|low][reference]{text} \marking[name]{text} \markversion \mathematics{text} \mediaeval{text} \midaligned{text} \mirror{text} \MONTH{text} \month{text} \moveongrid[options] # \MR \name{text} # \NC # \newcounter # \nextbox \nextsection \nocap{text} \noheaderandfooterlines \noindenting \nolist{text} \nomarking{text} \nomoreblocks \nomorefiles \nop \nospace \note[reference] \notopandbottomlines \nowhitespace # \NR \numbers{text} \overbar{text} \overbars{text text} # \overlaybutton # \overlayfigure \overstrike{text} \overstrikes{text text} \packed \page[options] \pagereference[reference] \pagetype[name] \paragraph \part[references]{text} \periods[number] \placebookmarks[names][names|all] \placecombinedlist[name][settings] \placecombinedlist[name][settings] # \placefigure \placefloat[options][references]{text}{text} \placefootnotes[settings] \placeformula[references]{text}$$ $$ # \placelayer \placelegend{text}{text} \placelist[names][settings] \placelistoffloats \placelistofsorts \placelistofsynonyms \placelocalfootnotes[settings] \placelogos[names] \placeongrid[settings{text} \placeontopofeachother{text}{text} \placereferencelist[names] \placeregister[name][settings] \placeregister[settings] \placerule[name] \placesidebyside{text}{text} \placesubformula[references]{text}$$ $$ \placetextvariable[name] # \plusone # \plustwo \position(numbers){text} \positiontext[name]{text} # \prependtoks
Re: [NTG-context] gray scale conversion of colored text
Peter Rolf wrote: Hi, I currently have a problem with the conversion of some mp graphics into gray scale. The mp graphics themself look great, but *text is always converted to black*, regardless of its real color. Is there a way to fix this? Sorry, I made a mistake. The text that is used inside MP has the correct gray value. Only the ConTeXt part always uses black as textcolor. So my problem is, that want to use colored text in a non colored document. Something like \setupcolors[conversion=always] \starttext \setbox\scratchbox\hbox{An example text.}% \bgroup\graycolor[cyan]\copy\scratchbox\egroup \startcolor[green]\copy\scratchbox\stopcolor \box\scratchbox \stoptext This always gives me black text, as color is not activated. How do I get the correct gray scale values for the text? Peter ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context