[NTG-context] Working with variables in MkIV (\ setvariables, \getparameters etc)
Hello ConTeXist, Is it possible go through all the keys of \setvariables (getvariable) macro and create the appropriate macros, as in the case of \getparameters macro? I mean macro like \getallvariablesfrom[myfirstnamespace], which return contents of brackets macro \setvariables[myfirstnamespace] (it mean list of all assignments key=value ...) In addition, you can assign all the variables one namespace to another namespace (or to create a loop which all variables passed and placed into the other namespace.)? Thanx Jaroslav Hajtmar Here is my inspiration of example : \setvariables[myfirstnamespace][id=1, value={text}] \starttext % \getparameters[myfirstnamespace][\getallvariablesfrom[myfirstnamespace]] % Now would be defined macros \myfirstnamespaceid (1) and \myfirstnamespacevalue (text) % Assign all the variables of [myfirstnamespace] namespace to [myotherspace] namespace? %\setvariable[myotherspace][\getallvariablesfrom[myfirstnamespace]] \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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations problems
Dear Hans and All, On Sat, Aug 18, 2012 at 10:00 PM, Michail Vidiassov mas...@iaas.msu.ru wrote: the examples from back-u3d.mkiv fail to work with latest beta (rectangled undefined message appears instead of annotation), but if \textwidth is replaced by in in the tex file 3D annotations appear OK. in the latest minimals (2012.09.06 23:03) the following example from back-u3d.mkiv fails to work \useexternalfigure [test] [test.prc] [width=0.5\textwidth, height=0.5\textwidth, display=u3d:myset:display:1, controls=u3d:myset:controls:1] \placefigure[here]{3d test}{\externalfigure[test]} while after getting rid of \texwidth the following does: \useexternalfigure [test] [test.prc] [width=3in, height=3in, display=u3d:myset:display:1, controls=u3d:myset:controls:1] \placefigure[here]{3d test}{\externalfigure[test]} Is it a bug of the example got wrong with some changes in ConTeXt. Sincerely, Michail ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Working with variables in MkIV (\ setvariables, \getparameters etc)
Am 09.09.2012 um 10:42 schrieb Jaroslav Hajtmar hajt...@gyza.cz: Hello ConTeXist, Is it possible go through all the keys of \setvariables (getvariable) macro and create the appropriate macros, as in the case of \getparameters macro? I mean macro like \getallvariablesfrom[myfirstnamespace], which return contents of brackets macro \setvariables[myfirstnamespace] (it mean list of all assignments key=value ...) In addition, you can assign all the variables one namespace to another namespace (or to create a loop which all variables passed and placed into the other namespace.)? Thanx Jaroslav Hajtmar Here is my inspiration of example : \setvariables[myfirstnamespace][id=1, value={text}] \starttext % \getparameters[myfirstnamespace][\getallvariablesfrom[myfirstnamespace]] % Now would be defined macros \myfirstnamespaceid (1) and \myfirstnamespacevalue (text) % Assign all the variables of [myfirstnamespace] namespace to [myotherspace] namespace? %\setvariable[myotherspace][\getallvariablesfrom[myfirstnamespace]] \stoptext There is no way to access the list with the parameters from \setvariables but the question why you want a command for each variable. In MkIV direct use of values in the form \myfirstnamespaceid are replaced with something like \mynamespaceparameter{id} which has the advantage that you can even use keys which haven’t been assigned before. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Working with variables in MkIV (\ setvariables, \getparameters etc)
Thanx Wolfgang. I do not know anything about such a possibility. What do you mean? Can you show a simple example? I tried several options but nothing works. Here are some examples: \setvariables[myspacename][id=1, value={value}] \getparameters[myotherspacename][id=1, value={value}] \starttext % \myspacenameid % not work % \myspacename{id} % not work % \myspacenameparameter{id} % not work % ??? \myotherspacenameid % this works only \stoptext Thanx Jaroslav Hajtmar Dne 9.9.2012 11:35, Wolfgang Schuster napsal(a): Am 09.09.2012 um 10:42 schrieb Jaroslav Hajtmarhajt...@gyza.cz: Hello ConTeXist, Is it possible go through all the keys of \setvariables (getvariable) macro and create the appropriate macros, as in the case of \getparameters macro? I mean macro like \getallvariablesfrom[myfirstnamespace], which return contents of brackets macro \setvariables[myfirstnamespace] (it mean list of all assignments key=value ...) In addition, you can assign all the variables one namespace to another namespace (or to create a loop which all variables passed and placed into the other namespace.)? Thanx Jaroslav Hajtmar Here is my inspiration of example : \setvariables[myfirstnamespace][id=1, value={text}] \starttext % \getparameters[myfirstnamespace][\getallvariablesfrom[myfirstnamespace]] % Now would be defined macros \myfirstnamespaceid (1) and \myfirstnamespacevalue (text) % Assign all the variables of [myfirstnamespace] namespace to [myotherspace] namespace? %\setvariable[myotherspace][\getallvariablesfrom[myfirstnamespace]] \stoptext There is no way to access the list with the parameters from \setvariables but the question why you want a command for each variable. In MkIV direct use of values in the form \myfirstnamespaceid are replaced with something like \mynamespaceparameter{id} which has the advantage that you can even use keys which haven’t been assigned before. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Working with variables in MkIV (\ setvariables, \getparameters etc)
Thanx Wolfgang. So far I have never worked with namespaces as follows. I thought that \setvariables macro automatically namespace for variables creates and sets the values in it. Setvariables somehow connected with the creation of macro variables in the namespace of the given name? It appears that the following example shows that it is not ... \starttext \definenamespace[myspace][name=myspace,command=yes,setup=yes,parent=one] \setupmyspace[ id=3, graphcolor=green, ] \setvariables[myspace][ id=5, graphcolor=blue, ] \myspaceparameter{id} \myspaceparameter{graphcolor} \stoptext Thanx Jaroslav Dne 9.9.2012 12:45, Wolfgang Schuster napsal(a): Am 09.09.2012 um 12:35 schrieb Jaroslav Hajtmarhajt...@gyza.cz: Thanx Wolfgang. I do not know anything about such a possibility. What do you mean? Can you show a simple example? I tried several options but nothing works. Here are some examples: \setvariables[myspacename][id=1, value={value}] \getparameters[myotherspacename][id=1, value={value}] \starttext % \myspacenameid % not work % \myspacename{id} % not work % \myspacenameparameter{id} % not work % ??? \myotherspacenameid % this works only \stoptext When you use \getparameter you have to define the command yourself, e.g. \def\mynamespaceid#1{\csname mynamespace#1\endcsname} or you use \definenamespace which creates all these commands for you: \starttext \definenamespace[one][name=one,command=yes,setup=yes,parent=one] \definenamespace[two][name=two,command=yes,setup=yes,parent=one] % With this parent setting \twoparameter uses the values from \setupone % when no value is set with \setuptwo. \unprotect \setuptwo[parent=\one] \protect \setupone[one=One,two=Two] \starttabulate \NC one:one \EQ \oneparameter{one} \NC\NR \NC one:two \EQ \oneparameter{two} \NC\NR \NC two:one \EQ \twoparameter{one} \NC\NR \NC two:one \EQ \twoparameter{two} \NC\NR \stoptabulate \setuptwo[one=1,two=2] \starttabulate \NC one:one \EQ \oneparameter{one} \NC\NR \NC one:two \EQ \oneparameter{two} \NC\NR \NC two:one \EQ \twoparameter{one} \NC\NR \NC two:one \EQ \twoparameter{two} \NC\NR \stoptabulate \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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Working with variables in MkIV (\ setvariables, \getparameters etc)
Am 09.09.2012 um 13:56 schrieb Jaroslav Hajtmar hajt...@gyza.cz: Thanx Wolfgang. So far I have never worked with namespaces as follows. I thought that \setvariables macro automatically namespace for variables creates and sets the values in it. Setvariables somehow connected with the creation of macro variables in the namespace of the given name? It appears that the following example shows that it is not … The internal functioning of both methods is more or less the same, I will begin with \getparameters. To set values as key-value-list you can use the \getparameters command, e.g. \getparameters[namespace][key1=value1,key2=value2,…] When ConTeXt process this list it takes each entry which till the next comma or the end of the list and splits it in two parts which are on the left (the “key”)and the right (the “value”) of the = sign. After that it creates a new command whose name consist of the namespace and key, e.g. “\namespacekye1” which stores the content of the key, e.g. “value1”. To create the command which stores the value context uses \csname/\endcsname which allows one to use numbers, spaces etc. as part of the key. The \setvariables command is a wrapper around \getparameters to store values in a certain namespace which can only be accessed with the \getvariable command. With \definenamespace you can generate \setup… and \define… command which use itself \getparameters to store the values but the namespace itself uses symbols (? and @) which can’t be normally used to create a command. What you always have to keep in mind is that what we call a namespace is nothing more than a certain string a command names which makes it possible to distinguish them because there a many setups which have a width key, e.g. tables can “\tablewidth” to store the value of the key while figures use “\figurewidth” to store the value etc. In reality context uses namespace like “@@ef” in MkII and in MkIV namespace have the form “123” where instead of letters numbers are used. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations problems
Am 09.09.2012 um 11:00 schrieb Michail Vidiassov mas...@iaas.msu.ru: Dear Hans and All, On Sat, Aug 18, 2012 at 10:00 PM, Michail Vidiassov mas...@iaas.msu.ru wrote: the examples from back-u3d.mkiv fail to work with latest beta (rectangled undefined message appears instead of annotation), but if \textwidth is replaced by in in the tex file 3D annotations appear OK. in the latest minimals (2012.09.06 23:03) the following example from back-u3d.mkiv fails to work \useexternalfigure [test] [test.prc] [width=0.5\textwidth, height=0.5\textwidth, display=u3d:myset:display:1, controls=u3d:myset:controls:1] \placefigure[here]{3d test}{\externalfigure[test]} while after getting rid of \texwidth the following does: \useexternalfigure [test] [test.prc] [width=3in, height=3in, display=u3d:myset:display:1, controls=u3d:myset:controls:1] \placefigure[here]{3d test}{\externalfigure[test]} Is it a bug of the example got wrong with some changes in ConTeXt. It should work when you use “width=\the\dimexpr\textwidth/2\relax” or “width=\the\dimexpr0.5\textwidth\relax”. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Working with variables in MkIV (\ setvariables, \getparameters etc)
Thanx Wolfgang for your explanations. Jaroslav Hajtmar Dne 9.9.2012 14:44, Wolfgang Schuster napsal(a): Am 09.09.2012 um 13:56 schrieb Jaroslav Hajtmarhajt...@gyza.cz: Thanx Wolfgang. So far I have never worked with namespaces as follows. I thought that \setvariables macro automatically namespace for variables creates and sets the values in it. Setvariables somehow connected with the creation of macro variables in the namespace of the given name? It appears that the following example shows that it is not … The internal functioning of both methods is more or less the same, I will begin with \getparameters. To set values as key-value-list you can use the \getparameters command, e.g. \getparameters[namespace][key1=value1,key2=value2,…] When ConTeXt process this list it takes each entry which till the next comma or the end of the list and splits it in two parts which are on the left (the “key”)and the right (the “value”) of the = sign. After that it creates a new command whose name consist of the namespace and key, e.g. “\namespacekye1” which stores the content of the key, e.g. “value1”. To create the command which stores the value context uses \csname/\endcsname which allows one to use numbers, spaces etc. as part of the key. The \setvariables command is a wrapper around \getparameters to store values in a certain namespace which can only be accessed with the \getvariable command. With \definenamespace you can generate \setup… and \define… command which use itself \getparameters to store the values but the namespace itself uses symbols (? and @) which can’t be normally used to create a command. What you always have to keep in mind is that what we call a namespace is nothing more than a certain string a command names which makes it possible to distinguish them because there a many setups which have a width key, e.g. tables can “\tablewidth” to store the value of the key while figures use “\figurewidth” to store the value etc. In reality context uses namespace like “@@ef” in MkII and in MkIV namespace have the form “123” where instead of letters numbers are used. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations problems
Dear Wolfgang and All, On Sun, Sep 9, 2012 at 4:52 PM, Wolfgang Schuster wolfgang.schus...@gmail.com wrote: in the latest minimals (2012.09.06 23:03) the following example from back-u3d.mkiv fails to work \useexternalfigure [test] [test.prc] [width=0.5\textwidth, ... It should work when you use “width=\the\dimexpr\textwidth/2\relax” or “width=\the\dimexpr0.5\textwidth\relax”. thank you, that works. Is it a permanent change of rules or the old shorter way is just temporary disabled by some ongoing unfinished development of ConTeXt code? Sincerely, Michail ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations problems
Just a follow up - the old way width=0.5\textwidth still works for png external figures. Is it considered non-kosher now and is to be changed everywhere to the new one “width=\the\dimexpr0.5\textwidth\relax” whenever possible to avoid potential problems? ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] 3D annotations problems
Am 09.09.2012 um 16:07 schrieb Michail Vidiassov mas...@iaas.msu.ru: Just a follow up - the old way width=0.5\textwidth still works for png external figures. When you use images in jpg, png or pdf format context still uses a lot of tex code where you can use this form of assignment because the values are assigned to another dimen register in tex where this is valid. \starttext \newdimen\mydimenregister \mydimenregister=10pt mydimenregister = \the\mydimenregister \mydimenregister=\textwidth mydimenregister = \the\mydimenregister \mydimenregister=.33\textwidth mydimenregister = \the\mydimenregister \stoptext When you insert a 3D graphic in your document the values of the width/height keys are read by lua which can’t handle with this assignment, what can be used in this case are only absolute values like 10pt and with \the\dimepr… you can do this even with relative value, e.g. .5\textwidth. Is it considered non-kosher now and is to be changed everywhere to the new one “width=\the\dimexpr0.5\textwidth\relax” whenever possible to avoid potential problems? Maybe Hans can add some code which checks the argument to avoid this, e.g. if argument == fit or argument == broad then return argument else return \the\dimeprargument\relax fi 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] No cmyk support in MKIV (TexLive 2012 version)?
Trying to define some spot colors using the wiki examples. I get the following error message every time I run MKIV: colors cmyk color space is not supported Here's the relevant section of my environment file: % Turn on colors. \setupcolors[rgb=no,cmyk=yes,spot=yes,state=start,overprint=yes] %\setupcolors[state=start] % Define the colors we want to use and give a print shop Pantone % equivalents to work with, % set up the cmyk fallbacks \definecolor [PantoneTwoNineFour] [c=1,m=.68,y=7,k=.28] \definecolor [PantoneThreeZeroZero] [c=1,m=.42,y=0,k=0] % Define tints of spot colors to be used in document for coloring text \definespotcolor [DarkBlue] [PantoneTwoNineFour] [p=1,e=PANTONE 294 PC] \definespotcolor [LightBlue] [PantoneThreeZeroZero] [p=1,e=PANTONE 300 PC] I do get the DarkBlue in my pdf output but no sign of the LightBlue anywhere. -- Bill Meahan Westland, Michigan USA ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Search path.
Hello, list! I am really new to ConTeXt. I am writing a book http://topologia-geral.ourproject.org/ It is written in LaTeX and I intend to migrate it to ConTeXt. I want to migrate and I want to be as far from HACKS as I can. So I want to know the recommended way to do things. One of my first difficulties comes from the search path used by texexec. It seems to me that the path searched for components, products and environments depends on the path were the script was called from. That is, it depends on the current working directory. My question (honestly) is: - Why would I want this behavior? When I write a project, product, component or environment file, why would I want the references I made to be dependent on the directory where the script was called? Shouldn't things be like the #include relative_path.h used in the C language, for example? That is, shouldn't those paths be relative to the script that refers to them? Am I missing something? André Caldas. ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] Sequence of MetaPost Pages
When I create animations using MetaPost, I typically do something like for n=1 upto N: beginfig(n); some code endfig; endfor; and a sequence of figures are created. How can I do this in ConTeXt using \startMPpage ... \stopMPpage? Troy Henderson ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Sequence of MetaPost Pages
On Sun, 9 Sep 2012, Troy Henderson wrote: When I create animations using MetaPost, I typically do something like for n=1 upto N: beginfig(n); some code endfig; endfor; and a sequence of figures are created. How can I do this in ConTeXt using \startMPpage ... \stopMPpage? (untested) \dorecurse{10} {\startMPpage label(btex On step \recurselevel etex, origin); \stopMPpage} (There is also \dostepwiserecurse if you need more control). 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Sequence of MetaPost Pages
That works great. Now I have defined a global numeric N:=8; in \startMPinclusions ... \stopMPinclusions at the be beginning of my document. All of my \startMPpage ... \stopMPpage environments understand this N, but how do I reference this value as the start value for \dostepwiserecurse? That is, I would like to do something like \dostepwiserecurse{N}{0}{-1}{ ... some code ... } Troy ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Sequence of MetaPost Pages
That works great. Now I have defined a global numeric N:=8; in \startMPinclusions ... \stopMPinclusions at the be beginning of my document. All of my \startMPpage ... \stopMPpage environments understand this N, but how do I reference this value as the start value for \dostepwiserecurse? That is, I would like to do something like \dostepwiserecurse{N}{0}{-1}{ ... some code ... } For that, you'll need to work on the TeX end. \edef\STEPS{8} \dorecurse\STEPS{} You can either use \STEPS instead of N everywhere in your code (and be careful on how TeX code is parsed, i.e., `a := \STEPS 0` will evaluate to `a := 80`), or use `N := \STEPS;` somewhere in the beginning of each `\MPpage` (the `N :\ \STEPS` can be hidden behind a macro like `\initializeAnimation`). 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Sequence of MetaPost Pages
label(decimal(n),origin); Sorry. I found the answer by wrapping the decimal() inside textext(). That is, label(textext(decimal(n)),origin); does what I want. Troy ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___