[NTG-context] Re: ligatures and inputtranslation

2025-08-15 Thread Wolfgang Schuster
rings in such ligatures as ct and st. More can be added. \startluacode fonts.handlers.otf.addfeature { name= "michael", type= "ligature", --~ nocheck = true, data= { [0x00C6] = { 0x0041, 0x0065 }, -- A + e -> Æ [0x00E6] = { 0x0

[NTG-context] Re: Pre-loading libraries by making custom format

2025-07-29 Thread Hans Hagen via ntg-context
kend code code loaded, this can badly interfere as you love hacking to the level of dangerous, here is an example of where all this stuff is getting weird \startluacode local t = tex.hashtokens() local l = { } for i=1,#t do if string.find(t[i],"mmm") then l[#l+1] = t[

[NTG-context] How to pass \MPcolor{aColour} to a lua function

2025-07-25 Thread Keith McKay
gestions on a solution to this would be greatly appreciated. Best Wishes Keith \startluacode local namedColors = { red = { 255, 0, 0}, green = { 0, 255, 0}, blue = { 0, 0, 255}, white = { 255, 255, 255}, black = { 0, 0, 0}, yellow = { 255, 255, 0}, cyan = { 0, 255, 255}, magenta = { 255, 0

[NTG-context] Re: interfaces.implement for key-value list

2025-07-03 Thread Wolfgang Schuster
Am 03.07.2025 um 19:53 schrieb Henning Hraban Ramm: Am 03.07.25 um 16:34 schrieb Wolfgang Schuster: Am 03.07.2025 um 16:04 schrieb Henning Hraban Ramm: Hi, I’m trying to get a simple function with a variable number of parameters working: """ \startluacode interfaces.impl

[NTG-context] Re: interfaces.implement for key-value list

2025-07-03 Thread Henning Hraban Ramm
Am 03.07.25 um 16:34 schrieb Wolfgang Schuster: Am 03.07.2025 um 16:04 schrieb Henning Hraban Ramm: Hi, I’m trying to get a simple function with a variable number of parameters working: """ \startluacode interfaces.implement {    name  = "Autoren",    publi

[NTG-context] Re: interfaces.implement for key-value list

2025-07-03 Thread Wolfgang Schuster
Am 03.07.2025 um 16:04 schrieb Henning Hraban Ramm: Hi, I’m trying to get a simple function with a variable number of parameters working: """ \startluacode interfaces.implement {   name  = "Autoren",   public    = true,   arguments = { "hash

[NTG-context] interfaces.implement for key-value list

2025-07-03 Thread Henning Hraban Ramm
Hi, I’m trying to get a simple function with a variable number of parameters working: """ \startluacode interfaces.implement { name = "Autoren", public= true, arguments = { "hash" }, actions = function(t) logs.report('Autoren&

[NTG-context] Re: \time pendant to \currenttime

2025-06-11 Thread Benjamin Buchmuller
formatting is handled more easily on the lua end or not, I can't really gauge. There is in fact a great number of formatting keys available that might be easy to parse in the context interface. So, maybe all that is needed is an optional secondary argument "format="? I could come up w

[NTG-context] Error with xml files and attribute lists

2025-05-11 Thread Wolfgang Schuster
Hi, the xml parser fails on attribute list settings in xml files. begin example \startbuffer[jmdict] ]> \stopbuffer \starttext \startluacode local jmdict = lxml.loadbuffer("","jmdict",false) inspect(jmdict) \stopluacode \stoptext %%%

[NTG-context] Re: TDM Reservation Protocol (TDMRep)

2025-05-01 Thread Rik Kabel
: |\setupbackend[format={PDF/UA-1}] \setuptagging[state=start] \enabledirectives[backend.usetags=crap] \startluacode lpdf.injectxmpinfo("xml://rdf:RDF","1",false) \stopluacode | Many thanks for the code, Rik. Just in case anyone intends to use any form of TDM reservation, it

[NTG-context] Re: TDM Reservation Protocol (TDMRep)

2025-05-01 Thread Rik Kabel
}] \setuptagging[state=start] \enabledirectives[backend.usetags=crap] \startluacode lpdf.injectxmpinfo("xml://rdf:RDF","1",false) \stopluacode | Many thanks for the code, Rik. Just in case anyone intends to use any form of TDM reservation, it seems that it might break PDF/A validatio

[NTG-context] Re: TDM Reservation Protocol (TDMRep)

2025-05-01 Thread Steffen Wolfrum
-archive.com/ntg-context@ntg.nl/msg64956.html> and inserted > it successfully as follows: > > > \setupbackend[format={PDF/UA-1}] > \setuptagging[state=start] > \enabledirectives[backend.usetags=crap] > \startluacode > lpdf.injectxmpinfo("xml://rdf:RDF"

[NTG-context] Re: TDM Reservation Protocol (TDMRep)

2025-05-01 Thread Steffen Wolfrum
list at https://www.mail- >> archive.com/ntg-context@ntg.nl/msg64956.html and inserted it >> successfully as follows: >> >> |\setupbackend[format={PDF/UA-1}] \setuptagging[state=start] >> \enabledirectives[backend.usetags=crap] \startluacode >> lpdf.injectxmpinfo(&

[NTG-context] Re: TDM Reservation Protocol (TDMRep)

2025-05-01 Thread Pablo Rodriguez via ntg-context
gt; \enabledirectives[backend.usetags=crap] \startluacode > lpdf.injectxmpinfo("xml://rdf:RDF"," xmlns:tdm='http://www.w3.org/ns/tdmrep/'>1 tdm:reservation>",false) \stopluacode | Many thanks for the code, Rik. Just in case anyone intends to use any form of TDM re

[NTG-context] Re: TDM Reservation Protocol (TDMRep)

2025-04-30 Thread Rik Kabel
successfully as follows: |\setupbackend[format={PDF/UA-1}] \setuptagging[state=start] \enabledirectives[backend.usetags=crap] \startluacode lpdf.injectxmpinfo("xml://rdf:RDF","xmlns:tdm='http://www.w3.org/ns/tdmrep/'>1"

[NTG-context] Re: Rotating and scaling images to fit a page

2025-04-24 Thread Fabrice L
0pt, bottomspace=0pt, >height=middle, width=middle, >backspace=0pt] > > \starttext > \startluacode > require "lfs" > function GetFileExtension(url) > return url:match("^.+(%..+)$") > end > cwd=lfs.currentdir() >

[NTG-context] Rotating and scaling images to fit a page

2025-04-24 Thread Michael Guravage
pt] \starttext \startluacode require "lfs" function GetFileExtension(url) return url:match("^.+(%..+)$") end cwd=lfs.currentdir() for file in lfs.dir(cwd) do suffix = GetFileExtension(file) if suffix == ".png" then ima

[NTG-context] Re: new way to do \addff?

2025-04-12 Thread Mohammad Hossein Bateni
tive to add/remove features on the fly? > > nothing changed there > > move the luacode before the \starttext or any place before the main font > is defined because features are bound to fonts so new ones have to be > defined beforehanbd > > > MNWE: > > > > === > &g

[NTG-context] Re: new way to do \addff?

2025-04-12 Thread Hans Hagen via ntg-context
cause features are bound to fonts so new ones have to be defined beforehanbd MNWE: === \starttext \startluacode   fonts.handlers.otf.addfeature{     name = "fanum",     type = "substitution",     data = {       [0x30] = 0x41  -- '0' => 'A'     }   }

[NTG-context] new way to do \addff?

2025-04-11 Thread Mohammad Hossein Bateni
Hello, \addff (and \doaddfeature) no longer seem to work. What's the alternative to add/remove features on the fly? MNWE: === \starttext \startluacode fonts.handlers.otf.addfeature{ name = "fanum", type = "substitution", data = { [0

[NTG-context] Re: nested context/lua calls

2025-04-03 Thread Mohammad Hossein Bateni
> > > I have some code like this: > > > > - > > \def\MakeSomething{... some code that returns number 12} > > > > \startluacode > > function WorkWithSomething(data) > >-- call MakeSomething to obtain 12 > >

[NTG-context] Re: nested context/lua calls

2025-03-30 Thread Wolfgang Schuster
Am 29.03.2025 um 16:06 schrieb Mohammad Hossein Bateni: Hello, I have some code like this: - \def\MakeSomething{... some code that returns number 12} \startluacode function WorkWithSomething(data)   -- call MakeSomething to obtain 12   -- base on the value

[NTG-context] Re: nested context/lua calls

2025-03-30 Thread Mohammad Hossein Bateni
gt; \else% > X% > \fi% > } > > \newcount\mycounter > \define\incrementmycounter{% > \advance\mycounter by 1\relax% > } > > \startluacode > local function WorkWithSomething(data) >

[NTG-context] Re: nested context/lua calls

2025-03-29 Thread Max Chernoff via ntg-context
ething{% \setbox0=\hbox{#1}% \ifdim\wd0>12pt\relax% 12% \else% X% \fi% } \newcount\mycounter \define\incrementmycounter{% \advance\mycounter by 1\relax% } \startluacode local function WorkWi

[NTG-context] nested context/lua calls

2025-03-29 Thread Mohammad Hossein Bateni
Hello, I have some code like this: - \def\MakeSomething{... some code that returns number 12} \startluacode function WorkWithSomething(data) -- call MakeSomething to obtain 12 -- base on the value above make some decisions end WorkWithSomething(some_data

[NTG-context] Re: month form \currentdate in Roman numerals

2025-02-28 Thread Mohammad Hossein Bateni
ali:to,y]}\endgroup} >> -- >> >> does \setdate expand to something non-empty? >> >> note that with the above ideas, we cannot get "mm" with leading zeros to >> work because >> \persiandecimals drops the leading zero. the following ugly hack wo

[NTG-context] Re: month form \currentdate in Roman numerals

2025-02-28 Thread Mohammad Hossein Bateni
above ideas, we cannot get "mm" with leading zeros to > work because > \persiandecimals drops the leading zero. the following ugly hack works if > I insist on using > \currentdate to format the output and I want Indic digits. > > > \startluacode > f

[NTG-context] Re: month form \currentdate in Roman numerals

2025-02-27 Thread Mohammad Hossein Bateni
expand to something non-empty? note that with the above ideas, we cannot get "mm" with leading zeros to work because \persiandecimals drops the leading zero. the following ugly hack works if I insist on using \currentdate to format the output and I want Indic digits. \startluacode

[NTG-context] Re: calculate ...

2025-02-24 Thread autumnus
\d_marginwidth \d_marginwidth=\dimexpr\fontdimen6\font*\c_margincount\relax \newdimen\d_textlineheight\d_textlineheight= \dimexpr\baselineskip*\c_heightcount-\baselineskip+ \ifdim\topskip<\ht\strutbox\topskip\else\ht\strutbox\fi\relax \protect \startluacode local todi

[NTG-context] Re: prevent a kind of heading at the bottom of the page

2025-02-14 Thread Thomas Meyer
Am 13.02.25 um 16:35 schrieb Wolfgang Schuster: \setuppagenumbering[location={footer,middle}, alternative=onesided] onesided isn't a valid keyword for the alternative key, only singlesided and doublesided can be used. Okay! It seems better. I never got an error message. \startlu

[NTG-context] Re: prevent a kind of heading at the bottom of the page

2025-02-13 Thread Wolfgang Schuster
={footer,middle}, alternative=onesided] onesided isn't a valid keyword for the alternative key, only singlesided and doublesided can be used. \setuplayout[     lines=44,     grid=yes, ] \showgrid \startluacode function userdata.Ddate(str)   local year  = string.sub(str,1,4)   local mo

[NTG-context] Re: prevent a kind of heading at the bottom of the page

2025-02-13 Thread Thomas Meyer
s Hagen via ntg-context: On 2/13/2025 10:58 AM, Thomas Meyer wrote: \startluacode function userdata.Ddate(str)    local year  = string.sub(str,1,4)    local month = string.sub(str,5,6)    local day   = string.sub(str,7,8) context.date({d=day,m=month,y=year},{"weekday,{, },day, {. },mont

[NTG-context] Re: prevent a kind of heading at the bottom of the page

2025-02-13 Thread Hans Hagen via ntg-context
On 2/13/2025 10:58 AM, Thomas Meyer wrote: \startluacode function userdata.Ddate(str)   local year  = string.sub(str,1,4)   local month = string.sub(str,5,6)   local day   = string.sub(str,7,8) context.date({d=day,m=month,y=year},{"weekday,{, },day, {. },month,space,year&qu

[NTG-context] prevent a kind of heading at the bottom of the page

2025-02-13 Thread Thomas Meyer
\setuplayout[     lines=44,     grid=yes, ] \showgrid \startluacode function userdata.Ddate(str)   local year  = string.sub(str,1,4)   local month = string.sub(str,5,6)   local day   = string.sub(str,7,8) context.date({d=day,m=month,y=year},{"weekday,{, },day,{. },month,space,year"}) end \s

[NTG-context] Re: How to load external lua library

2025-01-23 Thread Hans Hagen
tation for the interaction with sqlite from the context garden (https://www.pragma-ade.nl/general/manuals/sql-mkiv.pdf): ```tex \starttext \startluacode require("util-sql") utilities.sql.setmethod("sqlite") require("util-sql-loggers") local loggers = utilities.sq

[NTG-context] How to load external lua library

2025-01-23 Thread krulis . tomas
ext garden (https://www.pragma-ade.nl/general/manuals/sql-mkiv.pdf): ```tex \starttext \startluacode require("util-sql") utilities.sql.setmethod("sqlite") require("util-sql-loggers") local loggers = utilities.sql.loggers local presets = { -- method = "sq

[NTG-context] Re: Quickly invoke a self-defined index sorting file?

2025-01-12 Thread Hans Hagen
these files with my local context system and use setup to enable it directly. I want directly use %%% \setupregister[index][n=4,language=cn-alpha,] %%% instead of \input sort-alpha.lua \setupregister[index][ n=4, language={cn-alpha},] %%% remove \startluacode and \stopluacode in that

[NTG-context] Re: Lua question - table.save, table.load

2025-01-11 Thread Jeong Dal via ntg-context
ndfor; fi; %label the columns if (length second) = 1: for i = 0,1: label.top(textext(codeOne[i]), ((i+1)*wd,.3ht)); endfor; else: for i = 0 upto 3: label.top(textext(codeTwo[i]), ((i+1)*wd,.3ht)); endfor; fi; setbounds currentpicture to boundingbox currentpictur

[NTG-context] Re: Lua question - table.save, table.load

2025-01-11 Thread Hans Hagen
On 1/11/2025 4:01 PM, Jeong Dal via ntg-context wrote: Dear all, I save a table “tfList” using table.save in Lua: \startluacode ... table.save(“tempList.lua”,tfList) ... \stopluacode And I call it in MetaFun using a method explained in the MetaFun book. \startMPcode lua("MP = { } MP

[NTG-context] Lua question - table.save, table.load

2025-01-11 Thread Jeong Dal via ntg-context
Dear all, I save a table “tfList” using table.save in Lua: \startluacode ... table.save(“tempList.lua”,tfList) ... \stopluacode And I call it in MetaFun using a method explained in the MetaFun book. \startMPcode lua("MP = { } MP.data = table.load('te

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-08 Thread Jeong Dal via ntg-context
led (1.8wd,1ht) shifted (.6wd,-2.1ht) withpen pencircle scaled 2pt withcolor .625red ; \stopbuffer \starttext \startluacode function document.MakeHead(p,a) if not a then local t = p p = string.rep("|mcw(1cm)",#p-1) .. "|mcw(2cm)|" a = t end

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-07 Thread Hans Hagen
))    -- return ((p == "0" or q == "0") and r == "1") or (p == "1" and (q == "1" or r == "0"))   end Is not working. The outputs are blank(for false) and “?”(for true) Here is a working example. Thank you for enhancin

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-07 Thread Jeong Dal via ntg-context
ot; or q == "0") and r == "1") or (p == "1" and (q == "1" > or r == "0")) > end > Is not working. The outputs are blank(for false) and “?”(for true) Here is a working example. Thank you for enhancing the code. Best regards, Dalyoung \s

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-07 Thread Hans Hagen via ntg-context
simple code: \starttext \startluacode if 0 then context("True") else context("False") end \stopluacode \stoptext The output The output is “True”. Ah, i didn't check the function, so how about this: local tf = { true, false } --local tf = { "1", "0"

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-07 Thread Jeong Dal via ntg-context
d >end >document.MakeFooter() >end I think that the logical function “document.logicF()"is not working for the array tf={“1”,”0”}. In python, 1 and 0 are treated as true and false. But, I read that only “false” and “nil” are treated as false in Lua, that is, “0” i

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-06 Thread Jeong Dal via ntg-context
. >> It works! It draw the truth table of the given logic functions. >> Thanks a lot. >> Best regards, >> Dalyoung >> \startluacode >> function document.MakeHead(p,a) >> if not a then >> local t = p >> p = string.rep("|mcw(1cm)",#p-1) ..

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-05 Thread Hans Hagen via ntg-context
. 2. And call the functions in the text. It works! It draw the truth table of the given logic functions. Thanks a lot. Best regards, Dalyoung \startluacode function document.MakeHead(p,a) if not a then local t = p p = string.rep("|mcw(1cm)",#p-1) .. "|mcw(1.5cm)|" a = t end c

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-03 Thread Jeong Dal via ntg-context
! It draw the truth table of the given logic functions. Thanks a lot. Best regards, Dalyoung \startluacode function document.MakeHead(p,a) if not a then local t = p p = string.rep("|mcw(1cm)",#p-1) .. "|mcw(1.5cm)|" a = t end conte

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-03 Thread Jeong Dal via ntg-context
Dear Florent, Wolfgang, and Hans, Thank you for the solutions. All solutions are working well. I add more rows for the last solution to show the truth table of a logical function. I may modify it for 2-variable function. Thanks again. Best regards, Dalyoung \starttext \startluacode

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-03 Thread Hans Hagen
f table. How can I fix this error? Thank you. Best regards, Dalyoung \starttext \startluacode function makeHead(a) local n = #a context.HL() for i = 1, n do context.NC() context(a[i]) end context.NC()context.AR() context.HL() end \stopluacode %\starttabulate[|mcw(1cm)|mcw(1cm)|mcw(1cm)|mcw(

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-03 Thread Hans Hagen
f table. How can I fix this error? Thank you. Best regards, Dalyoung \starttext \startluacode function makeHead(a) local n = #a context.HL() for i = 1, n do context.NC() context(a[i]) end context.NC()context.AR() context.HL() end \stopluacode %\starttabulate[|mcw(1cm)|mcw(1cm)|mcw(1cm)|mcw(

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-03 Thread Wolfgang Schuster
of table. How can I fix this error? Thank you. Best regards, Dalyoung \starttext \startluacode function makeHead(a) local n = #a context.HL() for i = 1, n do context.NC() context(a[i]) end context.NC()context.AR() context.HL() end \stopluacode %\starttabulate[|mcw(1cm)|mcw(1

[NTG-context] Re: You can't use '\prevdepth' in restricted horizontal mode

2025-01-03 Thread Florent Michel
Dear Dalyoung, I am not sure what the issue is; but as a workaround it seems that using \ctxlua works: ___ \starttext \startluacode function makeHead(a) local n = #a context.HL() for i = 1, n do context.NC() context(a[i

[NTG-context] You can't use '\prevdepth' in restricted horizontal mode

2025-01-03 Thread Jeong Dal via ntg-context
t regards, Dalyoung \starttext \startluacode function makeHead(a) local n = #a context.HL() for i = 1, n do context.NC() context(a[i]) end context.NC()context.AR() context.HL() end \stopluacode %\starttabulate[|mcw(1cm)|mcw(1cm)|mcw(1cm)|mcw(1cm)|] \startluaco

[NTG-context] Re: playing with dates

2024-12-16 Thread vm via ntg-context
On 16/12/2024 22:18, Pablo Rodriguez via ntg-context wrote: It seems that it is too complex for me (and I have already invested two afternoons in this). For some reason, not meant to be in my case, like everyday for one year 8<--- \startluacode function userdata.now(dd) local wd

[NTG-context] Re: Tikz CD

2024-11-25 Thread Aditya Mahajan
def\pdflastxpos{\numexpr\clf_lastxpos\relax} \frozen\overloaded\protected\def\pdflastypos{\numexpr\clf_lastypos\relax} \protect \fi \ifdefined\pdfstrcmp\else \startluacode interfaces.implement { name = "pdfstrcmp", arguments = "2 s

[NTG-context] Remove umlauts etc. from input

2024-11-24 Thread Wolfgang Schuster
etter solution. \startluacode local shapedcodes = { } for k, v in next, characters.data do     local s = v.shcode     if s then     if type(s) == "number" then     shapedcodes[utf.char(k)] = { utf.char(s) }     elseif #s == 2 then     shapedcodes[utf.char(k)] =

[NTG-context] rfc4180splitter not handling UTF-8 with BOM files

2024-11-23 Thread Marco Patzer
Hi! I run into a problem reading in certain CSV files. I nailed it down to the following example: \starttext \startluacode local mycsvsplitter = utilities.parsers.rfc4180splitter{ separator = ",", quote = '"'} -- fails with -- token call, execute: [ctxlu

[NTG-context] Re: save runtime information

2024-11-20 Thread Thomas A. Schmitz
timing pretty late, like this: \startluacode luatex.wrapup (     function()     --     print("saving runtime in foo.txt")     io.savedata("foo.txt",statistics.elapsedtime(lua.getruntime()))     --     local t = {     runtime = st

[NTG-context] Re: save runtime information

2024-11-20 Thread Hans Hagen
. you need to register timing pretty late, like this: \startluacode luatex.wrapup ( function() -- print("saving runtime in foo.txt") io.savedata("foo.txt",statistics.elapsedtime(lua.getruntime())) -- local t = { ru

[NTG-context] Re: string.formatters

2024-11-14 Thread Wolfgang Schuster
juh+ntg-context--- via ntg-context schrieb am 14.11.2024 um 09:18: Am 14.11.24 um 08:59 schrieb juh+ntg-context--- via ntg-context: \starttext \startluacode context(string.formatters["%0.2M"](1000)) \stopluacode \stoptext Gives 10.2000,00 context(string.formatters["%M"

[NTG-context] Re: string.formatters

2024-11-14 Thread juh+ntg-context--- via ntg-context
Am 14.11.24 um 08:59 schrieb juh+ntg-context--- via ntg-context: \starttext \startluacode context(string.formatters["%0.2M"](1000)) \stopluacode \stoptext Gives 10.2000,00 context(string.formatters["%M"](1000)) Gives the right result. But I am

[NTG-context] string.formatters (was: Re: max function in spreadsheettable)

2024-11-13 Thread juh+ntg-context--- via ntg-context
Am 15.10.24 um 17:16 schrieb Hans Hagen via ntg-context: On 10/15/2024 2:33 PM, juh+ntg-context--- via ntg-context wrote: local sum = string.formatters["%0.2M"](0.3 * 100) This does not work here with numbers with more than three digits. \starttext \startluacode context(string.

[NTG-context] Re: Zigzag left margin with italics

2024-11-04 Thread Wolfgang Schuster
you can control that. \startluacode local classes = fonts.protrusions.classes local vectors = fonts.protrusions.vectors classes.rik = { vector = 'rik', factor = 1, } vectors.rik = table.merged ( vectors.quality, {    [0x0054] = { 0.35, 0 }, -- T }) \s

[NTG-context] Re: Zigzag left margin with italics

2024-11-04 Thread Hans Hagen
On 11/4/2024 6:39 PM, Rik Kabel wrote: On 2024-11-04 10:55, Wolfgang Schuster wrote: Mikael Sundqvist schrieb am 04.11.2024 um 07:35: Hi, You can try this below (from test suite), but then, as you see, also upright T will move out. Not sure how/if you can control that. \startluacode local

[NTG-context] Re: Zigzag left margin with italics

2024-11-04 Thread Rik Kabel
On 2024-11-04 10:55, Wolfgang Schuster wrote: Mikael Sundqvist schrieb am 04.11.2024 um 07:35: Hi, You can try this below (from test suite), but then, as you see, also upright T will move out. Not sure how/if you can control that. \startluacode local classes = fonts.protrusions.classes

[NTG-context] Re: Zigzag left margin with italics

2024-11-04 Thread Wolfgang Schuster
Mikael Sundqvist schrieb am 04.11.2024 um 07:35: Hi, You can try this below (from test suite), but then, as you see, also upright T will move out. Not sure how/if you can control that. \startluacode local classes = fonts.protrusions.classes local vectors = fonts.protrusions.vectors

[NTG-context] Re: Zigzag left margin with italics

2024-11-04 Thread Rik Kabel
On 2024-11-04 01:35, Mikael Sundqvist wrote: \startluacode local classes = fonts.protrusions.classes local vectors = fonts.protrusions.vectors classes.rik = { vector = 'rik', factor = 1, } vectors.rik = table.merged ( vectors.quality, { [0x0054] = { 0.35,

[NTG-context] Re: Zigzag left margin with italics

2024-11-03 Thread Mikael Sundqvist
Hi, You can try this below (from test suite), but then, as you see, also upright T will move out. Not sure how/if you can control that. \startluacode local classes = fonts.protrusions.classes local vectors = fonts.protrusions.vectors classes.rik = { vector = 'rik',

[NTG-context] Re: Lua <-> TeXShop

2024-10-09 Thread Thomas Meyer
menu File format where it is called Lua script). Then I use ConTeXt to run the lua file… Another possibility is to put your lua file between \startluacode … \stopluacode in a TeX file and then you typeset the TeX file in TeXShop with ConTeXt. But probably this is not what you want to do. Best

[NTG-context] Re: fixing kerning and substitutions

2024-10-09 Thread Hans Hagen via ntg-context
{\sc þýðask} 123 Nothing has changed (in fact, the font handler hasn't been touched that much at all, apart from some fixes for border cases that you're unlikely to run into). There are several issues with your approach, one being that you add a featur

[NTG-context] Re: configuring spitter

2024-10-08 Thread Wolfgang Schuster
","3968","1489" "2010","3975","1479" "2011","3885","1470" "2012","3879","1484" "2013","4000","1553" "2014","4068","1572"

[NTG-context] Re: Lua <-> TeXShop

2024-10-08 Thread Otared Kavian
Hi, I use TeXShop and it is possible to save a file with a .lua suffix (under « Save as… » you choose the menu File format where it is called Lua script). Then I use ConTeXt to run the lua file… Another possibility is to put your lua file between \startluacode … \stopluacode in a TeX file and

[NTG-context] configuring spitter (was: separatedlist with header repeating processing csv to table)

2024-10-08 Thread juh+ntg-context--- via ntg-context
;3975","1479" "2011","3885","1470" "2012","3879","1484" "2013","4000","1553" "2014","4068","1572" "2015","4134","1622" "2016"

[NTG-context] Re: Is there any way to automatically control the spacing between Chinese and non-Chinese characters?

2024-10-04 Thread hf
>> >> ```ConTeXt >> >> \mainlanguage[cn] >> >> \language[cn] >> >> \setscript[hanzi] >> >> \usetypescriptfile[mscore] >> >> \usebodyfont [mschinese,12pt] >> >> \showglyphs >> >> \startluacode >> >&

[NTG-context] Re: separatedlist with header repeating processing csv to table

2024-10-03 Thread Wolfgang Schuster
470" "2012","3879","1484" "2013","4000","1553" "2014","4068","1572" "2015","4134","1622" "2016","4251","1745" "2017","4096",

[NTG-context] Re: Values from Lua back to ConTeXt

2024-10-03 Thread Thomas Meyer
\ in the output. begin example \starttext \currentdate[weekday,{, },day,. ,month,space,year] %\currentdate[weekday,{, },day,.\ ,month,space,year] \currentdate[weekday,\textcomma\ ,day,\textperiod\ ,month,space,year] \startluacode context.currentdate{ "weekday,{, },day,. ,month,space

[NTG-context] Re: Values from Lua back to ConTeXt

2024-10-03 Thread Wolfgang Schuster
] \currentdate[weekday,\textcomma\ ,day,\textperiod\ ,month,space,year] \startluacode context.currentdate{ "weekday,{, },day,. ,month,space,year" } \stopluacode \startluacode context.currentdate{ "weekday,\\textcomma\\ ,day,\\textperiod\\ ,month,space,year" } \stopluacode

[NTG-context] Re: Values from Lua back to ConTeXt

2024-10-03 Thread Thomas Meyer
o get output back from the Lua side to TeX you use the tex.sprint (or tex.print) function. begin example \startluacode function Date(str)   local year  = string.sub(str,1,4)   local month = string.sub(str,5,6)   local day   = string.sub(str,7,8)   tex.sprint(day,".",month,".&qu

[NTG-context] Re: Is there any way to automatically control the spacing between Chinese and non-Chinese characters?

2024-10-02 Thread 黄复雄
gt; characters and non-Chinese characters > > > > ```ConTeXt > > > > \mainlanguage[cn] > > > > \language[cn] > > > > \setscript[hanzi] > > > > \usetypescriptfile[mscore] > > > > \usebodyfont [mschinese,12pt] > >

[NTG-context] Re: Is there any way to automatically control the spacing between Chinese and non-Chinese characters?

2024-10-02 Thread hf
`ConTeXt > > \mainlanguage[cn] > > \language[cn] > > \setscript[hanzi] > > \usetypescriptfile[mscore] > > \usebodyfont [mschinese,12pt] > > \showglyphs > > \startluacode > > Thirddata = Thirddata or {} > > local glyph_id = nodes

[NTG-context] Re: Values from Lua back to ConTeXt

2024-10-02 Thread Wolfgang Schuster
side to TeX you use the tex.sprint (or tex.print) function. begin example \startluacode function Date(str) local year = string.sub(str,1,4) local month = string.sub(str,5,6) local day = string.sub(str,7,8) tex.sprint(day,".",month,".",year) -- tex.s

[NTG-context] Values from Lua back to ConTeXt

2024-10-02 Thread Thomas Meyer
. Sorry, I'm a totally novice in Lua. \starttext \startluacode function ddate(s) i = 1 j = 4 y1 = string.sub(s,i,j) i = 5 j = 6 m1 = string.sub(s,i,j) i = 7 j = 8 d1 = string.sub(s,i,j) context("Geht das:  %s.%s.%s", d1, m1, y1) -- that works! --re

[NTG-context] Re: Is there any way to automatically control the spacing between Chinese and non-Chinese characters?

2024-10-01 Thread 黄复雄
This is a preliminary solution for inserting spaces between Chinese characters and non-Chinese characters ```ConTeXt \mainlanguage[cn] \language[cn] \setscript[hanzi] \usetypescriptfile[mscore] \usebodyfont [mschinese,12pt] \showglyphs \startluacode Thirddata = Thirddata or {} local glyph_id

[NTG-context] Re: appendaction in "shipouts" "after" fails in the latest version

2024-09-21 Thread 黄复雄
pendaction problem, > mini-try.lmtx, as > > ```ConTeXt > \startluacode > Moduledata = Moduledata or {} > Moduledata.vtypeset = Moduledata.vtypeset or {} > > function Moduledata.vtypeset.rotate_all1(head) > print(">>>>>> HERE IS ROTATE_A

[NTG-context] Re: Downsampling images (again)

2024-09-21 Thread Alan Braslau via ntg-context
ze. > > How can a converter function access … > – the final (scaled) size of a placed image > – the original pixel size of an image > ? > With that information it would be easy to calculate the target pixel > size. > > And then it would be nice to hook this function into

[NTG-context] Downsampling images (again)

2024-09-21 Thread Henning Hraban Ramm
hook this function into \setupexternalfigure[conversion=] """ \startluacode local function downsampler(oldname, newname, resolution) if not resolution or resolution == "" then resolution = 72 end local cmd = string.format( [[gm convert

[NTG-context] appendaction in "shipouts" "after" fails in the latest version

2024-09-15 Thread 黄复雄
nimum runnable example for the appendaction problem, mini-try.lmtx, as ```ConTeXt \startluacode Moduledata = Moduledata or {} Moduledata.vtypeset = Moduledata.vtypeset or {} function Moduledata.vtypeset.rotate_all1(head) print(">>>>>> HERE IS ROTATE_ALL1")

[NTG-context] Calling C code from ConTeXt LMTX

2024-09-14 Thread Florent Michel
ConTeXt using the Lua C API. * Compile the code and wrappers in a shared library and linking to the static lua library used by LuaMetaTeX (liblua.a on Linux). * In the .tex file, import the new library using, e.g., ``` \startluacode mylib = require("mylib") -- additional code u

[NTG-context] Re: how do I get the correct page numbers and do the calculations with it?

2024-09-11 Thread Wolfgang Schuster
to use \setinterfaceconstant. You can run the following example to get a list with a predefined constant. When you uncomment the first three lines you see the new entry also appears in the list. begin example % \startinterface all % \setinterfaceconstant {pointstyle} {pointstyle} % \stopi

[NTG-context] Re: Inconsistencies with fonts/c2sc feature

2024-06-25 Thread Pablo Rodriguez via ntg-context
gt; values help too, so thanks to you both! Hi Kirill, this font feature may work too: \startluacode fonts.handlers.otf.addfeature { name = "addedsc", type = "substitution", data = { A = "A.sc", B = "B.sc", C = "C.sc", D = "

[NTG-context] Re: weekend update

2024-06-24 Thread Gerion Entrup
={one-three}] > > ``` > > The order could also be implicitly defined after the order of the > > \definestacking calls. > > > > Or would it be possible to have numbers always automatically (additionally) > > available as stacking layer? > > So that this "j

[NTG-context] Re: weekend update

2024-06-23 Thread Hans Hagen via ntg-context
d a proof} of \stacking [2] {concept} indeed. \stopbuffer ... \setupstacking[criterium={1-}] ``` I also wondered, if it is possible to define a lot of layers semiautomatically in Lua (in some graphics I needed around 20 layers). It seems that numbers in layer names currently are not allowed. Is code like t

[NTG-context] Re: weekend update

2024-06-23 Thread Gerion Entrup
t; This is a test \stacking [1] {and a proof} of \stacking [2] {concept} indeed. > \stopbuffer > ... > \setupstacking[criterium={1-}] > ``` > > I also wondered, if it is possible to define a lot of layers > semiautomatically in Lua > (in some graphics I needed around 2

[NTG-context] Re: weekend update

2024-06-23 Thread Gerion Entrup
I also wondered, if it is possible to define a lot of layers semiautomatically in Lua (in some graphics I needed around 20 layers). It seems that numbers in layer names currently are not allowed. Is code like this possible somehow? ``` \startluacode for i = 1, 20 do context.definestacking(s

[NTG-context] Spacing within combinations

2024-06-22 Thread Michael Guravage
[state=] \setupcaptions[number=no] \starttext \startluacode context.setupblank({"10mm"}) context.setupcombinations({distance="10mm", after=context.blank()}) context.startplacefigure({title = ""}) context.startcombination({nx=3, ny=4}) for i=1,

[NTG-context] Pocket Diary Photo Calendar: how to specify on which day the week begins?

2024-06-15 Thread Michael Guravage
fotocal={Photo Calendar}] \setuplabeltext[nl][fotocal=Fotokalender] \setuplabeltext[de][fotocal=Fotokalender] \setuplabeltext[fr][fotocal={Calendrier photo}] \setuplabeltext[it][fotocal={Calendario fotografico}] \setuplabeltext[es][fotocal={Calendario fotográfico}] %D Let lua is perform the magic: \star

[NTG-context] Re: Cite-proc Lua - Following up

2024-06-12 Thread Max Chernoff
12 directories, 0 files Finally, make a new file somewhere in the "examples/" folder with the following contents: \startluacode package.loaded.unicode = { utf8 = string } package.loaded.lualibs = {} kpse.find_file = function(name) local path = resolvers.

[NTG-context] Re: get measures as dimension in Lua

2024-06-10 Thread Hans Hagen via ntg-context
\definemeasure[mymeasure][10pt] \newdimen\mydimen \mydimen=10pt \definemeasure[measureexpr][1in + 27.73pt] \startluacode -- Returns the unexpanded value of some variable in a namespace. local function get_variable(namespace, variable) -- -- Doesn

[NTG-context] Re: get measures as dimension in Lua

2024-06-09 Thread Max Chernoff
work okay: \definemeasure[mymeasure][10pt] \newdimen\mydimen \mydimen=10pt \definemeasure[measureexpr][1in + 27.73pt] \startluacode -- Returns the unexpanded value of some variable in a namespace. local function get_variable(namespace, variable)

  1   2   3   4   5   6   7   8   9   10   >