ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Filter module for R
@ 2020-06-15  3:26 Fabrice L
  2020-06-15  5:45 ` Aditya Mahajan
  0 siblings, 1 reply; 10+ messages in thread
From: Fabrice L @ 2020-06-15  3:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2112 bytes --]

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. 

2) In a teaching context, we may want sometimes to show the code. The filter module actually permits to show the output of the code submitted to R (which can include or not the input commands); would it be possible to typeset the submitted code ?

3) Finally, using "R CMD BATCH… » as the filtercommand add an extra line at the end of the output file which can be typeset to visualize results. Would it be possible by a magic trick to deleter the last line of the file ?

Here is a minimal code:
% —————————————————
\usemodule[filter]

\defineexternalfilter
  [R]
  [ filtercommand={R CMD BATCH -q --no-timing --save --restore \externalfilterinputfile\space \externalfilteroutputfile},
     output=\externalfilterbasefile.out,
     directory=output,
     readcommand=\typefile,
     read=no,
     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[MyHistogram.pdf][width=.5\textwidth] 

\stoptext
% —————————————————

Sorry for the three questions… and thanks for any help.
Fabrice.



[-- Attachment #1.2.1: Type: text/html, Size: 3734 bytes --]

[-- Attachment #1.2.2: MyHistogram.pdf --]
[-- Type: application/pdf, Size: 4518 bytes --]

[-- Attachment #1.2.3: Type: text/html, Size: 345 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Filter module for R
  2020-06-15  3:26 Filter module for R Fabrice L
@ 2020-06-15  5:45 ` Aditya Mahajan
  2020-06-15  6:04   ` Aditya Mahajan
  2020-06-15 17:33   ` Filter module for R Fabrice L
  0 siblings, 2 replies; 10+ messages in thread
From: Aditya Mahajan @ 2020-06-15  5:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 3892 bytes --]

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.

> 2) In a teaching context, we may want sometimes to show the code. The filter module actually permits to show the output of the code submitted to R (which can include or not the input commands); would it be possible to typeset the submitted code ?

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


> 3) Finally, using "R CMD BATCH… » as the filtercommand add an extra line at the end of the output file which can be typeset to visualize results. Would it be possible by a magic trick to deleter the last line of the file ?

It is possible to filter lines using `\typefile[range={start, stop}]{filename}`. You can use `range={1,3}` to only include lines 1 upto 3 or `range={1, +2}` to include line 1 followed by 2 lines. What you want is something like `range={1,-1}`, i.e., include from the first to last-1 line, but this is not currently supported. You could ask Hans to do so, as it is relatively simple to add. Of course, you will then need to document this on the wiki.

Aditya

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Filter module for R
  2020-06-15  5:45 ` Aditya Mahajan
@ 2020-06-15  6:04   ` Aditya Mahajan
  2020-06-15  6:24     ` Aditya Mahajan
       [not found]     ` <82287b24-d781-808f-f96b-675f56224bb6@azules.eu>
  2020-06-15 17:33   ` Filter module for R Fabrice L
  1 sibling, 2 replies; 10+ messages in thread
From: Aditya Mahajan @ 2020-06-15  6:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 2319 bytes --]

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

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Filter module for R
  2020-06-15  6:04   ` Aditya Mahajan
@ 2020-06-15  6:24     ` Aditya Mahajan
       [not found]     ` <82287b24-d781-808f-f96b-675f56224bb6@azules.eu>
  1 sibling, 0 replies; 10+ messages in thread
From: Aditya Mahajan @ 2020-06-15  6:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 3786 bytes --]

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

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Filter module for R
  2020-06-15  5:45 ` Aditya Mahajan
  2020-06-15  6:04   ` Aditya Mahajan
@ 2020-06-15 17:33   ` Fabrice L
  2020-06-15 18:06     ` Aditya Mahajan
  1 sibling, 1 reply; 10+ messages in thread
From: Fabrice L @ 2020-06-15 17:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear Aditya,

