[NTG-context] \fontdimen in LuaMetaTeX

2020-08-03 Thread Marcel Fabian Krüger
: \starttext \directlua{font.setfontdimen(0, 8, 0)} \stoptext gives token call, execute: invalid option '%i' to 'lua_pushfstring' stack traceback: [C]: in function 'font.setfontdimen' [ctxlua]:1: in main chunk 1 \starttext 2 >> \directlua{font.setfontdimen(0, 8, 0)} 3 \stop

Re: [NTG-context] consistent index entries

2020-08-01 Thread Henning Hraban Ramm
> Am 01.08.2020 um 22:44 schrieb Wolfgang Schuster > : >>> \define[1]\Ort{\expanded{\index{...}}} >> Ah, I never know where to expand (tried \expanded\ctxlua). > > \expanded needs a argument, i.e. \expanded{...} I recognized it doesn’t work otherwise. But I t

Re: [NTG-context] consistent index entries

2020-08-01 Thread Wolfgang Schuster
Henning Hraban Ramm schrieb am 01.08.2020 um 22:16: Am 01.08.2020 um 21:30 schrieb Wolfgang Schuster : \def\Ort#1{\index{\ctxlua{user.Lookup("#1")}}} You have to expand the \index argument: \define[1]\Ort{\expanded{\index{...}}} Ah, I never know where to expand (tried \expan

Re: [NTG-context] consistent index entries

2020-08-01 Thread Henning Hraban Ramm
> Am 01.08.2020 um 21:30 schrieb Wolfgang Schuster > : >> \def\Ort#1{\index{\ctxlua{user.Lookup("#1")}}} > > You have to expand the \index argument: > > \define[1]\Ort{\expanded{\index{...}}} Ah, I never know where to expand (tried \expanded\ctxlua). Now,

Re: [NTG-context] consistent index entries

2020-08-01 Thread Henning Hraban Ramm
> Am 01.08.2020 um 21:01 schrieb Jairo A. del Rio : > > Hi, Henning. According to the garden, something like: > > \def\Ort#1{\index[#1]{\ctxlua{user.Lookup("#1")}}} > > as long as #1 is capable of being sorted in the normal way, should work. Thank you, but tha

Re: [NTG-context] consistent index entries

2020-08-01 Thread Wolfgang Schuster
else return context(Name) end end \stopluacode \def\Ort#1{\index{\ctxlua{user.Lookup("#1")}}} You have to expand the \index argument: \define[1]\Ort{\expanded{\index{...}}} \starttext \Ort{Albano} \Ort{Altona} \Ort{Aurich} \strut\page \placeindex \stoptext The lookup wor

Re: [NTG-context] consistent index entries

2020-08-01 Thread Jairo A. del Rio
( jairoadelr...@gmail.com) escribió: > Hi, Henning. According to the garden, something like: > > \def\Ort#1{\index[#1]{\ctxlua{user.Lookup("#1")}}} > > as long as #1 is capable of being sorted in the normal way, should work. > > Regards, > > Jairo > > El sáb., 1 de

Re: [NTG-context] consistent index entries

2020-08-01 Thread Jairo A. del Rio
Hi, Henning. According to the garden, something like: \def\Ort#1{\index[#1]{\ctxlua{user.Lookup("#1")}}} as long as #1 is capable of being sorted in the normal way, should work. Regards, Jairo El sáb., 1 de ago. de 2020 a la(s) 13:49, Henning Hraban Ramm ( te...@fiee.net

Re: [NTG-context] consistent index entries

2020-08-01 Thread Henning Hraban Ramm
(Name) local Res = user.Lookups[Name] if Res then return context(Res) else return context(Name) end end \stopluacode \def\Ort#1{\index{\ctxlua{user.Lookup("#1")}}} \starttext \Ort{Albano} \Ort{Altona} \Ort{Aurich} \strut\page \placeindex \stoptext The look

Re: [NTG-context] --silent and so on

