[NTG-context] startup error
Hello everyone, I am coming back to Context after a while. I have updated ConTeXt LMTX, everything seemed to go well. I have the following problem: If I run: context Hello-world.tex I get the message "startup error : no format file given, quitting" I am clueless! Thanks in advance for your help, Roland (downloaded context-linux-64.zip) ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___
Re: [NTG-context] update fails
Le 6 janv. 2014 à 10:36, Hans Hagen a écrit : On 1/5/2014 6:36 PM, Roland Thiers wrote: Hi everybody, First of all, my best wishes of a very happy new year to all users of this list ! I used to update context standalone with the script ctx-update : cd /Users/rolandthiers/context rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh ../first-setup.sh --modules=all --engine=luatex Usually the update runs well, no problem. But the last time it did not work. I've got this message : This went wrong: ...67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.lui:107: bad bytecode register This is LuaTeX, Version beta-0.78.0-2013123119 (rev 4704) \write18 enabled. .. * cont-yes.mkiv ? Assertion failed: (kpse-program_name), function kpathsea_var_value, file ../../../source/texk/kpathsea/variable.c, line 36. mtx-context | fatal error: no return code, message: luatex: execution interrupted My system : Mac OS X 10.6.8 . Could someone tell me what happens or what mistake I did ? no clue ... kpse is not used in context mkiv so there should not be such a message; it looks like a bad binary or maybe you need to do a context --make explicitly also, don't use ctx-update but first-update in the minimal root Hans Thanks very much Hans ! I did a context --make and everything is working well again ! Roland ___ 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] update fails
Hi everybody, First of all, my best wishes of a very happy new year to all users of this list ! I used to update context standalone with the script ctx-update : cd /Users/rolandthiers/context rsync -ptv rsync://contextgarden.net/minimals/setup/first-setup.sh ./first-setup.sh --modules=all --engine=luatex Usually the update runs well, no problem. But the last time it did not work. I've got this message : This went wrong: ...67e0bfe781ce0dde776fb1556f32e/formats/luatex/cont-en.lui:107: bad bytecode register This is LuaTeX, Version beta-0.78.0-2013123119 (rev 4704) \write18 enabled. . * cont-yes.mkiv ? Assertion failed: (kpse-program_name), function kpathsea_var_value, file ../../../source/texk/kpathsea/variable.c, line 36. mtx-context | fatal error: no return code, message: luatex: execution interrupted My system : Mac OS X 10.6.8 . Could someone tell me what happens or what mistake I did ? Roland ___ 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] Configure AUCTeX to run context not texec
Le 8 nov. 2013 à 18:47, Michael Ash a écrit : Does anyone know how to change the command from texexec to context in emacs/AUCTeX? I have that in my preference.el (I use aquamacs) : --8---cut here---start-8--- (defun rol-context () (interactive) (save-current-buffer (save-buffer) (TeX-save-document ) (setq TeX-PDF-mode nil) (let ((nomdufichiersansextension (file-name-sans-extension (buffer-file-name (shell-command (format context --autopdf %s.tex nomdufichiersansextension)) (TeX-view --8---cut here---end---8--- I have bound this function rol-context to the key F7, it works fine but it's definitely non optimal ! Regards, Roland (math teacher in a high school) ___ 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] command for a MP graphic
Le 8 mai 13 à 06:56, Wolfgang Schuster a écrit : Am 07.05.2013 um 22:28 schrieb Roland Thiers roland.thi...@gmail.com: Thank you very much for this precision, Wolfgang. I tried with two variables and it works with this syntax : \startuniqueMPgraphic{polygoneregulier} numeric u ; u:=\MPvar{unite}*cm ; numeric n ; n:=\MPvar{sides}; rest of the code \stopuniqueMPgraphic \define[2]\polyreg {\setupMPvariables[polygoneregulier][unite,sides] \uniqueMPgraphic{polygoneregulier}{sides=#1,unite=#2}} You can define the command as \define[2]\polyreg {\setupMPvariables[polygoneregular][sides=#1,unite=#2]% \uniqueMPgraphic{polygoneregular}} where the variables are set with the \settupMPvariables command or as \define[2]\polyreg {\uniqueMPgraphic{polygoneregular}{sides=#1,unite=#2}} where the variables are set in the optional argument for \uniqueMPgraphic. \starttext %\uniqueMPgraphic{polygoneregulier}{unite=2,sides=4} \polyreg{6}{0.5} \stoptext I did not find any détails on \MPvar et \setupMPvariables on the wiki, however Both commands are mentioned in the metafun [1] manual. [1] http://www.pragma-ade.nl/show-man-7.htm Wolfgang Thank you Wolfgang for the correction of the syntax. I bought the Metafun manual and began to work with it. Great ! Roland ___ 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 ___
[NTG-context] command for a MP graphic
Hi, I did this code to get a regular polygon with metafun, it works but I would like to have an user command like \define or \def to be able to choose the number of sides, n. I don't know how to do that ... \startbuffer[largeurdeslignes] drawoptions (withpen pencircle scaled 2pt); \stopbuffer \startbuffer[polygoneregulier] numeric u ; u:=1*cm ; numeric n ; n:=7 ; pair a[]; a[0]:=(0,3u); path polygone[] ; for i=1 upto n : a[i]:=a[0] rotatedaround(origin,i*360/n) ; polygone[i]:=a[i-1]--a[i]; draw polygone[i]; endfor; \stopbuffer \startbuffer[cercleunite] draw fullcircle scaled 6u withcolor blue; \stopbuffer \define \polyreg {\processMPbuffer[largeurdeslignes,polygoneregulier,cercleunite]} \starttext \polyreg \stoptext Thanks, Roland Thiers ___ 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] command for a MP graphic
Le 7 mai 13 à 09:51, Marco Patzer a écrit : \startuniqueMPgraphic{polygoneregulier}{sides} drawoptions (withpen pencircle scaled 2pt); numeric u ; u:=1*cm ; numeric n ; n:=\MPvar{sides}; pair a[]; a[0]:=(0,3u); path polygone[] ; for i=1 upto n : a[i]:=a[0] rotatedaround(origin,i*360/n) ; polygone[i]:=a[i-1]--a[i]; draw polygone[i]; endfor; draw fullcircle scaled 6u withcolor blue; \stopuniqueMPgraphic %% \polyreg{number} \define[1]\polyreg {\setupMPvariables[polygoneregulier][sides=#1]%% \uniqueMPgraphic{polygoneregulier}} \starttext \dontleavehmode \dorecurse{9}{\polyreg\recurselevel\space} \stoptext Thanks a lot Marco ! I have to think carefully on your way : I don't understand all these commands yet. Roland ___ 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] command for a MP graphic
≥ Le 7 mai 13 à 13:05, Wolfgang Schuster a écrit : Am 07.05.2013 um 09:51 schrieb Marco Patzer home...@lavabit.com: On 2013–05–07 Roland Thiers wrote: Hi, I did this code to get a regular polygon with metafun, it works but I would like to have an user command like \define or \def to be able to choose the number of sides, n. I don't know how to do that ... Here's one way to do it: \startuniqueMPgraphic{polygoneregulier}{sides} drawoptions (withpen pencircle scaled 2pt); numeric u ; u:=1*cm ; numeric n ; n:=\MPvar{sides}; pair a[]; a[0]:=(0,3u); path polygone[] ; for i=1 upto n : a[i]:=a[0] rotatedaround(origin,i*360/n) ; polygone[i]:=a[i-1]--a[i]; draw polygone[i]; endfor; draw fullcircle scaled 6u withcolor blue; \stopuniqueMPgraphic %% \polyreg{number} \define[1]\polyreg {\setupMPvariables[polygoneregulier][sides=#1]%% \uniqueMPgraphic{polygoneregulier}} \define[1]\polyreg {\uniqueMPgraphic{polygoneregulier}{sides=#1}} Wolfgang Thank you very much for this precision, Wolfgang. I tried with two variables and it works with this syntax : \startuniqueMPgraphic{polygoneregulier} numeric u ; u:=\MPvar{unite}*cm ; numeric n ; n:=\MPvar{sides}; rest of the code \stopuniqueMPgraphic \define[2]\polyreg {\setupMPvariables[polygoneregulier][unite,sides] \uniqueMPgraphic{polygoneregulier}{sides=#1,unite=#2}} \starttext %\uniqueMPgraphic{polygoneregulier}{unite=2,sides=4} \polyreg{6}{0.5} \stoptext I did not find any détails on \MPvar et \setupMPvariables on the wiki, however Roland ___ 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 ___
[NTG-context] text overlayed
Hello all, I'm learning a little bit of metapost language, using metafun manual. I made some background for a title (surely the code is awful, thanks for suggestions of improvement) but it's static, i'd like to adapt it to the widthof the text. I don't know if it is possible from my code and if it is i don't know how to do ! Thanks for any help, best regards, Roland My code : \setuplayout[width=fit,height=fit,header=0cm,topspace=1.8cm,footer=1.2cm,% bottomspace=1cm,backspace=6cm,leftmargin=1.5cm, leftmargindistance=0.5cm,rightmargin=1cm,rightmargindistance=0.5cm, location=singlesided] \startuniqueMPgraphic{essai} path p,p',q,q'; p:=(0,0.1cm)--(12cm,0.3cm); q:=(11cm,-0.7cm)--(11.5cm,2.2cm); p':=(11.7cm,1.3cm)--(-0.4cm,1.4cm); q':=(0.3cm,2.4cm)--(0.2cm,-0.3cm); draw p withpen pencircle scaled 1mm withcolor 0.3white; draw p' withpen pencircle scaled 1mm withcolor 0.3white; draw q withpen pencircle scaled 1mm withcolor 0.3white; draw q' withpen pencircle scaled 1mm withcolor 0.3white; pair A; A:=q'intersectionpoint p'; pair B; B:=q intersectionpoint p'; pair C; C:=p intersectionpoint q; pair D; D:=q'intersectionpoint p; path s; s:= A--B--C--D--cycle; fill s withcolor .8white; \stopuniqueMPgraphic \starttext \defineoverlay[encadrement][\uniqueMPgraphic{essai}] \framed[frame=off,background=encadrement]{\it\tfb\color[darkred]{Devoir de mathématiques}} \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] text overlayed
Le 4 mars 13 à 12:37, Marco Patzer a écrit : On 2013–03–04 Roland Thiers wrote: I'm learning a little bit of metapost language, using metafun manual. I made some background for a title (surely the code is awful, thanks for suggestions of improvement) but it's static, i'd like to adapt it to the widthof the text. I don't know if it is possible from my code and if it is i don't know how to do ! You can use the variable OverlayWidth to obtain the width of the overlay, which is determined by the provided text. You can use it as follows: \setuplayout [backspace=6cm] \startuniqueMPgraphic{essai} path p,p',q,q'; w:=2OverlayWidth; p := (0,0.1cm) -- (w,0.3cm); q := (11cm,-0.7cm) -- (w,2.2cm); p':= (w,1.3cm) -- (-0.4cm,1.4cm); q':= (0.3cm,2.4cm) -- (0.2cm,-0.3cm); pickup pencircle scaled 1mm; drawoptions(withcolor 0.3white); draw p; draw p'; draw q; draw q'; pair A; A:=q'intersectionpoint p'; pair B; B:=q intersectionpoint p'; pair C; C:=p intersectionpoint q; pair D; D:=q'intersectionpoint p; path s; s:= A--B--C--D--cycle; fill s withcolor .8white; \stopuniqueMPgraphic \defineoverlay [encadrement] [\uniqueMPgraphic{essai}] \defineframed [boxframed] [frame=off, foregroundstyle=bolditalic, foregroundcolor=darkred, background=encadrement] \starttext \boxframed{Devoir de mathématiques} \blank [2cm] \boxframed{Devoir de mathématiques and some more text} \stoptext Marco Great ! Thank you very much, Marco ! I saw the use of the numeric variable OverlayWidth and also all your improvements like drawoptions, defineframed ... in preamble. Roland ___ 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] Math typesetting problems
Le 28 janv. 13 à 10:11, Janne Junnila a écrit : Indeed it seems like the alignment is good with \dfrac, but this does not solve my problem, since I wish to also use fractions with script-size or scriptscript-size (\xfrac, \xxfrac). The specific formula I have is \startformula f_{B_t | B_s = S, B_u = U}(x) = \frac{e^{-\frac{(u-s)x^2 - 2x(S(u-t) + U(t-s)) + \frac{(S(u-t) + U(t-s))^2}{(u-s)}}{2(t-s)(u-t)}}}{\sqrt{2\pi\frac{(t-s)(u-t)}{u-s}}} \stopformula Thanks, Janne OK ! So you need an expert, I'm just a newbie :) I would be interested to know how to do that. Best, Roland ___ 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] Math typesetting problems
Le 27 janv. 13 à 12:52, Janne Junnila a écrit : Hi all, Another problem I have is related to the positioning of minus signs in front of fractions. I would expect the minus sign to align with the horizontal line of the fraction, as it does on LaTeX. Below is an example formula to illustrate my point. The result seems to be independent of the font in use. \startformula -\frac{e^{\frac{4}{5}}}{4} \stopformula Janne Hi Janne, With \dfrac it looks good. With \fraction the minus sign is on the top of the fraction. Best regards, Roland ___ 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] \IncludePicture in SimpleSlides
Le 4 janv. 13 à 23:39, Thomas A. Schmitz a écrit : On 12/30/2012 03:05 AM, Roland Thiers wrote: Hello, I have tried the simpleslides module. Starting with it is very nice. I have get some trouble with \IncludePicture. Running : ConTeXt ver: 2012.12.28 20:30 MKIV fmt: 2012.12.29 int: english/ english \IncludePicture [horizontal] [riviere] {La Dumbéa} do not work. Maybe that problem is new (process succeded a few time ago). If I use \externalfigure, no problems. Best regards, Roland Please make a small example demonstrating your problem. \IncludePicture works normally here (with version: 2013.01.02 18:19). Thomas Thanks, Thomas, for your reply. I 've updated version to 2013.01.02 and \IncludePicture works perfectly ! I am not sure about the error that I have reported : maybe I made something wrong with the commands (surely that !) or maybe something missing in version 2012.12.29. To be able do produce a nice presentation without a long curve learning is really great, thanks a lot for this module, Roland ___ 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 ___
[NTG-context] \IncludePicture in SimpleSlides
Hello, I have tried the simpleslides module. Starting with it is very nice. I have get some trouble with \IncludePicture. Running : ConTeXt ver: 2012.12.28 20:30 MKIV fmt: 2012.12.29 int: english/english \IncludePicture [horizontal] [riviere] {La Dumbéa} do not work. Maybe that problem is new (process succeded a few time ago). If I use \externalfigure, no problems. Best regards, Roland ___ 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] to pass an argument in a macro
Am 23.12.2012 um 02:58 schrieb Roland Thiers roland.thi...@gmail.com: Bonjour, I am new in ConTeXt. I love its features. I need some (or a lot of) help. I tried to get a macro which compute some values for a math function. Le 23 déc. 12 à 18:43, Wolfgang Schuster a écrit : \startluacode userdata = userdata or {} userdata.roland = userdata.roland or {} local roland = userdata.roland function roland.f(x) context(x*x*x) end function roland.table(min,max,step) local min = tonumber(min) local max = tonumber(max) local step = tonumber(step) context.starttable({string.format(|*{%d}{l|},max-min+2)}) context.HL() context.VL() context(x) for i=min,max do context.NC() context(min+(i-1)*step) end context.VL() context.FR() context.HL() context.VL() context(f(x)) for i=min,max do context.NC() roland.f(min+(i-1)*step) end context.VL() context.AR() context.HL() context.stoptable() end \stopluacode \define[3]\TableFuntion {\ctxlua{userdata.roland.table(#1,#2,#3)}} \starttext \TableFuntion{1}{6}{1} \TableFuntion{2}{7}{1} \stoptext Wolfgang I read with care (maybe) your code above, Wolfgang (thanks again !) et had a look in programming in lua to get a better idea of the object table, new in lua too :-) I have some more questions : - when one create a table doing this : userdata=userdata or {}, is it only to be sure that userdata is not actually a variable which exists (with a non nil value) ? Less safely we could write : userdata={} ? - arguments for the user.data.table function are given as strings : #1 and changed in numbers in the body of the function. I noticed that it was possible to give numbers directly. is there always better to do like this ? (enter strings et use tonumber) - I found the command \define in context garden and saw it's the same than \unexpanded\def , there is a link to the définitions of the TeX primitives but I could'nt find \unexpanded\def (\def was very instructive however). - I changed slightly the code to obtain a range (x between min and max with a step) and to choose a round-way. I failed to find a context way to get rounded numbers, so I did a workaround (a another function) with help from programming in lua. I would like a more straight (context) way. Here is the code : \startluacode -- userdata = userdata or {} -- userdata[roland] = userdata[roland] or {} userdata=userdata or {} userdata[roland]=userdata[roland] or {} local roland = userdata[roland] function roland.f(x) return math.log(x) end function roland.round (number, approx) local power = 10^(approx or 0) context(math.floor(number * power + 0.5) / power) end function roland.table(min,max,step,approx) local min = tonumber(min) local max = tonumber(max) local step = tonumber(step) local nbrcol = tonumber((max-min)*(1/step)+2) local approx = tonumber(approx) context.starttable({string.format(|*{%d}{l|},nbrcol)}) context.HL() context.VL() context(x) for i=1,(nbrcol-1) do context.NC() context(min+(i-1)*step) end context.VL() context.FR() context.HL() context.VL() context(f(x)) for i=1,(nbrcol-1) do context.NC() local result=roland.f(min+(i-1)*step) roland.round(result,approx) end context.VL() context.AR() context.HL() context.stoptable() end \stopluacode \define[4]\TableFuntion {\ctxlua{userdata.roland.table(#1,#2,#3,#4)}} \starttext \TableFuntion{2}{6}{0.5}{2} \blank[2*big] \TableFuntion{1}{16}{1}{} \blank[2*big] \TableFuntion{2}{4}{2}{5} \blank[2*big] \TableFuntion{0.2}{2}{0.2}{3} \stoptext Best regards, Roland Happy Christmas to all Context users ! ___ 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] to pass an argument in a macro
Le 25 déc. 12 à 23:24, Hans Hagen a écrit : On 12/25/2012 9:36 AM, Roland Thiers wrote: - when one create a table doing this : userdata=userdata or {}, is it only to be sure that userdata is not actually a variable which exists (with a non nil value) ? Less safely we could write : userdata={} ? There can already be stuff in userdata that you don't want to loose. OK. - arguments for the user.data.table function are given as strings : #1 and changed in numbers in the body of the function. I noticed that it was possible to give numbers directly. is there always better to do like this ? (enter strings et use tonumber) Depends on if you want to catch errors. Forgetting an argument (or an empty one) when a number is expected results in ,, which triggers a Lua error, while with ,, you can intercept the empty string and default. Hans OK. Thanks ! Roland - 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] to pass an argument in a macro
Bonjour, I am new in ConTeXt. I love its features. I need some (or a lot of) help. I tried to get a macro which compute some values for a math function. With help from the wiki ConTeXt Garden and some time I could do that - write my function userdata.f - write another function to put the values in a table : userdata.tabf - put both of them in a file /Users/rolandt/context/mesfonctionsluatex.lua - In a file.tex, I use that macro : \def\tabf#1#2% {\startluacode dofile(/Users/rolandt/context/mesfonctionsluatex.lua) userdata.tabf(#1,#2) \stopluacode} Here are the functions: -- fonction cube -- on utilise l'espace de nom userdata userdata=userdata or {} function userdata.f(x) context(x*x*x) end -- fonction tabf -- which makes a table , compute 6 values, b=first x, c = step userdata=userdata or {} function userdata.tabf(b,c) context.starttable{*{7}{|l}|} local b=b local c=c context(\\HL) context(\\VL x ) for i=1,6 do context(\\NC .. b+(i-1)*c) end context(\\VL..\\AR) context(\\HL) context(\\VL f(x) ) for i=1,6 do context(\\NC) context(userdata.f(b+(i-1)*c)) end context(\\VL..\\LR) context(\\HL) context.stoptable() end I am sure it could be much better but it works ! Evidently I need a third argument to be able to choose how many values compute. I failed completely (I don't understand how arguments are passed). I tried things like : context.starttable{*{%s}{|l}|,a} but ... fatal error :) I would appreciate some help or what to read to improve understanding that kind of things. Best regards, Roland ___ 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] Numerical Calculations
Le 20 déc. 12 à 05:43, Troy Henderson a écrit : Do \luaexpr{1/3.8} and \ctxcommand{format(@0.3f,1/3.8)} return numbers or strings? That is, I would like to use these results in a \if or \ifnum command to exit a \doloop. Troy Bonjour, \ctxlua{context(type(\luaexpr{1/3.8}))} gives : number Roland ___ 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 ___