Re: [NTG-context] Asymptote or Metapost and ConTeXt parameters.
On Sat, 24 Dec 2016, Jaroslav Hajtmar wrote: It seems now, that everything at this time works as intended. Many thanks for your support. Below is a minimal example. Attached is a PDF sample result. Nice to know that it works. I tried also to experiment with the choice "object = no", as suggested by Hans, but without success. Note that it is "object=no" (without spaces around equal to) I would asking if you make any changes in filter module? Or have I misunderstood Your opinion? I will add the code between \unprotect ... \protect to the filter module after I have tested it a bit more thoroughly. 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] Asymptote or Metapost and ConTeXt parameters.
Hello Adytia. It seems now, that everything at this time works as intended. Many thanks for your support. Below is a minimal example. Attached is a PDF sample result. I tried also to experiment with the choice "object = no", as suggested by Hans, but without success. I would asking if you make any changes in filter module? Or have I misunderstood Your opinion? Thank you once again Jaroslav Hajtmar Here is minimal example: \usemodule[filter] \unprotect \appendtoks \setuevalue{set\currentexternalfilter buffer}{\externalfilter@set[\currentexternalfilter]}% \to \everydefineexternalfilter \unexpanded\def\externalfilter@set {\dodoubleargument\externalfiter@set_indeed} \starttexdefinition externalfiter@set_indeed [#1][#2]#3 % #1 = filter % #2 = options \begingroup \edef\currentexternalfilter{#1} \setupexternalfilter[#1][\c!name=,#2] \externalfilter@set_filenames \setbuffer[\externalfilter@buffer_name]#3\endbuffer \externalfilter@process_filter \stoptexdefinition \protect \defineexternalfilter [ASY] [ filtercommand={asy -tex context \externalfilterinputfile\space -o \externalfilteroutputfile}, output=\externalfilterbasefile.pdf, purge=no, cache=yes, readcommand=\ReadImage, ] \define[1]\ReadImage{\externalfigure[#1]} \define[1]\mycircle{ \setASYbuffer{ import graph; draw(Circle((0,0),#1)); }} \starttext \startASY import graph; draw((0,0)--(100,100)); \stopASY \mycircle{10} \mycircle{20} \mycircle{30} \stoptext Dne 23.12.16 20:22, ntg-context za uživatele Aditya Mahajannapsal(a): On Fri, 23 Dec 2016, Jaroslav Hajtmar wrote: > Thanks for sending Your code. It seems that it works with Asymptote. > Unfortunately, when I am trying to multiple call a macro then I get > fatal error, and then compile collapse. I do not know what it could be. When called for the first time, the code generates test-ASY.pdf file and includes it. After the second call, a new test-ASY.pdf is generated. ConTeXt generates an error because the name of the files is the same, but the content is not. There should be an option for \externalfigure to disable this check, but I couldn't find it. Here is an alternative approach, that changes the name of the PDF. \usemodule[filter] \unprotect \appendtoks \setuevalue{set\currentexternalfilter buffer}{\externalfilter@set[\currentexternalfilter]}% \to \everydefineexternalfilter \unexpanded\def\externalfilter@set {\dodoubleargument\externalfiter@set_indeed} \starttexdefinition externalfiter@set_indeed [#1][#2]#3 % #1 = filter % #2 = options \begingroup \edef\currentexternalfilter{#1} \setupexternalfilter[#1][\c!name=,#2] \externalfilter@set_filenames \setbuffer[\externalfilter@buffer_name]#3\endbuffer \externalfilter@process_filter \stoptexdefinition \protect \defineexternalfilter [MARKDOWN] [ filtercommand={pandoc -f markdown -t context \externalfilterinputfile\space -o \externalfilteroutputfile}, cache=yes, purge=no, ] \define[1]\NEW {\setMARKDOWNbuffer{This is #1}} \traceexternalfilters \starttext \startMARKDOWN This is **one** \stopMARKDOWN \NEW{**ONE**} \NEW{_TWO_} \stoptext Note that this has the same limitation as using \type{...}. The contents of \NEW{...} must have matched braces. If this works, I can include the code in t-filter (mkiv only, as I no longer want to maintain the mkii branch). 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 ___ AsymptoteCodeInConTeXt03a-Adytia.pdf Description: AsymptoteCodeInConTeXt03a-Adytia.pdf ___ 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] Asymptote or Metapost and ConTeXt parameters.
On 12/23/2016 8:22 PM, Aditya Mahajan wrote: On Fri, 23 Dec 2016, Jaroslav Hajtmar wrote: Thanks for sending Your code. It seems that it works with Asymptote. Unfortunately, when I am trying to multiple call a macro then I get fatal error, and then compile collapse. I do not know what it could be. When called for the first time, the code generates test-ASY.pdf file and includes it. After the second call, a new test-ASY.pdf is generated. ConTeXt generates an error because the name of the files is the same, but the content is not. There should be an option for \externalfigure to disable this check, but I couldn't find it. Here is an alternative approach, that changes the name of the PDF. object=no should work but even then, the backend can keep files open and flush later 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] Asymptote or Metapost and ConTeXt parameters.
On Fri, 23 Dec 2016, Jaroslav Hajtmar wrote: Thanks for sending Your code. It seems that it works with Asymptote. Unfortunately, when I am trying to multiple call a macro then I get fatal error, and then compile collapse. I do not know what it could be. When called for the first time, the code generates test-ASY.pdf file and includes it. After the second call, a new test-ASY.pdf is generated. ConTeXt generates an error because the name of the files is the same, but the content is not. There should be an option for \externalfigure to disable this check, but I couldn't find it. Here is an alternative approach, that changes the name of the PDF. \usemodule[filter] \unprotect \appendtoks \setuevalue{set\currentexternalfilter buffer}{\externalfilter@set[\currentexternalfilter]}% \to \everydefineexternalfilter \unexpanded\def\externalfilter@set {\dodoubleargument\externalfiter@set_indeed} \starttexdefinition externalfiter@set_indeed [#1][#2]#3 % #1 = filter % #2 = options \begingroup \edef\currentexternalfilter{#1} \setupexternalfilter[#1][\c!name=,#2] \externalfilter@set_filenames \setbuffer[\externalfilter@buffer_name]#3\endbuffer \externalfilter@process_filter \stoptexdefinition \protect \defineexternalfilter [MARKDOWN] [ filtercommand={pandoc -f markdown -t context \externalfilterinputfile\space -o \externalfilteroutputfile}, cache=yes, purge=no, ] \define[1]\NEW {\setMARKDOWNbuffer{This is #1}} \traceexternalfilters \starttext \startMARKDOWN This is **one** \stopMARKDOWN \NEW{**ONE**} \NEW{_TWO_} \stoptext Note that this has the same limitation as using \type{...}. The contents of \NEW{...} must have matched braces. If this works, I can include the code in t-filter (mkiv only, as I no longer want to maintain the mkii branch). 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] professional looking tables
Thank you for your help so far. Now I am close to what I'd like to achieve. I want to insert a foot on every pages except on the last page (at the end of the table). Is it possible? I have this simple code: \starttext \setupxtable[split=repeat,header=repeat,footer=repeat] \startxtable[frame=off,topframe=on,bottomframe=on,toffset=2pt,boffset=4pt] \startxtablehead \startxrow[bottomframe=off,rulethickness=2pt] \startxcell Head \stopxcell \stopxrow \stopxtablehead \startxtablenext \startxrow[topframe=off] \startxcell Continued from previous page \stopxcell \stopxrow \startxrow \startxcell Next \stopxcell \stopxrow \stopxtablenext \startxtablefoot[bottomframe=off] \startxrow \startxcell Continued on next page \stopxcell \stopxrow \stopxtablefoot \startxtablebody \startxrow \startxcell \input tufte \stopxcell \stopxrow \startxrow \startxcell \input tufte \stopxcell \stopxrow \startxrow \startxcell \input tufte \stopxcell \stopxrow \startxrow \startxcell \input tufte \stopxcell \stopxrow \startxrow \startxcell \input tufte \stopxcell \stopxrow \startxrow \startxcell \input tufte \stopxcell \stopxrow \startxrow \startxcell \input tufte \stopxcell \stopxrow \stopxtablebody \stopxtable \stoptext Thank you, bcsikos ___ 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] Asymptote or Metapost and ConTeXt parameters.
Hello Adytia. Thanks for sending Your code. It seems that it works with Asymptote. Unfortunately, when I am trying to multiple call a macro then I get fatal error, and then compile collapse. I do not know what it could be. Is it possible that my code is wrong. But it is possible that there is a stack overflow etc. It would be a need to look at why the fatal error occurs - It probably can evaluate Hans. Thanks again for your support. Below is my code. If removed commentary characters occurs advised error. Jaroslav Hajtmar \usemodule[filter] \defineexternalfilter [ASY] [ filtercommand={asy -tex context \externalfilterinputfile\space -o \externalfilteroutputfile}, output=\externalfilterbasefile.pdf, purge=no, cache=yes, readcommand=\ReadImage, ] \define[1]\ReadImage{\externalfigure[#1]} \define[1]\mycircle{ #1 - XXX \setbuffer[ASY] import graph; draw(Circle((0,0),#1)); \endbuffer \processASYbuffer[ASY] } \starttext AAA \startASY import graph; draw((0,0)--(100,100)); \stopASY BBB \mycircle{100} %CCC %\mycircle{50} %DDD %\mycircle{200} \stoptext Dne 22.12.16 5:49, ntg-context za uživatele Aditya Mahajannapsal(a): On Tue, 20 Dec 2016, Jaroslav Hajtmar wrote: > very much for your Metapost example. This I certainly sufficient for the > production of simple images for my ideas. > \define[1]\mycircle{ > \startASY > import graph; > draw(Circle((0,0),#1)); > \stopASY > } > > \starttext > \mycircle{20} > \mycircle{30} > \mycircle{40} > \stoptext It is already feasible to define something this simple using the filter module. I don't have asymptote installed on the machine that I am currently working on, but here is an example that uses pandoc. \usemodule[filter] \defineexternalfilter [MARKDOWN] [ filtercommand={pandoc -f markdown -t context \externalfilterinputfile\space -o \externalfilteroutputfile}, cache=yes, purge=no, % Just for testing. May be removed. ] \define[1]\TEST {\setbuffer[MARKDOWN]This is #1\endbuffer \processMARKDOWNbuffer[MARKDOWN]} \starttext \startMARKDOWN This is **one** \stopMARKDOWN \TEST{**ONE**} \TEST{_TWO_} \stoptext With this method, the results are not cached. Let me know if this works for your needs. 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 ___ ___ 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 ___