project.
El dom., 5 de abr. de 2020 a la(s) 09:28, Wolfgang Schuster (
wolfgang.schuster.li...@gmail.com) escribió:
> Jairo A. del Rio schrieb am 05.04.2020 um 15:00:
> > I'm writing a project in ConTeXt MKIV and I want to load some (pure) Lua
> > libraries and bindings (defining
Jairo A. del Rio schrieb am 05.04.2020 um 15:00:
I'm writing a project in ConTeXt MKIV and I want to load some (pure) Lua
libraries and bindings (defining \ctxlua and the like). For instance, I
have the file foo.lua with some macros and I want to use them in my
project. Something like
On 05.04.20 15:00, Jairo A. del Rio wrote:
I'm writing a project in ConTeXt MKIV and I want to load some (pure) Lua
libraries and bindings (defining \ctxlua and the like). For instance, I
have the file foo.lua with some macros and I want to use them in my
project. Something like
Il 05/04/20 15:00, Jairo A. del Rio ha scritto:
I'm writing a project in ConTeXt MKIV and I want to load some (pure) Lua
libraries and bindings (defining \ctxlua and the like). For instance, I
have the file foo.lua with some macros and I want to use them in my
project. Something like
I'm writing a project in ConTeXt MKIV and I want to load some (pure) Lua
libraries and bindings (defining \ctxlua and the like). For instance, I
have the file foo.lua with some macros and I want to use them in my
project. Something like this:
\startproject project
%\component foo.lua %This does
ns[+]{doublefun}
>
> \stopMPinclusions
>
> \startMPdefinitions{doublefun}
> vardef makeTeXLabel( expr w, h, name) =
> show "NAME makeTeXLabel:", name;
> save p; picture p ;
> save s; string s;
> s := "\framed{" & name & "}"; % Curly bra
save p; picture p ; save s; string s; s := "\framed{" & name & "}"; % Curly braces will be missing. I need this to work. % s := "\type-" & name & "-"; % Curly braces are displayed, but this must become a vbox in the end, so can't use it show "
;>
>> Basically, the approach is now something like this:
>>
>> TeX: calls Lua code with \ctxlua{filename}
>> Lua: context.startMPpage
>> Lua: read XML. String in XML in filename read by Lua
>> Here we know the dimensions in which the string must be typeset and
; TeX: calls Lua code with \ctxlua{filename}
> Lua: context.startMPpage
> Lua: read XML. String in XML in filename read by Lua
> Here we know the dimensions in which the string must be typeset and wrapped
> around because that is also in the XML
> Lua: A context() call contains METAPO
I have a string with double quotes that needs to become a text in a box in
METAPOST. METAPOST is used to create an image consisting of boxes and
connections.
Basically, the approach is now something like this:
TeX: calls Lua code with \ctxlua{filename}
Lua: context.startMPpage
Lua: read XML
Pablo Rodriguez schrieb am 29.03.2020 um 13:53:
Dear list,
consider the following sample:
\setuppapersize[A8]
\starttext
\ConTeXt:
\in[seac]
Is it defined?:
\doifelse{\in[seac]}{??}{undefined}{defined}
\Lua:
\ctxlua{context([[{\in[seac
Dear list,
consider the following sample:
\setuppapersize[A8]
\starttext
\ConTeXt:
\in[seac]
Is it defined?:
\doifelse{\in[seac]}{??}{undefined}{defined}
\Lua:
\ctxlua{context([[{\in[seac]}]])}
Is it defined?:
\startlua
if [[{\in[seac
On 3/19/2020 11:20 AM, Fabrice Couvreur wrote:
Hi,
this file did not pose any problems but today yes.
really?
lua error > lua error on line 34 in file /home/viserion/Table.tex:
[ctxlua]:5: unfinished string near '"align={middle,lohi},'
there is a "
xt.stopxrow()
context.startxrow()
for _, letter in ipairs(letters_2) do
context.startxcell() context(letter) context.stopxcell()
end
context.stopxrow()
context.startxrow()
context.startxcell() context("2") context.stopxcell()
context.startxcell({"width=2cm"}) context("Prix (
g setup:
\starttext
\startMPdefinitions (or inclusions, no difference)
% ApplicationComponentLogo is defined here with a vardef
\stopMPdefinitions
\ctxlua{foo(“filename”)}% produces a series of
%context.startMPpage { in
tions (or inclusions, no difference)
% ApplicationComponentLogo is defined here with a vardef
\stopMPdefinitions
\ctxlua{foo(“filename”)}% produces a series of
%context.startMPpage { instance =
"doublefun” }
\stopbuffer
\startxmlsetups xml:initialize
\xmlsetsetup{#1}{date}{xml:date}
\stopxmlsetups
\xmlregistersetup{xml:initialize}
\startxmlsetups xml:date
\xmldoifelse {#1}{.[@type='divDate']} {
\def\docdate{\ctxlua{
local tyear = string.sub('\xmlatt{#1}{when-iso}',1,4)
local tmonth = string.sub('\xmlatt{#1
>>
>> 10.I.08
>>
>>
>> 19 Mar '08
>>
>>
>>
>>
>>
>> \stopbuffer
>> \startxmlsetups xml:initialize
>> \xmlsetsetup{#1}{date}{xml:date}
&
into a table and
write auxiliary functions to access the data and insert them into the TeX
output.
When I process the included files with
context --environment=prozess-style-ecm.tex prozess.xml
I get
[ctxlua]:19: table index is nil
12
13 doc = xml.load(doclistfile, settings)
14
15
; title to my transform function.
> > \startluacode
> > userdata = userdata or {}
> > function userdata.mytransform(title)
> > --context(title) --this is just fine, but isn't very useful
> > context(string.reverse(title))
> > end
> > \stopluacode
> > \def\trans
textcommand does not work since I can't find the way to pass
> > the raw title to my transform function.
> > \startluacode
> > userdata = userdata or {}
> > function userdata.mytransform(title)
> > --context(title) --this is just fine, but isn't very
context(title) --this is just fine, but isn't very useful
> context(string.reverse(title))
> end
> \stopluacode
>
> \def\transformtitle#1%
> {\ctxlua{userdata.mytransform([==[#1]==])}}
>
> \setuplist[chapter][textcommand=\transformtitle]
>
> \starttext
&
ata or {}
function userdata.mytransform(title)
--context(title) --this is just fine, but isn't very useful
context(string.reverse(title))
end
\stopluacode
\def\transformtitle#1%
{\ctxlua{userdata.mytransform([==[#1]==])}}
\setuplist[chapter][textcommand=\transformtitle]
\startt
tle#1%
{\ctxlua{userdata.mytransform([==[#1]==])}}
\setuplist[chapter][textcommand=\transformtitle]
\starttext
\completecontent
\startchapter[title={Sample Chapter}]
\stopchapter
\stoptext
When I print the actual title that is passed to mytransform, all I get is
\currentlistentrytitle an
ncluding label stuffwhat you can also try (with lmtx) is this (no real interface yet):\starttext\hbox\bgroup \ctxlua{metapost.startsvghashing()}% \includesvgfile[labels-004.svg]% \ctxlua{metapost.stopsvghashing()}%\egroup\stoptextwhich should turn your labels into tex, so you can typeset them as tex (so $
investigate the details manual tip you provided, thanks a lot.
> you might want to peek into the luametafun manual as svg is discussed there,
> including label stuff
>
> what you can also try (with lmtx) is this (no real interface yet):
>
> \starttext
>
> \hbox\bgroup
&
there, including label stuff
what you can also try (with lmtx) is this (no real interface yet):
\starttext
\hbox\bgroup
\ctxlua{metapost.startsvghashing()}%
\includesvgfile[labels-004.svg]%
\ctxlua{metapost.stopsvghashing()}%
\egroup
\stoptext
which should turn your labels into tex, so you can
ter my previous message is that both
"\savebuffer[whatever][αβδ.γεζ]" and
"\ctxlua{os.remove([[\jobname]].."-αβδ.γεζ")}" are portable ways of
creating and removing empty files.
> Another way is to use a make file (or a ctx-file for ConTeXt)
> to add a image
kens.getters.macro("projectpath")
local xO = tokens.getters.macro("xO")
local yO = tokens.getters.macro("yO")
local I = {} -- Table of initial values
I ["projectpath"] = ppth
I ["column"] = {}
I ["colum
s normally a bad idea to have fonts in such a place. You never know
> how it will clash with other fonts (versions, similar names, etc).
>
> In context, we have
>
> tex/texmf-fonts
>
> so best is to use:
>
> tex/texmf-fonts/data/MyFont-It.otf
>
> etc,
environment variable.
Like:
\starttext
% \ctxlua{fonts.names.addruntimepath("./myfonts")}
\ctxlua{os.setenv("RUNTIMEFONTS","./myfonts")}
Hello World!
\definefont[myfont][file:myfont.otf]
{\myfont Hello World!}
\stoptext
But .. you need tio wipe such
ture_name,
[ "width_px" ] = b.width_px,
[ "height_px" ]= b.height_px,
}
context ( 'function Rosi(): b.smrk = ', b.smrk )
context.par()
andalone lua typically sees only one chunk (the file you pass on the
> > command
> > line) but embedded lua implementation often see (sometimes many) more
> > chunks.
> > In luatex’s case, each \directlua is a separate chunk (in ConTeXt, that
> > means every
> > \s
(sometimes many) more chunks.
In luatex’s case, each \directlua is a separate chunk (in ConTeXt, that means
every
\startluacode block and every \ctxlua call is a separate chunk).
The only unusual thing here is that standalone lua silently quits and returns a
non-zero exit code to the shell, wher
many) more chunks.
In luatex’s case, each \directlua is a separate chunk (in ConTeXt, that means
every
\startluacode block and every \ctxlua call is a separate chunk).
The only unusual thing here is that standalone lua silently quits and returns a
non-zero exit code to the shell, whereas luatex
On Mon, Oct 14, 2019 at 09:26:58PM +0200, Taco Hoekwater wrote:
> Hi,
>
> > On 14 Oct 2019, at 21:08, Rudolf Bahr wrote:
> >
> >
> > 2. But in the case of an not existing file (BBB.lua) the known error
> > message comes up
> > again:
> > &qu
Hi,
> On 14 Oct 2019, at 21:08, Rudolf Bahr wrote:
>
>
> 2. But in the case of an not existing file (BBB.lua) the known error message
> comes up
> again:
> "token call, execute: [ctxlua]:8: /home/sam/context-tests/BBB.lua: No such
> file or
>directory
>context ( " exists!" )
> > else
> >context ( name )
> > context ( " doesn't exist!" )
> > end
> > end
> >
> > \stopluacode
> >
> >
> > \starttext
> >
> > \def\l
( name, "r" ))
if f then
f:close ()
context ( name )
context ( " exists!" )
else
context ( name )
context ( " doesn't exist!" )
end
end
\stopluacode
\starttext
\def\lookupfile#1%
{\ctxl
Hi,
> On 14 Oct 2019, at 18:51, Rudolf Bahr wrote:
>
>
> Dear List!
>
> THis MWE must be faulty, but where is the error?
>
> ===
> \lookupfile{"$HOME/context-tests/AAA.lua"}% "AAA.lua" intentionally does
> exist
$HOME is an actual
I suspect the double quotes are part of file names, hence files cannot be
found. Perhaps try remove them in macro argument.
Hope this helps
De : Rudolf Bahr
Envoyé le :lundi 14 octobre 2019 18:50
À : ntg-context@ntg.nl
Objet :[NTG-context] \ctxlua and \startluacode ... \stopluacode
Dear List
f:close ()
context ( name )
context ( " exists!" )
else
context ( name )
context ( " doesn't exist!" )
end
end
\stopluacode
\starttext
\def\lookupfile#1%
{\ctxlua{userdata.file_exists([==[#1]==])}}
\lookupfile{"$HOME/cont
t;-comparator to compare the keys a and b
printlistitem(keyword, values)
end
context.TB{"2ex"}
for keyword, values in userdata.sorttable(latingroup, function(t,a,b) return
string.lower(a) < string.lower(b) end) do
printlistitem(keyword, values)
end
context.stoptabulate()
end
\stopluacode
ta.points = tonumber( question ) * 92
-- do some calculations with points and return to to context
userdata.answer=42
\stopluacode
% lots of Text in between
The answer is \ctxlua{ context(userdata.answer) }. Points are \ctxlua{
context(userdata.points) }.
\stoptext
Best wishes,
Massi
Il 27
t[i]["columnTwo"] = 10*i + 2
end
tt = {}
for i = 1,3 do -- is it possible to avoid this ?
tt[i] = t[i]["columnOne"]
end
\stopluacode
The first column of the array \type{t} is:
\ctxlua{context.print(tt," ; ")}
\
\fakewords{3}{20}}]
\externalfigure[place #1][width=\PicWidth,height=\dimexpr\textheight * \imgH /
10 \relax]
\stopplacefigure
}
\starttext
\dorecurse{3}
{\chapter{\fakewords{5}{10}}
\dorecurse{3}
{\dorecurse{3}{\fakewords{50}{100}\endgraf}
\Blindbild{\ctxlua
tupreferencing[state=start]
\definenumber[test]
\setnumber[test][5]
\startluacode
function TestVarA(var)
print('VARIABLE A: ',var)
context(var)
end
function TestVarB(var)
print('VARIABLE B: ',var)
context.inlinerange { var }
end
\stopluacode
\def\TestLuaA#1{\ctxlua{TestVarA(#
are obviously not being
expanded before they are passed to Lua.
Here is a minimal example:
|\setupreferencing[state=start]||\definenumber[test]\setnumber[test][5]\startluacodefunction
TestVar(var)print('VARIABLE: ')print(var)tex.print(var)end
\stopluacode\def\TestLua#1{\ctxlua{TestVar([==[#1]==])}}% Cf
to Lua.
Here is a minimal example:
|\setupreferencing[state=start]||\definenumber[test]\setnumber[test][5]\startluacodefunction
TestVar(var)print('VARIABLE: ')print(var)tex.print(var)end
\stopluacode\def\TestLua#1{\ctxlua{TestVar([==[#1]==])}}% Cf.
https://www.contextgarden.net
]
\starttext
\startbuffer[test]
print("Output from lua")
\stopbuffer
\savebuffer[list={test}, file={test.lua}, prefix=no]
\ctxlua{job.files.run("test.lua",
"lua test.lua > test-output.tex")}
\ReadFile{test-output.tex}
\savebuffer[list={test
= nuts.takebox(box_id)
local margin_node = nuts.getattr(box, margin_node_attr)
context('Expected 555=' .. (margin_node or '(nil)'))
end
\stopluacode
\starttext
Test.
\the\MarginNodeattribute
\setbox\MyBox\hbox attr\the\MarginNodeattribute=555{Test}
\ctxlua{test_attribute(\the\MyBox
r the list of nodes of a paragraph,
figuring out all the possible nodes and their fields, i'm wondering if
there's some hidden tool in the ConTeXt coffer to simplify the task.
\starttext
\setbox0\vbox{\input tufte }
\ctxlua{inspect(nodes.totable(tex.box[0]))}
\stoptext
\starttext
\se
> latin modern fonts are not preloaded
languages > language 'en' is active
open source > level 2, order 3, name '/tmp/uhd8RE/texweb.tex'
fonts > preloading latin modern fonts (second stage)
fonts > 'fallback modern-designsize rm 12pt' is loaded
lua error
> files > jobname 'texweb', input './texweb', result 'texweb'
> fonts > latin modern fonts are not preloaded
> languages > language 'en' is active
> open source > level 2, order 3, name '/tmp/uhd8RE/texweb.tex'
> fonts > preloading latin modern
ds defined by interfaces.definecommand fail when you
pass string arguments that contain brackets.
I think cldf-int.lua needs a patch to support those kind of arguments.
FYI, it fails because definecommand() creates a \myCommand that is equivalent
to this:
\def\myCommand#1{\ctxlua {_clmm_('myCom
necommand fail when you
> pass string arguments that contain brackets.
>
> I think cldf-int.lua needs a patch to support those kind of arguments.
FYI, it fails because definecommand() creates a \myCommand that is equivalent
to this:
\def\myCommand#1{\ctxlua {_clmm_('myCommand',[[
On Sat, 15 Jun 2019, Hans van der Meer wrote:
From\ctxlua{tex.print(hvdm.myluacall("\xmlatt{#1}{argument}"))}
Lua returns a string containing newline characters '\n'.
In ConTeXt this returned string is printed as one line, the embedded newlines
are not honoured.
I thought
From\ctxlua{tex.print(hvdm.myluacall("\xmlatt{#1}{argument}"))}
Lua returns a string containing newline characters '\n'.
In ConTeXt this returned string is printed as one line, the embedded newlines
are not honoured.
I thought to replace with \crlf in this manner: string1
On 5/2/2019 5:54 PM, Tristan Stenner wrote:
Dear list,
in the following document I can set the date as seen by LuaTeX so the
date functions use a different date:
---
\starttext
\ctxlua{tex.year=1980; tex.month=1; tex.day=15}
% Taken from https://wiki.contextgarden.net/Command/date,
% outputs
Dear list,
in the following document I can set the date as seen by LuaTeX so the
date functions use a different date:
---
\starttext
\ctxlua{tex.year=1980; tex.month=1; tex.day=15}
% Taken from https://wiki.contextgarden.net/Command/date,
% outputs 15 may 1980
\date[m=1][day,~,{\monthshort
quot;=")
context.NR()
end
context.stoptabulate()
context.stopcolumns()
context.page()
end
\stopluacode
\starttext
\ctxlua{AdditionTest(12)} % the background colors, gray and blue, show up when
a lua function is called
% \ctxlua{AdditionTest(120)}
On 3/11/19 10:36 PM, Wolfgang Schuster wrote:
> Pablo Rodriguez schrieb am 11.03.19 um 22:23:
>> [...]
>> Is there a single command for \ctxlua{context(...)}?
>
> \cldcontext{...}
Many thanks for your fast reply, Wolfgang.
Pablo
--
Pablo Rodriguez schrieb am 11.03.19 um 22:23:
Dear list,
I know this has been already posted to the list, but I cannot find it
right now.
Is there a single command for \ctxlua{context(...)}?
\cldcontext{...}
Wolfgang
Dear list,
I know this has been already posted to the list, but I cannot find it
right now.
Is there a single command for \ctxlua{context(...)}?
Many thanks for your help,
Pablo
--
http://www.ousia.tk
___
If your
(s, '%s+$', '')
s = string.gsub(s, '[\n\r]+', ' ')
return s
end
function document.sha512(file)
command_output= document.capture("sha512sum -b " .. file)
context(command_output:sub(0,8))
end
\stopluacode
\def\shafive#1{\ctxlua{document.
the length (seems to be 19 at least
for me) works just fine as well as printing the string itself to the
document.
\startluacode
userdata = userdata or{}
function userdata.numberfun(str)
context(tostring(#str))
end
\stopluacode
\def\mync#1%
{\ctxlua{userdata
ne as well as printing the string itself to the document.
\startluacode
userdata = userdata or
{
}
function userdata.numberfun
(
str
)
context
(
tostring(#str)
)
end
\stopluacode
\def
\mync
#1
%
{
\ctxlua
{
userdata.numberfun
(
[
==
[
#1
]
==
]
)
}
}
The i
from last year this showed the right date format,
> now it shows: d=1m=3y=2019
>
>
>
> \def\duedate{\ctxlua{
> local t = os.date('*t', os.time()+ 10 * 24 * 3600)
> context.date{d=t.day, m=t.month, y=t.year
es not
solve the problem.
In a context version from last year this showed the right date format,
now it shows: d=1m=3y=2019
####
\def\duedate{\ctxlua{
local t = os.date('*t', os.time()+ 10 * 24 * 3600)
context.date{d=t.day, m=t.month, y=t.year }
}}
\mainlanguage[de]
\starttext
\
Thanks, Henri! Works like a charm.
On Sun, Feb 17, 2019 at 11:03 PM Henri Menke wrote:
> Use Lua.
>
>
> \def\eval#1{\ctxlua{%
> local context = context
> local _ENV = math
> context(#1)
> }}
>
> \definecolor[mycolor][r=\eval{0.5*0.7}]
>
>
Use Lua.
\def\eval#1{\ctxlua{%
local context = context
local _ENV = math
context(#1)
}}
\definecolor[mycolor][r=\eval{0.5*0.7}]
\starttext
\color[mycolor]{Hello!}
\stoptext
On 18/02/19 4:37 PM, Mohammad Hossein Bateni wrote:
> Hi,
>
> When I use definecolor, (how)
I found a solution.
\startluacode
fonts.handlers.otf.addfeature {
name = "ktest",
type = "kern",
data = {
["t"] = { ["e"] = 500 },
}
}
\stopluacode
\definefontfeature[ktest][ktest=yes]
\definefont[1][Serif*ktest]
\st
?
Cheers, Henri
---
\startluacode
fonts.handlers.otf.addfeature {
name = "ktest",
type = "kern",
data = {
["t"] = { ["e"] = 500 },
}
}
\stopluacode
\definefontfeature[ktest][ktest=yes]
\definefont[1][Serif*ktest]
\starttext
\1 tes
he end (with the "1.1"
>> remembered from when the problem was typeset):
>> Solution to Problem 1.1.
>> An answer
>> It seems that buffers are the way to do this. But I cannot quite get
>> the automatic numbering to work. The delayed evaluation and informa
ng to work. The delayed evaluation and information
passing between lua and ConTeXt has me confused and tangled in a knot.
Below is a minimal almost-working example. The issue is in the line
{\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}
which ends up putting the verba
ng to work. The delayed evaluation and information
passing between lua and ConTeXt has me confused and tangled in a knot.
Below is a minimal almost-working example. The issue is in the line
{\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}
which ends up putting the verba
ta or { }
function userdata.indexing(s)
t = characters.lower(characters.shaped(s))
context.nome( { t }, s)
end
\stopluacode
\def\mynome#1%
{\ctxlua{userdata.indexing([==[#1]==])}}
\starttext
\mynome{árvore}árvore \mynome{Äard}Äard \mynome{água}água
\mynome{Água}Água \mynome{abnegação}abneg
vement?
% A '\start...\stopluacode' block inside a macro is just as bad (or worse?) to
% escape as '\ctxlua' code. So create a function here for use elsewhere.
%
% There were multiple font sizes in the "specification" and "parameters"
% tables, hopefully I picked the r
return {ex1, ex2} or similar
\ctxlua{context(...)}
\stoptext
The underlying idea is to store a large number of example problems in
individual buffers that could be retrieved either by specific name or as
a complete list. I'm having a problem with the latter as it seems like
all the lua buffer
ocal names = {}
for name,_ in pairs(cache) do
names[#names+1] = name
end
context(table.concat(names,", "))
\stopluacode
\stoptext
\starttext
\startbuffer[ex1]
Buffer 1
\stopbuffer
\startbuffer[ex2]
Buffer 2
\stopbuffer
% Should return {ex1, ex2} or similar
\ctxlua{context(...)}
\stoptext
r[ex1]
> Buffer 1
> \stopbuffer
> \startbuffer[ex2]
> Buffer 2
> \stopbuffer
> % Should return {ex1, ex2} or similar
> \ctxlua{context(...)}
> \stoptext
>
> The underlying idea is to store a large number of example problems in
> individual buffers that could be retri
Dear list,
As the subject line states, I am looking for a means of retrieving a
table of all saved buffer names from lua. A MNWE would looks like:
\starttext
\startbuffer[ex1]
Buffer 1
\stopbuffer
\startbuffer[ex2]
Buffer 2
\stopbuffer
% Should return {ex1, ex2} or similar
\ctxlua{context
\def\findmypattern#1#2{\ctxlua{tex.print(hvdm.findmypattern("#1","#2",))}
But I do not seem to get the node contents in the first argument #1.
Using \xmlverbatim{#1} fails with Lua error "hexadecimal digit expected
near '"\xm’”. \xmlflushpure{#1} fails with Lua error &qu
ber has no integer representation)
> stack traceback:
> [C]: in function 'string.format'
> /home/adityam/texmf/tex/context/third/drops/t-drops.lua:1098: in
> upvalue 'get_IM_paths'
> /home/adityam/texmf/tex/context/third/drops/t-drops.lua:1380: in
> field 'sha
In a Lua function called from within an \startxmlsetups..\stopxmlsetups code
block I would like to search through the current node and all below.
Using string.match("to-be-searched”,”pattern”).
The Lua function being called through
\def\findmypattern#1#2{\ctxlua{tex.print(hvdm.findmypatter
/tex/context/third/drops/t-drops.lua:1098: in
upvalue 'get_IM_paths'
/home/adityam/texmf/tex/context/third/drops/t-drops.lua:1380: in field
'shadow'
[ctxlua]:1: in main chunk
This is due to the change in Lua5.3 with respect to floating point
numbers. The simplest solution is to change '%d
finished string
near eof”. Obviously caused by the %’s.
How to get this working? \textpercent will not do, off course within
Luacode.
% = \letterpercent
$ = \letterdollar
You can also replace
\directlua{tex.print(...)}
with
\ctxlua{context(...)}
or
\cldcontext
xpanded ?
>
> end
>
> \stopluacode
>
> \definebuffer[ZZZBuffer]
>
> \def\StartZZZ{\grabbufferdata[ZZZBuffer][StartZZZ][StopZZZ]}
>
> \def\StopZZZ{\ctxlua{zzz_function(buffers.getcontent('ZZZBuffer'))}}
>
> \StartZZZ
>
> \
\StopZZZ{\ctxlua{zzz_function(buffers.getcontent('ZZZBuffer'))}}
\StartZZZ
\input knuth
\StopZZZ
context.processbuffer { "ZZZBuffer" }
-
Hans Hagen | PRAGMA ADE
Ridde
function zzz_function(text)
- How to process ‘text’ to get bits which are macros, groups etc… ? Eventually
expanded ?
end
\stopluacode
\definebuffer[ZZZBuffer]
\def\StartZZZ{\grabbufferdata[ZZZBuffer][StartZZZ][StopZZZ]}
\def\StopZZZ{\ctxlua{zzz_function(buffers.getcontent('ZZZBuffer'))}}
\StartZZZ
pic) ;
label.lft(decimal ymax,ulcorner pic) ;
\stopuseMPgraphic
\unexpanded\def\ContourPlot
{\dosingleempty\doContourPlot}
\def\doContourPlot[#1]%
{\setvariables
[ContourPlot]
[x={0,0},
y={0,0},
w=10cm,
n=1000,
e=1e-2,
#1]%
\ctxlua{userdat
ourPlot[#1]%
{\setvariables[ContourPlot][#1]%
\ctxlua{userdata.contourplot(
function(x,y) return \getvariable{ContourPlot}{function} end,
{\getvariable{ContourPlot}{x}},
{\getvariable{ContourPlot}{y}},
\getvariable{ContourPlot}{n})}%
\useMPgraphic{doublefun::C
der Meer.
Sorry, but I’m afraid I don’t see the way of generating an URL to a
non-external document in your code.
After all, the document is embedded in the PDF document itself.
Pablo
> % Return the code when clicking the link.
> \def\URIReturnCode#1{\ctxlua{tex.print(hvdm.ur
I am embedding links to an UR in my documents. Although it is used in
XML-documents, you might be able to use the gist of this code that generates a
clickable link. Perhaps you find it useful.
dr. Hans van der Meer
% Return the code when clicking the link.
\def\URIReturnCode#1{\ctxlua
il calls...)
...xlive/2017/texmf-dist/tex/context/base/mkiv/util-sql.lua:114: in function '__index'
...xlive/2017/texmf-dist/tex/context/base/mkiv/util-sql.lua:288: in function 'execute'
[ctxlua]:38: in ma
here no problem?
> you can define
>
> \def\byindex#1{\ctxlua{
> for k, v in pairs(fonts.hashes.identifiers[true].characters) do
> if v.index == #1 then
> tex.print(utf.char(k))
> break
> end
> end
> }}
>
&
in your case the glyphs have no real useful names so basically i wonder
what their use it (are they meant for direct access?)
you can define
\def\byindex#1{\ctxlua{
for k, v in pairs(fonts.hashes.identifiers[true].characters) do
if v.index == #1 then
tex.print(utf.
end
end
end
\stopluacode
\def\mpdefineoutlines#1#2{\ctxlua{
local char = "\luaescapestring{#1}"
local outlines = outlinepaths("#2")
local len = \letterhash outlines
tex.print("path " .. char .. "[];")
tex.print(char .. &qu
shapedata.glyphs or { }
> >>> character = utf.byte(character)
> >>> local c = chardata[character]
> >>> if c then
> >>> if not c.index then
> >>> return {}
> >>> end
> >>>
.sequence) then
local units = shapedata.units or 1000
local factor = 100/units
local paths = fonts.metapost.paths(glyph,factor)
return paths
end
end
end
\stopluacode
\def\mpdefineoutlines#1#2{\ctxlua{
local char = "\luaescapestring{
201 - 300 of 1161 matches
Mail list logo