Re: [NTG-context] Overwritten text with newcolumnsets
On 2/6/2018 9:51 PM, Charles Vejnar wrote: Hi, I am trying to get a two-column document with figures. After failing with \startcolumns, I tried with newcolumnsets. But the most basic example (see below) is not working properly. The text at the bottom of the first page gets overwritten by the first two line of the column. I think this problem was also reported on Sept 22, 2016 by Jose Luis Arellano on this mailing-list. Do you confirm the problem? Any way/plan to fix it? Thanks so much for your help. Best, Charles % start of example \usemodule[newcolumnsets] \definecolumnset[example][n=2] \starttext \startcolumnset[example] \dorecurse{12}{\input knuth \par} \stopcolumnset \stoptext % end of example i'm not surew what goes wrong there but you can best run with \setuplayout[grid=yes] - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ 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] Overwritten text with newcolumnsets
Hi, I am trying to get a two-column document with figures. After failing with \startcolumns, I tried with newcolumnsets. But the most basic example (see below) is not working properly. The text at the bottom of the first page gets overwritten by the first two line of the column. I think this problem was also reported on Sept 22, 2016 by Jose Luis Arellano on this mailing-list. Do you confirm the problem? Any way/plan to fix it? Thanks so much for your help. Best, Charles % start of example \usemodule[newcolumnsets] \definecolumnset[example][n=2] \starttext \startcolumnset[example] \dorecurse{12}{\input knuth \par} \stopcolumnset \stoptext % end of example ___ 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] image file resolver in Lua?
Am 2018-02-06 um 17:09 schrieb Procházka Lukáš Ing. : > I'm usually implementing complicated solutions via Lua, with functions with > obligatory arg(s) first followed by one optional argument of table type: Thank you for your effort! I actually already wrote parts of my invoicing solution in Lua. I was planning to even run a simple GUI (tekui) on top of LuaTeX, but my priorities keep shifting... At the moment I got shell scripts that call Python scripts that read JSON files (as a simple database) and write ConTeXt code that includes (object oriented) Lua libraries for most of the the calculations... It works well enough for my own company and our publishing house, but is quite convoluted. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___ 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] image file resolver in Lua?
Hello Henning, On Tue, 06 Feb 2018 13:13:12 +0100, Henning Hraban Ramm wrote: I’ll try as soon as I get some time, since algorithmic image placement is a recurring problem for me, as I try to replace InDesign in my workflow. I thought about providing a module, but each of my projects has so differing needs that either every macro would need a bunch of options, or I need a lot of similar macros. We’ll see... my experience in these situations: I'm usually implementing complicated solutions via Lua, with functions with obligatory arg(s) first followed by one optional argument of table type: - it's easy to investigate this optional argument and alter the algorithm depending on table keys (presence and/or value), - you don't have to be afraid of optional arg(s) rearrangement. To be more concrete: Sample Lua code MyPlaceFigure = function(figname, opts) -- Optional; .scale = .sc, .rotation = .rot, .label, ... opts = opts or {} -- To simplify code bellow local scale, rot, lab = opts.scale or opts.sc, -- I.e. more keys are allowed in long/short alternative opts.rotation or opts.rotate or opts.rot, -- dtto opts.label or opts.lab, nil if label then -- E.g. use context.placefloat(...) else context.externalfigure({figname}, {scale = 1000 * scale, orientation = rot, }) end end Best regards, Lukas Greetlings, Hraban -- Ing. Lukáš Procházka | mailto:l...@pontex.cz Pontex s. r. o. | mailto:pon...@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn Bezová 1658 147 14 Praha 4 Mob.: +420 702 033 396 ___ 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] image file resolver in Lua?
Am 2018-02-06 um 09:34 schrieb Procházka Lukáš Ing. : > Hello Henning, > >> This is really interesting, but my original question was about the file path >> resolver, i.e. how to get "t:/sources/cow.pdf" from just "cow"? >> > > I guess there was a similar question here: > > https://mailman.ntg.nl/pipermail/ntg-context/2017/088324.html > > Reading till the end, I deduce one has to collect snippets which appear in > the code to build its own "file locator" as no function like > "MyExternalFigureLocator()" exists in ConTeXt/Lua API. Dear Lukáš, thank you very much for collecting this information! I’ll try as soon as I get some time, since algorithmic image placement is a recurring problem for me, as I try to replace InDesign in my workflow. I thought about providing a module, but each of my projects has so differing needs that either every macro would need a bunch of options, or I need a lot of similar macros. We’ll see... Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___ 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] image file resolver in Lua?
Hello Henning, This is really interesting, but my original question was about the file path resolver, i.e. how to get "t:/sources/cow.pdf" from just "cow"? I guess there was a similar question here: https://mailman.ntg.nl/pipermail/ntg-context/2017/088324.html Reading till the end, I deduce one has to collect snippets which appear in the code to build its own "file locator" as no function like "MyExternalFigureLocator()" exists in ConTeXt/Lua API. Some highlights: Personally I use the lua variable named : figures.path It’s a lua table which contains directories names you provide in directory= in \setupexternalfigures: for _, path in ipairs(figures.paths) do local figure_file = path .. '/' .. file local doc = lpdf.epdf.load(figure_file) -- assume pdf (just an example) if doc then …. end done Unfortunately, this code supposes the figure name was passed WITH extension, as no lookup in table-of-valid-extensions is performed (maybe no such table nor iterator exists). There should be also: local n = "x:/Users/MMi/Akce/I-6_Krusovice.DSP-ZDS/Admin/Jednani/2017-07-07-SU-Rakovnik/ZJ.pdf" local d = figures.getinfo(n) inspect(d) And a snippet from another mailing thread: (Hans' answer) \getfiguredimensions[test.pdf] \dorecurse {\noffigurepages} { \getfiguredimensions[test.pdf][page=#1] \figurenaturalwidth ,\figurenaturalheight,\figureorientation,\figurerotation\par } in lua you can either use the img library (see luatex manual) or context helpers local data = figures.push("foo.pdf") figures.identify() figures.check() figures.pop() inspect(data) i'll add: function figures.getinfo(name,page) if type(name) == "string" then name = { name = name, page = page } end if name.name then local data = figures.push(name) figures.identify() figures.check() figures.pop() return data end end so that one can do local n = "ms.pdf" local d = figures.getinfo(n) if d then for i=1,d.used.pages do local p = figures.getinfo(n,i) if p then local u = p.used print(u.width,u.height,u.orientation) end end end Hope this helps. Best regards, Lukas On Sun, 04 Feb 2018 19:04:28 +0100, Henning Hraban Ramm wrote: Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD ___ 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 ___ -- Ing. Lukáš Procházka | mailto:l...@pontex.cz Pontex s. r. o. | mailto:pon...@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn Bezová 1658 147 14 Praha 4 Mob.: +420 702 033 396 ___ 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 ___