Re: [NTG-context] help with facing page image
On Tuesday, March 8, 2022 8:21 AM śrīrāma wrote: > However, I was not able to get the preview PDF correctly, only the first page > is visible. Someone who knows how to fix this, please point me in the right > direction and I will edit it as needed. Fixed now using \setuppaper. Sreeram ___ 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] help with facing page image
On Tuesday, March 8, 2022 12:05 AM Wolfgang Schuster wrote: > The example below uses a different mechanism to add images at the start > of a chapter. In the example you have to pass the name of image as > userdata argument of \startchapter but in the commented \setuphead > setting you can see how this can be automated. Many thanks for the elegant solution Wolfgang! Personally, I find it much cleaner without need for push, pop. I have now added it to the wiki here: https://wiki.contextgarden.net/Command/setuphead#Special_facing_pages_for_chapters However, I was not able to get the preview PDF correctly, only the first page is visible. Someone who knows how to fix this, please point me in the right direction and I will edit it as needed. Thanks, Sreeram ___ 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] help with facing page image
Special thanks to Sreeram, Wolfgang, Bruce, Hraban for help with this issue, ranging from the simplest 'manual' approach (Bruce) to one that I must confess I could never have thought of using: definepageinjection (Wolfgang). Needless to say, all contributions work, with a bit of adjustment in each case for my particular situation. The one common factor in all four contributions is the use of setups, so a light has begun flashing for me: setups are such an important feature of ConTeXt for solving many problems! Thanks to all, Julian On 7/3/22 18:01, śrīrāma wrote: On Monday, March 7, 2022 11:50 AM jbf wrote: All ten images are different, though, in my case (Chapter1.jpg, Chapter2.jpg... Chapter10.jpg all in a pics directory, so I'd point \setupexternalfigures to that). I wonder if there is a way to list them so that they get called in order as chapters proceed. A kind of "if such and such then \setlayer 1,2,3" I think that should be easy. Suppose you have images {chap-cover-1.jpg, chap-cover-2.jpg, ... chap-cover-10.jpg} each of which appear at the ends of their respective chapters, then the following achieves what you want (once you point ConTeXt to the right directory for figures of course): % kate: hl ctx %%% SOF \setuppagenumbering[alternative=doublesided] \definelayer [chapCover] [x=0mm, y=0mm, width=\paperwidth, height=\paperheight,repeat=yes] \startsetups chapter:before \doifoddpageelse{} {\pushbackground[page] \resetlayer[chapCover] \setlayer [chapCover] {\determineheadnumber[chapter] \externalfigure [chap-cover-\currentheadnumber] [width=\paperwidth]} \setupbackgrounds[page][background=chapCover] \page[empty] \popbackground} \stopsetups \startsetups chapter:after \doifoddpageelse{} {\page[empty]} \stopsetups \setuphead [chapter] [page=yes, before=\directsetup{chapter:before}, aftersection=\directsetup{chapter:after}] \starttext \dorecurse{10}{ \startchapter[title={Chapter \convertnumber{word}{\recurselevel}}] \input knuth \ifnum\headnumber[chapter]=5 {\bfd five} \fi \blank \input tufte \blank \input ward \blank \ifnum\recurselevel=5 \page \input zapf \input zapf \fi \stopchapter } \stoptext %%% EOF So we figure out which chapter we are in and then set the layer to the corresponding picture. Personally, I much prefer to collect all the images into a separate PDF with: %%% chap-covers.tex \starttext \dorecurse{10}{\startTEXpage \externalfigure[chap-cover-\recurselevel] \stopTEXpage} \stoptext %%% EOF [and get 'chap-covers.pdf' from context] ... and then modify the 'before' setup to read as below %%% \startsetups chapter:before \doifoddpageelse{} {\pushbackground[page] \resetlayer[chapCover] \setlayer [chapCover] {\determineheadnumber[chapter] \externalfigure [chap-covers] [page=\currentheadnumber,width=\paperwidth]} \setupbackgrounds[page][background=chapCover] \page[empty] \popbackground} \stopsetups %%% Sreeram ___ 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] help with facing page image
Am 07.03.22 um 21:08 schrieb Bruce Horrocks via ntg-context: On 7 Mar 2022, at 03:49, jbf via ntg-context wrote: I wonder if someone can help me untangle the current little mess I seem to be creating! Author wants an image on facing page to each of 10 chapters in the bodypart of the document. Assume that everything else is working properly for this document (double-sided etc.), but other than before chapter 1, I can't seem to get my facing page image to appear where it should! I didn’t see your original message. Here’s my approach, as used in https://www.dreiviertelhaus.de/reihen/eka/lauf-los-buch/ : \startsetups eka:normalheader \setupheadertexts[chapter][{\feature[=normnum]\pagenumber}][{\feature[=normnum]\pagenumber}][] \stopsetups \startsetups eka:noheader \setupheadertexts[][][][] \stopsetups \startsetups eka:imagechapter \setupalign[flushleft] \doifelse{\structureuservariable{image}}{}{% if image empty, do nothing }{% \directsetup{eka:noheader} \vbox{% \blank[big] \externalfigure[\structureuservariable{image}][width=0.8\textwidth]\par } \doifnot{\structureuservariable{motto}}{}{ \vfill \vbox{% {\MottoFont\structureuservariable{motto}} }% }% \page[right] \vbox{% \doifnot{\structureuservariable{subtitle}}{}{ {\SubtitleFont\structureuservariable{subtitle}} }% }% }% \blank[3*big] \directsetup{eka:normalheader} \setupalign[width] \stopsetups \define[2]\Nothing{} % do nothing \setuphead[chapter][ number=no, page=left, command=\Nothing, before=, after={\directsetup{eka:imagechapter}}, ] % example: \startchapter [title={Chapter Title – here only used in list}] [author={},image=cow, subtitle={Subtitle – here a quote by the author}, motto={Motto – here a short biography of the author}] ... \stopchapter 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] help with facing page image
> On 7 Mar 2022, at 03:49, jbf via ntg-context wrote: > > I wonder if someone can help me untangle the current little mess I seem to be > creating! > > Author wants an image on facing page to each of 10 chapters in the bodypart > of the document. Assume that everything else is working properly for this > document (double-sided etc.), but other than before chapter 1, I can't seem > to get my facing page image to appear where it should! > A simpler solution as you only have 10 chapters might be to 'manually' add the facing page rather than fiddle with the definition of \startchapter. For example: \definestartstop [ChapterPreface] [ before={\setups{ChapterPrefaceSetup}}, after={\page} ] % which gives you the commands \startChapterPreface ... \stopChapterPreface which I put immediately before \startchapter in the text. % Then use a setup to prepare the page for your image (you may only need \page[left] but also remember you need to stop page headers/footers etc from the previous chapter) \startsetups ChapterPrefaceSetup \page[left] \setupheader[state=empty] % etc \stopsetups % If the page setup is complicated then you might need another setup to clean it up afterwards. In this example there is just the "after=" in the definition. % Now you can print your images by using: \starttext \startChapterPreface \externalfigure[cow.pdf] \stopChapterPreface \startchapter[title={firstchapter}} ... \stopchapter \startChapterPreface \externalfigure[another_cow.pdf] \stopChapterPreface \startchapter{title={second chapter}] ... \stopchapter \stoptext Hope this helps. — Bruce Horrocks Hampshire, UK ___ 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] APS bib: literals and small error in "pages" field
Hi, Two things here: 1. There is an extra . on the end of lines 732 and 734 of publ-imp-aps.mkvi which causes references to be rendered like "p.. 417" and "pp.. 417--418". 2. Suppose I have a literal such as @literal{company, text = {Company Name (n.d.) {\it Webpage name}. Retrieved 22 February, 2022, from https://www.example.com} } how can I cite this without the (company) appearing in the bibliography list? For reference I'm using \usebtxdefinitions[aps] Jack ___ 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] help with facing page image
jbf via ntg-context schrieb am 07.03.2022 um 09:27: Appreciate your assistance. I'll do my best with what you offer here. Of course, I've always said these images are at the beginning, not "the end of their respective chapters" and I've already indicated how the images are named, simply as Chapter1.jpg and so on, so I'll need to work around these differences in your example. But with trial and error, let's hope I get there! The example below uses a different mechanism to add images at the start of a chapter. In the example you have to pass the name of image as userdata argument of \startchapter but in the commented \setuphead setting you can see how this can be automated. begin example % \definepageinjectionalternative % [chapter:image] % [renderingsetup=pageinjection:chapter:image] % % \startsetups [pageinjection:chapter:image] % \clip % [width=\framedwidth,height=\framedheight] % {\centerbox{\externalfigure[\dummyparameter{name}][factor=min]}} % \stopsetups \definepageinjection [chapter:start] [empty] [page=left] \definepageinjection [chapter:insert] [previouspage] [%alternative=chapter:image, pagestate=stop] \setuphead [chapter] [beforesection={\pageinjection[chapter:start]}, insidesection={\pageinjection[chapter:insert][name=\structureuservariable{image}]}] % \setuphead % [chapter] % [beforesection={\pageinjection[chapter:start]}, % insidesection={\pageinjection[chapter:insert][name={chapter\namedheadnumber{chapter}}]}] \setuppagenumbering [alternative=doublesided] \setupexternalfigures [location=default] \starttext \startchapter [title={Mill}] [image=mill] \dorecurse{7}{\samplefile{lorem}} \stopchapter \startchapter [title={Mill}] [image=mill] \dorecurse{11}{\samplefile{lorem}} \stopchapter \startchapter [title={Mill}] [image=mill] \dorecurse{7}{\samplefile{lorem}} \stopchapter \stoptext end example Wolfgang ___ 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] What’s wrong with installation?
Hi, I just tried to install a new instance of LMTX without success. """ $ unzip -l *.zip Archive: context-osx-64.zip Length DateTimeName - -- - 0 03-05-2019 22:50 bin/ 19082 01-21-2022 20:13 bin/mtx-install.lua 693184 01-21-2022 20:13 bin/mtxrun.lua 3910 01-21-2022 20:13 install.sh 2725900 01-21-2022 20:13 bin/mtxrun 24047 01-21-2022 20:13 installation.pdf - --- 3466123 6 files $ sh install.sh mtx-install | provide valid server and instance cp: /Users/hraban/lmtx_2022-03-07/tex/texmf-osx-64/bin/mtxrun: No such file or directory cp: /Users/hraban/lmtx_2022-03-07/tex/texmf-context/scripts/context/lua/mtxrun.lua: No such file or directory cp: /Users/hraban/lmtx_2022-03-07/tex/texmf-context/scripts/context/lua/mtx-install.lua: No such file or directory If you want to run ConTeXt everywhere, you need to adapt the path, like: export PATH=/Users/hraban/lmtx_2022-03-07/tex/texmf-osx-64/bin:$PATH If you run from an editor you can specify the full path to mtxrun: /Users/hraban/lmtx_2022-03-07/tex/texmf-osx-64/bin/mtxrun --autogenerate --script context --autopdf ... The following settings were used: server : lmtx.contextgarden.net,lmtx.pragma-ade.com,lmtx.pragma-ade.nl instance : install-lmtx extras : ownpath : /Users/hraban/lmtx_2022-03-07 platform : osx-64 $ ./bin/mtxrun --script ./bin/mtx-install.lua --update --server=lmtx.contextgarden.net --instance=install-lmtx --platform=osx-64 --extras=all mtx-install | provide valid server and instance """ Same result if I omit --server and --instance, since they default to the same. In mtx-install.lua, line 489 "local server = false" overwrites the previously set server variable. If I comment this line, I get: """ $ ./bin/mtxrun --script ./bin/mtx-install.lua --update --platform=osx-64 --extras=all mtx-install | server : lmtx.contextgarden.net,lmtx.pragma-ade.com,lmtx.pragma-ade.nl,dmz.pragma-ade.nl mtx-install | instance : install-lmtx mtx-install | platform : osx-64 mtx-install | system : unix mtx-install | invalid database 'http://lmtx.contextgarden.net,lmtx.pragma-ade.com,lmtx.pragma-ade.nl,dmz.pragma-ade.nl/install-lmtx//tex/texmf.tma' mtx-install | invalid database 'http://lmtx.contextgarden.net,lmtx.pragma-ade.com,lmtx.pragma-ade.nl,dmz.pragma-ade.nl/install-lmtx//tex/texmf-context.tma' mtx-install | invalid database 'http://lmtx.contextgarden.net,lmtx.pragma-ade.com,lmtx.pragma-ade.nl,dmz.pragma-ade.nl/install-lmtx//tex/texmf-osx-64.tma' mtx-install | current : %S mtx-install | target : %S mtx-install | removing : mtxrun mtx-install | removing : context mtx-install | copied : mtxrun mtx-install | copied : context mtx-install | running: /Users/hraban/lmtx_2022-03-07/tex/texmf-osx-64/bin/mtxrun --generate sh: /Users/hraban/lmtx_2022-03-07/tex/texmf-osx-64/bin/mtxrun: No such file or directory mtx-install | running: /Users/hraban/lmtx_2022-03-07/tex/texmf-osx-64/bin/context --make en sh: /Users/hraban/lmtx_2022-03-07/tex/texmf-osx-64/bin/context: No such file or directory mtx-install | mtx-install | mtx-install | ConTeXt LMTX with LuaMetaTeX is still experimental and when you get a crash this mtx-install | can be due to a mismatch between Lua bytecode and the engine. In that case you can mtx-install | try the following: mtx-install | mtx-install | - wipe the texmf-cache directory mtx-install | - run: mtxrun --generate mtx-install | - run: context --make mtx-install | mtx-install | When that doesn't solve the problem, ask on the mailing list (ntg-context@ntg.nl). mtx-install | mtx-install | update, done """ The "invalid database" lines don’t look good. If I give an explicit --server=lmtx.contextgarden.net, I still get the same error: """ mtx-install | invalid database 'http://lmtx.contextgarden.net/install-lmtx//tex/texmf.tma' mtx-install | invalid database 'http://lmtx.contextgarden.net/install-lmtx//tex/texmf-context.tma' mtx-install | invalid database 'http://lmtx.contextgarden.net/install-lmtx//tex/texmf-osx-64.tma' """ What’s wrong? 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] help with facing page image
Appreciate your assistance. I'll do my best with what you offer here. Of course, I've always said these images are at the beginning, not "the end of their respective chapters" and I've already indicated how the images are named, simply as Chapter1.jpg and so on, so I'll need to work around these differences in your example. But with trial and error, let's hope I get there! Thank you, Julian On 7/3/22 18:01, śrīrāma wrote: On Monday, March 7, 2022 11:50 AM jbf wrote: All ten images are different, though, in my case (Chapter1.jpg, Chapter2.jpg... Chapter10.jpg all in a pics directory, so I'd point \setupexternalfigures to that). I wonder if there is a way to list them so that they get called in order as chapters proceed. A kind of "if such and such then \setlayer 1,2,3" I think that should be easy. Suppose you have images {chap-cover-1.jpg, chap-cover-2.jpg, ... chap-cover-10.jpg} each of which appear at the ends of their respective chapters, then the following achieves what you want (once you point ConTeXt to the right directory for figures of course): % kate: hl ctx %%% SOF \setuppagenumbering[alternative=doublesided] \definelayer [chapCover] [x=0mm, y=0mm, width=\paperwidth, height=\paperheight,repeat=yes] \startsetups chapter:before \doifoddpageelse{} {\pushbackground[page] \resetlayer[chapCover] \setlayer [chapCover] {\determineheadnumber[chapter] \externalfigure [chap-cover-\currentheadnumber] [width=\paperwidth]} \setupbackgrounds[page][background=chapCover] \page[empty] \popbackground} \stopsetups \startsetups chapter:after \doifoddpageelse{} {\page[empty]} \stopsetups \setuphead [chapter] [page=yes, before=\directsetup{chapter:before}, aftersection=\directsetup{chapter:after}] \starttext \dorecurse{10}{ \startchapter[title={Chapter \convertnumber{word}{\recurselevel}}] \input knuth \ifnum\headnumber[chapter]=5 {\bfd five} \fi \blank \input tufte \blank \input ward \blank \ifnum\recurselevel=5 \page \input zapf \input zapf \fi \stopchapter } \stoptext %%% EOF So we figure out which chapter we are in and then set the layer to the corresponding picture. Personally, I much prefer to collect all the images into a separate PDF with: %%% chap-covers.tex \starttext \dorecurse{10}{\startTEXpage \externalfigure[chap-cover-\recurselevel] \stopTEXpage} \stoptext %%% EOF [and get 'chap-covers.pdf' from context] ... and then modify the 'before' setup to read as below %%% \startsetups chapter:before \doifoddpageelse{} {\pushbackground[page] \resetlayer[chapCover] \setlayer [chapCover] {\determineheadnumber[chapter] \externalfigure [chap-covers] [page=\currentheadnumber,width=\paperwidth]} \setupbackgrounds[page][background=chapCover] \page[empty] \popbackground} \stopsetups %%% Sreeram ___ 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 ___