Re: [NTG-context] Using stylistic sets in math

2010-07-16 Thread Khaled Hosny
calligraphic one, so I did: \starttext \setupbodyfont[xits] \ctxlua{fonts.otf.features.register_base_substitution('ss01')} \definefontfeature[ss01][mode=base,script=math,ss01=yes] $\addff{ss01}\cal ABCDEFG$ \stoptext (I was not expecting \addff to work in math, but anyway). This works

[NTG-context] Using stylistic sets in math

2010-07-15 Thread Khaled Hosny
In XITS I have stylistic sets (ss01-07) for accessing additional alphabets not bresent in Unicode, or variants of exising ones. For example, ss01 maps the script alphabets to an alternate calligraphic one, so I did: \starttext \setupbodyfont[xits] \ctxlua

Re: [NTG-context] Using stylistic sets in math

2010-07-15 Thread Hans Hagen
On 15-7-2010 9:24, Khaled Hosny wrote: In XITS I have stylistic sets (ss01-07) for accessing additional alphabets not bresent in Unicode, or variants of exising ones. For example, ss01 maps the script alphabets to an alternate calligraphic one, so I did: \starttext \setupbodyfont[xits] \ctxlua

Re: [NTG-context] A problem with combining characters

2010-07-05 Thread luigi scarso
tex.sprint(tex.ctxcatcodes,unicode.utf8.char(us)) end \stopluacode \def\N#1{\ctxlua{desc2utf8(#1)}} \starttext \N{LATIN SMALL LETTER A}\N{COMBINING DOT BELOW}\N{COMBINING CARON BELOW} {\ss \N{LATIN SMALL LETTER A}\N{COMBINING DOT BELOW}\N{COMBINING CARON BELOW} }\\ \\ {\rm \N{LATIN SMALL LETTER N}\N

Re: [NTG-context] A problem with combining characters

2010-07-04 Thread luigi scarso
in pairs(characters.data) do plane = i if v.description == desc then us = v.unicodeslot break end end return tex.sprint(tex.ctxcatcodes,unicode.utf8.char(us)) end \stopluacode \def\N#1{\ctxlua{desc2utf8(#1)}} \starttext \N{LATIN SMALL LETTER A}\N{COMBINING DOT

Re: [NTG-context] context mkiv eats a table

2010-05-27 Thread Marius
. \dofloatssave #1-\ctxlua {floats.save(#1)} \the \everyfloatscheck \dosavefloat -\dofloatssave {text} \nonoindentation argument ...hod ,bottom,top] \else \dosavefloat \fi

Re: [NTG-context] How to get randomly coloured text in metapost?

2010-05-11 Thread Marco
for the information. But how to do this? How can I set up the randomness in ConTeXt? I browsed a bit through the sources and found a lua snipped producing random integers. So here's my first attempt. % only Integers, so not much variation in color :-( \def\r{\ctxlua{commands.getrandomcounta(0,1

Re: [NTG-context] tooltips and glossary

2010-05-05 Thread Philipp Gesang
]) context.unskip() context(, () context.at( v.s. on p., { refstring } ) context().) context.par() end end \setupinteraction[state=start] \ctxlua{dofile(glossarium.lua)} % Use \gloss#1#2 somewhere before \starttext, in a secondary file if you like

Re: [NTG-context] get tex-value in lua

2010-05-04 Thread Peter Münster
On Tue, May 04 2010, Peter Münster wrote: How can I get the value of a variable or a mode in the lua part? The solution is so simple... : \ctxlua{userdata = userdata or {}; userdata.myvar = \env{MyVar}} \starttext \startluacode if userdata.myvar then tex.print(TRUE) else tex.print

Re: [NTG-context] tooltips and glossary

2010-05-04 Thread Philipp Gesang
___ -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments \setupinteraction[state=start] \ctxlua{dofile(glossarium.lua)} % Use \gloss#1#2 somewhere before \starttext

Re: [NTG-context] lua, footnotes, interaction

2010-04-17 Thread Peter Münster
On Fri, Apr 16 2010, Philipp Gesang wrote: function track.simple(arg) Try this: print(TRACK:, arg) \def\foottrack#1{\footnote{\ctxlua{track.simple(#1)}}} With interaction enabled, the argument to \footnote{} gets evaluated twice. Cheers, Peter -- Contact information: http://pmrb.free.fr

Re: [NTG-context] lua, footnotes, interaction

2010-04-17 Thread Peter Münster
On Fri, Apr 16 2010, Philipp Gesang wrote: I'd naively expect \track#1 to behave identically regardless of interaction. How do I make it interaction-proof Sorry, I had forgotten to answer your main-question: \def\foottrack#1{\expanded{\footnote{\ctxlua{track.simple(#1

Re: [NTG-context] lua, footnotes, interaction

2010-04-17 Thread Philipp Gesang
\foottrack#1{\expanded{\footnote{\ctxlua{track.simple(#1) Thanks very much, this does it! and, if possible, how do I interaction-proof macros in general? I don't know, but I suppose \expanded{} can help in most cases. Adding that one to my “try first”-list seems reasonable. There's a macro

