Re: [NTG-context] wrong page for annotation and \pagenumber
On Mon, Jun 15, 2020 at 02:52:49PM +0200, Pablo Rodriguez wrote: > Dear list, > > I have the following number with wrong annotation placement and wrong > page number, which would be both on the second page: > > \setupinteraction[state=start] > \definelayer[pgnumber] > \setupbackgrounds[page][background=pgnumber] > \starttext > \placelist[section][alternative=d] > \dorecurse{16}{\section{Section}} > \pagenumber/\lastpagenumber > \setlayer[pgnumber] > {\comment{\pagenumber}} > \stoptext > > Could anyone confirm the issue? > > Many thanks for your help, > > Pablo Hi Pablo, I fear I don't understand what issue you mean, therefore I append my output here. I'm using: LuaMetaTeX, Version 2.04.02 ConTeXt ver: 2020.02.17 19:36 MKIV beta fmt: 2020.2.23 Best wishes, Rudolf annotation-u-pagenumber.pdf Description: Adobe PDF document ___ 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] Fwd: Janus M. Nowacki
Quoted from: lilypond-u...@gnu.org I just wanted to let you know that Janus Nowacki, one of the founders of the TeX Gyre font suite, has recently died: http://www.gust.org.pl/news/jmn-obit-en And his personal website (in Polish): https://jmn.pl/ The TeX Gyre font project was started in 2006 to provide high-quality, free-licensed replacements for existing URW fonts: http://www.gust.org.pl/projects/e-foundry/tex-gyre/nfp11.pdf ___ 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] using modeset
> Am 12.06.2020 um 11:26 schrieb Jan Willem Flamma : > > Thank you Wolfgang, BPJ and Robert for your answers and feedback. Much > appreciated. > > I will explorer the solutions that have been offered to extend my knowledge > on using ConTeXt but at the same time I value the advice of not going down > that route for large document. The project that pays my bills is technical documentation in several languages (in LaTeX3, setup by Marei). Each manual is constructed from many small building blocks of text. Each block is in its own file. That makes editing one whole manual somewhat tedious, but pays off if you recycle the same blocks. E.g. each block is only translated once, even if it appears in several manuals (think of security instructions or legal stuff that is the same in all). Each block has an explicite change date to keep track of the state of the different translations. The two main files of each product are one that contains just a few settings and one that pulls in all the needed building blocks. In this case all blocks with the same content in different languages are kept together in one directory (files have a language code). Another approach would be same structures and file names below a main language directory. If you have only one translation, the latter might be better. If you need to keep several translations in sync, the first approach might make more sense. 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] Filter module for R
On Mon, 15 Jun 2020, Fabrice L wrote: Dear Aditya, Le 15 juin 2020 à 01:45, Aditya Mahajan a écrit : This is an adapted version of the code that I use for my course where I use the vim module to do the typesetting: \usemodule[filter] \usemodule[vim] \definecolor [darkblue] [r=0.1, g=0.11, b=0.84] \definecolor [darkgreen] [g=0.7] \definecolor [lightblue] [h=87cefa] \definecolor [lightgreen] [g=0.95,b=0.8,r=0.8] \defineframedtext [leftbartext] [ width=local, frame=off, framecolor=darkblue, leftframe=on, rulethickness=1ex, offset=0.25ex, loffset=3ex, background=color, backgroundcolor=lightblue, ] \definevimtyping [RCODE] [ syntax=r, directory=output, strip=yes, escape=yes, before={\blank[quarterline]\startleftbartext}, after={\stopleftbartext}, ] \define[1]\ShowOutput {\typeRCODEfile{\externalfilterinputfile} \startleftbartext[framecolor=darkgreen, backgroundcolor=lightgreen] \setupalign[flushleft, verytolerant] % range={1,-1} not currently supported % See below for details \typefile[range={1,-1}]{#1} \stopleftbartext} \defineexternalfilter [R] [ filtercommand={R CMD BATCH -q --no-timing --save --restore \externalfilterinputfile\space \externalfilteroutputfile}, output=\externalfilterbasefile.out, directory=output, readcommand=\ShowOutput, read=no, cache=yes, purge=yes, % THE COMMA WAS MISSING ] \starttext Some text... \startR[read=yes] pdf("RPlots/MyHistogram.pdf",5,5) X <- rnorm(200,mean=10,sd=2) hist(X, col = "red3" , xlab="Score QI" , main="", ylab="fréquence") \stopR \externalfigure[RPlots/MyHistogram.pdf][width=.5\textwidth] \stoptext Thanks so much for your answer. I had (of course) to install nvim in order the code to work, but this works ! Sorry, that was a leftover. I was testing in a docker container where I did not have vim installed. This will also work with regular vim. Thanks also for your additional work regarding the locale setting.. this is really deep magic for me. I think the facility to run R code directly from context can open ConTeXt to new users. The alliance between R and LaTeX is a winning combination to a lot of my colleagues. Do you think this would be appropriate to do a simple page on the wiki explaining how R code can be done in ConTeXt, with eventual formatting, with some simple examples, or this is too much noise ? Definitely. I think there is already a short page. But it will be good to add more detailed instructions. Aditya___ 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] issue with remote \attachment
Hi Hans, one of my documents uses \attachment to embed PDF documents (well, it contains many). I have been doing this for more than a year, but right now it is way slower: over 250s vs. 7s compilation time (with and without the attachment). It takes me 6s to download the document directly with curl using the same address. I’m afraid this might be also related to the server where the file is downloaded from. The document seems to be downloaded in each run. I wonder whether this could be improved with these proposals: 1. Only download the document on the first run of each compilation. 2. Before that, check last modified information (from "curl -I") and avoid downloading if the already downloaded file is newer that the remote version. 3. It would be better if downloaded files could have the remote time ("curl -R"), instead download time. CreationDate and ModDate might differ from upload time. A sample for that would be https://etsc.eu/wp-content/uploads/2014_06_smart_factsheet_alco_gate_sweden.pdf. These are dates from the PDF document: CreationDate: Mon Jul 7 14:57:05 2014 CEST ModDate:Mon Jul 7 14:57:07 2014 CEST And this is what "curl -I" displays about uploading time: Last-Modified: Sat, 24 Mar 2018 13:51:29 GMT Would it be possible to implement these proposals to improve remote file embedding? 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] Bar within math (amended)
> Am 11.06.2020 um 13:41 schrieb Axel Kielhorn : > >> Am 09.06.2020 um 20:41 schrieb Wolfgang Schuster >> : >> >> Use a textbackground to highlight parts of your text. >> >> \definetextbackground >> [Highlight] >> [frame=off, >> background=color, >> backgroundcolor=yellow] >> >> \starttext >> >> \m{1 + 2 = \unit{3 kilo newton}} >> >> \m{1 + 2 = \Highlight{\unit{3 kilo newton}}} >> >> \stoptext >> >> Wolfgang >> > > Is there a way to highlight just the words and leave the space white? > Something like \overstrikes? Wolfgang or whoelse, when would you advise to use textbackgrounds and when bars? E.g. if I need a “marker” highlighting. 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] ConTeXt source browser website update
> Am 07.06.2020 um 16:25 schrieb Taco Hoekwater : > > > * On the plus side, because of the SciTE lexer, “contextversion’ and > “\contextversion” are separate entries in the search index. And you can > search for “\@@kldirection”. > This is quite great! I was often annoyed that I couldn’t really search for commands that are also regular words. Thank you so much! And thanks again to Garulfo for the whole effort of restructuring the wiki! 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] start/stop executed conditionally on mode ?
> Am 10.06.2020 um 09:33 schrieb Hans Hagen : > > the begin/end are used for marking blobs of content (kind of buffers) that > can be mixed in, reused, moved, while start/stop is for structure > > so, begin/end is independent > > it is an already old mechanism that was made for educational material where > one source had to result in teacher, student, examns, extra, materials > > but it's there to stay ... Wow, I think this is the first time I encounter blocks in my 20 years of using ConTeXt. Probably I just didn’t recognize they were special. Astonished: 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] Filter module for R
Dear Aditya, > Le 15 juin 2020 à 01:45, Aditya Mahajan a écrit : > > This is an adapted version of the code that I use for my course where I use > the vim module to do the typesetting: > > \usemodule[filter] > \usemodule[vim] > > \definecolor [darkblue] [r=0.1, g=0.11, b=0.84] > \definecolor [darkgreen] [g=0.7] > \definecolor [lightblue] [h=87cefa] > \definecolor [lightgreen] [g=0.95,b=0.8,r=0.8] > > \defineframedtext > [leftbartext] > [ >width=local, >frame=off, >framecolor=darkblue, >leftframe=on, >rulethickness=1ex, >offset=0.25ex, >loffset=3ex, >background=color, >backgroundcolor=lightblue, > ] > > \definevimtyping > [RCODE] > [ >syntax=r, >directory=output, >strip=yes, >escape=yes, >before={\blank[quarterline]\startleftbartext}, >after={\stopleftbartext}, > ] > > \define[1]\ShowOutput >{\typeRCODEfile{\externalfilterinputfile} > \startleftbartext[framecolor=darkgreen, backgroundcolor=lightgreen] > \setupalign[flushleft, verytolerant] > % range={1,-1} not currently supported > % See below for details > \typefile[range={1,-1}]{#1} > \stopleftbartext} > > > \defineexternalfilter > [R] > [ filtercommand={R CMD BATCH -q --no-timing --save --restore > \externalfilterinputfile\space \externalfilteroutputfile}, > output=\externalfilterbasefile.out, > directory=output, > readcommand=\ShowOutput, > read=no, > cache=yes, > purge=yes, % THE COMMA WAS MISSING > ] > > \starttext > > Some text... > > \startR[read=yes] > pdf("RPlots/MyHistogram.pdf",5,5) > X <- rnorm(200,mean=10,sd=2) > hist(X, col = "red3" , xlab="Score QI" , main="", ylab="fréquence") > \stopR > > \externalfigure[RPlots/MyHistogram.pdf][width=.5\textwidth] > > \stoptext > > Thanks so much for your answer. I had (of course) to install nvim in order the code to work, but this works ! Thanks also for your additional work regarding the locale setting.. this is really deep magic for me. I think the facility to run R code directly from context can open ConTeXt to new users. The alliance between R and LaTeX is a winning combination to a lot of my colleagues. Do you think this would be appropriate to do a simple page on the wiki explaining how R code can be done in ConTeXt, with eventual formatting, with some simple examples, or this is too much noise ? Thanks. Fabrice. ___ 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] wrong page for annotation and \pagenumber
On 6/15/20 4:09 PM, Wolfgang Schuster wrote: > Pablo Rodriguez schrieb am 15.06.2020 um 14:52: >> Dear list, >> >> I have the following number with wrong annotation placement and wrong >> page number, which would be both on the second page: >> [...] >> Could anyone confirm the issue? > > \pagenumber is only reliable headers/footer texts or page backgrounds, > for everything else you need a multi pass mechanism (save the page > number in the first run and provide it in the second). Many thanks for your reply, Wolfgang. I thought this was caused by the deployment of "\placelist[section][alternative=d]". But my new sample shows clearly that this isn’t the cause. My question is now is how to get the right page for the layer in this sample: \definelayer[whatever] [x=3em, y=3em] \setupbackgrounds[page][background=whatever] \starttext \dorecurse{18}{\section{Section}} just a line \setlayerframed[whatever][foregroundstyle=\bf\ss] {layer on the last page?} \stoptext 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] wrong page for annotation and \pagenumber
Pablo Rodriguez schrieb am 15.06.2020 um 14:52: Dear list, I have the following number with wrong annotation placement and wrong page number, which would be both on the second page: \setupinteraction[state=start] \definelayer[pgnumber] \setupbackgrounds[page][background=pgnumber] \starttext \placelist[section][alternative=d] \dorecurse{16}{\section{Section}} \pagenumber/\lastpagenumber \setlayer[pgnumber] {\comment{\pagenumber}} \stoptext Could anyone confirm the issue? \pagenumber is only reliable headers/footer texts or page backgrounds, for everything else you need a multi pass mechanism (save the page number in the first run and provide it in the second). \setuppapersize[A6] \definepagestate[pagenumber] \starttext \subject{\tex{pagenumber}} \dorecurse{50}{\twodigits{\recurselevel}: \pagenumber\par} \page \subject{\tex{pagestaterealpage}} \dorecurse{50} {\twodigits{\recurselevel}: \setpagestate[pagenumber]% \pagestaterealpage{pagenumber}{\recurselevel}\par} \stoptext 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] wrong page for annotation and \pagenumber
Dear list, I have the following number with wrong annotation placement and wrong page number, which would be both on the second page: \setupinteraction[state=start] \definelayer[pgnumber] \setupbackgrounds[page][background=pgnumber] \starttext \placelist[section][alternative=d] \dorecurse{16}{\section{Section}} \pagenumber/\lastpagenumber \setlayer[pgnumber] {\comment{\pagenumber}} \stoptext Could anyone confirm the issue? 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] Filter module for R
On Mon, 15 Jun 2020, Aditya Mahajan wrote: On Mon, 15 Jun 2020, Aditya Mahajan wrote: On Sun, 14 Jun 2020, Fabrice L wrote: Hi, Following a question about the broken R module (R the statistical software), Aditya suggested me the filter module (thanks to him). I’m about to distribute a set of course notes to colleagues, and I need to deal with details now. I have one problem and two questions. 1) the filter collect R code between \startR / \stopR and submit this code to R. As it can be seen in the following minimal example, when a label contains an accented character (« Fréquence » in my example), the pdf graphic does not contains the « é ». Strangely, the snippet of code (which is saved locally as « test2-temp-R-0.tmp » (for test2.tex)) when submitted with the same command as the filtercommand, works correctly; that means the same file works when submitted to R outside of ConTeXt. I have no idea how to solve this. Are you running the exact same command as the `filtercommand`. If so, I don't know why running the `filtercommand` through context vs directly typing it on the terminal should behave differently. The filter module effectively just runs os.execute("filtercommand"). I don't use R so I am unable to debug further. I can reproduce this output side the filter module. If I directly run os.execute(...) from a lua session, the output is correct but running it through context gives the wrong output. I am guessing this is something to do with locale. I notice that the output of os.execute("locale") from context is different from that from my shell. But I don't know why locale should affect UTF characters in R. It is indeed related to locale. Here is a minimal example that works. I use a beforebuffer to set the locale so that you don't have to do it in each snippet and then filter out the first line in the typeset code listing and filter out the first two lines in the output. \usemodule[filter] \usemodule[vim] \definecolor [darkblue] [r=0.1, g=0.11, b=0.84] \definecolor [darkgreen] [g=0.7] \definecolor [lightblue] [h=87cefa] \definecolor [lightgreen] [g=0.95,b=0.8,r=0.8] \defineframedtext [leftbartext] [ width=local, frame=off, framecolor=darkblue, leftframe=on, rulethickness=1ex, offset=0.25ex, loffset=3ex, background=color, backgroundcolor=lightblue, ] \definevimtyping [RCODE] [ vimcommand=nvim, syntax=r, directory=output, strip=yes, escape=yes, before={\blank[quarterline]\startleftbartext}, after={\stopleftbartext}, ] \define[1]\ShowOutput {\typeRCODEfile[start=2]{\externalfilterinputfile} \startleftbartext[framecolor=darkgreen, backgroundcolor=lightgreen] \setupalign[flushleft, verytolerant] \typefile[range={3,-1}]{#1} \stopleftbartext} \startbuffer[locale] Sys.setlocale(category="LC_ALL", locale="en_US.UTF-8") \stopbuffer \defineexternalfilter [R] [ filtercommand={R CMD BATCH -q --no-timing --save --restore \externalfilterinputfile\space \externalfilteroutputfile}, output=\externalfilterbasefile.out, directory=output, readcommand=\ShowOutput, read=no, bufferbefore=locale, cache=yes, purge=yes, ] \starttext Some text... \startR[read=yes] pdf("RPlots/MyHistogram.pdf",5,5) X <- rnorm(200,mean=10,sd=2) hist(X, col = "red3" , xlab="Score QI" , main="", ylab="fréquence") \stopR \externalfigure[RPlots/MyHistogram.pdf][width=.5\textwidth] \stoptext Aditya___ 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] Filter module for R
On Mon, 15 Jun 2020, Aditya Mahajan wrote: On Sun, 14 Jun 2020, Fabrice L wrote: Hi, Following a question about the broken R module (R the statistical software), Aditya suggested me the filter module (thanks to him). I’m about to distribute a set of course notes to colleagues, and I need to deal with details now. I have one problem and two questions. 1) the filter collect R code between \startR / \stopR and submit this code to R. As it can be seen in the following minimal example, when a label contains an accented character (« Fréquence » in my example), the pdf graphic does not contains the « é ». Strangely, the snippet of code (which is saved locally as « test2-temp-R-0.tmp » (for test2.tex)) when submitted with the same command as the filtercommand, works correctly; that means the same file works when submitted to R outside of ConTeXt. I have no idea how to solve this. Are you running the exact same command as the `filtercommand`. If so, I don't know why running the `filtercommand` through context vs directly typing it on the terminal should behave differently. The filter module effectively just runs os.execute("filtercommand"). I don't use R so I am unable to debug further. I can reproduce this output side the filter module. If I directly run os.execute(...) from a lua session, the output is correct but running it through context gives the wrong output. I am guessing this is something to do with locale. I notice that the output of os.execute("locale") from context is different from that from my shell. But I don't know why locale should affect UTF characters in R. Perhaps someone with more knowledge of R can comment on that. \starttext \startluacode lfs.mkdir("output/") \stopluacode \startbuffer[code] pdf("output/MyHistogram.pdf",5,5) X <- rnorm(200,mean=10,sd=2) hist(X, col = "red3" , xlab="Score QI" , main="", ylab="fréquence") \stopbuffer \savebuffer[prefix=no, list=code, file={output/code.r}] \startluacode print("", "RUNNING R CMD") os.execute("R CMD BATCH --no-timing --save --restore output/code.r output/out") \stopluacode \externalfigure[RPlots/MyHistogram.pdf][width=.5\textwidth] \stoptext Aditya___ 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 ___