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
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
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
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
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
.
\dofloatssave #1-\ctxlua {floats.save(#1)}
\the \everyfloatscheck
\dosavefloat -\dofloatssave {text}
\nonoindentation
argument ...hod ,bottom,top] \else \dosavefloat
\fi
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
])
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
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
___
--
() 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
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
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
\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
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
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
(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
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
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
!title={#3},\c!list=,\c!bookmark=,][]%
\xdef\currentnotenumber{\ctxlua{structure.notes.store(\currentnote,\currentdescriptionnumberentry)}}%
\settrue\processingnote
\ifconditional\skipnoteplacement
\globallet\lastnotesymbol\dolastnotesymbol
\else
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
...ement {#1}{#2}{#3}{#4}{#5}{#6}
\global \utilitydonetrue
\processlistofstructure ...\fi \fi \fi \endcsname
\ctxlua {structure.lists.p...
l.1 \processlistofstructure{section}{section}{1
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
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
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
x = math.pi
tex.print(pi = .. (x - x%0.01))
end
\stopluacode
\startxmlsetups xml:mycommand
\ctxlua{document.MyPiStuff()}
\stopxmlsetups
Hans
-
Hans Hagen | PRAGMA ADE
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
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
.
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
[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
)
\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
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
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
[\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
··
\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
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
\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
[\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
[\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
\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
]
\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
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
63.6383pt-0pt\relax
\MPy #1-\ctxlua {jobpositions.MPy(#1)}
\dopresetpositionanchors ...expr \MPy \textanchor
+\MPh \textanchor
-\!!dime...
...
l
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
;
\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
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
(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
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
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
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
\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
-0pt\relax
\MPy #1-\ctxlua {jobpositions.MPy(#1)}
\dopresetpositionanchors ...expr \MPy \textanchor
+\MPh \textanchor
-\!!dime...
...
l.5 \s[]{bla
}
--
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
(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
)
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
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
, 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
.. 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
) 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
)) 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
(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
Is it obsolete? Is there an alternative?
patch this:
\def\setcharacterkerning
{\ctxlua{kerns.enable()}%
\gdef\setcharacterkerning[##1]%
{\dosetattribute{kern}{\csname\??ck:##1\endcsname}}%
\setcharacterkerning
{\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
{\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
{\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
\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
[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
]
\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
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
~= 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
)
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
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
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
()? 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
\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
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
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
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
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
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
]
[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
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
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
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
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
for this
\ifconditional\testexternalfigureonly
\ifcase\figurestatus \else
\ctxlua{figures.check()}%
\fi
\signalexternalfigure
\else
This works perfectly.
\ifconditional\testexternalfigureonly
\ifcase\figurestatus \else
\ctxlua{figures.check
\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
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
}{%
\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
}{%
\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
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
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
() 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
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
-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
-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
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
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
]
\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
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
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
901 - 1000 of 1168 matches
Mail list logo