Re: [NTG-context] lua, footnotes, interaction

2010-04-17 Thread Hans Hagen
On 17-4-2010 8:27, Peter Münster wrote: On Fri, Apr 16 2010, Philipp Gesang wrote: function track.simple(arg) Try this: print(TRACK:, arg) \def\foottrack#1{\footnote{\ctxlua{track.simple(#1)}}} With interaction enabled, the argument to \footnote{} gets evaluated twice. eventually

Re: [NTG-context] lua, footnotes, interaction

2010-04-17 Thread Hans Hagen
to answer your main-question: \def\foottrack#1{\expanded{\footnote{\ctxlua{track.simple(#1) Thanks very much, this does it! and, if possible, how do I interaction-proof macros in general? I don't know, but I suppose \expanded{} can help in most cases. Adding that one to my “try first”-list

[NTG-context] lua, footnotes, interaction

2010-04-16 Thread Philipp Gesang
(Last one:\\ {\\bf .. track.preceding .. }.\\ .. This one:\\ {\\bf .. arg .. }) if arg == track.preceding then context(\\ -- matching!) else context(\\ -- not matching!) track.preceding = arg end end \stopluacode \def\track#1{\ctxlua{track.simple(#1

Re: [NTG-context] font lookup

2010-04-07 Thread Wolfgang Werners-Lucchini
When you know the filename, you can get the complete path like this: \starttext \ctxlua{tex.print(resolvers.find_file(texgyrepagella-regular.otf)) } \stoptext Your question is now answered but why do you need the complete path? Wolfgang I want to modify an example from

Re: [NTG-context] font lookup

2010-04-06 Thread Wolfgang Schuster
Am 06.04.10 07:20, schrieb Peter Münster: When you know the filename, you can get the complete path like this: \starttext \ctxlua{tex.print(resolvers.find_file(texgyrepagella-regular.otf))} \stoptext Your question is now answered but why do you need the complete path? Wolfgang

Re: [NTG-context] temporarily disabling enumeration numbering