2020-07-23 Thread Hans Hagen
"typeset on my ipad" or so, like: \starttext \ctxlua { texio.write_nl( "Typeset on my " .. string.char(27) .. "[32;5;7m" .. "IPAD" .. string.char(27) .. &quo

Re: [NTG-context] Code lua in a table

2020-07-18 Thread Fabrice Couvreur
end >> > >> > context.startxtable({"align={middle,lohi}, >> > width=1.2cm,offset=0.8ex,bodyfont=9pt"}) >> > for i = 1, 10 do >> >context.startxrow({"background=color,backgroundcolor=cyan"}) >> > for j = 1, i do &g

Re: [NTG-context] Code lua in a table

2020-07-18 Thread Fabrice Couvreur
end > > > > context.startxtable({"align={middle,lohi}, > > width=1.2cm,offset=0.8ex,bodyfont=9pt"}) > > for i = 1, 10 do > > context.startxrow({"background=color,backgroundcolor=cyan"}) > &

Re: [NTG-context] Code lua in a table

2020-07-18 Thread Wolfgang Schuster
ckgroundcolor=cyan"})             for j = 1, i do                   context.startxcell()                      \ctxlua{context(Binom(i,j))} Remove \ctxlua: context(Binom(i,j)) Wolfgang ___ If your question is of interest to

Re: [NTG-context] Code lua in a table

2020-07-18 Thread Fabrice Couvreur
context.startxcell() \ctxlua{context(Binom(i,j))} context.stopxcell() end context.stopxrow() end context.stopxtable() \stopluacode \stoptext Le sam. 18 juil. 2020 à 20:32, Wolfgang Schuster < wolfgang.schuster.li...@gmail.com>

Re: [NTG-context] French interface

2020-06-25 Thread Wolfgang Schuster
ts "start" (\e!start) and "place" (\e!place) and the variable "figure" (\v!figure.) 2/ I don't understand the following RUN OK: % interface=fr \debuttexte \debutsection[titre=test] This is a test \finsection \codelua{context("Foo Bar 1")} \fintexte \

Re: [NTG-context] Yet another cornercase of ^^ handling in LuaMetaTeX

2020-06-17 Thread Marcel Fabian Krüger
way > > > > Thanks. Is there any way to convert either a token number (as given e.g. > > by t.tok) or a numeric cs identifier (as given e.g. by t.tok-cs_token_flag) > > to a token uservalue? > > In LuaTeX I used to use `token.new(tok, 0)` for this, but LuaMetaTeX > >

Re: [NTG-context] Yet another cornercase of ^^ handling in LuaMetaTeX

2020-06-17 Thread Hans Hagen
d cmd code and a valid chr code. \ctxlua{ local t = token.new(string.byte("X"),token.command_id("letter")) tex.print(t) } The interface might evolve a bit more. Valid commands (at this moment) are: \ctxlua{ for k, v in ipairs(token.values("command")) do

[NTG-context] using annotations for extended print handling

2020-06-14 Thread Pablo Rodriguez
ld be passed automatically to a \filterpages command. A sample that generates something similar: \setuppapersize[A8] \setupinteraction[state=start] \starttext \dorecurse{5}{\part{\romannumerals{\recurselevel}} \dorecurse{15}{\chapter{\recurselevel} \comment [title=whatever,

[NTG-context] Two questions concerning numerals in ConTeXt

2020-06-01 Thread Jairo A. del Rio
efont[tallyfont][babelstonehan] %\mainlanguage[es] \startluacode userdata = userdata or {} userdata.tallymarks = function(n) local one = [[\char"1D377]] --Also tried "\u{1D377}" local five = [[\char"1D378]] --Also tried "\u{1D377}" return string.rep(five, (ton

[NTG-context] RE : Re: Issue with latest LMTX version 2020-05-25

2020-05-26 Thread Joseph
 :Re: [NTG-context] Issue with latest LMTX version 2020-05-25 On 5/26/2020 11:29 AM, Joseph wrote: > \appendtoks\ctxlua{userdata.font_switch(\fontid\font)}\to \everyfontswitch btw, using font.current() is more natural at the lua end H

Re: [NTG-context] Issue with latest LMTX version 2020-05-25

2020-05-26 Thread Hans Hagen
On 5/26/2020 11:29 AM, Joseph wrote: \appendtoks\ctxlua{userdata.font_switch(\fontid\font)}\to \everyfontswitch btw, using font.current() is more natural at the lua end Hans - Hans

Re: [NTG-context] Issue with latest LMTX version 2020-05-25

2020-05-26 Thread Hans Hagen
On 5/26/2020 11:29 AM, Joseph wrote: Dear list, With following MWE : %%% \startluacode \stopluacode \appendtoks\ctxlua{userdata.font_switch(\fontid\font)}\to \everyfontswitch \setupbodyfont[mainfont, 9pt] \starttext Foo. \stoptext %%% I get following error (commenting out

[NTG-context] Issue with latest LMTX version 2020-05-25

2020-05-26 Thread Joseph
Dear list, With following MWE : %%% \startluacode \stopluacode \appendtoks\ctxlua{userdata.font_switch(\fontid\font)}\to \everyfontswitch \setupbodyfont[mainfont, 9pt] \starttext Foo. \stoptext %%% I get following error (commenting out the \appendtoks line makes the error to disappear) : token

Re: [NTG-context] List of language-specific hyphenation commands

2020-05-23 Thread Wolfgang Schuster
rrent") then context.tex(language) end end \stopluacode \def\doShowLanguage#1% {\doifnotinstring{-}{#1} {\ctxlua{userdata.checklanguage("#1","\luaescapestring{\expandafter\meaning\csname#1\endcsname}")}}% \par} \def\ShowLanguage#1% {\testpage[3

Re: [NTG-context] Getting width of text to be typeset

2020-05-22 Thread Rik Kabel
uot;inject" TeX workflow or whether to access LuaTeX internals (nodes?) to get the desired information. - Is it possible somehow? Too easy ... \startluacode function document.whatever() context(nodes.hpack(tex.getnest().head.next).width) end \stopluacode \unex

Re: [NTG-context] Getting width of text to be typeset

2020-05-22 Thread Hans Hagen
access LuaTeX internals (nodes?) to get the desired information. - Is it possible somehow? Too easy ... \startluacode     function document.whatever()     context(nodes.hpack(tex.getnest().head.next).width)     end \stopluacode \unexpanded\def\widthuptohere{\dimexpr\ctxlua{d

Re: [NTG-context] Getting width of text to be typeset

2020-05-22 Thread Hans Hagen
(nodes?) to get the desired information. - Is it possible somehow? Too easy ... \startluacode function document.whatever() context(nodes.hpack(tex.getnest().head.next).width) end \stopluacode \unexpanded\def\widthuptohere{\dimexpr\ctxlua{document.whatever()}sp\relax} \starttext \dorecurs

Re: [NTG-context] Retrieving original value of enviroment variable HOME

2020-05-11 Thread context
tform: mswin, type: windows, binary subtree: texmf-mswin mkiv lua stats > used engine: luatex version: 1.13, functionality level: 7353, banner: this is luatex, version 1.13.0 (tex live 2020/w32tex) mkiv lua stats > control sequences: 45940 of 65536 + 1000

Re: [NTG-context] Retrieving original value of enviroment variable HOME

2020-05-11 Thread context
Hello Hans, my step-by-step actions: 1. Updated ConTeXt yesterday - described before. 2. Created EnvHome.mkiv for testing: \starttext Ahoj \ctxlua{print("1",environment.homedir)} \ctxlua{print("2",environment.oldhome)} \ctxlua{print("3",os.geten

Re: [NTG-context] Retrieving original value of enviroment variable HOME

2020-05-10 Thread Hans Hagen
On 5/10/2020 2:33 PM, cont...@vivaldi.net wrote: I've just renewed the Ctx Beta installation, but 'environment.oldhome' seems be unavailable. are you ser HOME is set? \ctxlua{print("1",environment.homedir)} \ctxlua{print("2",environment.oldhome)} \ctxlua{print("3&quo

Re: [NTG-context] Use \unit for value and uncertainty

2020-05-09 Thread Otared Kavian
context.digits(tbl[1]) > context.phys_units_space() > context("(") > context.digits(tbl[3]) > context(")") >

Re: [NTG-context] Use \unit for value and uncertainty

2020-05-09 Thread Benjamin Buchmuller
context.unit(table.concat(tbl, " ", 4)) end else context.unit(table.concat(tbl, " ")) end end \stopluacode \def\units#1{\ctxlua{userdata.units("#1")}} Car 1 dri

[NTG-context] [rotate question]

2020-05-01 Thread Floris van Manen
I try to introduce a per character rotation using lua. But a negative rotation angle seems to introduce a vertical offset to the base line. It might be intended, but how to get it gone? Any hints? .Floris \def\streepA{% \rotate[rotation=\ctxlua{context(math.random(1,15))}]{\|}% } \def\streepB

[NTG-context] \framed[align=] with a 'maxwidth' instead of a width? Or get the size of a \frame returned to lua without typesetting it in a document?

2020-04-26 Thread Gerben Wierda
Setup: TeX file Contains ctxlua{} call lua function reads XML file and calls context() statements, it puts out a \startMPpage METAPOST statements Of which some are textext(\framed[align, so

[NTG-context] filtering pages from /PrintPageRange

2020-04-16 Thread Pablo Rodriguez
context.filterpages( { filename }, { right_range }, { width = Opt } ) end \stopluacode \def\filterfrompagerange[#1]{% \ctxlua{document.printrange_from_file("#1")}} \setuplayout[page] \setupinteractionscreen[option={portrait, paper}] \starttext \filterfrompageran

[NTG-context] Using command line values in a TeX document; writing a script?

2020-04-13 Thread Gerben Wierda
Currently, I process a file like this: mtxrun --autogenerate --script context test12.tex and in the file test12.tex one sees something like this: \input archimate-mp \ctxlua{moduledata.archimate(“myarchimatefile.xml")} The latter parses the xml file and produces a PDF using generated MP

Re: [NTG-context] Trying to understand this ctxlua error

2020-04-06 Thread Gerben Wierda
On 6 Apr 2020, at 02:54, Wolfgang Schuster wrote: > > Gerben Wierda schrieb am 06.04.2020 um 00:41: >> I got this error after I had changed some lua code: >> tex error > tex error on line 272 in file archimate-lua.new: ! >> Undefined control sequence >> warnIfVerbose( "Breaking

Re: [NTG-context] Trying to understand this ctxlua error

2020-04-05 Thread Wolfgang Schuster
Gerben Wierda schrieb am 06.04.2020 um 00:41: I got this error after I had changed some lua code: tex error       > tex error on line 272 in file archimate-lua.new: ! Undefined control sequence         warnIfVerbose( "Breaking off the processing of node %s\nNo       l...eak

[NTG-context] Trying to understand this ctxlua error

2020-04-05 Thread Gerben Wierda
I got this error after I had changed some lua code: tex error > tex error on line 272 in file archimate-lua.new: ! Undefined control sequence warnIfVerbose( "Breaking off the processing of node %s\nNo l...eak

Re: [NTG-context] Using Lua files in project structure

2020-04-05 Thread Aditya Mahajan
On Sun, 5 Apr 2020, 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

Re: [NTG-context] Using Lua files in project structure

2020-04-05 Thread Jairo A. del Rio
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

Re: [NTG-context] Using Lua files in project structure

2020-04-05 Thread Wolfgang Schuster
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

Re: [NTG-context] Using Lua files in project structure

2020-04-05 Thread Thomas A. Schmitz
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

Re: [NTG-context] Using Lua files in project structure

2020-04-05 Thread mf
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

[NTG-context] Using Lua files in project structure

2020-04-05 Thread Jairo A. del Rio
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

[NTG-context] Solved: Minimum example of problem getting curly braces printed in METAPOST

2020-04-03 Thread Gerben Wierda
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

[NTG-context] Minimum example of problem getting curly braces printed in METAPOST

2020-04-02 Thread Gerben Wierda
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 "

Re: [NTG-context] Puzzle (for me)

2020-04-01 Thread Gerben Wierda
;> >> 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

Re: [NTG-context] Puzzle (for me)

2020-03-31 Thread Henri Menke
; 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

[NTG-context] Puzzle (for me)

2020-03-31 Thread Gerben Wierda
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

Re: [NTG-context] conditional for undefined references

2020-03-29 Thread Wolfgang Schuster
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

[NTG-context] conditional for undefined references

2020-03-29 Thread Pablo Rodriguez
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

Re: [NTG-context] Bug (Lua) ?

2020-03-19 Thread Hans Hagen
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 "

[NTG-context] Bug (Lua) ?

2020-03-19 Thread Fabrice Couvreur
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 (

Re: [NTG-context] Can I share METAPOST vardefs over multiple pages?

2020-03-16 Thread Aditya Mahajan
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

Re: [NTG-context] Can I share METAPOST vardefs over multiple pages?

2020-03-16 Thread Gerben Wierda
tions (or inclusions, no difference) % ApplicationComponentLogo is defined here with a vardef \stopMPdefinitions \ctxlua{foo(“filename”)}% produces a series of %context.startMPpage { instance = "doublefun” }

Re: [NTG-context] XML to ConTeXt: converting date attribute from ISO date

2020-03-11 Thread Hans Hagen
\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

Re: [NTG-context] XML to ConTeXt: converting date attribute from ISO date

2020-03-11 Thread Axel Kielhorn
>> >> 10.I.08 >> >> >> 19 Mar '08 >> >> >> >> >> >> \stopbuffer >> \startxmlsetups xml:initialize >> \xmlsetsetup{#1}{date}{xml:date} &

[NTG-context] Need help processing XML in luacode

2020-03-10 Thread Axel Kielhorn
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

Re: [NTG-context] Accessing raw titles in textcommand in TOC

2020-02-21 Thread alephzorro
; 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

Re: [NTG-context] Accessing raw titles in textcommand in TOC

2020-02-21 Thread alephzorro
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

Re: [NTG-context] Accessing raw titles in textcommand in TOC

2020-02-21 Thread Wolfgang Schuster
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 &

Re: [NTG-context] Accessing raw titles in textcommand in TOC

2020-02-21 Thread Hans Hagen
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

[NTG-context] Accessing raw titles in textcommand in TOC

2020-02-21 Thread alephzorro
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

Re: [NTG-context] Label in externalfigures

2020-02-14 Thread Jan-Erik Hägglöf
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 $

Re: [NTG-context] Label in externalfigures

2020-02-13 Thread Jan-Erik Hägglöf
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 &

Re: [NTG-context] Label in externalfigures

2020-02-12 Thread Hans Hagen
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

Re: [NTG-context] repeat a page inside a document

2020-02-07 Thread Pablo Rodriguez
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

Re: [NTG-context] "error not related to input file"

2019-12-16 Thread Rudolf Bahr
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

Re: [NTG-context] ConTeXt: specify a path to font in \definefontfamily

2019-11-20 Thread Krešimir Cindrić
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,

Re: [NTG-context] ConTeXt: specify a path to font in \definefontfamily

2019-11-20 Thread Hans Hagen
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

[NTG-context] Luacode: Data File to Table

2019-10-24 Thread Rudolf Bahr
ture_name, [ "width_px" ] = b.width_px, [ "height_px" ]= b.height_px, } context ( 'function Rosi(): b.smrk = ', b.smrk ) context.par()

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-16 Thread Rudolf Bahr
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

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-15 Thread Hans Hagen
(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

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-15 Thread Taco Hoekwater
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

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Rudolf Bahr
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

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Taco Hoekwater
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

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Rudolf Bahr
>context ( " exists!" ) > > else > >context ( name ) > > context ( " doesn't exist!" ) > > end > > end > > > > \stopluacode > > > > > > \starttext > > > > \def\l

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Hans Hagen
( 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

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Taco Hoekwater
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

[NTG-context] RE : \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Joseph
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

[NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Rudolf Bahr
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

Re: [NTG-context] List of Symbols/Abbreviations/Glosses with more then two entries

2019-10-11 Thread Thomas Welter
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

Re: [NTG-context] passing variables/data between context and lua

2019-09-27 Thread mf
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

[NTG-context] Extracting a column from an array in lua

2019-09-20 Thread Otared Kavian
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," ; ")} \

[NTG-context] expansion problem: random location

2019-09-13 Thread Henning Hraban Ramm
\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

Re: [NTG-context] Cross-reference expansion with ConTeXt and processing with LuaTeX

2019-09-06 Thread Oliver von Criegern
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(#

Re: [NTG-context] Cross-reference expansion with ConTeXt and processing with LuaTeX

2019-09-05 Thread Hans Hagen
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

[NTG-context] Cross-reference expansion with ConTeXt and processing with LuaTeX

2019-09-04 Thread Oliver von Criegern
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

Re: [NTG-context] Bug with jobs.file.run?

2019-08-25 Thread Aditya Mahajan
] \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

[NTG-context] Issue with \hbox attrSomeAttr=Val (LTMX only)

2019-07-19 Thread Joseph Canedo
= 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

Re: [NTG-context] an object representation of the node list of a paragraph: a lua table or a JSON

2019-07-10 Thread Hans Hagen
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

Re: [NTG-context] Fwd: [garden] debug getinfo error

2019-07-10 Thread Hans Hagen
 > 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

[NTG-context] Fwd: [garden] debug getinfo error

2019-07-10 Thread Taco Hoekwater
> 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

Re: [NTG-context] interfaces.definecommand fails with brackets inside string arguments

2019-07-09 Thread Hans Hagen
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

Re: [NTG-context] interfaces.definecommand fails with brackets inside string arguments

2019-07-09 Thread Taco Hoekwater
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',[[

Re: [NTG-context] newlines in return Lua string

2019-06-15 Thread Aditya Mahajan
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

[NTG-context] newlines in return Lua string

2019-06-15 Thread Hans van der Meer
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

Re: [NTG-context] tex.month can't be overridden like tex.day and tex.year

2019-05-06 Thread Hans Hagen
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

[NTG-context] tex.month can't be overridden like tex.day and tex.year

2019-05-03 Thread Tristan Stenner
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

  1   2   3   4   5   6   7   8   9   10   >