> Le 15 juin 2020 à 01:45, Aditya Mahajan <adityam@umich.edu> 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Filter module for R
  2020-06-15 17:33   ` Filter module for R Fabrice L
@ 2020-06-15 18:06     ` Aditya Mahajan
  0 siblings, 0 replies; 10+ messages in thread
From: Aditya Mahajan @ 2020-06-15 18:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 2900 bytes --]

On Mon, 15 Jun 2020, Fabrice L wrote:

> Dear Aditya,
>
>> Le 15 juin 2020 à 01:45, Aditya Mahajan <adityam@umich.edu> 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

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* French interface - previous message = wrong title
       [not found]     ` <82287b24-d781-808f-f96b-675f56224bb6@azules.eu>
@ 2020-06-24 21:01       ` Garulfo
  2020-06-24 21:35         ` Hans Hagen
  0 siblings, 1 reply; 10+ messages in thread
From: Garulfo @ 2020-06-24 21:01 UTC (permalink / raw)
  To: ntg-context

Hi,

I try to update and to fill the french content of mult-def.lua.

Currently, I have an updated "mult-def.lua" file. 3 questions :

1/ which commands should be executed in order to make the new local
    interface effective with context

2/ which commands should be executed in order to build a local version
    of setup-fr.pdf

3/ many commands in setup-fr.pdf are not documented in mult-def.lua
    where does the additionnal translations should come from ?

Thanks a lot for your precious help.
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: French interface - previous message = wrong title
  2020-06-24 21:01       ` French interface - previous message = wrong title Garulfo
@ 2020-06-24 21:35         ` Hans Hagen
  2020-06-25 19:34           ` French interface Garulfo
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2020-06-24 21:35 UTC (permalink / raw)
  To: Garulfo, ntg-context@ntg.nl >> mailing list for ConTeXt users

On 6/24/2020 11:01 PM, Garulfo wrote:
> Hi,
> 
> I try to update and to fill the french content of mult-def.lua.
> 
> Currently, I have an updated "mult-def.lua" file. 3 questions :
> 
> 1/ which commands should be executed in order to make the new local
>     interface effective with context

context --make fr

btw, top lines of files can have % interface=fr

> 2/ which commands should be executed in order to build a local version
>     of setup-fr.pdf

context --interface=fr --global --result=mysetup x-setups-overview.mkiv

> 3/ many commands in setup-fr.pdf are not documented in mult-def.lua
>     where does the additionnal translations should come from ?
users who know the language

Hans

-----------------------------------------------------------------
                                           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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* French interface
  2020-06-24 21:35         ` Hans Hagen
@ 2020-06-25 19:34           ` Garulfo
  2020-06-25 20:00             ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: Garulfo @ 2020-06-25 19:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

If I understand, the translation file mult-def.lua provides 5 families
for translations:
1- commands
2- constants
3- variables
4- elements (prefix or suffix of commands) like
    - \completeREGISTER and \completeindex
       ^^^^^^^^              ^^^^^^^^
    - \startmakeup and \stopmakeup
           ^^^^^^          ^^^^^^
5- setupstrings, to describe the syntaxe and the type of the arguments


1/ I don't understand how to impact, for example, FLOAT and chemical in:

      \placeFLOAT           becomes \placerFLOAT
      \startplaceFLOAT      becomes \debutplacerFLOAT
      \placerchemical       becomes \placerchemical
      \startplacerchemical  becomes \debutplacerchemical

2/ I don't understand the following

RUN OK:

% interface=fr
\debuttexte
\debutsection[titre=test] This is a test \finsection
\codelua{context("Foo Bar 1")}
\fintexte

DOESNT RUN
% interface=fr
\debuttexte
\debutsection[titre=test] This is a test \finsection
\debutcodelua  context("Foo Bar 2") \fincodelua
\fintexte

with:
tex error       > error not related to input file:
tex error       >   tex: ?
tex error       >   lua: ?
tex error       >   mps: -
mtx-context     | fatal error: return code: 256


I suppose that some complementary modifications may be required with
\start \stop and lua


