Re: [NTG-context] Can anyone connect context to R or python?

2018-10-05 Thread Alan Braslau
On Fri, 5 Oct 2018 20:07:27 +0200
Hans Hagen  wrote:

> > I want to fill it in with numbers that r reads from a csv file and 
> > processes.  
> Can you give an example? Do you only need R for reading the csv?

The processing is done by R.

Of course, it *could* be done in Lua, but this all depends on what processing 
is needed, for R contains many libraries of routines (but so *can* lua).


For the list, this discussion between Hans and myself follows a presentation 
that I made at the last ConTeXt Meeting regarding handling large data files in 
lua (+MetaPost). We are presently working on an article for the Context Journal 
to document this.

Alan

P.S. Lua is rather magical...
___
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] Can anyone connect context to R or python?

2018-10-05 Thread Hans Hagen

On 10/5/2018 8:00 PM, Kelley, Claire wrote:

Thank you for all the answers so far !



Ive gathered from that I need to use filter to call R externally.

  What I am still most interested in is how I could get a single value from R 
to be part of the Context code. (Like you would do with \Sexpr{} in sweave. The 
use case for this is that I have some complicated tikz code that makes a fancy 
matrix - I want to fill it in with numbers that r reads from a csv file and 
processes.

Can you give an example? Do you only need R for reading the csv?

Hans ntg-context@ntg.nl


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

Re: [NTG-context] Can anyone connect context to R or python?

2018-10-05 Thread Kelley, Claire
Thank you for all the answers so far !



Ive gathered from that I need to use filter to call R externally.

 What I am still most interested in is how I could get a single value from R to 
be part of the Context code. (Like you would do with \Sexpr{} in sweave. The 
use case for this is that I have some complicated tikz code that makes a fancy 
matrix - I want to fill it in with numbers that r reads from a csv file and 
processes. 
 

On 10/5/18, 1:48 PM, "ntg-context on behalf of Pablo Rodriguez" 
 wrote:

>Lua
___
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] Can anyone connect context to R or python?

2018-10-05 Thread Pablo Rodriguez
On 10/5/18 4:55 PM, Kelley, Claire wrote:
> Hi All, 
> I am very interested in creating pdf documents using Context with
> calculations done in R or Python and then added into the document. 

Hi Claire,

ConTeXt MkIV comes with Lua inside.

Would Lua fit your purposes?

> If you were using traditional latex this could be accomplished through R
> markdown or Sweave- is there any way to connect these to Context? 

I’m afraid that my background is in humanities. If you need R, I wonder
whether this can be easily done with ConTeXt.

Just in case it helps,

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] Can anyone connect context to R or python?

2018-10-05 Thread Henning Hraban Ramm
Am 2018-10-05 um 16:55 schrieb Kelley, Claire :

> Hi All, 
> I am very interested in creating pdf documents using Context with 
> calculations done in R or Python and then added into the document. 
> 
> If you were using traditional latex this could be accomplished through R 
> markdown or Sweave- is there any way to connect these to Context? 

Hi Claire,

you should use Aditya’s filter module to call external programs:
https://github.com/adityam/filter

There’s a module for R in the distribution (see 
https://source.contextgarden.net/tex/context/modules/mkii/m-r.mkii), but it’s 
only for MkII and AFAIK superseded by the filter module.

Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
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] Need help with project: TeX capacity exceeded

2018-10-05 Thread Wolfgang Schuster



Axel Kielhorn schrieb am 05.10.18 um 18:44:

Am 05.10.2018 um 17:33 schrieb Wolfgang Schuster 
:

I took a look at your example files and there a few things which can be 
improved.


Product file:

1. You don’t need the actual name of the current file and use * instead

2. You can use brackets as delimiters for the file name instead of a space 
after the name

Does this mean I can use a space in the filename?


It’s possible but the safer method is to use a underscore or hyphen in 
file names.



3. In products you can put all content in a document environment which has 
hooks to insert text etc. at the begin and end of the document (which can be 
used to insert a titlepage or endpage). You can even use \startdocument (or 
\setupdocument) to set the document name in the pdf viewer (yes it can also be 
done with \setupinteraction but \startdocument is nicer).

A minimal file would be

 \startproduct [*]

 \project [project_skel]

 \startdocument

 \component [c_01]
 \component [c_02]

 \stopdocument

 \stopproduct

or

[..]


Environment file:

1. Don’t load the project from your environment file

2. Don’t use \usepath to set the folders for the product files, use it instead 
to set the folders for your component files which are loaded from the products

