Re: [NTG-context] setting date in \setupinteraction
On Tue Oct 19, 2021 at 8:51 PM CEST, Pablo Rodriguez via ntg-context wrote: > On 10/19/21 6:23 PM, Michal Vlasák via ntg-context wrote: > > On Tue Oct 19, 2021 at 5:47 PM CEST, Pablo Rodriguez via ntg-context wrote: > > [...] > > So this works: > > > > > > \setupinteraction[state=start, > > date={2022-02-02T12:00:21+02:00}] > > \starttext > > This document is from 02.02.2020 at 12:00:21. > > \stoptext > > > > This parameter sets the "ModDate" is that what you are after? > > Hi Michal, > > many thanks for your fast reply. > > I would like to import both metadata values (CreationDate and ModDate) > from another file (such as https://pdf.ousia.tk/metadata.pdf). > > Besides from the fact that LMTX doesn’t work with this (only MkIV does > [already reported]), isn’t no simpler way to get ISO 8601 formatting > from doc.Info.ModDate than the following one? > > \starttext > \startluacode > function document.transfer_metadata(name) > local main_doc = lpdf.epdf.load(name) > context.setupinteraction{ title = 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) .. ":" .. > main_doc.Info.ModDate:sub(15,22):gsub("'", ":") } > context(main_doc.Info.Title .. "\\par") > lpdf.epdf.unload(name) > end > \stopluacode > \unexpanded\def\TransferMetadata#1% > {\ctxlua{document.transfer_metadata("#1")}} > \startTEXpage[offset=1em, align=center] > \TransferMetadata{metadata.pdf} > \stopTEXpage > \stoptext > > > Seems that "CreationDate" could be set by the SOURCE_DATE_EPOCH > > environment variable, but I am not succesfull with it right now. > > It would be fine to ble able to set CreationDate. Otherwise, having a > ModDate prior to CreationDate gives a weird impression. I don't know how official these interfaces are. But you can try adapting the following to your use case. \setupinteraction[state=start] %\luacode{lpdf.settime("2020-02-02 12:00")} %\luacode{lpdf.settime(1580641221)} \startluacode local Y, M, D, h, m, s, Zs, Zh, Zm = string.match("D:20200202120021+02'00'", "^D:(%d%d%d%d)(%d%d)(%d%d)(%d%d)(%d%d)(%d%d)([%+%-])(%d%d)%'(%d%d)%'$") local time = os.time{year=Y,month=M,day=D,hour=h,min=m,sec=s} lpdf.settime(time) \stopluacode \starttext This document is from 02.02.2020 at 12:00:21. \stoptext The pattern doesn't catch all the PDF spec cases, but should match what ConTeXt emits. The timezone info gets overwritten by current timezone though. Requires the below patch. Michal --- a/tex/context/base/mkiv/core-con.lua +++ b/tex/context/base/mkiv/core-con.lua @@ -1991,7 +1991,7 @@ function converters.totime(s) end local n = tonumber(s) if n and n >= 0 then -return date("*t",n) +return osdate("*t",n) end end diff --git a/tex/context/base/mkxl/lpdf-ini.lmt b/tex/context/base/mkxl/lpdf-ini.lmt index 7979b80..9703ac0 100644 --- a/tex/context/base/mkxl/lpdf-ini.lmt +++ b/tex/context/base/mkxl/lpdf-ini.lmt @@ -1123,7 +1123,7 @@ do n = converters.totime(n) if n then converters.settime(n) -timestamp = osdate("%Y-%m-%dT%X") .. ostimezone(true) -- probably not ok +timestamp = osdate("%Y-%m-%dT%X", ostime(n)) .. ostimezone(true) -- probably not ok end end if metadata then ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Bloody PDF boxes and cr*p marks!
> Am 12.10.2021 um 20:48 schrieb Hans Hagen : > >> Hm, you implemented these boxes only in 2015, there was not much change in >> that regard since then. > > Way earlier but it wasn't enabled ... (I'm not going to check ancient tex > live dvd's). > >addtopageattributes("CropBox",box) -- mandate for rendering >addtopageattributes("TrimBox",box) -- mandate for pdf/x > -- addtopageattributes("BleedBox",box) > -- addtopageattributes("ArtBox",box) > > I remember discussing it with (I think) Pablo and it definityely came up when > we were dealing with these 'standards'. Ok. I found it in lpdf-mis.lua, maybe I’ll use the Lua function directly. >>> well, that's an assumption ... who knows what a printer (driver) does ... >> Who sends PDF files directly to a printer (driver)? I know it only from >> automated, professional workflows. >> Usually printer drivers gets fed by PDF viewers, and I know none that even >> *can* print something different than CropBox. > > afaik some printers accept pdf (hard to check) but I the fact that a viewer > does something doesn't mean it did years ago (just like at how crippled > tounicode has been / is supported over time) Yes, you can send PDF files to some copiers and other professional printing devices. But usually you do this via the manufacturer’s workflow tools – only a few admins still know how to (ab)use a prn queue ;) Beware, \setupbleeding refers only to stretching of images (\externalfigure)! >>> >>> fwiw, that bleeding options is mostly there to communicate with mp >> Good to know. I just browsed the Details manual, didn’t try it yet, since I >> scale and move my “bleeding” images differently. > > i actually need to pick up that bit ... (some code in my local styles i need > to check) because it can be handy for cover pages (but then i also need to > check if i don't break something I’d be interested to see what you’re trying. I want to create my covers more and more with ConTeXt to avoid manual adaptions due to number of pages. >>> the problem is as usual documentation and indeed we can have some backward >>> compatibility issue here ... i honestly have no clue how viewers and >>> printers react (so if something would be added/changed it would be option >>> driven) >> I wouldn’t expect printers (office printing devices) to react at all; I hope >> that printers (printshop workers) will react positively to correct boxes in >> our PDFs ;) > > oh, i'm often surprised about printing houses .. (the best were some comment > on a file having rgb bitmaps while it actually had cmyk outlines and > validators/fixers inlining xforms while setting lines to 0pt widths) .. and > some still use acrobat 4 -) Yep, last weekend I finally sent the latest issue of our magazine to the printshop, of course with correctly set boxes (and markings activated), and since the content didn’t need bleed this time, I set the CropBox to TrimBox. Everything in perfect order – but they charged me for adding crop marks... (Without even asking back.) I’ll teach them PDF basics. BTW, is there a hook to replace crop marks with my own? Ah, found page-mrk.mkiv Can I just replace \startuniqueMPgraphic{print:lines} ? (Something to play with if I get into MP mode...) >>> probably spreads need some treatment (imposition) >> Multiple pages on a sheet are not considered by the PDF specs. > > yes but what of context imposes Right. IMO, if there’s a BleedBox defined, ConTeXt should use it as “page size”, otherwise CropBox. > remind me in a few months (it's a typical boring winter evening activity with > some music blu ray (or movie) running on a second screen) I’ll never understand how others can work with such distractions ;) Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] setting date in \setupinteraction
On 10/19/21 6:23 PM, Michal Vlasák via ntg-context wrote: > On Tue Oct 19, 2021 at 5:47 PM CEST, Pablo Rodriguez via ntg-context wrote: > [...] > So this works: > > > \setupinteraction[state=start, > date={2022-02-02T12:00:21+02:00}] > \starttext > This document is from 02.02.2020 at 12:00:21. > \stoptext > > This parameter sets the "ModDate" is that what you are after? Hi Michal, many thanks for your fast reply. I would like to import both metadata values (CreationDate and ModDate) from another file (such as https://pdf.ousia.tk/metadata.pdf). Besides from the fact that LMTX doesn’t work with this (only MkIV does [already reported]), isn’t no simpler way to get ISO 8601 formatting from doc.Info.ModDate than the following one? \starttext \startluacode function document.transfer_metadata(name) local main_doc = lpdf.epdf.load(name) context.setupinteraction{ title = 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) .. ":" .. main_doc.Info.ModDate:sub(15,22):gsub("'", ":") } context(main_doc.Info.Title .. "\\par") lpdf.epdf.unload(name) end \stopluacode \unexpanded\def\TransferMetadata#1% {\ctxlua{document.transfer_metadata("#1")}} \startTEXpage[offset=1em, align=center] \TransferMetadata{metadata.pdf} \stopTEXpage \stoptext > Seems that "CreationDate" could be set by the SOURCE_DATE_EPOCH > environment variable, but I am not succesfull with it right now. It would be fine to ble able to set CreationDate. Otherwise, having a ModDate prior to CreationDate gives a weird impression. Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] precedence of texmf trees
Hi wizards, if I have files with the same name in several texmf trees (e.g. texmf-context, texmf-local, texmf-project, ~/texmf or TeX Live’s texmf-dist, texmf-var), which one will be used? I guess “local” trees or “local” directories take precedence over “distribution”, but which is “the localest” of ~/texmf/..., texmf-dist/.../local, texmf-local/... ? Where is the order defined? (Not in TDS.) Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] marginals from footnotes
Hi, this is an edge case, but I tried to replicate a feature from DANTE’s LaTeX DTK style where links in the text (and also in footnotes) get a QR code in the margin. It works for me (using zint) in the running text, but not in footnotes. Actually, marginals in footnotes are never displayed. Maybe I shouldn’t expect it to work, but I’d like to have this... Is it possible? \starttext \samplefile{tufte}\inmargin{margin note} bla\footnote{footnote\inmargin{margin note from footnote}} bla \stoptext Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] MkIV missing?
It works. I don't know why, but it works now. Best wishes Jörg Am 18.10.21 um 17:27 schrieb Jörg Hofmann via ntg-context: Am 04.10.21 um 15:33 schrieb Taco Hoekwater via ntg-context: We are busy with this off-list. If it is urgent: luatex --luaonly ~/lmtx/tex/texmf-osx-64/bin/mtxrun.lua --generate fixed it for me (you’ll need to adjust the path, of course) Best wishes, Taco But not for me. :( After I set up my PC again, Linux Mint 20.1 Cinnamon, I also reinstalled ConTeXt and since then I have been experiencing the error. Are there any further steps? Besst wishes Jörg On 4 Oct 2021, at 15:28, Marcus Vinicius Mesquita via ntg-context wrote: Same problem here, on a linux64, context current version: 2021.09.26 17:00 Greetings Marcus Vinicius On Mon, Oct 4, 2021 at 8:55 AM Henning Hraban Ramm via ntg-context wrote: Am 04.10.2021 um 13:06 schrieb Hans Hagen: On 10/4/2021 12:39 PM, Henning Hraban Ramm via ntg-context wrote: Hi, since a while, I can’t run MkIV any more, even after several runs of install.sh (and mtxrun --generate, of course). It’s the same on my Mac and my Linux laptop (of course the bin dir is different on the latter): $ context --version mtx-context | ConTeXt Process Management 1.04 mtx-context | mtx-context | main context file: /Users/hraban/lmtx/tex/texmf-context/tex/context/base/mkiv/context.mkiv mtx-context | current version: 2021.09.26 17:00 mtx-context | main context file: /Users/hraban/lmtx/tex/texmf-context/tex/context/base/mkxl/context.mkxl mtx-context | current version: 2021.09.26 17:00 $ context --version --luatex mtx-context | redirect luametatex -> luatex: luatex --luaonly "/Users/hraban/lmtx/tex/texmf-osx-64/bin/mtxrun.lua" --script mtx-context --version --luatex --redirected mtxrun | unknown script 'mtx-context.lua' or 'mtx-mtx-context.lua' $ which context /Users/hraban/lmtx/tex/texmf-osx-64/bin/context $ which luatex /Users/hraban/lmtx/tex/texmf-osx-64/bin/luatex $ luatex --version This is LuaTeX, Version 1.13.0 (TeX Live 2021) ... $ mtxrun --version mtxrun | ConTeXt TDS Runner Tool 1.32 mtxrun | source path I thought that was related to the server/provider move, but I guess it isn’t. It’s a bit annoying that install.sh leaves ~/lmtx/bin in the PATH, so that a call to mtxrun can’t find any configuration. works here ... maybe a --generate issue? I re-ran the install script with a shell ("sh install.sh" instead just ". install.sh"), but that doesn’t change the "unknown script" issue. "mtxrun --generate" seems to work without problems; or do you see something suspicious in the attached log? Hraban ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist :ntg-context@ntg.nl /http://www.ntg.nl/mailman/listinfo/ntg-context webpage :http://www.pragma-ade.nl /http://context.aanhet.net archive :https://bitbucket.org/phg/context-mirror/commits/ wiki :http://contextgarden.net ___ -- Todas as coisas fatigam o corpo, salvo a música, que não fatiga nem o corpo nem seus membros, por ser descanso da alma, primavera do coração, distração do aflito, entretenimento do solitário, e viático do viajante. Kunnâsh al-Hâ'ik (Cancioneiro de al-Hâ'ik) ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist :ntg-context@ntg.nl /http://www.ntg.nl/mailman/listinfo/ntg-context webpage :http://www.pragma-ade.nl /http://context.aanhet.net archive :https://bitbucket.org/phg/context-mirror/commits/ wiki :http://contextgarden.net ___ — Taco Hoekwater E:t...@bittext.nl genderfluid (all pronouns) ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist :ntg-context@ntg.nl /http://www.ntg.nl/mailman/listinfo/ntg-context webpage :http://www.pragma-ade.nl /http://context.aanhet.net archive :https://bitbucket.org/phg/context-mirror/commits/ wiki :http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] setting date in \setupinteraction
On Tue Oct 19, 2021 at 5:47 PM CEST, Pablo Rodriguez via ntg-context wrote: > Dear list, > > I have the following sample: > > \setupinteraction[state=start, > date={02.02.2022}] > \starttext > This document is from 02.02.2020 at 12:00:21. > \stoptext > > Which is the right way to get PDF dates working with \setupinteraction? According to lpdf-mis.lmt about the "date" parameter: -- users should enter the date in 2010-01-19T23:27:50+01:00 format -- and if not provided that way we use the creation time instead I can get this format also with `date --iso-8601=seconds` or the shorter `date -Iseconds`. So this works: \setupinteraction[state=start, date={2022-02-02T12:00:21+02:00}] \starttext This document is from 02.02.2020 at 12:00:21. \stoptext This parameter sets the "ModDate" is that what you are after? Seems that "CreationDate" could be set by the SOURCE_DATE_EPOCH environment variable, but I am not succesfull with it right now. Michal ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] upload
On 10/18/21 11:17 PM, Hans Hagen via ntg-context wrote: > Hi, > > I uploaded a new lmtx. This one is a little experimental because I > removed so redundant / intermediate code still present from teh > transition from mkiv to lmtx (mostly backend related). I might have > missed something (not all is in the test suite) but nothing that can't > be fixed easy, most has to do with the timing of definitions. > > But I assume users save their stable trees anyway ... Hi Hans, I’m afraid that viewerlayers have issues now. I hope I’ll find some time soon to write a minimal sample. Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] setting date in \setupinteraction
Dear list, I have the following sample: \setupinteraction[state=start, date={02.02.2022}] \starttext This document is from 02.02.2020 at 12:00:21. \stoptext Which is the right way to get PDF dates working with \setupinteraction? Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] upload
> Am 18.10.2021 um 23:17 schrieb Hans Hagen via ntg-context > : > > Hi, > > I uploaded a new lmtx. This one is a little experimental because I removed so > redundant / intermediate code still present from teh transition from mkiv to > lmtx (mostly backend related). I might have missed something (not all is in > the test suite) but nothing that can't be fixed easy, most has to do with the > timing of definitions. > > But I assume users save their stable trees anyway … Of course we do, especially after Hraban recommended the 2021-10-10 tree last week. Just one question: LMTX comes with an empty texmf-modules tree. Are we still supposed to copy the context version? There have been updates to letter, filter and some others lately. That means we have to update the context tree as well. Do you plan to include this tree in the future? Greetings Axel PS: I tested one document with the new version without problems. ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___