[NTG-context] Re: Is there a short-cut to adding sub-categories for index entries?

2024-08-25 Thread Henning Hraban Ramm
xt(userdata.Mapping[name] or name) end %%% environment \loadluafile[lookups.lua] \defineregister[Location][] \define[1]\LocIndex{\expanded{\Location{% \ctxlua{userdata.Lookup("#1") Hraban ___ If

[NTG-context] ConTeXt has stopped working

2024-07-05 Thread Jethro Djan
od.lmt:82: in function 'lua.registercode' [ctxlua]:1: in main chunk You injected something that confused the parser, maybe by using some Lua call. resolvers | formats | resolvers | formats | binary path : /Users/me/context/tex/texmf-osx-64/bin resolvers |

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

2024-06-15 Thread Michael Guravage
ableH(i,year) context.page() end end \stopluacode % Setup of the month table \startsetups table:month \setupTABLE[c] [each] [width=\dimexpr\textwidth/7, frame=on, style=\tfa] \setupTABLE[r][each][height=1.8\lineheight,align={center,lohi

[NTG-context] Re: ConTeXt source from XML

2024-06-08 Thread Pablo Rodriguez via ntg-context
On 6/8/24 10:49, vm via ntg-context wrote: > in the document > https://wiki.contextgarden.net/images/8/8c/xhtml.pdf > > near the end an essential line got truncated: > [...] > how should this line continue ? > {\externalfigure[\xmlatt{#1}{src}][width=\ctxlua{getmeas("

[NTG-context] Re: ConTeXt source from XML

2024-06-08 Thread Thomas A. Schmitz
On 6/8/24 10:49, vm via ntg-context wrote: in the document https://wiki.contextgarden.net/images/8/8c/xhtml.pdf near the end an essential line got truncated: \startxmlsetups xml:img \placefigure[here] [\xmlatt{#1}{src}] {\xmlatt{#1}{alt}} {\externalfigure[\xmlatt{#1}{src}][width=\ctxlua

[NTG-context] Re: ConTeXt source from XML

2024-06-08 Thread vm via ntg-context
in the document https://wiki.contextgarden.net/images/8/8c/xhtml.pdf near the end an essential line got truncated: \startxmlsetups xml:img \placefigure[here] [\xmlatt{#1}{src}] {\xmlatt{#1}{alt}} {\externalfigure[\xmlatt{#1}{src}][width=\ctxlua{getmeas("\xmla \stopxmlsetups how should

[NTG-context] Re: defining hashtag simulator

2024-05-20 Thread Hans Hagen
\Hashtag#1{ \hbox{\tfa\ctxlua{ str = "#1" replacespace = string.gsub(str," ","_") context.letterhash() context(replacespace) } } } \starttext \Hashtag{hello} \stoptext i used hbox for making phrase unbreakable. How c

[NTG-context] Re: defining hashtag simulator

2024-05-20 Thread Hans Hagen via ntg-context
\Hashtag#1{ \hbox{\tfa\ctxlua{ str = "#1" replacespace = string.gsub(str," ","_") context.letterhash() context(replacespace) } } } \starttext \Hashtag{hello} \stoptext i used hbox for making phrase unbreakable. How c

[NTG-context] Re: defining hashtag simulator

2024-05-19 Thread seyal . zavira
Thanks. What if we want the text to be copied when it is clicked? I found these link on the stack site for this https://tex.stackexchange.com/questions/174637/copy-to-clipboard-feature-in-pdf-output/545107#545107 also i defined this: \def\Hashtag#1{ \hbox{\tfa\ctxlua{ str = &qu

[NTG-context] Re: Combine lua and btx setup, was: Re: Customize citation format of a bibliography (use the short form as reference format)

2024-04-25 Thread Gerion Entrup
ag, variant = "short", righttext = righttext}) context("]") end \stopluacode \startsetups btx:aps:cite:special \btxcitereference \ctxlua{render_cite([==[\currentbtxdataset]==], [==[\currentbtxtag]==], [==[\currentbtxrighttext]==])} \stopsetups \setupbtx[ap

[NTG-context] Combine lua and btx setup, was: Re: Customize citation format of a bibliography (use the short form as reference format)

2024-04-23 Thread Gerion Entrup
ot;[>" .. short .. "]") else context("[" .. short .. "]") end end \stopluacode \definebtx[aps:cite:special][aps:cite] \startsetups btx:aps:cite:special \btxcitereference \ctxlua{render_cite([==[\btxflush{year}]==], [==[\btxflush{

[NTG-context] Re: \luaescapestring in proper Lua

2024-04-11 Thread Pablo Rodriguez via ntg-context
On 4/11/24 18:56, Hans Hagen via ntg-context wrote: > [...] >>> \protected\def\PrintTheThing{\ctxlua{document.print_the_thing()}} >> >> Sorry, but why \protected is required or recommended here? > > depends if you want it to be expandable I see now that "still.

[NTG-context] Re: \luaescapestring in proper Lua

2024-04-11 Thread Hans Hagen via ntg-context
On 4/11/2024 5:07 PM, Pablo Rodriguez via ntg-context wrote: On 4/10/24 21:48, Hans Hagen via ntg-context wrote: On 4/10/2024 7:49 PM, Pablo Rodriguez via ntg-context wrote: [...] I wonder whether there is a proper way in the Lua code to avoid [[\luaescapestring{}]] in \ctxlua

[NTG-context] Re: \luaescapestring in proper Lua

2024-04-11 Thread Pablo Rodriguez via ntg-context
On 4/10/24 21:48, Hans Hagen via ntg-context wrote: > On 4/10/2024 7:49 PM, Pablo Rodriguez via ntg-context wrote: >> [...] >> I wonder whether there is a proper way in the Lua code to avoid >> [[\luaescapestring{}]] in \ctxlua. >> [...] > context(tokens.s

[NTG-context] Re: \luaescapestring in proper Lua

2024-04-10 Thread Hans Hagen via ntg-context
On 4/10/2024 7:49 PM, Pablo Rodriguez via ntg-context wrote: Dear list, I have the following sample: \starttext \startluacode function document.print_the_thing(str) context(str) end \stopluacode \unexpanded\def\PrintTheThing#1{% \ctxlua{document.print_the_thing

[NTG-context] \luaescapestring in proper Lua

2024-04-10 Thread Pablo Rodriguez via ntg-context
Dear list, I have the following sample: \starttext \startluacode function document.print_the_thing(str) context(str) end \stopluacode \unexpanded\def\PrintTheThing#1{% \ctxlua{document.print_the_thing([[\luaescapestring{#1}]])}} \PrintTheThing{a \em b {c}} \stoptext I

[NTG-context] Re: using an end of line as parameter

2024-02-21 Thread Bruce Horrocks
-- Reset for the next question (in case no blank line) tracker = 0 the_question = {} end end end \stopluacode \def\startTestQuestions {\dostartbuffer[TestQuestions][startTestQuestions][stopTestQuestions]} \def\stopTestQuestion

[NTG-context] Re: using an end of line as parameter

2024-02-20 Thread Bruce Horrocks
ion (in case no blank line) tracker = 0 the_question = {} end end end \stopluacode \def\startTestQuestions {\dostartbuffer[TestQuestions][startTestQuestions][stopTestQuestions]} \def\stopTestQuestions {\ctxlua{userdata.formatTestQuestions()}} \starttext Here are

[NTG-context] Re: removing whitespace

2024-02-13 Thread Wolfgang Schuster
Michael Guravage schrieb am 13.02.2024 um 14:01: While reading the documentation I spotted something similar from which I derived this solution: \setupinteraction[state=start] \def\squeeze#1%   {     \goto{#1} [url(tel:\ctxlua{context(string.gsub("#1", " ", "")

[NTG-context] Re: removing whitespace

2024-02-13 Thread Michael Guravage
While reading the documentation I spotted something similar from which I derived this solution: \setupinteraction[state=start] \def\squeeze#1% { \goto{#1} [url(tel:\ctxlua{context(string.gsub("#1", " ", ""))})] } \starttext Call \squeeze{01234 56789

[NTG-context] removing whitespace

2024-02-12 Thread Michael Guravage
In the example below I pass the macro a string with a space, but the space should not appear in the url. I've tried using \ctxlua to invoke string substitution, but without success. What is the proper way to remove this space, and to perform string manipulation more generally? \setupintera

[NTG-context] Re: Own command definition breaks with interaction: Use of \do_my_command doesn't match its definition

2024-01-29 Thread Wolfgang Schuster
;] then context.bold(text) else context(text) end end \stopluacode % without that line there is no problem \setupinteraction[state=start] \defineenumeration[enu][text=Enu] \defineenumeration[enu][text=Enu,title=yes] \unprotect \def\mc{\dosingleempty\do_my_command} \def\do_my

[NTG-context] Re: Own command definition breaks with interaction: Use of \do_my_command doesn't match its definition

2024-01-29 Thread Taco Hoekwater
> % without that line there is no problem > \setupinteraction[state=start] > > \defineenumeration[enu][text=Enu] > > \unprotect > \def\mc{\dosingleempty\do_my_command} > \def\do_my_command[#1]#2{% > \iffirstargument{% > \ctxlua{userdata.my_command('#1',

[NTG-context] Own command definition breaks with interaction: Use of \do_my_command doesn't match its definition

2024-01-25 Thread Gerion Entrup
text(text) end end \stopluacode % without that line there is no problem \setupinteraction[state=start] \defineenumeration[enu][text=Enu] \unprotect \def\mc{\dosingleempty\do_my_command} \def\do_my_command[#1]#2{% \iffirstargument{% \ctxlua{userdata.my_command('#1

[NTG-context] Re: vim syntax highlighting bug?

2024-01-09 Thread Gerion Entrup
t; > > > > > Happy New Year! > > > > I got into a bug in my Vim syntax highlighting version. > > Highlight stays in lua mode after ctxlua macro is closed. > > Here is a MWE, where «this should not be highlitghted as > > a comment indeed is

[NTG-context] Re: vim syntax highlighting bug?

2024-01-08 Thread Vincent Hennebert
ghlighting version. Highlight stays in lua mode after ctxlua macro is closed. Here is a MWE, where «this should not be highlitghted as a comment indeed is. \starttext Hello! \ctxlua{context("does the parser work?")} -- this should not be highlighted as a comment \stoptext Do other

[NTG-context] Re: vim syntax highlighting bug?

2024-01-06 Thread Christian Prim via ntg-context
ersion 9.0... Hope it helps Christian Am Sa., 6. Jan. 2024 um 13:04 Uhr schrieb Damien Thiriet via ntg-context < ntg-context@ntg.nl>: > Hello, > > > Happy New Year! > > I got into a bug in my Vim syntax highlighting version. > Highlight stays in lua mode after ctxlua ma

[NTG-context] vim syntax highlighting bug?

2024-01-06 Thread Damien Thiriet via ntg-context
Hello, Happy New Year! I got into a bug in my Vim syntax highlighting version. Highlight stays in lua mode after ctxlua macro is closed. Here is a MWE, where «this should not be highlitghted as a comment indeed is. \starttext Hello! \ctxlua{context("does the parser work?")} -- t

[NTG-context] Re: LMTX: Command handling, Interface between TeX and Lua

2023-12-14 Thread Gerion Entrup
1]) > context('\\par') > context('Color chosen = ' .. named_values['color']) > context('\\par') > context('Curly braces = ' .. str) > context('\\par') > end > \stopluacode > > \def\mycommand[#1][#2]#

[NTG-context] Re: LMTX: Command handling, Interface between TeX and Lua

2023-12-13 Thread Bruce Horrocks
to_array(keywords) named_values = utilities.parsers.settings_to_hash(keyvals) context('First option = ' .. keyword_options[1]) context('\\par') context('Color chosen = ' .. named_values['color']) context('\\par') context('Curly

[NTG-context] Adobe Source Typescript With Design Sizes

2023-10-31 Thread Vincent Hennebert
riptprefix{\typescriptone}] [\ctxlua{context(userdata.adobesource.getfontname("\typescriptone", "\typescripttwo", false, false))}] [features=default] \definefontsynonym [\typescriptprefix{\typescriptone}Italic] [\ctxlua{context(userdata.adobesource.getfontname("\typ

[NTG-context] Re: XML: flush to lua function

2023-09-12 Thread Taco Hoekwater
esendet: Montag, 11. September 2023 16:47 > An: ntg-context@ntg.nl > Betreff: [NTG-context] XML: flush to lua function > Hi, > I have the following xml setup with a lua function: > \startluacode > function markingLength(s) > _,n = s:gsub("%S+","&qu

[NTG-context] Re: XML: flush to lua function

2023-09-11 Thread denis.maier
_,n = s:gsub("%S+","") if n > 3 then context("yes" .. " ...") else context("no") end end \stopluacode \startxmlsetups xml:ink:ink-title:marking %\ctxlua{markingLength(\

[NTG-context] XML: flush to lua function

2023-09-11 Thread denis.maier
end end \stopluacode \startxmlsetups xml:ink:ink-title:marking %\ctxlua{markingLength(\xmlflush{#1})} % does not work \ctxlua{markingLength{"1 2 3 4"}} \stopxmlsetups While the function works, I cannot use xmlflush here. How can I p

[NTG-context] Re: Table head/body via lua

2023-08-18 Thread Wolfgang Schuster
oning commands, like \bTABLEhead, \eTABLEhead, bTABLEbody or \eTABLEbody: it seems impossible to incapsulate them into lua functions. For example, the following is not compiled: \starttext \bTABLE \ctxlua{context.bTABLEbody()} \bTR \bTD Cell 1\eTD \bTD Cell 2\eTD \eTR \ctxlua{context.eTABLEbody()} \e

[NTG-context] Table head/body via lua

2023-08-18 Thread Alexey Kryukov
Ebody or \eTABLEbody: it seems impossible to incapsulate them into lua functions. For example, the following is not compiled: \starttext \bTABLE \ctxlua{context.bTABLEbody()} \bTR \bTD Cell 1\eTD \bTD Cell 2\eTD \eTR \ctxlua{context.eTABLEbody()} \eTABLE \stoptext Can anybody suggest a worka

[NTG-context] Re: Why overbar is so big

2023-08-13 Thread Hans Hagen
on <...nt/tex/texmf-context/tex/context/base/mkiv/l-sandbox.lua:165> (...tail calls...) [ctxlua]:1: in main chunk 25 \subsubject{Versió} 26 27 Contínuament canvio aquest document, afegint, modificant o eliminant algunes parts seves. En aquest sentit, és una obra pe

[NTG-context] Re: Why overbar is so big

2023-08-13 Thread Xavier B.
it.lua' no file './lualibs-os.lua' no file './lualibs-os/init.lua' stack traceback: [C]: in upvalue 'requiem' ...nt/tex/texmf-context/tex/context/base/mkiv/l-sandbox.lua:180: in function <...nt/tex/texmf-context/tex/cont

[NTG-context] Problems with luametatex and texlive on OpenBSD

2023-07-27 Thread Edd Barrett
> loading interface definitions from 'mult-def.lua' interface > initialization > loading interface messages from 'mult-mes.lua' interface > initialization > definitions: 746 constants, 637 variables, 28 elements, 865 commands, 191 formats, 21 tra

[NTG-context] Fwd: Re: Replacing %20 with spaces in xml attributes

2023-07-21 Thread Hans Hagen via ntg-context
. I'm thinking that it has something to do with the percent characters... This here works just fine: \startluacode function test(s) result = string.gsub(s, 'x20', 'MATCH') context(result) end \stopluacode \define[1]\test{\ctxlua{test("#1")}} \starttext

[NTG-context] Re: Replacing %20 with spaces in xml attributes

2023-07-21 Thread denis.maier
Thanks, but I'm still getting the same error. I'm thinking that it has something to do with the percent characters... This here works just fine: \startluacode function test(s) result = string.gsub(s, 'x20', 'MATCH') context(result) end \stopluacode \d

[NTG-context] Re: Replacing %20 with spaces in xml attributes

2023-07-21 Thread Hans van der Meer via ntg-context
e/expand the > %20s to regular spaces? > > I’ve tried with some Lua, but I don’t really know how to pass data around. > > % > \startluacode > function replaceSpaces(s) > result = string.gsub(s, "%%20", " ") > context(result) > end > \stopluacode >

[NTG-context] Replacing %20 with spaces in xml attributes

2023-07-21 Thread denis.maier
opluacode \define[1]\replaceSpaces{\ctxlua{replaceSpaces("#1")}} \startxmlsetups xml:fig:graphic \externalfigure[\replaceSpaces{\xmlatt{#1}{xlink:href}}] \stopxmlsetups % Any hints, why this does not work?` Also, maybe there's a s

[NTG-context] Re: access image properties in Lua

2023-07-17 Thread Henning Hraban Ramm
scaled target size of an image; either the "current" one or by name. \ctxlua{inspect(figures.getinfo("t:/sources/mill.png").used)} \ctxlua{inspect(figures.getinfo("t:/sources/mill.png").status)} etc .. no more faking the img lib Thank you! We also might have a

[NTG-context] Re: access image properties in Lua

2023-07-17 Thread Alan Braslau via ntg-context
so the scaled target size of an image; either the "current" one or by name. \ctxlua{inspect(figures.getinfo("t:/sources/mill.png").used)} \ctxlua{inspect(figures.getinfo("t:/sources/mill.png").status)} etc .. no more faking the img lib Hans Hraban, Hans, and maili

[NTG-context] Re: access image properties in Lua

2023-07-13 Thread Hans Hagen
I understand this right, "img" isn’t valid anymore: """ token call, execute: grph-imagelib.lua:37: attempt to index a nil value (global 'img') """ I’d like to know the pixel size and if possible also the scaled target size of an image; eit

[NTG-context] [ error installing fresh lmtx]

2023-05-29 Thread vm via ntg-context
ext/tex/texmf-context/tex/context/base/mkiv/lxml-lpt.lua:64: in local 'code' ...ext/tex/texmf-context/tex/context/base/mkiv/util-lua.lua:96: in field 'loadedluacode' ...ext/tex/texmf-context/tex/context/base/mkiv/luat-env.lua:108: in field 'luafilechunk' ...ext/te

Re: [NTG-context] Is there a way to centrally add a list of indexed items to a sub category?

2023-05-14 Thread Henning Hraban Ramm via ntg-context
Index lookups \defineregister[Person][] \defineprocessor[italics][style=italicface] \define[1]\Passim{\emph{passim}} \defineprocessor[passim][command=\Passim] \define[1]\nPerson{% \expanded{\Person{\ctxlua{userdata.Lookup("#1")}}}% } \define[1]\TPerson{% \expanded{\Person[kursiv->

Re: [NTG-context] cannot generate format file with current latest

2023-04-30 Thread Bruce Horrocks via ntg-context
back: > ...ext/base/mkxl/cldf-pos.lmt:18: in local 'code' > ...ext/base/mkiv/util-lua.lua:96: in field 'loadedluacode' > ...ext/base/mkiv/luat-env.lua:108: in field 'luafilechunk' > ...ext/base/mkxl/luat-cod.lmt:82: in function 'lua.registercode' >

[NTG-context] cannot generate format file with current latest

2023-04-30 Thread Pablo Rodriguez via ntg-context
; ...ext/base/mkiv/luat-env.lua:108: in field 'luafilechunk' ...ext/base/mkxl/luat-cod.lmt:82: in function 'lua.registercode' [ctxlua]:1: in main chunk A number should have been here; I inserted '0'. (If you can't figure out why I needed to

[NTG-context] cannot compile with MkIV

2023-03-06 Thread Pablo Rodriguez via ntg-context
ontext/base/mkiv/luat-env.lua:108: in field 'luafilechunk' ...ext/tex/texmf-context/tex/context/base/mkiv/luat-cod.lua:73: in function 'lua.registercode' [ctxlua]:1: in main chunk 11 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for 12 %C details. 13

Re: [NTG-context] \hpos in math - Half solved

2022-12-07 Thread Hans Hagen via ntg-context
same labels (X,Y,Z), but internally they have separate sets, (1:X and 2:X, etc.). The moral of the story for me: Use more Lua. but ... work local ... so document.sfnum etc in order to avoid clashes Gavin % Lua counts the spin formulas \ctxlua{sfnum = 0} % Count starts at zero \def\sfID

Re: [NTG-context] \hpos in math - Half solved

2022-12-07 Thread Gavin via ntg-context
more Lua. Gavin % Lua counts the spin formulas \ctxlua{sfnum = 0} % Count starts at zero \def\sfID{\ctxlua{context(sfnum)}} % ConTeXt can call the count from Lua to use as an ID for each equation. % Spin formulas increase the spin formula count and typeset the formula as usual. \define

Re: [NTG-context] How to display the pages of a particular section in another PDF?

2022-12-05 Thread Hans Hagen via ntg-context
t we need more inpiut and discussion for that \starttexdefinition DoWithSection #1#2 \startpagemakeup \externalfigure[#1.pdf][page=#2] \stoppagemakeup \stoptexdefinition \starttexdefinition LoadSectionsA #1#2 \ctxlua{document.loadsection("#1","#2")} \doifnot

Re: [NTG-context] filling buffers in cld documents

2022-11-27 Thread Hans Hagen via ntg-context
txcell {"width=1.5cm","align=flushright"} context(Eleve[note]) context("/") context(notemax)   context.stopxcell ()    end    \stopluacode    \startbuffer [grille]    \startxtable       \startxrow \startxcell     \ct

[NTG-context] filling buffers in cld documents

2022-11-27 Thread damien thiriet via ntg-context
context(Eleve[note]) context("/") context(notemax) context.stopxcell () end \stopluacode \startbuffer [grille] \startxtable \startxrow \startxcell \ctxlua {userdata.Critere ("structure","NoteStructure"

Re: [NTG-context] Font expansion enabled by default with the latest upload

2022-11-21 Thread Max Chernoff via ntg-context
ello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello.% \ctxlua{nodes.tasks.enableaction("finalizers", "userdata.test")} \ctxlua{nodes.tasks.disableaction("finalizers", "userdata.test")}

Re: [NTG-context] font features

2022-11-03 Thread Hans Hagen via ntg-context
"yes", script = script } ) context.start() context.addff("f:"..name) context(test) context.stop() context.blank() end end end \stopluacode \definedfont[LibertinusS

[NTG-context] new hash for buffer (as file)

2022-09-22 Thread Pablo Rodriguez via ntg-context
Dear list, playing with buffer contents, I have the following file: \setupinteraction[state=start] \setupinteractionscreen[option={attachment}] \startbuffer[test] just a test and another one \stopbuffer \starttext \ctxlua{require("util-sha")} \def\s

[NTG-context] hash for buffer contents

2022-09-21 Thread Pablo Rodriguez via ntg-context
Dear list, I have the following sample: \ctxlua{require("util-sha")} \starttext \startbuffer[abc] samples \stopbuffer \cldcontext{utilities.sha2.hash512("buffer-name")} \stoptext Is there any way to get "utilities.sha2.hash512" with the conte

Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate

2022-08-29 Thread Hans Hagen via ntg-context
= true, public= true, actions = poetry.sidebyside, arguments = "hash", } \stopluacode \continueifinputfile{m-poetry.mkxl} \starttext \starttext \startbuffer[lines-1] THIS IS A POEM WITH TWO STANZAS \stopbuffer \startbuffer[lines-1b] THIS IS A LONGER PO

Re: [NTG-context] SHA calculation

2022-08-28 Thread Pablo Rodriguez via ntg-context
ontext > garden.  > Where to look? Dear dr. van der Meer, it is my fault since Hans explained this before (to me). Here you have the minimal sample: \ctxlua{require("util-sha")} \def\shatwo#1{% \cldcontext{utilities.sha2.hash256("#1")}} \def\shafive#1{%

Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate

2022-08-28 Thread Hans Hagen via ntg-context
NZAS \stopbuffer \startbuffer[lines-2] this is a poem with two stanzas \stopbuffer \startbuffer[lines-3] this | THIS is | IS a| A poem | POEM | with | WITH two | TWO stanzas | STANZAS \stopbuffer \ctxlua { modu

Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-21 Thread Hans Hagen via ntg-context
offset 3pt{\strut #1}} \setbox1000\hbox{\NotoCJK\startscript[hangul]\dorecurse{20}{通用规范汉字表 \stripe{test #1} }\stopscript} \ctxlua{document.manipulate_one(1000)} \ruledvbox orientation 1 to \textwidth \bgroup \hsize \textheight \unhbox1000 \vfill \egroup \page \setbox1000\hbox{\N

Re: [NTG-context] Can't manipulate glue added by tex.preparelinebreak

2022-07-26 Thread Hans Hagen via ntg-context
{\dorecurse{209}{Hello }\par}\page {\parfillskip=0pt\dorecurse{209}{Hello }\par}\page {\ctxlua{nodes.tasks.appendaction("processors", "after", "test")} \dorecurse{209}{Hello }\par}\page \box\testbox \stoptex

[NTG-context] Can't manipulate glue added by tex.preparelinebreak

2022-07-25 Thread Max Chernoff via ntg-context
kip.stretch = 0 local broken = tex.linebreak(new_head) tex.setbox("global", "testbox", broken) return head end \stopluacode \starttext {\dorecurse{209}{Hello }\par}\page {\parfillskip=0pt\dorecurse{209}{He

Re: [NTG-context] How to switch off the numbering of a float in a CLDocument?

2022-07-21 Thread Taco Hoekwater via ntg-context
textwidth}] Best wishes, Taco PS \enabletrackers[context.*] > --context.framedtext( > -- {frame="on",style="\\bfd"}, > -- "{This is a test}") > context.stopplacefigure() > end > > \stopluacode &g

Re: [NTG-context] How to switch off the numbering of a float in a CLDocument?

2022-07-21 Thread Willi Egger via ntg-context
-- "{This is a test}") context.stopplacefigure() end \stopluacode \define\Test{\ctxlua{Foto_page()}} \starttext \strut \Test \stoptext KR Willi > On 18 Jul 2022, at 20:56, Henning Hraban Ramm via ntg-context > wrote: > >

Re: [NTG-context] Count (and limit) glyphs per line?

2022-06-26 Thread Hans Hagen via ntg-context
: \setuppapersize[landscape,letter] \showframe \starttext \samplefile{knuth} \ctxlua{context(tex.dimen["textwidth"])} % 37213340 \ctxlua{context(tex.dimen["localhsize"])} % 0 \startitemize[width=5em] \item \samplefile{knuth

Re: [NTG-context] Count (and limit) glyphs per line?

2022-06-26 Thread Benjamin Buchmuller via ntg-context
chars = 0 end n = n.next end return head end nodes.tasks.appendaction( "processors", "before", "userdata.limiter" ) \stopluacode \setuppapersize[A5] \showf

Re: [NTG-context] Count (and limit) glyphs per line?

2022-06-25 Thread Benjamin Buchmuller via ntg-context
\samplefile{knuth} \ctxlua{context(tex.dimen["textwidth"])} % 37213340 \ctxlua{context(tex.dimen["localhsize"])} % 0 \startitemize[width=5em] \item \samplefile{knuth} \ctxlua{context(tex.dimen["

Re: [NTG-context] How to print a random whole number between x and y?

2022-06-17 Thread Wolfgang Schuster via ntg-context
Joel via ntg-context schrieb am 17.06.2022 um 16:10: I was using this code for a long time in my document. I have a PDF with 10 pages, and this would randomly display one of those pages:    \ctxlua{math.randomseed( os.time() )}         \getrandomnumber \n {1} {10}      \placefigure

[NTG-context] How to print a random whole number between x and y?

2022-06-17 Thread Joel via ntg-context
I was using this code for a long time in my document. I have a PDF with 10 pages, and this would randomly display one of those pages:    \ctxlua{math.randomseed( os.time() )}                  \getrandomnumber \n {1} {10}              \placefigure[force, none]{}{\framed[frame=off

[NTG-context] \doifnotdocumentargument in proper Lua

2022-04-29 Thread Pablo Rodriguez via ntg-context
Dear list, I have the following command in one of my documents: \doifnotdocumentargument{no-metadata} {\ctxlua{document.transfer_metadata(document.main_file)}} Which would be the right way to write \doifnotdocumentargument in proper Lua? Many thanks for your help, Pablo

Re: [NTG-context] lua-widow-control module error in LMTX

2022-04-25 Thread Eduardo Bohoyo via ntg-context
\setuplwc command ends on line 74, which then triggers \everysetuplwc which then calls \ctxlua{lwc.enable_callbacks()}. This fails since lwc is undefined because the Lua file isn't loaded because ConTeXt can't seem to find the file. In Plain LuaTeX and LuaLaTeX, a missing Lua file

Re: [NTG-context] lua-widow-control module error in LMTX

2022-04-25 Thread Max Chernoff via ntg-context
75 of the t-lua-widow-control file is empty. The \setuplwc command ends on line 74, which then triggers \everysetuplwc which then calls \ctxlua{lwc.enable_callbacks()}. This fails since lwc is undefined because the Lua file isn't loaded because ConTeXt can't seem to find the file. In

Re: [NTG-context] gzip.compress in ConTeXt mkiv

2022-03-02 Thread Hans Hagen via ntg-context
...mtx/tex/texmf-context/tex/context/base/mkiv/util-zip.lua:610: in upvalue 'putcompressed' ...mtx/tex/texmf-context/tex/context/base/mkiv/util-zip.lua:662: in function 'gzip.compress' [ctxlua]:1: in main chunk i'll check it (at some point

[NTG-context] gzip.compress in ConTeXt mkiv

2022-03-01 Thread Marcel Fabian Krüger via ntg-context
lua:610: in upvalue 'putcompressed' ...mtx/tex/texmf-context/tex/context/base/mkiv/util-zip.lua:662: in function 'gzip.compress' [ctxlua]:1: in main chunk Best regards, Marcel ___ If your q

Re: [NTG-context] Reset environment between MetaPost graphics?

2022-01-21 Thread Vincent Hennebert via ntg-context
On Thu, 2022-01-20 at 15:47 +0100, Hans Hagen via ntg-context wrote: > On 1/20/2022 3:26 PM, Aditya Mahajan via ntg-context wrote: > > > AFAIK, there is no in-built support for this. > > FYEO: > > \starttext > > \startMPcode >      u = 123; > \stopMPcode &g

Re: [NTG-context] Reset environment between MetaPost graphics?

2022-01-20 Thread Hans Hagen via ntg-context
On 1/20/2022 3:26 PM, Aditya Mahajan via ntg-context wrote: AFAIK, there is no in-built support for this. FYEO: \starttext \startMPcode u = 123; \stopMPcode \ctxlua{metapost.reset("metafun:1")} \startMPcode u = 123; \stopMPcode \stoptext (the instance is reported on t

[NTG-context] getting sha512 from text in buffer

2021-12-01 Thread Pablo Rodriguez via ntg-context
Dear list, I have this minimal sample: \ctxlua{require("util-sha")} \def\sha#1{% \ctxlua{context(utilities.sha2.hash512("#1"))}} \startbuffer[text] hola \stopbuffer \starttext \sha{hola} \sha{\typebuffer[text]} \stoptext How can I get that both c

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-27 Thread Joey McCollum via ntg-context
> instead of "YES": > > > > ``` > > > > \starttexdefinition loc [#1] > > > > \doifassignmentelse{#1} { > > > > % if an assignment, then parse and format accordingly > > > > \getparameters[loc][#1] > > > > % Was a sectio

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-27 Thread Hans Hagen via ntg-context
\locsec } } { % otherwise, just print the input as-is #1 } \stoptexdefinition \def\DoIfPrefixElse#1#2{\ctxlua{commands.doifelse(string.find([==[#2]==],"^"..[==[#1]==]))}} \def\currentbtxloctext{\loc[sec=31]} \starttext \currentbtxloctext\blank \DoIfPrefixElse{§}{\currentbtxloc

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-27 Thread Joey McCollum via ntg-context
ut as-is #1 } \stoptexdefinition \def\DoIfPrefixElse#1#2{\ctxlua{commands.doifelse(string.find([==[#2]==],"^"..[==[#1]==]))}} \def\currentbtxloctext{\loc[sec=31]} \starttext \currentbtxloctext\blank \DoIfPrefixElse{§}{\currentbtxloctext}{YES}{NOP} \stoptext ``` Indeed, if I add a s

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-26 Thread Joey McCollum via ntg-context
fined{locsec} { § \locsec\btxcomma } } { % otherwise, just print the input as-is #1 } \stoptexdefinition \def\DoIfPrefixElse#1#2{\ctxlua{commands.doifelse(string.find("#2","^".."#1"))}} \def\currentbtxloctext{\loc[sec=31]} \starttext \DoIfPrefixElse{§}{\currentbtxloct

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-26 Thread Hans Hagen via ntg-context
) == prefix then       return true     end     return false   end ``` how about if string.find(str,"^"..prefix) then in: \starttext \def\DoIfPrefixElse#1#2{\ctxlua{commands.doifelse(string.find("#2","^".."#1"))}} \DoIfPrefixElse{pre}{prefix}{YES}{N

Re: [NTG-context] Checking for a macro in a string without expanding it

2021-11-16 Thread Hans Hagen via ntg-context
t want the content inside the brackets     end     context(innerparams)     return end \stopluacode \def\parseinner#1{\ctxlua{userdata.parseinner([==[#1]==])}} \starttext Testing:\blank \parseinner{\outer} \stoptext ``` My problem is that when I pass \outer to the \parseinner macro, it get

Re: [NTG-context] Checking for a macro in a string without expanding it

2021-11-16 Thread Jairo A. del Rio via ntg-context
ot;\\inner(%b[])") then > > i, j = string.find(str, "\\inner(%b[])") > > innerparams = string.sub(str, i+1, j-1) -- we just want the content > inside the brackets > > end > > context(innerparams) > > return > > end > > \stoplu

[NTG-context] Checking for a macro in a string without expanding it

2021-11-16 Thread Joey McCollum via ntg-context
rseinner(str) local innerparams = "" if string.find(str, "\\inner(%b[])") then i, j = string.find(str, "\\inner(%b[])") innerparams = string.sub(str, i+1, j-1) -- we just want the content inside the brackets end context(innerparams) re

Re: [NTG-context] getting number from context.figurewidth

2021-10-28 Thread Pablo Rodriguez via ntg-context
t.figurewidth >> .. ' height=' .. context.figureheight) >> >> I cannot concatenate string and function (and I need the number, not the >> unit). >> >> Is there no way of doing it? > i'm pretty sure this has been asked before > > \ctxlua{local f

Re: [NTG-context] getting number from context.figurewidth

2021-10-27 Thread Hans Hagen via ntg-context
his has been asked before \ctxlua{local f = figures.getinfo("cow.pdf") print(f and f.used and f.used.width)} so .. time to wikify it Hans - Hans Hagen | PRAGMA ADE

Re: [NTG-context] setting date in \setupinteraction

2021-10-19 Thread Michal Vlasák via ntg-context
itle = main_doc.Info.Title } > context.setupinteraction{ date = main_doc.Info.ModDate:sub(3,6) .. > "-" .. main_doc.Info.ModDate:sub(7,8) .. "-" .. > main_doc.Info.ModDate:sub(9,10) .. "T" .. > main_doc.Info.ModDate:sub(11,12) .. ":" .. > main_doc.Info.ModDate:sub(13,14) .. &quo

Re: [NTG-context] setting date in \setupinteraction

2021-10-19 Thread Pablo Rodriguez via ntg-context
in_doc.Info.ModDate:sub(11,12) .. ":" .. main_doc.Info.ModDate:sub(13,14) .. ":" .. main_doc.Info.ModDate:sub(15,22):gsub("'", ":") } context(main_doc.Info.Title .. "\\par") lpdf.epdf.unload(name) end \stopluacode \unexpanded\de

Re: [NTG-context] Reading ConTeXt metadata values into Lua

2021-10-17 Thread Ramkumar KB via ntg-context
n the distro but > >> could not catch on how to read a metadata value (not print). I am sure > >> that I am missing a small trick somewhere (or is it something more > >> involved?). > >> > >> \startluacode > >> function myFancyCalculations(pages) &

Re: [NTG-context] Reading ConTeXt metadata values into Lua

2021-10-16 Thread Hans Hagen via ntg-context
ro but could not catch on how to read a metadata value (not print). I am sure that I am missing a small trick somewhere (or is it something more involved?). \startluacode function myFancyCalculations(pages)   -- some fancy stuff but as an example local myCal = tonumber(pages) + 1 return myCal

Re: [NTG-context] Reading ConTeXt metadata values into Lua

2021-10-16 Thread Wolfgang Schuster via ntg-context
t). I am sure that I am missing a small trick somewhere (or is it something more involved?). \startluacode function myFancyCalculations(pages)   -- some fancy stuff but as an example local myCal = tonumber(pages) + 1 return myCal \stopluacode \starttext \blah \ctxlua{context(myFancyCalculati

[NTG-context] Reading ConTeXt metadata values into Lua

2021-10-15 Thread Ramkumar KB via ntg-context
omething more involved?). \startluacode function myFancyCalculations(pages) -- some fancy stuff but as an example local myCal = tonumber(pages) + 1 return myCal \stopluacode \starttext \blah \ctxlua{context(myFancyCalculations("\\totalnumberofpages"))} \stoptext Thank yo

Re: [NTG-context] Acrobat doesn’t read imported metadata

2021-10-10 Thread Hans Hagen via ntg-context
nexpanded\def\TransferMetadata#1% {\ctxlua{document.transfer_metadata("#1")}} \startTEXpage[offset=1em, align=center] \ssbf metadatos\\importados \TransferMetadata{metadata.pdf} \stopTEXpage \stoptext Being the sample file https://pdf.ousia.tk/metadata.pdf, Acrobat can

[NTG-context] Acrobat doesn’t read imported metadata

2021-10-10 Thread Pablo Rodriguez via ntg-context
ot;CreationDate", lpdf.string(main_doc.Info.CreationDate)) lpdf.addtoinfo("ModDate", lpdf.string(main_doc.Info.ModDate), main_doc.Info.ModDate) lpdf.epdf.unload(name) end \stopluacode \unexpanded\def\TransferMetadata#1% {\ctxlua{document.transfer_metadata(&quo

Re: [NTG-context] Default values for key-value macros

2021-10-10 Thread Hans Hagen via ntg-context
, but I'm having problems with the following MWE: ``` \def\style#1[#2] {   \ctxlua{userdata.style([==[#2]==])}   \placestyle } here you overload a core macro \startluacode   userdata = userdata or {}   userdata.style = function(keyvals)     local style = {       color = nil,      

  1   2   3   4   5   6   7   8   9   10   >