Does this mean that I should use a product level environment file for the 
\usepath?
(Accessing things like ../img_global?)


With \usepath (and \usesubpath) you can set folders which are searched 
when you
use the \component command to load chapters etc. in your product (or 
component) files.


To load images from other folder you use 
\setupexternalfigure[directory=...] where you
can also use "../images" to load them from a global folder for all 
documents in your project.


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
___

Re: [NTG-context] Need help with project: TeX capacity exceeded

2018-10-05 Thread Axel Kielhorn

> Am 05.10.2018 um 17:33 schrieb Wolfgang Schuster 
> :
> 
> I took a look at your example files and there a few things which can be 
> improved.
> 
> 
> Product file:
> 
> 1. You don’t need the actual name of the current file and use * instead
> 
> 2. You can use brackets as delimiters for the file name instead of a space 
> after the name

Does this mean I can use a space in the filename?
> 
> 3. In products you can put all content in a document environment which has 
> hooks to insert text etc. at the begin and end of the document (which can be 
> used to insert a titlepage or endpage). You can even use \startdocument (or 
> \setupdocument) to set the document name in the pdf viewer (yes it can also 
> be done with \setupinteraction but \startdocument is nicer).
> 
> A minimal file would be
> 
> \startproduct [*]
> 
> \project [project_skel]
> 
> \startdocument
> 
> \component [c_01]
> \component [c_02]
> 
> \stopdocument
> 
> \stopproduct
> 
> or

[..]

> Environment file:
> 
> 1. Don’t load the project from your environment file
> 
> 2. Don’t use \usepath to set the folders for the product files, use it 
> instead to set the folders for your component files which are loaded from the 
> products

Does this mean that I should use a product level environment file for the 
\usepath?
(Accessing things like ../img_global?)

> 3. You can remove the braces around the subfolder which aren’t necessary.

Thanks for the clarification.

I have updated my project.

Greetings Axel


___
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] Need help with project: TeX capacity exceeded

2018-10-05 Thread Wolfgang Schuster


Taco Hoekwater schrieb am 04.10.18 um 09:27:

Hi,


On 4 Oct 2018, at 08:47, Axel Kielhorn  wrote:

Hello,

this is my second try to start with context and I can’t even do the first step.

I’m planing to convert a large but simple document to context.
The document consists of 3 Parts.
Each part has several chapters.

Thus I started to build a project with three products, see enclosed archive.

According to my understanding I should be able to
context c_01 to get one chapter
context prd_A to get one product
context project_ecm to get the whole book.

Any whole book should be a product, and the Parts should just be components.
The project level is only there to connect meta-info across a book series.
You are not supposed to run ‘context’ on the project file.

That said, it is definitely not your installation or understanding of the
wiki page that creates the circular inclusion. The same happens here. I
discovered it works OK if I move the \product to within the \startcomponent,
and I assume that is how it supposed to work:

   \startcomponent
   \product prd_1
…
   \stopcomponent

At a guess, I think the wiki page is wrong. But before editing that,
I would like to have confirmation of the above assumption.


The \product command is more or less useless because it provides only 
the information

of the main file of the document.

The real question is where you should put the \project or \environment 
commands.
When you put them before \startproduct you’re loading your fonts before 
the start
of the document and the Latin Modern fallback isn’t used but when you 
put them

after \startproduct you load your font after the Latin Modern fallback.

One advantage when you load the project/environment after \startproduct 
(or \startcomponent)
is that you can use the product or component modes in your environment 
file to set

different image or subpath folder dependant on which file type you typeset.

In the end it doesn’t matter whether you load your project/environment 
before or after

\startproduct because there is no difference.

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
___

Re: [NTG-context] Need help with project: TeX capacity exceeded

2018-10-05 Thread Wolfgang Schuster
I took a look at your example files and there a few things which can be 
improved.



Product file:

1. You don’t need the actual name of the current file and use * instead

2. You can use brackets as delimiters for the file name instead of a 
space after the name


3. In products you can put all content in a document environment which 
has hooks to insert text etc. at the begin and end of the document 
(which can be used to insert a titlepage or endpage). You can even use 
\startdocument (or \setupdocument) to set the document name in the pdf 
viewer (yes it can also be done with \setupinteraction but 
\startdocument is nicer).


A minimal file would be

    \startproduct [*]

    \project [project_skel]

    \startdocument

    \component [c_01]
    \component [c_02]

    \stopdocument

    \stopproduct

