Re: [NTG-context] startMPpage..stopMPpage written to a separate PDF?
Gerben Wierda schrieb am 05.04.2020 um 12:27: On 5 Apr 2020, at 11:34, Hans Hagen wrote: On 4/5/2020 12:29 AM, Gerben Wierda wrote: I have a series of startMPpage—stopMPpage pairs (with MP code inbetween). These now become separate pages in a single PDF. But I need them to become separate PDF’s each during my ConTeXt run, with a name of my own choosing. Is this possible? I guess this will be problematic, but one can hope (maybe some very low level TeX trickery)... no (i would probably cook up something but it's not worth the trouble and it would add lots of ugly code deep down) but Yes, I was thinking about some low level open/writeout stuff in TeX but was scared to try. Still, a \startMPfile{pdffilename}..\stopMPfile (instead of page) would have been great... Something like this: \starttext \startbuffer[square] \startMPpage draw fullsquare scaled 10 withcolor red ; \stopMPpage \stopbuffer \typesetbufferonly[square] \startbuffer[circle] \startMPpage draw fullcircle scaled 10 withcolor green ; \stopMPpage \stopbuffer \typesetbuffer[circle] \startbuffer[triangle] \startMPpage draw fulltriangle scaled 10 withcolor blue ; \stopMPpage \stopbuffer \savebuffer[list=triangle,prefix=no,file=triangle.tex] \typesetfile[triangle.tex][] \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] startMPpage..stopMPpage written to a separate PDF?
> On 5 Apr 2020, at 12:27, Gerben Wierda wrote: > > Alternatively, I could have a step before this to turn the input XML into > many separate XMLs and have many ConTeXt runs. Probably that is the best way > to do it. Each generated XML would have all of the original XML except it > would only have one ‘view’ in it and the rest removed. Or you could write out a shell script while processing the run. function moduledata.archimate(filename) local root = xml.load(filename) warnIfVerbose( "Processing %s", filename) local shfile = io.open(tex.jobname.. ".sh", "w") local i = 1 for view in xml.collected(root,"diagrams/view") do local viewName = xml.text(view,"/name") shfile:write(string.format('mutool merge -o "%s.pdf" %s "%s.pdf" ', viewName, i, tex.jobname)) i = i + 1 …. end shfile:close() and process that shell script at the end of the run. ___ 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] startMPpage..stopMPpage written to a separate PDF?
> On 5 Apr 2020, at 11:34, Hans Hagen wrote: > > On 4/5/2020 12:29 AM, Gerben Wierda wrote: >> I have a series of startMPpage—stopMPpage pairs (with MP code inbetween). >> These now become separate pages in a single PDF. But I need them to become >> separate PDF’s each during my ConTeXt run, with a name of my own choosing. >> Is this possible? I guess this will be problematic, but one can hope (maybe >> some very low level TeX trickery)... > no (i would probably cook up something but it's not worth the trouble and it > would add lots of ugly code deep down) but Yes, I was thinking about some low level open/writeout stuff in TeX but was scared to try. Still, a \startMPfile{pdffilename}..\stopMPfile (instead of page) would have been great... > you can use for instance mutool etc to split pdf’s I can’t do that simply because it would mean lots and lots of manual work (including typing long names every time) each time I automatically produce the PDFs. I am talking hundreds of views generated anew every time and they all need to end up in a separate file. I need some sort of automatic flow. It’s OK if the PDF with all the pages is an intermediate and use a tool to split this into separate files with separate file names (so an additional step in the workflow) but I would have to create th eextraction script automatically during the ConTeXt run. Alternatively, I could have a step before this to turn the input XML into many separate XMLs and have many ConTeXt runs. Probably that is the best way to do it. Each generated XML would have all of the original XML except it would only have one ‘view’ in it and the rest removed. > > 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] startMPpage..stopMPpage written to a separate PDF?
On 4/5/2020 12:29 AM, Gerben Wierda wrote: I have a series of startMPpage—stopMPpage pairs (with MP code inbetween). These now become separate pages in a single PDF. But I need them to become separate PDF’s each during my ConTeXt run, with a name of my own choosing. Is this possible? I guess this will be problematic, but one can hope (maybe some very low level TeX trickery)... no (i would probably cook up something but it's not worth the trouble and it would add lots of ugly code deep down) but you can use for instance mutool etc to split pdf's 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] startMPpage..stopMPpage written to a separate PDF?
I have a series of startMPpage—stopMPpage pairs (with MP code inbetween). These now become separate pages in a single PDF. But I need them to become separate PDF’s each during my ConTeXt run, with a name of my own choosing. Is this possible? I guess this will be problematic, but one can hope (maybe some very low level TeX trickery)... Thanks, 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] \startMPpage ... \stopMPpage
David Arnold wrote: % \startMPpage % \includeMPgraphic{EnglishRule} % \stopMPpage you can only include a simple usable graphic, defined with \startuseMPgraphic; unique mp graphics are more tricky and involve (once we have lua in tex we can find ways around this since then we can (1) implement some of the unique housekeeping in lua and (2) fool tex with hidden expansions) Hans ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
[NTG-context] \startMPpage ... \stopMPpage
Hans, Taco, et al, There's a quote in metafun-s.pdf (page 539) that says You can embed the graphic in a \startMPpage construct and process it with TEXEXEC. In that case you have the full MetaFun functionality available. Before processing the file, TEXEXEC will do a couple of checks on the file. It will also make sure that the auxiliary files (mpt for textext’s and mpo for outline fonts) are taken care of too. I am really unsure of what this means as the code below will attest. Simply uncomment % \startMPpage % \includeMPgraphic{EnglishRule} % \stopMPpage at the end and the file will not compile. Just what can and cannot be used between a \startMPpage ... \stopMPpage pair? This is first introduced in metafun-s.pdf on page 214 and wish there were more said there. %output=pdf \setupcolors[state=start] \definecolor[gridlines][s=0.7] \startMPinclusions color gridlines; gridlines:=\MPcolor{gridlines}; \stopMPinclusions \starttext \setupMPvariables [EnglishRule] [height=1ex, width=\localhsize, color=darkred] \startuniqueMPgraphic{EnglishRule}{height,width,color} numeric height; height=\MPvar{height}; x1=0; x3=\MPvar{width}; x2=x4=.5x3; y1=y3=0; y2:=-y4=height/2; fill z1..z2..z3 z3..z4..z1 cycle withcolor \MPvar{color}; \stopuniqueMPgraphic \defineblank [EnglishRule] [medium] \def\EnglishRule% {\startlinecorrection[EnglishRule] \setlocalhsize \noindent \reuseMPgraphic{EnglishRule} \stoplinecorrection} Why is this called an English line? \startnarrower \EnglishRule Is it because they cannot draw a straight one? This could be ture after a few strong beers, but then, ow do Germans draw a line? \EnglishRule \stopnarrower \defineblank [EnglishRule] [big] Why is this called an English line? \startnarrower \EnglishRule Is it because they cannot draw a straight one? This could be ture after a few strong beers, but then, ow do Germans draw a line? \EnglishRule \stopnarrower % \startMPpage % \includeMPgraphic{EnglishRule} % \stopMPpage \stoptext %%% Local Variables: %%% mode: conTeXt-en %%% End:___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context