Re: [NTG-context] duplicate booklet arrangement
On 02/24/2015 03:29 PM, Willi Egger wrote: > Hi Pablo, > > ..late answer ;-) > > your explanation is fine. I also looked at your example in the link… > > We had this discussion in earlier threads. For me as a bookbinder, your > issue is not really something for impositioning in a restricted sense. > The thing is, that the machinery for imposition is looping over the > number of pages and puts them in the defined place. So if one wants to > achieve what you describe, the machinery would have to set up in a > different way. I run into this issue myself and I would suggest, that > you are going to use for this special purpose some code like this: > > \def\Myfilename{quotes-1} > \def\Mypages{22} Many thanks for your reply, Willy. Your code works fine, but I would like two improvements to make the process fully automatic. So I could use it with different documents in an easier way. Is there a way that ConTeXt gets the total number of pages from the PDF file itself? I can redefine \Myfilename with an \env argument, but I don’t know how to get thet total number of pages. > p.s. I am curious about how your booklet looks like after assembly. > You put 142 pages in it with arranging 2UP. Folding this amount of paper > makes a rather thick booklet and I expect, that the outer margins are > very small after cutting it square…? This is a booklet that I made available on the net. I don’t try to compete with the bookbinding industry ;-). The booklet is rather thick, but the trick is not to cut the outer margin. It is a booklet and not a book, after all. But I would say that the result is not bad. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] handling code in XML
On 02/24/2015 03:41 PM, Hans Hagen wrote: > In a next upload you can do: > [...] > \startxmlsetups xml:pre > \xmlprettyprint{#1}{tex} > \stopxmlsetups Hans, many thanks for your replies and the new feature. 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] handling code in XML
In a next upload you can do: \startbuffer[demo] \def\whatever#1{[whatever #1]} \ctxlua{print("okay")} \stopbuffer \usemodule[scite] % optional \startxmlsetups xml:initialize \xmlsetsetup{#1}{doc|pre}{xml:*} \stopxmlsetups \xmlregistersetup{xml:initialize} \startxmlsetups xml:doc \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:pre \xmlprettyprint{#1}{tex} \stopxmlsetups \starttext \xmlprocessbuffer{main}{demo}{} \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] duplicate booklet arrangement
Hi Pablo, ..late answer ;-) your explanation is fine. I also looked at your example in the link… We had this discussion in earlier threads. For me as a bookbinder, your issue is not really something for impositioning in a restricted sense. The thing is, that the machinery for imposition is looping over the number of pages and puts them in the defined place. So if one wants to achieve what you describe, the machinery would have to set up in a different way. I run into this issue myself and I would suggest, that you are ging to use for this special purpose some code like this: \def\Myfilename{quotes-1} \def\Mypages{22} \setuplayout [topspace=0mm, backspace=0mm, margin=0pt, header=0pt, footer=0pt, height=middle, width=middle,] \definelayer[Draw][width=\paperwidth,height=\paperheight] \setuplayer[Draw][preset=lefttop] \setupmakeup[standard][top=,bottom=,page=yes,doublesided=no] \starttext \dorecurse {\Mypages} {\setlayerframed [Draw] [x=0mm,y=0mm] [offset=overlay,frame=off,rightframe=on] {\externalfigure[\Myfilename][page=\recurselevel]} \setlayerframed [Draw] [x=0mm,y=\dimexpr\paperheight/2] [offset=overlay,frame=off] {\externalfigure[\Myfilename][page=\recurselevel]} \startstandardmakeup \placelayer[Draw] \stopstandardmakeup} \stop What this code does is to pick up the pages from the pdf which is made with e.g. 2UP arranging on A5_landscape. It puts then each page two times on a sheet of paper. Willi p.s. I am curious about how your booklet looks like after assembly. You put 142 pages in it with arranging 2UP. Folding this amount of paper makes a rather thick booklet and I expect, that the outer margins are very small after cutting it square…? > On 22 feb. 2015, at 09:26, Pablo Rodriguez wrote: > > Hans, > > I need to generate a duplicate booklet from a PDF file. > > It would be like \setuparrange[2UP, singlesided]. But I need an extra > imposition (this is what I have to do now), repeating the same booklet > imposition one above each other. > > This would require a \setuppaper such as [A6][A4]. > > The first four pages would be: > > last|first last-1|first+1 last-2|first+2 last+3|first+3 > last|first last-1|first+1 last-2|first+2 last+3|first+3 > > Just in case I haven’t explained myself, here you have a sample: > https://archive.org/download/ensayo-escritura/ensayo-escritura.pdf. > > ConTeXt was used to typeset the book and arrange the booklet. But I > needed to use another tool for the final imposition. > > I think it might be useful for other users also. > > Could this 2UPrepeated arrangement be included in ConTeXt? > > 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://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] handling code in XML
\startbuffer[demo] \def\whatever#1{[whatever #1]} \ctxlua{print("okay")} \stopbuffer \usemodule[scite] \startxmlsetups xml:initialize \xmlsetsetup{#1}{doc|pre}{xml:*} \stopxmlsetups \xmlregistersetup{xml:initialize} \starttexdefinition xmlsaveinbuffer #1 \ctxlua{buffers.assign("foo",xml.content(lxml.id('#1')))} \stoptexdefinition \starttexdefinition xmlprettyprint #1#2 \xmlsaveinbuffer{#1} \typebuffer[foo][option=#2] \stoptexdefinition \starttexdefinition xmlprettyprint #1#2 \start \tt \xmlsaveinbuffer{#1} \setcatcodetable\ctxcatcodes \scitebuffer[#2][foo] \stop \stoptexdefinition \startxmlsetups xml:doc \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:pre \xmlprettyprint{#1}{tex} \stopxmlsetups \starttext \xmlprocessbuffer{main}{demo}{} \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] handling code in XML
On 2/23/2015 8:29 PM, Pablo Rodriguez wrote: On 02/23/2015 07:34 PM, Hans Hagen wrote: On 2/23/2015 7:25 PM, Pablo Rodriguez wrote: Is there no way to get xml:texcode with a TEX typing? \xmlcontext{#1}{} Sorry, Hans, I’m afraid that I don’t get it. I have been searching the wiki and mailing list, the code (using grep) after I got your reply. The solution may be there, but I haven’t been able to find it. \xmlcontext{#1}{.} compiles in ConTeXt the contents of (in this case): \ConTeXt\ rocks! It would be the same as compiling in pure ConTeXt: \starttext \ConTeXt\ rocks! \stoptext And what I need (and haven’t been able to explain) is in pure ConTeXt: \startTEX \ConTeXt\ rocks! \stopTEX If this can be achieved with \xmlcontext{#1}{#2}, I cannot find which values #2 take (I have no idea of what is expected there). Many thanks for your help, \usemodule[scite] \starttexdefinition xmlsaveinbuffer #1 \ctxlua{buffers.assign("foo",xml.content(lxml.id('#1')))} \stoptexdefinition \starttexdefinition xmlprettyprint #1#2 \xmlsaveinbuffer{#1} \typebuffer[foo][option=#2] \stoptexdefinition \starttexdefinition xmlprettyprint #1#2 \start \tt \xmlsaveinbuffer{#1} \setcatcodetable\ctxcatcodes \scitebuffer[foo][#2] \stop \stoptexdefinition \startxmlsetups xml:code \xmlprettyprint{#1}{tex} \stopxmlsetups \startxmlsetups xml:pre \xmlprettyprint{#1}{tex} \stopxmlsetups - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Different versions of Lua and error in the same versions of ConTeXt (Fedora vs Win7)
On 2/24/2015 2:13 PM, Jaroslav Hajtmar wrote: This library is loaded automatically? Or as a module? always present local mycsvsplitter = utilities.parsers.rfc4180splitter() local mycsvsplitter = utilities.parsers.rfc4180splitter { separator = ";" quote = '"', } Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] Different versions of Lua and error in the same versions of ConTeXt (Fedora vs Win7)
Hi Hans. One more I ask You about this thing. When I have other separator - for example ";" then c.txt data file is: first,second,third,fourth "1";"2";"3";"4" "a";"b";"c";"d" "foo";"bar""baz";"boogie";"xyzzy" I was unable to figure out how to set the separator (and others default values too) so as to replace the default value in the library util-prs.lua Is there anything as utilities.parsers.rfc4180splitter.separator=";"??? This library is loaded automatically? Or as a module? Thanks Jaroslav Hajtmar Here is minimal example for Your correction: \starttext \startluacode local mycsvsplitter = utilities.parsers.rfc4180splitter() utilities.parsers.rfc4180splitter.separator=";" local crap = io.loaddata("c.txt") local list, names = mycsvsplitter(crap,true) inspect(list) inspect(names) local list, names = mycsvsplitter(crap)inspect(list) inspect(names) context.starttabulate { "|l|r|" } for i=1,#list do local l = list[i] context.NC() context(l[1]) context.NC() context(l[3]) context.NC() context.NR() end context.stoptabulate() \stopluacode \stoptext Dne 23.2.2015 v 9:49 Hans Hagen napsal(a): On 2/22/2015 9:42 PM, Pablo Rodriguez wrote: On 02/22/2015 07:44 PM, Hans Hagen wrote: [...] for pablo: there are csv scanners built in context Hans, I don’t really need this at home, but I’m interested in this. in addition to the previous mail, t.txt is: first,second,third,fourth "1","2","3","4" "a","b","c","d" "foo","bar""baz","boogie","xyzzy" the code is in util-prs.lua (where all kind of parsing code lives) if you want to use that kind of code outside context you can do something like this: lua mtxlibs.lua --selfmerge foo.lua and then in your script load foo.lua this makes it possible to use the same set of helpers in context as well outside it (alternatively you can just use luatex as lua engine and mtxrun as script runner which is what we mostly do); this means that the context distribution provides all kind of means to set up workflows I guess you mean m-database.mkiv. But I don’t have a clue on how to handle it. I mean, how to ignore the first line and how to make commands from the so-called cells (A2, B5...; to use them in document combination) reading an external file. Many thanks for your help, Pablo ___ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___