or

    \startproduct [*]

    \project [project_skel]

    \startdocument

    \startbodymatter

    \component [c_01]
    \component [c_02]

    \stopbodymatter

    \stopdocument

    \stopproduct


Environment file:

1. Don’t load the project from your environment file

2. Don’t use \usepath to set the folders for the product files, use it 
instead to set the folders for your component files which are loaded 
from the products


3. You can remove the braces around the subfolder which aren’t necessary.


Wolfgang



Axel Kielhorn schrieb am 05.10.18 um 08:31:

Am 04.10.2018 um 20:59 schrieb Henning Hraban Ramm :

Am 2018-10-04 um 10:08 schrieb Axel Kielhorn :


Thus having the whole file inside \start{project|product|component} \stop… 
would be a good idea and consistent.

That’s what I do.
Since I wrote that wiki page (some years ago) I’ll change it.

I appreciate that.

How about offering a skeleton project for download?

Here is my corrected ECM with the following README:

This is a skeleton project.
You can copy it and change the files to contain your content.

The top level project collects metatdata to make all products have the same
layout. It is not meant to be processed by context.

The products are used to generate the whole book, but you can process each
component seperately to reduce the processing time.






Greetings
Axel


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


___
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] Magic Elimination

2018-10-05 Thread Wolfgang Schuster

The following examples are taken from mtx-context-meaning.tex

context --extra=meaning --pattern=*paper*
context --extra=meaning setuplayout
context --extra=meaning setup_layout
context --extra=meaning --once --noconsole --nostatistics setuplayout
mtxrun --silent --script context --extra=meaning --once  --noconsole 
--nostatistics setuplayout

mtxrun --script interface --meaning setuplayout

Wolfgang


Sebastian Miele schrieb am 05.10.18 um 16:49:

ConTeXt contains a lot of magic. Is there a very plain-ish X between
iniLuaTeX and MKIV, plus a tool that does the following: Given an MKIV
document, reduce the document to X, especially including a solid deal
of dead code and magic elimination? I.e. a tool that leaves a "How it
can be done without magic directly in X".

There is a tool named (la)texdef. Is there something like contextdef?
What is the quickest way to find the definition of a macro (on the
command line and/or in Emacs)?
___
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
___


___
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] Can anyone connect context to R or python?

2018-10-05 Thread Kelley, Claire
Hi All,
I am very interested in creating pdf documents using Context with calculations 
done in R or Python and then added into the document.

If you were using traditional latex this could be accomplished through R 
markdown or Sweave- is there any way to connect these to Context?

Best,
Claire
___
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] Magic Elimination

2018-10-05 Thread Sebastian Miele
ConTeXt contains a lot of magic. Is there a very plain-ish X between
iniLuaTeX and MKIV, plus a tool that does the following: Given an MKIV
document, reduce the document to X, especially including a solid deal
of dead code and magic elimination? I.e. a tool that leaves a "How it
can be done without magic directly in X".

There is a tool named (la)texdef. Is there something like contextdef?
What is the quickest way to find the definition of a macro (on the
command line and/or in Emacs)?
___
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] Need help with project: TeX capacity exceeded

2018-10-05 Thread Henning Hraban Ramm
Am 2018-10-05 um 08:31 schrieb Axel Kielhorn :

> How about offering a skeleton project for download?

I’m offering a Python script that creates projects:
https://github.com/fiee/tools/blob/master/contextproject.py
This avoids renaming everything.

In my bigger projects I use additional shell scripts to create directories and 
generic content (e.g. ISBN barcode). Since these are very specific it wouldn’t 
make sense to share them.



Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
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] Need help with project: TeX capacity exceeded

2018-10-05 Thread Axel Kielhorn

> Am 04.10.2018 um 20:59 schrieb Henning Hraban Ramm :
> 
> Am 2018-10-04 um 10:08 schrieb Axel Kielhorn :
> 
>> Thus having the whole file inside \start{project|product|component} \stop… 
>> would be a good idea and consistent.
> 
> That’s what I do.
> Since I wrote that wiki page (some years ago) I’ll change it.

I appreciate that.

How about offering a skeleton project for download?

Here is my corrected ECM with the following README:

This is a skeleton project.
You can copy it and change the files to contain your content.

The top level project collects metatdata to make all products have the same
layout. It is not meant to be processed by context.

The products are used to generate the whole book, but you can process each
component seperately to reduce the processing time.


<>



Greetings
Axel___
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
___