Once again, thanks a lot for your support.


Le 24/06/2020 à 23:35, Hans Hagen a écrit :
> On 6/24/2020 11:01 PM, Garulfo wrote:
>> Hi,
>>
>> I try to update and to fill the french content of mult-def.lua.
>>
>> Currently, I have an updated "mult-def.lua" file. 3 questions :
>>
>> 1/ which commands should be executed in order to make the new local
>>     interface effective with context
> 
> context --make fr
> 
> btw, top lines of files can have % interface=fr
> 
>> 2/ which commands should be executed in order to build a local version
>>     of setup-fr.pdf
> 
> context --interface=fr --global --result=mysetup x-setups-overview.mkiv
> 
>> 3/ many commands in setup-fr.pdf are not documented in mult-def.lua
>>     where does the additionnal translations should come from ?
> users who know the language
> 
> Hans
> 
> -----------------------------------------------------------------
>                                            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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: French interface
  2020-06-25 19:34           ` French interface Garulfo
@ 2020-06-25 20:00             ` Wolfgang Schuster
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Schuster @ 2020-06-25 20:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Garulfo schrieb am 25.06.2020 um 21:34:
> Hi,
>
> If I understand, the translation file mult-def.lua provides 5 families
> for translations:
> 1- commands
> 2- constants
> 3- variables
> 4- elements (prefix or suffix of commands) like
>    - \completeREGISTER and \completeindex
>       ^^^^^^^^              ^^^^^^^^
>    - \startmakeup and \stopmakeup
>           ^^^^^^          ^^^^^^
> 5- setupstrings, to describe the syntaxe and the type of the arguments
>
>
> 1/ I don't understand how to impact, for example, FLOAT and chemical in:
>
>      \placeFLOAT           becomes \placerFLOAT
>      \startplaceFLOAT      becomes \debutplacerFLOAT
>      \placerchemical       becomes \placerchemical
>      \startplacerchemical  becomes \debutplacerchemical

\placefigure is a combination of the element "place" (\e!place) and the 
variable "figure" (\v!figure)

\startplacefigure is a combination of the elements "start" (\e!start) 
and "place" (\e!place) and the variable "figure" (\v!figure.)

> 2/ I don't understand the following
>
> RUN OK:
>
> % interface=fr
> \debuttexte
> \debutsection[titre=test] This is a test \finsection
> \codelua{context("Foo Bar 1")}
> \fintexte
\ctxlua?
> % interface=fr
> \debuttexte
> \debutsection[titre=test] This is a test \finsection
> \debutcodelua  context("Foo Bar 2") \fincodelua
> \fintexte
>
> with:
> tex error       > error not related to input file:
> tex error       >   tex: ?
> tex error       >   lua: ?
> tex error       >   mps: -
> mtx-context     | fatal error: return code: 256
>
>
> I suppose that some complementary modifications may be required with
> \start \stop and lua

Delimited command are problematic (especially when they change 
catcodes), e.g. \startluacode use \stopluacode as hard coded delimiter 
for the environment. While it is easy to create a synonym for 
\startluacode this isn't the case for \stopluacode because the 
environment always look for \stopluacode as stopper and alternative 
names are ignored.

There are ways to work around this (e.g. \startfootnote) but for the 
english interface they aren't needed in most cases.

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-06-25 20:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15  3:26 Filter module for R Fabrice L
2020-06-15  5:45 ` Aditya Mahajan
2020-06-15  6:04   ` Aditya Mahajan
2020-06-15  6:24     ` Aditya Mahajan
     [not found]     ` <82287b24-d781-808f-f96b-675f56224bb6@azules.eu>
2020-06-24 21:01       ` French interface - previous message = wrong title Garulfo
2020-06-24 21:35         ` Hans Hagen
2020-06-25 19:34           ` French interface Garulfo
2020-06-25 20:00             ` Wolfgang Schuster
2020-06-15 17:33   ` Filter module for R Fabrice L
2020-06-15 18:06     ` Aditya Mahajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).