Re: [NTG-context] \startsetups amd \startJSpreamble
Am 10.03.2011 um 15:32 schrieb Procházka Lukáš Ing. - Pontex s. r. o.: > I guess the same approach in general, so also: > > \startJSpreamble[MyStuff used later] No, you need braces here, e.g. \startJSpreamble {Mystuff used later} ... 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] \startsetups amd \startJSpreamble
... Thanks for the explanation. You can write \startsetups[long name with spaces] ... \stopsetups or \startsetups shortname ... \stopsetups Wolfgang I guess the same approach in general, so also: \startJSpreamble[MyStuff used later] Best regards, Lukas -- Ing. Lukáš Procházka [mailto:l...@pontex.cz] Pontex s. r. o. [mailto:pon...@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038 ___ 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] \startsetups amd \startJSpreamble
Am 10.03.2011 um 15:13 schrieb Procházka Lukáš Ing. - Pontex s. r. o.: > I fell a bit confused as normally such names are enclosed in brackets; thus > I'd rather expect syntax like: > > \startsetups[thumbs] > ... > \stopsetups You can write \startsetups[long name with spaces] ... \stopsetups or \startsetups shortname ... \stopsetups 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] \startsetups amd \startJSpreamble
Hello, just to confirm - the role of the text after \start*: \startsetups thumbs - on http://wiki.contextgarden.net/Thumb_index and \startJSpreamble MyStuff used later - in the last mails between Vedran and Hans. Do I understand well that "thumbs" and "MyStuff used later" in both cases are names of the setups and are reffered later by these names? I fell a bit confused as normally such names are enclosed in brackets; thus I'd rather expect syntax like: \startsetups[thumbs] ... \stopsetups and \startJSpreamble[MyStuff used later] ... \stopJSpreamble Kind regards, Lukas -- Ing. Lukáš Procházka [mailto:l...@pontex.cz] Pontex s. r. o. [mailto:pon...@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038 ___ 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] \switchtobodyfont does not work inside of \startsetups layer ?
On Fri, Feb 18, 2011 at 20:11, Wolfgang Schuster wrote: > > Am 18.02.2011 um 19:08 schrieb Vnpenguin: > >> Wow, it works now. > > You can also separate the style and content of a layer with \setlayerframed, > e.g. > > \setlayerframed > [mylayer] > [x=..., > y=..., > frame=off, > style={\switchtobodyfont[10pt]}] > {text} > Thank you, Regards ___ 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] \switchtobodyfont does not work inside of \startsetups layer ?
Am 18.02.2011 um 19:08 schrieb Vnpenguin: > Wow, it works now. You can also separate the style and content of a layer with \setlayerframed, e.g. \setlayerframed [mylayer] [x=..., y=..., frame=off, style={\switchtobodyfont[10pt]}] {text} 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] \switchtobodyfont does not work inside of \startsetups layer ?
On Fri, Feb 18, 2011 at 19:03, Wolfgang Schuster wrote: > > Am 18.02.2011 um 18:59 schrieb Vnpenguin: > >> \usetypescript[palatino] >> \switchtobodyfont[palatino,20pt] > > Replace this (both lines) with > > \setupbodyfont[palatino,20pt] > > Wolfgang > Wow, it works now. Thank you so much for your very quick help. Cheers, ___ 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] \switchtobodyfont does not work inside of \startsetups layer ?
Am 18.02.2011 um 18:59 schrieb Vnpenguin: > \usetypescript[palatino] > \switchtobodyfont[palatino,20pt] Replace this (both lines) with \setupbodyfont[palatino,20pt] 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] \switchtobodyfont does not work inside of \startsetups layer ?
Hi, I have a following test: = \setuppapersize[S8][S8] \setuplayout [width=fit,height=fit, rightmargin=1.5cm,leftmargin=1.5cm, backspace=15mm,topspace=23mm,top=10mm, header=0mm,footer=0mm,bottom=5mm, margin=0mm] \usetypescript[palatino] \switchtobodyfont[palatino,20pt] \setupcolors[state=start] \definelayer[myLayer] [width=\paperwidth, height=\paperheight] \startsetups layer \setlayer[myLayer][preset=lefttop,x=0.9\paperwidth,y=0.96\paperheight] {\switchtobodyfont[10pt]\pagenumber\ of \lastpage} \stopsetups \setupbackgrounds [page] [setups=layer,background={myLayer},state=start] \starttext \page \setlayer[myLayer][preset=leftttop,x=7mm,y=6mm]% {\switchtobodyfont[48pt]\bf Page One} blah blah blah blah blah blah blah blah blah \page \setlayer[myLayer][preset=leftttop,x=7mm,y=6mm]% {\switchtobodyfont[48pt]\bf Page Two} blah blah blah \stoptext The command \switchtobodyfont[10pt] inside of my \startsetups layer ...\stopsetups does not work for me. In the final PDF I have not page number at 10pt. Here are the files: http://dl.dropbox.com/u/7959896/context/test2/test2.tex http://dl.dropbox.com/u/7959896/context/test2/test2.log http://dl.dropbox.com/u/7959896/context/test2/test2.pdf I use on WinXP : E:\User>context --version mtx-context | main context file: C:/context/tex/texmf-context/tex/context/base/context.mkiv mtx-context | current version: 2011.02.18 17:17 Any help ? Thanks in advance, ___ 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] Problem calling Lua during \startsetups
Thanks you, Hans, - On Tue, 25 Jan 2011 09:33:04 +0100, Hans Hagen wrote: On 25-1-2011 8:44, Wolfgang Schuster wrote: \startsetups layer % In my real code (= not in this example) % the value of 'n' is used here to set the appropriate background, % = n-th page of a PDF, and also to draw a filled rectangle on % the left or right side (depending on whether n is even or odd) % The code bellow fails [1] \startluacode print("N=", n) if n == 2 then else end \stopluacode \stopsetups \startluasetups layer \stopluasetups - I guess to be used like: \startluasetups layer \startluacode ... \stopluacode \stopluasetups \luasetup{...} To be used how? This way? \setupbackgrounds[page][setups=\luasetup{layer},background={T}] Best regards, Lukas -- Ing. Lukáš Procházka [mailto:l...@pontex.cz] Pontex s. r. o. [mailto:pon...@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038 ___ 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] Problem calling Lua during \startsetups
Am 25.01.2011 um 09:00 schrieb Procházka Lukáš Ing. - Pontex s. r. o.: > Thank you, Wolfgang, this works better. > > Actually I need to use '%' in the condition and that fails: > > --- > ... > \startrawsetups layer > % The value of 'n' is used here to set the appropriate background, > % = n-th page of a PDF, and also to draw a filled rectangle on > % the left or right side (depending on whether n is even or odd) > > % The code bellow fails > > \startluacode >print("N=", n) > >if n % 2 == 1 then > >else > >end > \stopluacode > \stoprawsetups > ... > --- > > with: > > --- > ! LuaTeX error :1: 'then' expected near 'else'. > --- > > So like '%' was still treated as TeX comment char. > > How to enable '%'? You can’t use % in the luacode environment when you write it inside of another environment because TeX can change the meaning of % but this should works (untested): \startbuffer[lualayer] % … \startluacode … \stopluacode \stopbuffer \doifmode{foo}{\ctxluabuffer[lualayer]} 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] Problem calling Lua during \startsetups
On 25-1-2011 8:44, Wolfgang Schuster wrote: \startsetups layer % In my real code (= not in this example) % the value of 'n' is used here to set the appropriate background, % = n-th page of a PDF, and also to draw a filled rectangle on % the left or right side (depending on whether n is even or odd) % The code bellow fails [1] \startluacode print("N=", n) if n == 2 then else end \stopluacode \stopsetups \startluasetups layer \stopluasetups \luasetup{...} - 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] Problem calling Lua during \startsetups
Thank you, Wolfgang, this works better. Actually I need to use '%' in the condition and that fails: --- ... \startrawsetups layer % The value of 'n' is used here to set the appropriate background, % = n-th page of a PDF, and also to draw a filled rectangle on % the left or right side (depending on whether n is even or odd) % The code bellow fails \startluacode print("N=", n) if n % 2 == 1 then else end \stopluacode \stoprawsetups ... --- with: --- ! LuaTeX error :1: 'then' expected near 'else'. --- So like '%' was still treated as TeX comment char. How to enable '%'? Best regards, Lukas NB: Dirty trick: to define a Lua function like 'function isEven(n) return n % 2 == 0 end' and to use this function at the place of 'n % 2 == 1'; but I'd rather avoid this. -- Ing. Lukáš Procházka [mailto:l...@pontex.cz] Pontex s. r. o. [mailto:pon...@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038 ___ 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] Problem calling Lua during \startsetups
Am 25.01.2011 um 08:33 schrieb Procházka Lukáš Ing. - Pontex s. r. o.: > Hello, > > I encountered a bit weird thing when I used Lua in \startsetup: > > --- > \definelayer[T][x=0mm,y=0mm,width=\paperwidth,height=\paperheight] > > \directlua{n, m = 1, 11} % Initialization > > \startsetups layer > % In my real code (= not in this example) > % the value of 'n' is used here to set the appropriate background, > % = n-th page of a PDF, and also to draw a filled rectangle on > % the left or right side (depending on whether n is even or odd) > > % The code bellow fails [1] > > \startluacode >print("N=", n) > >if n == 2 then >else >end > \stopluacode > \stopsetups > > \setupbackgrounds[page][setups=layer,background={T}] > > \starttext > % The code bellow works well [2] > > \startluacode >print("M=", m) > >if m == 2 then > else >end > \stopluacode > > \dorecurse{4}{\page[empty]} > \stoptext > --- > > The problem is that Lua code between \startsetups ... \stopsetups [1] seems > to be "parsed" another way than when in [2]. > > The [1] gives the following error message: > > --- > ! LuaTeX error :1: 'then' expected near 'thenelseend'. > --- > > So it seems like s and/or <\n>s were "ignored". > > If you commented [1], the section [2] would work well. > > So how to use make Lua work well even between \startsetups ... \stopsetups? Use \startrawsetups … \stoprawsetups. 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] Problem calling Lua during \startsetups
Hello, I encountered a bit weird thing when I used Lua in \startsetup: --- \definelayer[T][x=0mm,y=0mm,width=\paperwidth,height=\paperheight] \directlua{n, m = 1, 11} % Initialization \startsetups layer % In my real code (= not in this example) % the value of 'n' is used here to set the appropriate background, % = n-th page of a PDF, and also to draw a filled rectangle on % the left or right side (depending on whether n is even or odd) % The code bellow fails [1] \startluacode print("N=", n) if n == 2 then else end \stopluacode \stopsetups \setupbackgrounds[page][setups=layer,background={T}] \starttext % The code bellow works well [2] \startluacode print("M=", m) if m == 2 then else end \stopluacode \dorecurse{4}{\page[empty]} \stoptext --- The problem is that Lua code between \startsetups ... \stopsetups [1] seems to be "parsed" another way than when in [2]. The [1] gives the following error message: --- ! LuaTeX error :1: 'then' expected near 'thenelseend'. --- So it seems like s and/or <\n>s were "ignored". If you commented [1], the section [2] would work well. So how to use make Lua work well even between \startsetups ... \stopsetups? Best regards, Lukas -- Ing. Lukáš Procházka [mailto:l...@pontex.cz] Pontex s. r. o. [mailto:pon...@pontex.cz] [http://www.pontex.cz] Bezová 1658 147 14 Praha 4 Tel: +420 244 062 238 Fax: +420 244 461 038 t-Bkg.log Description: Binary data t-Bkg.mkiv Description: Binary data ___ 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 ___