[NTG-context] Creating TeX dimensions and counters registers directly in Lua
Hello all, Is it possible to create a new dimension ConTeXt register directly in Lua, or I have to first create the ConTeXt dimensional register and then to subsequently assign it a value? Here is example: \starttext \newdimen\mydimension \directlua{tex.setdimen(mydimension, 123)} \stoptext works fine, but all like: \starttext \directlua{tex.print([[\newdimen\myotherdimension]])} \directlua{tex.setdimen(myotherdimension, 123)} \directlua{tex.newdimen(myotherdimension)} etc... \stoptext fails. In addition, I am interested in whether directly in Lua to create a new counter as in the previous. \starttext \newcount\mycount \directlua{ tex.setcount(mycount,125) } again works, but anything like: \starttext \directlua{tex.print([[\newcount\myothercount]])} \directlua{tex.newcount(myothercount)} etc... \stoptext again fails... Is there any source or examples to study anything about it? Thanx Jaroslav ___ 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] Creating TeX dimensions and counters registers directly in Lua
Am 22.08.2012 um 09:19 schrieb Jaroslav Hajtmar hajt...@gyza.cz: Hello all, Is it possible to create a new dimension ConTeXt register directly in Lua, or I have to first create the ConTeXt dimensional register and then to subsequently assign it a value? Here is example: \starttext \newdimen\mydimension \directlua{tex.setdimen(mydimension, 123)} \stoptext works fine, but all like: \starttext \directlua{tex.print([[\newdimen\myotherdimension]])} \directlua{tex.setdimen(myotherdimension, 123)} \directlua{tex.newdimen(myotherdimension)} etc... \stoptext fails. In addition, I am interested in whether directly in Lua to create a new counter as in the previous. \starttext \newcount\mycount \directlua{ tex.setcount(mycount,125) } again works, but anything like: \starttext \directlua{tex.print([[\newcount\myothercount]])} \directlua{tex.newcount(myothercount)} etc... \stoptext again fails... Is there any source or examples to study anything about it? AFAIK there is no tex.setdimen but what’s the problem to use Lua tables to save the values. \starttext \ctxlua{mydimension = number.topoints(1)} \ctxlua{context(mydimension)} \blank \ctxlua{myotherdimension = 123456} \ctxlua{context(number.tocentimeters(myotherdimension))} \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] Struggling with ConTeXt
Thank you for the tips. Here, I cleaned up the code some more (sorry to have left stuff over last time),. I added some explanations to make my issue clearer \startusableMPgraphic{myFrame} draw OverlayBox withpen pencircle scaled 1pt withcolor green; draw (currentpicture enlarged 2cm) withcolor red withpen pencircle scaled 2pt; \stopusableMPgraphic \defineoverlay[myOverlay][\useMPgraphic{myFrame}] \defineframedtext[myStatement][frame=off] \setupframedtexts[myStatement][background=myOverlay,offset=overlay,autowidth=force] \starttext \framed[strut=no]{\startmyStatement FIRST TEST\stopmyStatement} In the first test, I would like the black box to have the dimensions of the red box. \blank[big,big,big,big,big,big,big,big,big,big] \placefigure[left,none]{}{\startmyStatement SECOND TEST\stopmyStatement} In the second test, I'm going to demonstrate the issue by flowing text around the framed text, the green color {\em and the red color} shouldn't touch the flowing text as I want the float box to include the text box {\em and the overlay box.} Best regards, Olivier ___ 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] Struggling with ConTeXt
On Wed, 22 Aug 2012, Olivier Binda wrote: Thank you for the tips. Here, I cleaned up the code some more (sorry to have left stuff over last time),. I added some explanations to make my issue clearer \startusableMPgraphic{myFrame} draw OverlayBox withpen pencircle scaled 1pt withcolor green; draw (currentpicture enlarged 2cm) withcolor red withpen pencircle scaled 2pt; \stopusableMPgraphic \defineoverlay[myOverlay][\useMPgraphic{myFrame}] \defineframedtext[myStatement][frame=off] \setupframedtexts[myStatement][background=myOverlay,offset=overlay,autowidth=force] \starttext \framed[strut=no]{\startmyStatement FIRST TEST\stopmyStatement} In the first test, I would like the black box to have the dimensions of the red box. \defineframed[myStatement][background=myOverlay, offset=overlay,width=fit] \dontleavehmode\framed[strut=no, offset=2cm]{\myStatement{FIRST TEST}} In the first test, I would like the black box to have the dimensions of the red box. \blank[big,big,big,big,big,big,big,big,big,big] \placefigure[left,none]{}{\startmyStatement SECOND TEST\stopmyStatement} In the second test, I'm going to demonstrate the issue by flowing text around the framed text, the green color {\em and the red color} shouldn't touch the flowing text as I want the float box to include the text box {\em and the overlay box.} \placefigure[left,none]{}{\framed[strut=no,offset=2cm]{\myStatement{SECOND TEST}}} If needed, you can hide this behind macros: \def\startmyStatement {\framed[struct=no, offset=2cm]\bgroup\myStatement\bgroup} \def\stopmyStatement {\egroup\egroup} 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] Creating TeX dimensions and counters registers directly in Lua
Thanks Wolfgang for the reply, but I must have misunderstood. My point is, that TeX registers was subsequently visible and usable in TeX (eg for width or height of boxes, etc.) Eg. for example, \the\mydimension can see that this does not occur! In addition, I solve the problem at LuaTEX, so ConTeXt converting functions do not work etc. .. Thanx Jaroslav Here is another example: \starttext \newdimen\mytexdimension \mytexdimension=100pt \ctxlua{myluadimension = number.topoints(1)} \ctxlua{context(myluadimension)} \the\mytexdimension \hbox to\mytexdimension{X} % FAILS %\the\myluadimension %\hbox to\myluadimension{X} \stoptext Dne 22.8.2012 9:43, Wolfgang Schuster napsal(a): \starttext \ctxlua{mydimension = number.topoints(1)} \ctxlua{context(mydimension)} \blank \ctxlua{myotherdimension = 123456} \ctxlua{context(number.tocentimeters(myotherdimension))} \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] Struggling with ConTeXt
On 22/08/2012 10:42, Aditya Mahajan wrote: On Wed, 22 Aug 2012, Olivier Binda wrote: Thank you for the tips. Here, I cleaned up the code some more (sorry to have left stuff over last time),. I added some explanations to make my issue clearer \startusableMPgraphic{myFrame} draw OverlayBox withpen pencircle scaled 1pt withcolor green; draw (currentpicture enlarged 2cm) withcolor red withpen pencircle scaled 2pt; \stopusableMPgraphic \defineoverlay[myOverlay][\useMPgraphic{myFrame}] \defineframedtext[myStatement][frame=off] \setupframedtexts[myStatement][background=myOverlay,offset=overlay,autowidth=force] \starttext \framed[strut=no]{\startmyStatement FIRST TEST\stopmyStatement} In the first test, I would like the black box to have the dimensions of the red box. \defineframed[myStatement][background=myOverlay, offset=overlay,width=fit] \dontleavehmode\framed[strut=no, offset=2cm]{\myStatement{FIRST TEST}} In the first test, I would like the black box to have the dimensions of the red box. \blank[big,big,big,big,big,big,big,big,big,big] \placefigure[left,none]{}{\startmyStatement SECOND TEST\stopmyStatement} In the second test, I'm going to demonstrate the issue by flowing text around the framed text, the green color {\em and the red color} shouldn't touch the flowing text as I want the float box to include the text box {\em and the overlay box.} \placefigure[left,none]{}{\framed[strut=no, offset=2cm Thanks for the help. But I'm affraid that this won't do as I won't know/I am not supposed to know the dimensions of the bounding box of the overlay I'll use. :/ For the sake of the minimal example, I only enlarged the picture by 2cm, but in real production situations, the bounding box is going to be enlarged by random offset, because the overlay will have various parts with weird shapes (super ellipse, squeezed rectangles) that go beyond the original text boundaries (like in the Zapf frametext example of the Context manual : the title is protruding out of the main box and if you put weird stuff in there, you won't know the dimensions). I don't want to manually calculate those offsets, I would like metapost to pass it's bounding box dimensions for the overlay to context so that it automatically applies the correct offset to the text+overlay ]{\myStatement{SECOND TEST}}} If needed, you can hide this behind macros: \def\startmyStatement {\framed[struct=no, offset=2cm]\bgroup\myStatement\bgroup} \def\stopmyStatement {\egroup\egroup} 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 ___ ___ 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] Creating TeX dimensions and counters registers directly in Lua
On 22-8-2012 11:09, Jaroslav Hajtmar wrote: Thanks Wolfgang for the reply, but I must have misunderstood. My point is, that TeX registers was subsequently visible and usable in TeX (eg for width or height of boxes, etc.) Eg. for example, \the\mydimension can see that this does not occur! In addition, I solve the problem at LuaTEX, so ConTeXt converting functions do not work etc. .. Thanx Jaroslav Here is another example: \starttext \newdimen\mytexdimension \mytexdimension=100pt \ctxlua{myluadimension = number.topoints(1)} \ctxlua{context(myluadimension)} \the\mytexdimension \hbox to\mytexdimension{X} % FAILS %\the\myluadimension %\hbox to\myluadimension{X} Of course that fails: why should the globally defined lua variable myluadimension magically become a \dimen register at the tex end? And believe it or not, the context conversion function do work, else mkiv wouldn't work. \stoptext Here is the right code: \starttext \newdimen\mytexdimension \mytexdimension 100pt \ruledhbox to\mytexdimension{\the\mytexdimension} \ctxlua{document.myluadimension = 200pt} \ruledhbox to \cldcontext{document.myluadimension}{\cldcontext{document.myluadimension}} \ctxlua{tex.dimen.mytexdimension = 300pt} \ruledhbox to\mytexdimension{\the\mytexdimension} \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Creating TeX dimensions and counters registers directly in Lua
On Wed, Aug 22 2012, Jaroslav Hajtmar wrote: \ctxlua{myluadimension = number.topoints(1)} \ctxlua{context(myluadimension)} \def\myluadimension{\ctxlua{context(myluadimension)}} ... \hbox to\myluadimension{X} -- Peter ___ 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] Ctx ... Lua
Hello, sometimes in this mail discussion I'm encountering a Ctx/Lua command which has been unknown for me or I would use other (known) commands to do the job. So - would it be possible to explain - what's the difference/advantage btw \directlua and \ctxlua - what \ctxcommand{} does - what \cldcontext{} does? TIA. Lukas ___ 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] Creating TeX dimensions and counters registers directly in Lua
Thank to Hans and Peter too. It works in context fine now. I would like realize this same in pure LuaTeX. I was primarily in the query for it to find Lua equivalent of TeX primitives \newdimen and \newcount (for direct creating new TeX registers) I could use something like \directlua{tex.newdimen.mydimen} that would create TeX register mydimen and then \directlua{tex.dimen.mydimen=200*2^16} which set value of register and that should be present in TeX for direct use such as \the\mydimen etc. I apologize for my naivete :-). Of course, I did not think that the global variable is magically changed the registry value, I just did not know how to implement it. Plus, I had in mind that ConTeXt conversion functions do not work in a clean LuaTEX (without reading about some library functions). One more thanx. Jaroslav Here is my pure luatex example. Is there any easy way? \newdimen\mytexdimension \mytexdimension 100pt mytexdimension: .\hbox to\mytexdimension{\the\mytexdimension}. \directlua{tex.myluadimension = 200pt} myluadimension: .\hbox to \directlua{tex.print(tex.myluadimension)}{\directlua{tex.print(tex.myluadimension)}}. \directlua{tex.dimen.mytexdimension = 300pt} mytexdimension: .\hbox to\mytexdimension{\the\mytexdimension}. \def\myluadimension{\directlua{tex.print(tex.myluadimension)}} myluadimension: .\hbox to\myluadimension{\myluadimension}. \bye Dne 22.8.2012 12:32, Hans Hagen napsal(a): On 22-8-2012 11:09, Jaroslav Hajtmar wrote: Thanks Wolfgang for the reply, but I must have misunderstood. My point is, that TeX registers was subsequently visible and usable in TeX (eg for width or height of boxes, etc.) Eg. for example, \the\mydimension can see that this does not occur! In addition, I solve the problem at LuaTEX, so ConTeXt converting functions do not work etc. .. Thanx Jaroslav Here is another example: \starttext \newdimen\mytexdimension \mytexdimension=100pt \ctxlua{myluadimension = number.topoints(1)} \ctxlua{context(myluadimension)} \the\mytexdimension \hbox to\mytexdimension{X} % FAILS %\the\myluadimension %\hbox to\myluadimension{X} Of course that fails: why should the globally defined lua variable myluadimension magically become a \dimen register at the tex end? And believe it or not, the context conversion function do work, else mkiv wouldn't work. \stoptext Here is the right code: \starttext \newdimen\mytexdimension \mytexdimension 100pt \ruledhbox to\mytexdimension{\the\mytexdimension} \ctxlua{document.myluadimension = 200pt} \ruledhbox to \cldcontext{document.myluadimension}{\cldcontext{document.myluadimension}} \ctxlua{tex.dimen.mytexdimension = 300pt} \ruledhbox to\mytexdimension{\the\mytexdimension} \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Ctx ... Lua
Am 22.08.2012 um 13:15 schrieb Procházka Lukáš l...@pontex.cz: Hello, sometimes in this mail discussion I'm encountering a Ctx/Lua command which has been unknown for me or I would use other (known) commands to do the job. So - would it be possible to explain - what's the difference/advantage btw \directlua and \ctxlua No difference, just another name, there are even more synonyms. - what \ctxcommand{} does \ctxcommand{...} == \ctxlua{commands} - what \cldcontext{} does? \cldcontext{...} == \ctxlua{context(...)} There is also \cldcommand{...} which is a short form for \ctxlua{context} All these commands access functions in the “commands” or the “context” namespace. 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] Lua: document v. userdata
In a recent thread, Hans used the document namespace, where I (naively) expected userdata: On Aug 22, 2012, at 6:32 AM, Hans Hagen wrote: \ctxlua{document.myluadimension = 200pt} Is there a reason not to use userdata.myluadimension? Or is document.myluadimension safe, because myluadimension is almost certainly not an entry used by ConTeXt? Is using document.myluadimension better style here, in some sense? Somewhere I had gotten the idea that if a ConTeXt user wanted to store something in Lua, they ought to store it in the userdata namespace. Thanks, Michael This e-mail message (including any attachments) is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message (including any attachments) is strictly prohibited. If you have received this message in error, please contact the sender by reply e-mail message and destroy all copies of the original message (including attachments). ___ 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] Lua: document v. userdata
On 22-8-2012 14:55, Rogers, Michael K wrote: In a recent thread, Hans used the document namespace, where I (naively) expected userdata: On Aug 22, 2012, at 6:32 AM, Hans Hagen wrote: \ctxlua{document.myluadimension = 200pt} Is there a reason not to use userdata.myluadimension? Or is document.myluadimension safe, because myluadimension is almost certainly not an entry used by ConTeXt? Is using document.myluadimension better style here, in some sense? Somewhere I had gotten the idea that if a ConTeXt user wanted to store something in Lua, they ought to store it in the userdata namespace. Sure. Actually the document namespace has some functions so there is more danger in a clash there, so userdata is better. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Ctx ... Lua
On 22-8-2012 13:26, Wolfgang Schuster wrote: Am 22.08.2012 um 13:15 schrieb Procházka Lukáš l...@pontex.cz: Hello, sometimes in this mail discussion I'm encountering a Ctx/Lua command which has been unknown for me or I would use other (known) commands to do the job. So - would it be possible to explain - what's the difference/advantage btw \directlua and \ctxlua No difference, just another name, there are even more synonyms. The \ctxlua variant is somewhat more future proof. In the past \directlua had a mandate extra argument. Also, the \ctxlua macro can use a dedicated message namespace if needed and future versions might have more tracing. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Creating TeX dimensions and counters registers directly in Lua
Great!!! Thanx very much Hans... Normally I do all things in ConTeXt, but I am preparing a beginning tutorial for users of LaTeX and PlainTeX, who would be interested in getting to know the basics LuaTEX. Therefore I am seeking a solution applicable in LuaLaTeX and LuaPlain too. Jaroslav Hajtmar Dne 22.8.2012 14:12, Hans Hagen napsal(a): On 22-8-2012 13:24, Jaroslav Hajtmar wrote: Thank to Hans and Peter too. It works in context fine now. I would like realize this same in pure LuaTeX. I was primarily in the query for it to find Lua equivalent of TeX primitives \newdimen and \newcount (for direct creating new TeX registers) I could use something like \directlua{tex.newdimen.mydimen} that would create TeX register mydimen and then \directlua{tex.dimen.mydimen=200*2^16} which set value of register and that should be present in TeX for direct use such as \the\mydimen etc. I apologize for my naivete :-). Just do: tex.dimen[20001] = 100pt at the lau end and at the tex end: \dimen20001=100pt keep in mind that \newdimen is just an allocator that associates a \cs and the implementation of that is pretty macro package dependent! Starting at 2 makes sure that you have no clash with existing registers. Of course, I did not think that the global variable is magically changed the registry value, I just did not know how to implement it. Plus, I had in mind that ConTeXt conversion functions do not work in a clean LuaTEX (without reading about some library functions). Ok, but keep in mind that clean luatex does not exist. As soon as one starts doing things at the lua end that reflects on the tex end, you have a dependency. I will add a context.newdimen function so that one can do: \startluacode document.mydimen = context.newdimen(MyDimen) tex.dimen[document.mydimen] = 10pt \stopluacode \the\MyDimen \MyDimen=100pt \the\MyDimen \startluacode context(number.points(tex.dimen[document.mydimen])) \stopluacode Posting the implemenation makes no sense as it refers to low level context properties that users should not be troubled with. PS. From the context point of view I see no advantages of using plain. First of all, one can still do pretty plain things in context. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] built-in units command (mkiv) fails
Hi there, Did / Do I miss something or is there a problem with the built-in \unit command? minimal example: start example \starttext 10 \unit{km/h} \stoptext stop example output: 10 kilometersolidushour ConTeXt: ver: 2012.08.16 22:20 MKIV fmt: 2012.8.22 Similar results are obtained for all examples in the Using the built-in command on http://wiki.contextgarden.net/Units Cheers, Andreas ___ 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] Code in contextref-env.tex
In the file contextref-env.tex I find code like the following: \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=] I have no idea what the sequences like \v!and \c! etc. mean. Are they references to modes? -- John Culleton Free list of books for self-publishers: http://wexfordpress.net/shortlist.html Police Procedural and Expose: Death Wore Black Create Book Covers with Scribus http://www.booklocker.com/books/4055.html ___ 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] Code in contextref-env.tex
On Wed, 22 Aug 2012, john Culleton wrote: In the file contextref-env.tex I find code like the following: \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=] I have no idea what the sequences like \v!and \c! etc. mean. Are they references to modes? Search for multi-lingual on this page: http://wiki.contextgarden.net/System_Macros/Key_Value_Assignments 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] Code in contextref-env.tex
I have no idea what the sequences like \v!and \c! etc. mean. Are they references to modes? I asked much the same question on tex.stackexchange.com two months ago, except mine was not so nice and focused. Aditya gave a very nice explanation of what the letters do; clearer than the one on the wiki, I thought. Here's a link straight to his answer: http://tex.stackexchange.com/a/58716/2229 They are used as language-agnostic forms. Using ConTeXt's English format, you'd type \startmarginblock Using ConTeXt's French format, you'd type \demarreblocmarge So to accomodate both, we define variables \s!start -- start or demarre, and \e!marginblock -- marginblock or blocmarge, depending on the language, and then we tell TeX we want to run the command named with the string \s!start\e!marginblock -- startmarginblock or demarreblocmarge. (Example not entirely accurate, I believe the variable for startmarginblock is define holisticaly. But you get my point.) Example of the need for the letter codes, paraphrased from mult-ini.mkiv: Where English uses 'left', in Dutch one finds both 'links' for '(on) the left' and 'linker' for 'the left one'. Hence the letter codes, so we can have \v!left -- links and \c!left -- linker. \c! is for keywords \v! is for value names \s! is for system bits \e! is for elements Hope this helps you in reading the sources! Cheers, Sietse ___ 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] mp
Hi, In the next version you can run mp files: % test.mp beginfig(1) ; fill fullcircle scaled 10cm withcolor 0.5red ; fill fullcircle scaled 4cm withcolor 0.5white ; endfig ; beginfig(2) ; fill fullcircle scaled 10cm withcolor 0.5green ; fill fullcircle scaled 5cm withcolor 0.5white ; endfig ; beginfig(3) ; fill fullcircle scaled 10cm withcolor 0.5blue ; fill fullcircle scaled 6cm withcolor 0.5white ; endfig ; as follows: context test.mp and you'll get a pdf file with 3 pages that can be included with \externalfigure[test][page=1] \externalfigure[test][page=2] \externalfigure[test][page=3] or used in different ways. Alteratively you can run % test.tex \starttext \processMPfigurefile{figures-001.mp} \stoptext In which case you can add styling directives in the preamble. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Code in contextref-env.tex
On 22-8-2012 23:02, Sietse Brouwer wrote: I have no idea what the sequences like \v!and \c! etc. mean. Are they references to modes? I asked much the same question on tex.stackexchange.com two months ago, except mine was not so nice and focused. Aditya gave a very nice explanation of what the letters do; clearer than the one on the wiki, I thought. Here's a link straight to his answer: http://tex.stackexchange.com/a/58716/2229 They are used as language-agnostic forms. Using ConTeXt's English format, you'd type \startmarginblock Using ConTeXt's French format, you'd type \demarreblocmarge So to accomodate both, we define variables \s!start -- start or demarre, and \e!marginblock -- marginblock or blocmarge, depending on the language, and then we tell TeX we want to run the command named with the string \s!start\e!marginblock -- startmarginblock or demarreblocmarge. (Example not entirely accurate, I believe the variable for startmarginblock is define holisticaly. But you get my point.) Example of the need for the letter codes, paraphrased from mult-ini.mkiv: Where English uses 'left', in Dutch one finds both 'links' for '(on) the left' and 'linker' for 'the left one'. Hence the letter codes, so we can have \v!left -- links and \c!left -- linker. \c! is for keywords \v! is for value names \s! is for system bits \e! is for elements Hope this helps you in reading the sources! In practice users don't have to use that convention in their files, unless they are meant to be multilingual. Btw, there is a nice story behind this: - left= 4 tokens - \c!left = 1 token so, when context grew harder than tex's string space (we're talking emtex times) it was also a way to save memory. To some extend it's also faster (less tokens to pass as argument) but at the same time there is a penalty of expanding the 1 into 4. So, in a single lingual interface there is not much gain. Some of the 'struggles with too small engines' has been removed in mkiv as nowadays we have no such constraints. When I introduced the \c! and \v! prefixes context was still dutch and when there came interest from abroad, it had the nice side effect that I could make an (first german, later also english) interface in just a couple of hours (context was smaller at that time). The first module to actually be multilingual was 'ppchtex'. Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] mp
On Wed, 22 Aug 2012, Hans Hagen wrote: Hi, In the next version you can run mp files: context test.mp Nice. How is font setup handled? Using verbatimtex ... etex? Or using the styling directives as you explain below. Would something like context --environment=font-setup test.mp work? or used in different ways. Alteratively you can run % test.tex \starttext \processMPfigurefile{figures-001.mp} \stoptext In which case you can add styling directives in the preamble. 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 ___