2010-04-05 Thread Wolfgang Schuster
!title={#3},\c!list=,\c!bookmark=,][]% \xdef\currentnotenumber{\ctxlua{structure.notes.store(\currentnote,\currentdescriptionnumberentry)}}% \settrue\processingnote \ifconditional\skipnoteplacement \globallet\lastnotesymbol\dolastnotesymbol \else

Re: [NTG-context] font lookup

2010-04-05 Thread Peter Münster
On Tue, Apr 06 2010, Wolfgang Werners-Lucchini wrote: Result (on my system): Path: texgyrepagella-regular.otf Hmm! How does context resolve the complete path afterwards? Hello Wolfgang, When you know the filename, you can get the complete path like this: \starttext \ctxlua{tex.print

[NTG-context] Error under Ubuntu Lnux

2010-04-03 Thread Alain Delmotte
...ement {#1}{#2}{#3}{#4}{#5}{#6} \global \utilitydonetrue \processlistofstructure ...\fi \fi \fi \endcsname \ctxlua {structure.lists.p... l.1 \processlistofstructure{section}{section}{1

Re: [NTG-context] directlua in xmlsetup

2010-03-31 Thread Hans Hagen
out one backslash before the it: {it abc} I suspect some catcode trickery here. But can this be solved easily? Or do I need to program calling of some explicite Lua-function for this? wont work, \ctxlua does but \startluacode indeed does catcode trickery Hans

[NTG-context] arguments to ctxlua

2010-03-30 Thread Hans van der Meer
When I have a Lua function with 2 arguments: \startluacode function f(a,b) ... \stopluacode called through: \def\callf#1#2{\ctxlua{f(#1,#2)}} and do this actually with one argument: \callf{one} then I find that the absent argument b in f(a,b

Re: [NTG-context] arguments to ctxlua

2010-03-30 Thread Hans Hagen
On 30-3-2010 19:45, Hans van der Meer wrote: When I have a Lua function with 2 arguments: \startluacode function f(a,b) ... \stopluacode called through: \def\callf#1#2{\ctxlua{f(#1,#2)}} and do this actually with one argument: \callf{one} so, #1 will be one and #2 will be the next token

Re: [NTG-context] luacode inside xmlsetups

2010-03-30 Thread Hans Hagen
x = math.pi tex.print(pi = .. (x - x%0.01)) end \stopluacode \startxmlsetups xml:mycommand \ctxlua{document.MyPiStuff()} \stopxmlsetups Hans - Hans Hagen | PRAGMA ADE

Re: [NTG-context] luacode inside xmlsetups

2010-03-30 Thread Hans van der Meer
function outside the setups and call that one inside the setup \startluacode function document.MyPiStuff() local x = math.pi tex.print(pi = .. (x - x%0.01)) end \stopluacode \startxmlsetups xml:mycommand \ctxlua{document.MyPiStuff()} \stopxmlsetups Hans

Re: [NTG-context] arguments to ctxlua

2010-03-30 Thread Peter Münster
On Tue, Mar 30 2010, Hans van der Meer wrote: called through: \def\callf#1#2{\ctxlua{f(#1,#2)}} and do this actually with one argument: \callf{one} then I find that the absent argument b in f(a,b) is not nil but a string of length 1. Hello Hans, You want probably something

Re: [NTG-context] Microtype in ConTeXt

2010-03-26 Thread Yan Zhou
. On Mar 25, 2010, at 10:42 PM, Hans Hagen wrote: On 25-3-2010 19:14, Wolfgang Schuster wrote: \setupcharacterkerning[kerncharacters][factor=\ctxlua{tex.write(#1/1000)}]% i'll add it but simply with \setupcharacterkerning[kerncharacters][factor=#1]% there is no reason to use

Re: [NTG-context] Microtype in ConTeXt

2010-03-25 Thread Wolfgang Schuster
[letterspace] \def\letterspace {\bgroup \dosingleempty\doletterspace} \def\doletterspace[#1]#2% use \groupedcommand? {\iffirstargument \setupcharacterkerning[letterspace][factor=\ctxlua{tex.sprint(#1/1000)}]}% \fi \setcharacterkerning[letterspace]#2% \egroup} \starttext text

Re: [NTG-context] Microtype in ConTeXt

2010-03-25 Thread Hans Hagen
) \definecharacterkerning[letterspace] \def\letterspace {\bgroup \dosingleempty\doletterspace} \def\doletterspace[#1]#2% use \groupedcommand? {\iffirstargument \setupcharacterkerning[letterspace][factor=\ctxlua{tex.sprint(#1/1000)}]}% \fi \setcharacterkerning[letterspace]#2% \egroup} \starttext text

Re: [NTG-context] Microtype in ConTeXt

2010-03-25 Thread Wolfgang Schuster
Am 25.03.10 16:21, schrieb Hans Hagen: Who about something like (pseudocode) \definecharacterkerning[letterspace] \def\letterspace {\bgroup \dosingleempty\doletterspace} \def\doletterspace[#1]#2% use \groupedcommand? {\iffirstargument \setupcharacterkerning[letterspace][factor=\ctxlua

Re: [NTG-context] Microtype in ConTeXt

2010-03-25 Thread Hans Hagen
On 25-3-2010 19:14, Wolfgang Schuster wrote: \setupcharacterkerning[kerncharacters][factor=\ctxlua{tex.write(#1/1000)}]% i'll add it but simply with \setupcharacterkerning[kerncharacters][factor=#1]% there is no reason to use a different model than we have now (also, these 1000 based

Re: [NTG-context] interaction fails with footnotes

2010-03-16 Thread Wolfgang Schuster
[\TRLhyphenate]% \ctxlua{translit.transliterate(\TRLmode,\luaescapestring{#2})}% \egroup } \unexpanded\def\transliterate{\dosingleempty\dotransliterate} \unexpanded\def\starttransliterate{% \bgroup% \dosingleempty\dostarttransliterate } \let\stoptransliterate\relax \def\dostarttransliterate[#1]#2

Re: [NTG-context] interaction fails with footnotes

2010-03-16 Thread Philipp Gesang
·· \def\dotransliterate[#1]#2{% \bgroup \iffirstargument \getparameters[TRL][#1]% \fi \language[\TRLhyphenate]% \ctxlua{translit.transliterate(\TRLmode,\luaescapestring{#2})}% \egroup } \unexpanded\def\transliterate{\dosingleempty\dotransliterate} \unexpanded

Re: [NTG-context] Where to put a module?

2010-03-07 Thread Wolfgang Schuster
command! A better defintion for the setup command is: \def\setupTranslit{\dodoubleargument\getparameters[TRL]} You can also shorten your \dotransliterate macro a lot: \def\dotransliterate[#1]#2% {\bgroup \iffirstargument \getparameters[TRL][#1]% \fi \language[\TRLhyphenate]% \ctxlua

Re: [NTG-context] Where to put a module?

2010-03-07 Thread Philipp Gesang
\dotransliterate[#1]#2% {\bgroup \iffirstargument \getparameters[TRL][#1]% \fi \language[\TRLhyphenate]% \ctxlua{translit.transliterate(\TRLmode,\luaescapestring{#2})}% \egroup} Done. Seems I was a little too worried about not overwriting the globals; I promise to never ever mistrust TeX's

Re: [NTG-context] Where to put a module?

2010-03-07 Thread Wolfgang Schuster
[\TRLhyphenate]% \ctxlua{translit.transliterate(\TRLmode,\luaescapestring{#2})}% \egroup} Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl

Re: [NTG-context] Where to put a module?

2010-03-07 Thread Wolfgang Schuster
[\TRLhyphenate]% \ctxlua{translit.transliterate(\TRLmode,\luaescapestring{#2})}% \egroup} Wolfgang ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl

Re: [NTG-context] Where to put a module?

2010-03-07 Thread Philipp Gesang
\translate[\TRLhyphenate]% “\translate” -- is this a typo? I need to setup hyphenation. \ctxlua{translit.transliterate(\TRLmode,\luaescapestring{#2})}% \egroup} Wolfgang ___ If your question is of interest

[NTG-context] MetaPost + format(%g,n)

2010-03-07 Thread Troy Henderson
] \ctxlua{metapost.showlog=true} \startMPpage draw begingraph(1in,1in); setrange((0,0),(1,1)); for n=auto.x: show format(%g,n); endfor; endgraph; \stopMPpage See foo.log (attached). Thoughts? Troy (foo.tex ConTeXt ver: 2010.03.02 12:34 MKIV fmt: 2010.3.6 int: english

Re: [NTG-context] MetaPost + format(%g,n)

2010-03-07 Thread Troy Henderson
Is the sarith package usable in MKIV? For example, I would like to get the numerical (not string) values of auto.x and auto.y from the graph package. I expect the following example to work, but it does not (even if I input sarith) with MPinclusions. \usemodule[graph] \ctxlua{metapost.showlog

Re: [NTG-context] very strange error with \xypos and vim-typing

2010-02-16 Thread Peter Münster
63.6383pt-0pt\relax \MPy #1-\ctxlua {jobpositions.MPy(#1)} \dopresetpositionanchors ...expr \MPy \textanchor +\MPh \textanchor -\!!dime... ... l

Re: [NTG-context] very strange error with \xypos and vim-typing

2010-02-16 Thread Hans Hagen
63.6383pt-0pt\relax \MPy #1-\ctxlua {jobpositions.MPy(#1)} \dopresetpositionanchors ...expr \MPy \textanchor +\MPh \textanchor -\!!dime... ... l.5 \s[]{bla;} Hello, No answer. Does

Re: [NTG-context] very strange error with \xypos and vim-typing

2010-02-16 Thread Aditya Mahajan
; \stopC \stoptext which gives ! Missing number, treated as zero. to be read again \dontleavehmode argument \dontleavehmode \normalspace \secondoftwoarguments #1#2-#2 l.1 \the\dimexpr 63.6383pt-0pt\relax \MPy #1-\ctxlua

Re: [NTG-context] Formatting numbers in LuaTeX

2010-02-15 Thread Peter Münster
tex.write(s) end \stopluacode \def\calculate#1{% \start \def\Expression{\ctxlua{userdata.filter_expression(#1)}} \def\Result{\ctxlua{userdata.filter_result(#1)}} \calcmath{\Expression=\ctxlua{userdata.result_as_string(\Result)}} \stop } \starttext \startlines \calculate{1+2

Re: [NTG-context] Formatting numbers in LuaTeX

2010-02-15 Thread Andreas Harder
(res_replacements) do s = s:gsub(k, v) end tex.write(s) end \stopluacode \def\calculate#1{% \start \def\Expression{\ctxlua{userdata.filter_expression(#1)}} \def\Result{\ctxlua{userdata.filter_result(#1)}} \calcmath{\Expression=\ctxlua{userdata.result_as_string(\Result

[NTG-context] Formatting numbers in LuaTeX

2010-02-14 Thread Andreas Harder
Hi all! I played a little bit with LuaTeX in ConTeXt and two questions have arisen. \usemodule[calcmath] \starttext \def\calculate#1{\calcmath{#1=\ctxlua{tex.print(#1)}}} \calculate{1+2} \par \calculate{3/2-1}\par % the output should be 0,5 \calculate{3*2}\par % \calculate{sqrt(2)} \calculate{2

Re: [NTG-context] Formatting numbers in LuaTeX

2010-02-14 Thread luigi scarso
On Sun, Feb 14, 2010 at 11:42 AM, Andreas Harder andreas.har...@rz-online.de wrote: Hi all! I played a little bit with LuaTeX in ConTeXt and two questions have arisen. \usemodule[calcmath] \starttext \def\calculate#1{\calcmath{#1=\ctxlua{tex.print(#1)}}} \calculate{1+2} \par \calculate{3

Re: [NTG-context] Formatting numbers in LuaTeX

2010-02-14 Thread Peter Münster
examples? Hello Andreas, Just a quick hack: \usemodule[calcmath] \startluacode sqrt = math.sqrt pi = math.pi function my_equation(s, r) r = tostring(r) tex.print(s:gsub(*, ×) .. = .. r:gsub(%., ,)) end \stopluacode \def\calculate#1{\calcmath{\ctxlua{my_equation(#1, #1)}}} \starttext

Re: [NTG-context] Formatting numbers in LuaTeX

2010-02-14 Thread Andreas Harder
\calculate#1{\calcmath{\ctxlua{my_equation(#1, #1)}}} \starttext \startlines \calculate{1+2} \calculate{3/2-1} \calculate{3*2} \calculate{sqrt(2)} \calculate{2*pi} \stoplines \stoptext That’s nice! Thank you very much! I've found an posting on the LuaTeX-mailing-list and incorporated

[NTG-context] very strange error with \xypos and vim-typing

2010-02-08 Thread Peter Münster
-0pt\relax \MPy #1-\ctxlua {jobpositions.MPy(#1)} \dopresetpositionanchors ...expr \MPy \textanchor +\MPh \textanchor -\!!dime... ... l.5 \s[]{bla

Re: [NTG-context] What do you miss in ConTeXt?

2010-02-08 Thread Philipp Gesang
} -- which is odd because \xmlresetsorter _is_ defined in lxml-sor.mkiv. Furthermore when I add -- \unprotect \def\xmlresetsorter #1{\ctxlua{lxml.sorters.reset(#1)}} \protect -- to the preamble, I get a lua error (attempt to index field 'sorters' (a nil value

Re: [NTG-context] ConText and definecolor: undefined control sequence

2010-01-20 Thread Aditya Mahajan
(no model) pgfutil.unsupported_color(name) end else print(no color) pgfutil.unsupported_color(name) end end \stopluacode \unprotect \def\pgfu...@registercolor#1% {\ctxlua{pgfutil.registercolor(#1,\thecolorattribute {#1})}} \protect

[NTG-context] Automated Quotation/Punctuation Placement

2010-01-08 Thread Tad Ashlock
) context(cmd_start .. text .. cmd_mid) if string.find('.,!?', punc, 1, true) then context(punc .. cmd_end) else context(cmd_end .. ' ' .. punc) end end \stopluacode \def\Var#1#2{\ctxlua{move_end_punctuation([==[#1]==],[==[#2]==], '\\quote{\\type{','}','}')}} \starttext

Re: [NTG-context] Automated Quotation/Punctuation Placement

2010-01-08 Thread Wolfgang Schuster
move_end_punctuation (text, punc, cmd_start, cmd_mid, cmd_end) context(cmd_start .. text .. cmd_mid) if string.find('.,!?', punc, 1, true) then context(punc .. cmd_end) else context(cmd_end .. ' ' .. punc) end end \stopluacode \def\Var#1#2{\ctxlua{move_end_punctuation

Re: [NTG-context] Automated Quotation/Punctuation Placement

2010-01-08 Thread Khaled Hosny
, 1, true) then context(punc .. cmd_end) else context(cmd_end .. ' ' .. punc) end end \stopluacode \def\Var#1#2{\ctxlua{move_end_punctuation([==[#1]==],[==[#2]==], '\\quote{\\type{','}','}')}} \starttext This is \Var{var_name}, a variable. \stoptext

Re: [NTG-context] Automated Quotation/Punctuation Placement

2010-01-08 Thread Tad Ashlock
.. cmd_end) else context(cmd_end .. ' ' .. punc) end end \stopluacode \def\Var#1#2{\ctxlua{move_end_punctuation([=#1]==],[==[#2]==], '\\quote{\\type{','}','}')}} \starttext This is \Var{var_name}, a variable. \stoptext This works, until the \Var{} macro appears

Re: [NTG-context] Automated Quotation/Punctuation Placement

2010-01-08 Thread Tad Ashlock
) then context(punc .. cmd_end) else context(cmd_end .. ' ' .. punc) end end \stopluacode \def\Var#1#2{\ctxlua{move_end_punctuation([==[#1]==],[==[#2]==], '\\quote{\\type{','}','}')}} \starttext This is \Var{var_name}, a variable. \stoptext == What about: \def\Var#1

Re: [NTG-context] What is the luatex version of \pdfescapehex

2010-01-06 Thread Hans Hagen
)) end))) end \stopluacode \long\def\hexify#1{\ctxlua{commands.hexify([[#1]])}} \hexify{I wonder why this is needed.} btw, if your old module produces pdf and uses other \pdf... primitives it's unlikely to work with mkiv anyway so you'd better check if it's still needed Hans

Re: [NTG-context] What is the luatex version of \pdfescapehex

2010-01-06 Thread Zhichu Chen
(str)        texsprint(ctxcatcodes,(gsub(str,.,function(s) return format(%0X,byte(s)) end)))    end \stopluacode \long\def\hexify#1{\ctxlua{commands.hexify([[#1]])}} \hexify{I wonder why this is needed.} btw, if your old module produces pdf and uses other \pdf... primitives it's unlikely

Re: [NTG-context] extra kerning do nothing

2009-12-21 Thread Hans Hagen
Is it obsolete? Is there an alternative? patch this: \def\setcharacterkerning {\ctxlua{kerns.enable()}% \gdef\setcharacterkerning[##1]% {\dosetattribute{kern}{\csname\??ck:##1\endcsname}}% \setcharacterkerning

Re: [NTG-context] extra kerning do nothing

2009-12-21 Thread Andreas Harder
{\setcharacterkerning[negative]\input davis\relax} \stoptext Is it obsolete? Is there an alternative? patch this: \def\setcharacterkerning {\ctxlua{kerns.enable()}% \gdef\setcharacterkerning[##1]% {\dosetattribute{kern}{\csname\??ck:##1\endcsname}}% \setcharacterkerning} Thank you Hans. I’ve

Re: [NTG-context] extra kerning do nothing

2009-12-21 Thread Hans Hagen
{\setcharacterkerning[negative]\input davis\relax} \stoptext Is it obsolete? Is there an alternative? patch this: \def\setcharacterkerning {\ctxlua{kerns.enable()}% \gdef\setcharacterkerning[##1]% {\dosetattribute{kern}{\csname\??ck:##1\endcsname}}% \setcharacterkerning} Thank you

Re: [NTG-context] extra kerning do nothing

2009-12-21 Thread Andreas Harder
{\setcharacterkerning[extrakerning]\input davis\relax} \blank {\setcharacterkerning[negative]\input davis\relax} \stoptext Is it obsolete? Is there an alternative? patch this: \def\setcharacterkerning {\ctxlua{kerns.enable()}% \gdef\setcharacterkerning[##1]% {\dosetattribute{kern}{\csname\??ck:##1

Re: [NTG-context] extra kerning do nothing

2009-12-21 Thread Hans Hagen
\blank {\setcharacterkerning[extrakerning]\input davis\relax} \blank {\setcharacterkerning[negative]\input davis\relax} \stoptext Is it obsolete? Is there an alternative? patch this: \def\setcharacterkerning {\ctxlua{kerns.enable()}% \gdef\setcharacterkerning[##1]% {\dosetattribute{kern

Re: [NTG-context] extra kerning do nothing

2009-12-21 Thread Andreas Harder
[negative][factor=-0.125] \starttext \input davis \blank {\setcharacterkerning[extrakerning]\input davis\relax} \blank {\setcharacterkerning[negative]\input davis\relax} \stoptext Is it obsolete? Is there an alternative? patch this: \def\setcharacterkerning {\ctxlua{kerns.enable()}% \gdef

Re: [NTG-context] extra kerning do nothing

2009-12-21 Thread Hans Hagen
] \setupcharacterkerning[negative][factor=-0.125] \starttext \input davis \blank {\setcharacterkerning[extrakerning]\input davis\relax} \blank {\setcharacterkerning[negative]\input davis\relax} \stoptext Is it obsolete? Is there an alternative? patch this: \def\setcharacterkerning {\ctxlua{kerns.enable

Re: [NTG-context] Metapost label - Truncating digits after decimal point

2009-12-15 Thread Aditya Mahajan
can use lua to truncate a number. \unexpanded\def\truncate#1{\ctxlua{context(\%.1f, #1)}} \startMPdefinitions def truncatedtext(expr s) = textext(\truncate{ s }) enddef ; \stopMPdefinitions \starttext \startuseMPgraphic{Figure} u := 1cm; pickup pencircle scaled 2pt; % default pen

Re: [NTG-context] Call for papers (pracjourn mkiv)

2009-12-15 Thread Aditya Mahajan
~= then tex.sprint(tex.ctxcatcodes, action) end end \stopluacode \def\doifdefinedurl#1#2{\ctxlua{ptj.doifdefinedurl(#1, \!!bs\detokenize{#2}\!!es)}} \stopmode Bookmarks are not working, but that seems to be a bug in current MKIV. Minimal example \setupinteraction[state=start

Re: [NTG-context] Call for papers (pracjourn mkiv)

2009-12-15 Thread Hans Hagen
) if jobreferences.urls.data[name] and name ~= then tex.sprint(tex.ctxcatcodes, action) end end \stopluacode \def\doifdefinedurl#1#2{\ctxlua{ptj.doifdefinedurl(#1, \!!bs\detokenize{#2}\!!es)}} \stopmode i'll add: \def\doifurldefinedelse {\ctxlua{commands.doifurldefinedelse (#1)}} \def

Re: [NTG-context] Call for papers (pracjourn mkiv)

2009-12-15 Thread Aditya Mahajan
On Tue, 15 Dec 2009, Hans Hagen wrote: i'll add: \def\doifurldefinedelse {\ctxlua{commands.doifurldefinedelse (#1)}} \def\doiffiledefinedelse{\ctxlua{commands.doiffiledefinedelse(#1)}} Can you also add corresponding commands in MkII. The practex module needs to work with both MkII and MkIV

Re: [NTG-context] Call for papers (pracjourn mkiv)

2009-12-15 Thread Hans Hagen
Aditya Mahajan wrote: On Tue, 15 Dec 2009, Hans Hagen wrote: i'll add: \def\doifurldefinedelse {\ctxlua{commands.doifurldefinedelse (#1)}} \def\doiffiledefinedelse{\ctxlua{commands.doiffiledefinedelse(#1)}} Can you also add corresponding commands in MkII. The practex module needs to work

Re: [NTG-context] Metapost label - Truncating digits after decimal point

2009-12-15 Thread Curiouslearn
()? Please see the minimal example below which produces 1.84375. Can I just keep the first digit and have it produce 1.8 ? Thanks. If you are using mkiv, you can use lua to truncate a number. \unexpanded\def\truncate#1{\ctxlua{context(\%.1f, #1)}} \startMPdefinitions  def truncatedtext(expr s

Re: [NTG-context] actualtext and encoding

2009-12-07 Thread Hans Hagen
\pdfliteral{EMC} text \stoptext Is /ActualText supposed to be in PDFDoc Encoding? nopdfcompression \def\pdfactualtext#1#2% {\pdfliteral direct{/Span /ActualText \ctxlua{tex.write(lpdf.tosixteen(#2))} BDC}#1\pdfliteral direct{EMC}} \starttext text \pdfactualtext{Meier}{Müller} text

Re: [NTG-context] actualtext and encoding

2009-12-07 Thread Wolfgang Schuster
Am 07.12.2009 um 09:46 schrieb Hans Hagen: \def\pdfactualtext#1#2% {\pdfliteral direct{/Span /ActualText \ctxlua{tex.write(lpdf.tosixteen(#2))} BDC}#1\pdfliteral direct{EMC}} \starttext text \pdfactualtext{Meier}{Müller} text \stoptext Perfect, will this end in the core? Regards

Re: [NTG-context] actualtext and encoding

2009-12-07 Thread Hans Hagen
Wolfgang Schuster wrote: Am 07.12.2009 um 09:46 schrieb Hans Hagen: \def\pdfactualtext#1#2% {\pdfliteral direct{/Span /ActualText \ctxlua{tex.write(lpdf.tosixteen(#2))} BDC}#1\pdfliteral direct{EMC}} \starttext text \pdfactualtext{Meier}{Müller} text \stoptext Perfect, will this end

Re: [NTG-context] actualtext and encoding

2009-12-07 Thread Wolfgang Schuster
processing) or maybe dictionary driven .. there is no linebreak in the text because it's a boxed content, a simple version of my macro is \def\pdfactualtext#1#2% {\pdfliteral direct{/Span /ActualText \ctxlua{tex.write(lpdf.tosixteen(#2))} BDC}#1\pdfliteral direct{EMC}} \def\ruby#1#2

Re: [NTG-context] actualtext and encoding

2009-12-07 Thread Hans Hagen
attributes and delayed processing) or maybe dictionary driven .. there is no linebreak in the text because it's a boxed content, a simple version of my macro is \def\pdfactualtext#1#2% {\pdfliteral direct{/Span /ActualText \ctxlua{tex.write(lpdf.tosixteen(#2))} BDC}#1\pdfliteral direct{EMC

Re: [NTG-context] Problem with font mapping

2009-11-26 Thread Wolfgang Schuster
mechanism and I'm going to adapt simplefonts to the new code (will take a while) but there are now many new features available, take for example the new spec-interface which could be used to write this: \starttypescript[Xserif][all][name] \definefontsynonym [Serif] [spec:\ctxlua

Re: [NTG-context] Problem with font mapping

2009-11-26 Thread Hans Hagen
] [spec:\ctxlua{tex.sprint(string.lower(string.gsub(\typescripttwo,[^a-zA-Z0-9],)))}-normal-normal] [features=default] \definefontsynonym [SerifItalic] [spec:\ctxlua{tex.sprint(string.lower(string.gsub(\typescripttwo,[^a-zA-Z0-9],)))}-normal-italic] [features=default

Re: [NTG-context] Problem with font mapping

2009-11-26 Thread Wolfgang Schuster
Am 26.11.2009 um 16:01 schrieb Hans Hagen: \definefontsynonym[Serif][spec:\ctxlua{fonts.names.cleanname(\typescripttwo}-normal-normal][features=default] I'll add \cleanfontname so that we can have \definefontsynonym[Serif][spec:\cleanfontname\typescripttwo-normal-normal][features=default

Re: [NTG-context] Problem with font mapping

2009-11-26 Thread Hans Hagen
Wolfgang Schuster wrote: Am 26.11.2009 um 16:01 schrieb Hans Hagen: \definefontsynonym[Serif][spec:\ctxlua{fonts.names.cleanname(\typescripttwo}-normal-normal][features=default] I'll add \cleanfontname so that we can have \definefontsynonym[Serif][spec:\cleanfontname\typescripttwo-normal

Re: [NTG-context] Getting the width of an expression inside lua

2009-11-02 Thread Matthijs Kooijman
how this boxing thing works... tex.sprint(\\ctxlua{document.step_two(0)}) I guess this indirection is needed to force the \setbox command to be expanded? I guess tex.sprint doesn't expand its arguments immediately, so just putting document.step_two(0) instead of the entire tex.sprint(\\ctxlua

Re: [NTG-context] Getting the width of an expression inside lua

2009-11-02 Thread Hans Hagen
this? I'm not quite sure how this boxing thing works... well, you can allocate a box for that purpose tex.sprint(\\ctxlua{document.step_two(0)}) I guess this indirection is needed to force the \setbox command to be expanded? I guess tex.sprint doesn't expand its arguments immediately, so

Re: [NTG-context] Getting number of figure pages in MkIV

2009-10-31 Thread Aditya Mahajan
for this \ifconditional\testexternalfigureonly \ifcase\figurestatus \else \ctxlua{figures.check()}% \fi \signalexternalfigure \else This works perfectly. \ifconditional\testexternalfigureonly \ifcase\figurestatus \else \ctxlua{figures.check

[NTG-context] \attachment not working in MkIV

2009-10-29 Thread Matthijs Kooijman
\ctxlua {interaction... to be read again \starttext l.4 \starttext \attachment[whatever] \stoptext What's up with this? Gr. Matthijs signature.asc Description: Digital signature

Re: [NTG-context] format float numbers in luatex

2009-10-26 Thread Otared Kavian
Hi Jorge, Regarding your first question try this: \starttext The square root of 2 is \ctxlua{tex.print(math.sqrt(2))}\dots, but usually the default value \ctxlua{tex.print(math.floor(1000*math.sqrt(2))/1000)} is considered to be a good approximation. \stoptext (There is also math.ceil

[NTG-context] Curiosity about math.random in LuaTeX

2009-10-25 Thread Otared KAVIAN
}{% \ctxlua{tex.print(math.random(110,150))} \qquad \ctxlua{tex.print(math.random(math.random(110,120),math.random(140,150)))} \par} \stoptext %%% end test-random.tex Indeed I guess that this is due to the random seed used by LuaTeX: is it possible to force a new random seed upon each typesetting

[NTG-context] Curiosity about math.random in LuaTeX

2009-10-25 Thread Otared Kavian
}{% \ctxlua{tex.print(math.random(110,150))} \qquad \ctxlua{tex.print(math.random(math.random(110,120),math.random (140,150)))} \par} \stoptext %%% end test-random.tex Indeed I guess that this is due to the random seed used by LuaTeX: is it possible to force a new random seed upon each

Re: [NTG-context] format float numbers in luatex

2009-10-25 Thread Wolfgang Schuster
Am 24.10.2009 um 18:59 schrieb batela: Dear Sirs, I'm looking a way to format float numbers. For example \ctxlua {text.print(sqrt(2))} give me 1.41421356237309504880 but i want 1.414. Is there a way to format real numbers. Note: I had tried \ctxlua{a = sqrt(a) ; aformat = string.format

Re: [NTG-context] Curiosity about math.random in LuaTeX

2009-10-25 Thread Taco Hoekwater
to the seed values. If you want near-random randomness, you can set the seed yourself based on the return value of os.time(): \ctxlua{math.randomseed(os.time())} Best wishes, Taco ___ If your question is of interest

Re: [NTG-context] Curiosity about math.random in LuaTeX

2009-10-25 Thread Thomas A. Schmitz
() expects an integer, this gives almost no randomness at all to the seed values. If you want near-random randomness, you can set the seed yourself based on the return value of os.time(): \ctxlua{math.randomseed(os.time())} Ah, that explains why I could never get random numbers in mkiv when I

Re: [NTG-context] Curiosity about math.random in LuaTeX

2009-10-25 Thread Otared Kavian
in that process: all randomseeds in mkiv appear to be between 0 and 1. Since math.randomseed() expects an integer, this gives almost no randomness at all to the seed values. If you want near-random randomness, you can set the seed yourself based on the return value of os.time(): \ctxlua

Re: [NTG-context] latest beta doesn't process my xml files

2009-10-20 Thread Hans Hagen
-context/tex/context/base/lxml-tex.lua:1207: in function 'flush' main ctx instance:1: in main chunk. \xmlflush #1-\ctxlua {lxml.flush(#1)} \dostructurecomponent ...uctureparameter \c!title }\xdef \currentstructurebo... \doregisterstructurehead

[NTG-context] latest beta doesn't process my xml files

2009-10-19 Thread Thomas A. Schmitz
-tex.lua:1207: in function 'flush' main ctx instance:1: in main chunk. \xmlflush #1-\ctxlua {lxml.flush(#1)} \dostructurecomponent ...uctureparameter \c!title }\xdef \currentstructurebo... \doregisterstructurehead ... \c!command =, #2][#3

Re: [NTG-context] Line Numbering and References

2009-10-14 Thread Wolfgang Schuster
wrong with the \mksomelinereference command and 'ctxlua' with it's argument appears in the text. \starttext \startlinenumbering Thus, I came to the conclusion that the designer of a new system must not only be the implementer and first large--scale user;\someline [here] the designer should also

Re: [NTG-context] Line Numbering and References

2009-10-14 Thread Andreas Harder
this should be the correct form but there is something wrong with the \mksomelinereference command and 'ctxlua' with it's argument appears in the text. Thank you Wolfgang. I hope it can be fixed soon … Andreas

Re: [NTG-context] activating font specific ligatures

2009-10-01 Thread Peter Rolf
] \definefontfeature[minion][mode=node,script=latn,language=dflt,liga=yes,kern=yes,tlig=yes,trep=yes,onum=yes, xlig=yes,featurefile=minionpro.fea] [font-ini.mkiv] [..] \def\doinstallfontfeature[#1][#2]% {\writestatus\m!fonts{installing font features was experimental}} % \ctxlua

Re: [NTG-context] setting variable on cmd-line

2009-09-21 Thread Peter Münster
On Mon, 21 Sep 2009, luigi scarso wrote: test-file: \starttext Value of myVar: \ctxlua{tex.print(document.arguments[arguments=myVar])} \stoptext cmd-line: context --arguments=myVar=myValue test But this syntax is very strange! Does  context --arguments=myVar

Re: [NTG-context] setting variable on cmd-line

2009-09-21 Thread Hans Hagen
Peter Münster wrote: On Mon, 21 Sep 2009, luigi scarso wrote: test-file: \starttext Value of myVar: \ctxlua{tex.print(document.arguments[arguments=myVar])} \stoptext cmd-line: context --arguments=myVar=myValue test But this syntax is very strange! Does context --arguments=myVar=myValue

<    5   6   7   8   9   10   11   12   >