Re: [NTG-context] Compile a file embedding modules with the lmtx engine

2020-04-03 Thread Fabrice Couvreur
Hi Pablo,
It seems to be working, thanks for your help.
Fabrice

Le ven. 3 avr. 2020 à 22:22, Pablo Rodriguez  a écrit :

> On 4/3/20 7:21 PM, Fabrice Couvreur wrote:
> >
> > I reinstalled context and lmtx, followed your instructions because I got
> > the same error message but now I get another error message; my editor is
> > Emacs.
> >
> > Running `LmtX' on `ESSAI' with
> > ``/home/viserion/LMTX/tex/texmf-linux-64/bin/mtxrun --autogenerate
> > --script context --autopdf ESSAI''
> > mtxrun  | unknown script 'context.lua' or 'mtx-context.lua'
>
> Hi Fabrice,
>
> from the shell, run "~/LMTX/tex/texmf-linux-64/bin/mtxrun --generate"
> before.
>
> After that, it should compile your document fine.
>
> 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
>
> ___
>
___
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] Compile a file embedding modules with the lmtx engine

2020-04-03 Thread Pablo Rodriguez
On 4/3/20 7:21 PM, Fabrice Couvreur wrote:
>
> I reinstalled context and lmtx, followed your instructions because I got
> the same error message but now I get another error message; my editor is
> Emacs.
>
> Running `LmtX' on `ESSAI' with
> ``/home/viserion/LMTX/tex/texmf-linux-64/bin/mtxrun --autogenerate
> --script context --autopdf ESSAI''
> mtxrun          | unknown script 'context.lua' or 'mtx-context.lua'

Hi Fabrice,

from the shell, run "~/LMTX/tex/texmf-linux-64/bin/mtxrun --generate"
before.

After that, it should compile your document fine.

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] Compile a file embedding modules with the lmtx engine

2020-04-03 Thread Fabrice Couvreur
I reinstalled context and lmtx, followed your instructions because I got
the same error message but now I get another error message; my editor is
Emacs.
Thank you.
Fabrice

Running `LmtX' on `ESSAI' with
``/home/viserion/LMTX/tex/texmf-linux-64/bin/mtxrun --autogenerate --script
context --autopdf ESSAI''
mtxrun  | unknown script 'context.lua' or 'mtx-context.lua'


TeX Output exited abnormally with code 1 at Fri Apr  3 19:15:18

Le ven. 3 avr. 2020 à 15:07, Pablo Rodriguez  a écrit :

> On 4/3/20 2:18 PM, Fabrice Couvreur wrote:
> > Hi,
> >
> > I did the installation then I copied the files and finally I did mtxrun
> > --generate
> > The file does not compile and I get a file where it says ERROR.
> >
> > viserion@archlinux ~]$ cd /home/viserion/data/context/tex/texmf-modules/
> > [viserion@archlinux texmf-modules]$ ls
> > doc  fonts  ls-R  metapost  scripts  source  tex  VERSION
>
> Hi Fabrice,
>
> I have just installed both LMTX and the ConTeXt Suite brand new. I moved
> the tex/texmf-modules contents form the Suite to LMTX tex/temxf-modules.
>
> Your file was compiled perfectly fine. I removed the contents of
> tex/texmf-modules and I got these errors:
>
> system  > jobfiles > unknown tex file
>
> '/home/ousia/64ctx/tex/texmf-modules/tex/context/pgf/frontendlayer/t-tikz.tex'
> modules > 'tikz' is loaded
>
> tex error   > tex error on line 2 in file ./a.tex: ! Undefined
> control sequence
>
>  \syst_helpers_triple_empty_two_nop  \usetikzlibrary
>
> l.2 \usetikzlibrary
>  [calc]
>
> If you get a similar error, I would do the following:
>
> 1. Remove tex/texmf-cache/luatex-cache.
> 2. Run "mtxrun --generate".
> 3. Compile the document.
>
> I hope this 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
>
> ___
>
___
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] Solved: Minimum example of problem getting curly braces printed in METAPOST

2020-04-03 Thread Gerben Wierda
Thanks to Taco, the solution was to simply use:

function doubleQuotableEscapedConTeXtString( str)
  local rep = {
  [1] =  { '{', '{\\textbraceleft}' },
  [2] =  { '}', '{\\textbraceright}' },
  [3] =  { '#', '{\\texthash}' },
  [4] =  { '$', '{\\textdollar}' },
  [5] =  { '&', '{\\textampersand}' },
  [6] =  { '%', '{\\textpercent}' },
  [7] =  { '\\','{\\textbackslash}' },
  [8] =  { '|', '{\\textbar}' },
  [9] =  { '_', '{\\textunderscore}' },
  [10] = { '~', '{\\textasciitilde}' },
  [11] = { '^', '{\\textasciicircum}' },
  [12] = { '"', "\"&\"" },
  }
  return lpeg.replacer(rep):match(str)
end

And the string becomes something that can safely be given toi METAPOST and 
safely handled by TeX when called from METAPOST via textext()

G


> On 2 Apr 2020, at 14:05, Gerben Wierda  wrote:
> 
> Here is a minimum example of a problem that I have in getting curly braces 
> printed in METAPOST in code that is generated by lua.
> 
> Any help is welcome.
> 
> \usemodule[scite]
> \setupxml
>  [entities=yes]
> 
> 
> \startluacode
> 
> function warn( ... )
>   texio.write_nl("-> " .. string.format(...))
> end
> 
> local function mpLabelString( xmlLabelString)
>   -- Returns a string where each " is replaced by a METAPOST compatible 
> result, except for outer double quotes"
>   rep = {
>   [1] = { "\"", "\"&\""   },
>   -- DOESN'T WORK: [2] = { "\\", "" },
>   }
>   local tmpString = string.formatters( "%!tex!", xmlLabelString)
>   warn( "STRING.FORMAT XML \"%s\"", xmlLabelString)
>   warn( "STRING.FORMAT TeX-ed \"%s\"", tmpString)
>   warn( "STRING.FORMAT Replaced \"%s\"", lpeg.replacer(rep):match(tmpString))
>   return lpeg.replacer(rep):match(tmpString)
> end
> 
> function warnAndConTeXt( ...)
>   warn( ...)
>   context( ...)
> end
> 
> function moduledata.test( filename)
>   local labelString
>   context( "The string to typeset is:\\par\\type-{Label} \"a\" [Text]!-")
>   context( "\\par The attempts are:")
>   context( "\\par1. \\type-Label Text-")
>   context( "\\par2. \\type-Label [Text]!-")
>   context( "\\par3. \\type-Label \"a\" [Text]!-")
>   context( "\\par4. \\type-{Label} [Text]!-")
>   context( "\\par5. \\type-{Label} \"a\" [Text]!-")
>   context.startMPpage { instance = "doublefun" }
>   context( "picture pic;")
>   labelString = "1. Label Text OK"
>   warnAndConTeXt( "pic := Foo( 0, 0, 150, 50, \"%s\");", mpLabelString( 
> labelString))
>   labelString = "2. Label [Text]! OK"
>   warnAndConTeXt( "pic := Foo( 0, -75, 150, 50, \"%s\");", mpLabelString( 
> labelString))
>   labelString = "3. Label \"a\" [Text]! OK"
>   warnAndConTeXt( "pic := Foo( 0, -150, 150, 50, \"%s\");", mpLabelString( 
> labelString))
>   labelString = "4. {Label} [Text]! MISSING curly braces"
>   warnAndConTeXt( "pic := Foo( 0, -225, 150, 50, \"%s\");", mpLabelString( 
> labelString))
>   labelString = "5. {Label} \"a\" [Text]! MISSING curly braces"
>   warnAndConTeXt( "pic := Foo( 0, -300, 150, 50, \"%s\");", mpLabelString( 
> labelString))
>   context( "drawdot (0,0) withpen pencircle scaled 4 withcolor red;")
>   context.stopMPpage()
> end
> \stopluacode
> 
> \usemodule[article-basic]
> %\enabletrackers[metapost.tracingall,metapost.lua,metapost.runs,metapost.textexts,metapost.scrintersectionPoints,metapost.runs,metapost.graphics,metapost.terminal]
> 
> \starttext
> 
> \definefontfamily[mainface][rm][Optima]
> \setupbodyfont[mainface,10pt]
> 
> \startMPinclusions[+]{doublefun}
> 
> \stopMPinclusions
> 
> \startMPdefinitions{doublefun}
> vardef makeTeXLabel( expr w, h, name) =
>   show "NAME makeTeXLabel:", name;
>   save p; picture p ;
>   save s; string s;
>   s := "\framed{" & name & "}"; % Curly braces will be missing. I need this 
> to work.
>   % s := "\type-" & name & "-"; % Curly braces are displayed, but this must 
> become a vbox in the end, so can't use it
>   show "SCAN:", s;
>   p := textext( s);
>   p
> enddef;
> 
> vardef Foo( expr xpos, ypos, width, height, str) =
>   show "NAME Foo:", str; % Backslashes are already gone here
>   save pic; picture pic;
>   pic := makeTeXLabel( width, height, str) shifted (xpos, ypos);
>   draw pic;
>   pic
> enddef;
> 
> \stopMPdefinitions
> 
> \ctxlua{moduledata.test("My ArchiMate Model Export BES.xml")}
> \typefile[option=TEX]{test11.tex}
> 
> \stoptext
> 
> The question is: how can I get this to work? The strings that have to be 
> printed inside the METAPOST picture come from an XML and can contain about 
> anything. But in the end that string will have to be vertically typeset as a 
> paragraph, hence I cannot use \type (which works).
> 
> 
> 
> ___
> 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  : 

Re: [NTG-context] xtable headers and handlecsv loop

2020-04-03 Thread Pablo Rodriguez
On 4/3/20 3:16 PM, Geert Dobbels wrote:
> Pablo,
>
> Gracias, your suggestion with \rownums works.  I will try this one too,
> since it is a simpler solution.  By the way, All information I have
> about handlecsv comes from the PDF file you wrote.  \rownums and \lineno
> are not explained in this document.  Do you know of documentation that
> describes those aspects ?

Geert,

de nada . I know that handlecsv has many other features that aren’t
documented.

I don’t have much time now, but as I wrote the user manual, I didn’t
have many cases that didn’t look extremely complex. And this would be
the best way to scare newcomers.

If you aren’t scared, t-handlecsv.lua contains a complete list of
defined commands (as a huge comment near the end of the file). You might
 be interested in reading them.

Or feel free to ask here for help, if you don’t find the command, its
explanation, or the right approach to solve an issue dealing with data
from CSV files. (But please, individual issues, not the explatiation for
the whole command list .)

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] xtable headers and handlecsv loop

2020-04-03 Thread Geert Dobbels
Wolfgang,

Thanks for this.  It works, however, the page where the table starts has
three lines of text before the table starts.  After inserting
"split=repeat", the table jumps to the next page, leaving the rest of
the page with the three lines of text completely blank.  This did not
happen without the "split=repeat".

Geert



On 03/04/2020 12:18, Wolfgang Schuster wrote:
> Geert Dobbels schrieb am 03.04.2020 um 11:57:
>> Hello,
>>
>> The sample below has 2 problems I cannot find the solution for:
>>
>> I am reading a table from a CSV file and want to typeset it via \xtable.
>>
>> The xtable as defined below works, it splits over several pages, but
>> the header does not repeat. I have seen examples in the mailing list
>> where people put the "\startxtable.\stopxtable" within a
>> \placefigure, but as soon as I try this, I get an error message:
>> "missing } or endgroup", although I doublechecked the "}" and I see
>> no error.
>>
>> The other issue I have: Since xtable requires me to read the header
>> line separately in order to put it between \startxtablehead and
>> \stopxtablehead, I access the csv buffer twice: the first time, I
>> only read the first line, and the second time, I read starting from
>> the second line. My problem here is that I do not know beforehand the
>> number of lines in the csv file. So in my second \doloopfromto I give
>> the second argument a number high enough to be sure it reads all the
>> lines. It works fine, but I would like to know if there is a way to
>> read the number of lines in the csv file to use the exact number of
>> lines, instead of guessing.
>>
>> \usemodule[handlecsv]
>>
>> \opencsvfile{systaprov2.csv}
>>
>> \starttext
>>
>>
>> \startbuffer[loop]
>> \startxrow
>> \startxcell[left] \cA \stopxcell
>> \startxcell[left] \cB \stopxcell
>> \startxcell[left] \cC \stopxcell
>> \startxcell[left] \cD \stopxcell
>> \startxcell \cE \stopxcell
>> \startxcell[left] \cF \stopxcell
>> \startxcell \cG \stopxcell
>> \startxcell \cH \stopxcell
>> \doifdefined{cI}{\startxcell \cI \stopxcell}
>> \doifdefined{cJ}{\startxcell \cJ \stopxcell}
>> \doifdefined{cK}{\startxcell [left] \cK \stopxcell}
>> \stopxrow
>> \stopbuffer
>>
>> \setupxtable[offset=0cm,
>> frame=off,
>> bottomframe=on,
>> framecolor=gray,
>> option=stretch,
>> align=middle]
>>
>> \setupxtable[head][background=color,
>> backgroundcolor=gray,
>> topframe=on,
>> bottomframe=on,
>> framecolor=black,
>> foregroundcolor=blue]
>>
>> \setupxtable[left][align=right]
>>
>> \startxtable[header=repeat]
>
> Add "split=repeat" to \startxtable.
>
>> \startxtablehead[head]
>> \doloopfromto{1}{1}{\getbuffer[loop]}
>> \stopxtablehead
>> \startxtablebody
>> \doloopfromto{2}{500}{\getbuffer[loop]}
>> \stopxtablebody
>>
>> \stopxtable
>>
>> \stoptext
>
> Wolfgang

-- 
-- 
*_IHTS Approvals S.L._*
Geert Dobbels
ge...@ihts.eu 
Zubiegi 11, E-01139 Bitoriano (Spain)  0034 945 462633
ihts.eu
___
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] xtable headers and handlecsv loop

2020-04-03 Thread Geert Dobbels
Pablo,

Gracias, your suggestion with \rownums works.  I will try this one too,
since it is a simpler solution.  By the way, All information I have
about handlecsv comes from the PDF file you wrote.  \rownums and \lineno
are not explained in this document.  Do you know of documentation that
describes those aspects ?

Geert


On 03/04/2020 13:34, Pablo Rodriguez wrote:
> On 4/3/20 12:31 PM, Pablo Rodriguez wrote:
>> On 4/3/20 11:57 AM, Geert Dobbels wrote:
>>> [...]
>>> So in my second \doloopfromto I give the second argument a number
>>> high enough to be sure it reads all the lines. It works fine, but I
>>> would like to know if there is a way to read the number of lines in
>>> the csv file to use the exact number of lines, instead of guessing.
>> If \numrows doesn’t fit your needs, please provide a CSV file with fake
>> data. I cannot guess why a second loop might be required.
> Hi Geert,
>
> this approach is simpler:
>
> \starttext
> \startxtable
> \startxtablehead[head]
> \doloopif{\lineno}{<}{2}{\getbuffer[loop]}
> \stopxtablehead
> \startxtablebody
> \doloopif{\lineno}{>}{1}{\getbuffer[loop]}
> \stopxtablebody
> \stopxtable
> \stoptext
>
> Only loop header with CSV lines numbered below 2, and loop boody with
> CSV lines numbered above 1.
>
> 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
> ___

___
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] Compile a file embedding modules with the lmtx engine

2020-04-03 Thread Pablo Rodriguez
On 4/3/20 2:18 PM, Fabrice Couvreur wrote:
> Hi,
>
> I did the installation then I copied the files and finally I did mtxrun
> --generate
> The file does not compile and I get a file where it says ERROR.
>
> viserion@archlinux ~]$ cd /home/viserion/data/context/tex/texmf-modules/
> [viserion@archlinux texmf-modules]$ ls
> doc  fonts  ls-R  metapost  scripts  source  tex  VERSION

Hi Fabrice,

I have just installed both LMTX and the ConTeXt Suite brand new. I moved
the tex/texmf-modules contents form the Suite to LMTX tex/temxf-modules.

Your file was compiled perfectly fine. I removed the contents of
tex/texmf-modules and I got these errors:

system  > jobfiles > unknown tex file
'/home/ousia/64ctx/tex/texmf-modules/tex/context/pgf/frontendlayer/t-tikz.tex'
modules > 'tikz' is loaded

tex error   > tex error on line 2 in file ./a.tex: ! Undefined
control sequence

 \syst_helpers_triple_empty_two_nop  \usetikzlibrary

l.2 \usetikzlibrary
 [calc]

If you get a similar error, I would do the following:

1. Remove tex/texmf-cache/luatex-cache.
2. Run "mtxrun --generate".
3. Compile the document.

I hope this 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] Compile a file embedding modules with the lmtx engine

2020-04-03 Thread Fabrice Couvreur
Hi,

I did the installation then I copied the files and finally I did mtxrun
--generate
The file does not compile and I get a file where it says ERROR.

viserion@archlinux ~]$ cd /home/viserion/data/context/tex/texmf-modules/
[viserion@archlinux texmf-modules]$ ls
doc  fonts  ls-R  metapost  scripts  source  tex  VERSION
[viserion@archlinux texmf-modules]$

Fabrice



Le ven. 3 avr. 2020 à 13:10, Pablo Rodriguez  a écrit :

> On 4/3/20 12:38 PM, Fabrice Couvreur wrote:
> > Hi,
> > I'm sorry but I didn't necessarily follow all the threads. I use to make
> > my graphics Metapost or Metafun, but I also sometimes use TiKz. This
> > file compiles with context but not with lmtx because the modules are not
> > recognized. I am willing to use only lmtx which seems to be the future
> > of ConteXt, but how do I do that?
>
> Hi Fabrice,
>
> do you have any modules installed in your LMTX distribution?
>
> As far as I know (sorry if I’ missing something), the user should
> install the modules manually for LMTX.
>
> Your sample compiles for me, but I copied the tex/texmf-modules
> directory from the ConTeXt Suite to the LMTX distribution.
>
> I hope this 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
>
> ___
>
___
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] xtable headers and handlecsv loop

2020-04-03 Thread Pablo Rodriguez
On 4/3/20 12:31 PM, Pablo Rodriguez wrote:
> On 4/3/20 11:57 AM, Geert Dobbels wrote:
>> [...]
>> So in my second \doloopfromto I give the second argument a number
>> high enough to be sure it reads all the lines. It works fine, but I
>> would like to know if there is a way to read the number of lines in
>> the csv file to use the exact number of lines, instead of guessing.
>
> If \numrows doesn’t fit your needs, please provide a CSV file with fake
> data. I cannot guess why a second loop might be required.

Hi Geert,

this approach is simpler:

\starttext
\startxtable
\startxtablehead[head]
\doloopif{\lineno}{<}{2}{\getbuffer[loop]}
\stopxtablehead
\startxtablebody
\doloopif{\lineno}{>}{1}{\getbuffer[loop]}
\stopxtablebody
\stopxtable
\stoptext

Only loop header with CSV lines numbered below 2, and loop boody with
CSV lines numbered above 1.

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] Compile a file embedding modules with the lmtx engine

2020-04-03 Thread Pablo Rodriguez
On 4/3/20 12:38 PM, Fabrice Couvreur wrote:
> Hi,
> I'm sorry but I didn't necessarily follow all the threads. I use to make
> my graphics Metapost or Metafun, but I also sometimes use TiKz. This
> file compiles with context but not with lmtx because the modules are not
> recognized. I am willing to use only lmtx which seems to be the future
> of ConteXt, but how do I do that?

Hi Fabrice,

do you have any modules installed in your LMTX distribution?

As far as I know (sorry if I’ missing something), the user should
install the modules manually for LMTX.

Your sample compiles for me, but I copied the tex/texmf-modules
directory from the ConTeXt Suite to the LMTX distribution.

I hope this 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] Compile a file embedding modules with the lmtx engine

2020-04-03 Thread Hans Hagen

On 4/3/2020 12:38 PM, Fabrice Couvreur wrote:

Hi,
I'm sorry but I didn't necessarily follow all the threads. I use to make 
my graphics Metapost or Metafun, but I also sometimes use TiKz. This 
file compiles with context but not with lmtx because the modules are not 
recognized. I am willing to use only lmtx which seems to be the future 
of ConteXt, but how do I do that ?

Thank you.
Fabrice


\usemodule[tikz]
\usetikzlibrary[calc]

\starttext

\startlinecorrection[blank]
   \startmidaligned
     \starttikzpicture
        \draw[fill=orange!30e,draw=orange] (0,0) rectangle (5,5);
      \stoptikzpicture
      \stopmidaligned
     \stoplinecorrection

\stoptext
you can put additional modules in texmf-local or texmf-modules (after 
installation run mtxrun --generate)


at some point the installer will deal with modules but that has to wait 
till we have set up the new repository infrastructure which will happen 
when there's is time


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
___


[NTG-context] Compile a file embedding modules with the lmtx engine

2020-04-03 Thread Fabrice Couvreur
Hi,
I'm sorry but I didn't necessarily follow all the threads. I use to make my
graphics Metapost or Metafun, but I also sometimes use TiKz. This file
compiles with context but not with lmtx because the modules are not
recognized. I am willing to use only lmtx which seems to be the future of
ConteXt, but how do I do that ?
Thank you.
Fabrice


\usemodule[tikz]
\usetikzlibrary[calc]

\starttext

\startlinecorrection[blank]
  \startmidaligned
\starttikzpicture
   \draw[fill=orange!30e,draw=orange] (0,0) rectangle (5,5);
 \stoptikzpicture
 \stopmidaligned
\stoplinecorrection

\stoptext
___
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] xtable headers and handlecsv loop

2020-04-03 Thread Pablo Rodriguez
On 4/3/20 11:57 AM, Geert Dobbels wrote:
> Hello,
>
> The sample below has 2 problems I cannot find the solution for:
>
> I am reading a table from a CSV file and want to typeset it via \xtable.
>
> The xtable as defined below works, it splits over several pages, but the
> header does not repeat. I have seen examples in the mailing list where
> people put the "\startxtable.\stopxtable" within a \placefigure, but
> as soon as I try this, I get an error message: "missing } or endgroup",
> although I doublechecked the "}" and I see no error.

Hi Geert,

your sample lacks the CSV file. Of course, we don’t need your actual
data, but something to test your sample is required.

BTW, how about using \startembeddedxtable...\stopembeddedxtable instead
of \startxtable...\stopxtable? This has worked for me in some documents.

> The other issue I have: Since xtable requires me to read the header line
> separately in order to put it between \startxtablehead and
> \stopxtablehead, I access the csv buffer twice: the first time, I only
> read the first line, and the second time, I read starting from the
> second line. My problem here is that I do not know beforehand the number
> of lines in the csv file.

I don’t understand what you aiming at, but \numrows gives exactly that
information.

> So in my second \doloopfromto I give the second argument a number
> high enough to be sure it reads all the lines. It works fine, but I
> would like to know if there is a way to read the number of lines in
> the csv file to use the exact number of lines, instead of guessing.

If \numrows doesn’t fit your needs, please provide a CSV file with fake
data. I cannot guess why a second loop might be required.

I hope 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] xtable headers and handlecsv loop

2020-04-03 Thread Wolfgang Schuster

Geert Dobbels schrieb am 03.04.2020 um 11:57:

Hello,

The sample below has 2 problems I cannot find the solution for:

I am reading a table from a CSV file and want to typeset it via \xtable.

The xtable as defined below works, it splits over several pages, but the 
header does not repeat. I have seen examples in the mailing list where 
people put the "\startxtable.\stopxtable" within a \placefigure, but 
as soon as I try this, I get an error message: "missing } or endgroup", 
although I doublechecked the "}" and I see no error.


The other issue I have: Since xtable requires me to read the header line 
separately in order to put it between \startxtablehead and 
\stopxtablehead, I access the csv buffer twice: the first time, I only 
read the first line, and the second time, I read starting from the 
second line. My problem here is that I do not know beforehand the number 
of lines in the csv file. So in my second \doloopfromto I give the 
second argument a number high enough to be sure it reads all the lines. 
It works fine, but I would like to know if there is a way to read the 
number of lines in the csv file to use the exact number of lines, 
instead of guessing.


\usemodule[handlecsv]

\opencsvfile{systaprov2.csv}

\starttext


\startbuffer[loop]
\startxrow
\startxcell[left] \cA \stopxcell
\startxcell[left] \cB \stopxcell
\startxcell[left] \cC \stopxcell
\startxcell[left] \cD \stopxcell
\startxcell \cE \stopxcell
\startxcell[left] \cF \stopxcell
\startxcell \cG \stopxcell
\startxcell \cH \stopxcell
\doifdefined{cI}{\startxcell \cI \stopxcell}
\doifdefined{cJ}{\startxcell \cJ \stopxcell}
\doifdefined{cK}{\startxcell [left] \cK \stopxcell}
\stopxrow
\stopbuffer

\setupxtable[offset=0cm,
frame=off,
bottomframe=on,
framecolor=gray,
option=stretch,
align=middle]

\setupxtable[head][background=color,
backgroundcolor=gray,
topframe=on,
bottomframe=on,
framecolor=black,
foregroundcolor=blue]

\setupxtable[left][align=right]

\startxtable[header=repeat]


Add "split=repeat" to \startxtable.


\startxtablehead[head]
\doloopfromto{1}{1}{\getbuffer[loop]}
\stopxtablehead
\startxtablebody
\doloopfromto{2}{500}{\getbuffer[loop]}
\stopxtablebody

\stopxtable

\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] xtable headers and handlecsv loop

2020-04-03 Thread Geert Dobbels
Hello,

The sample below has 2 problems I cannot find the solution for:

I am reading a table from a CSV file and want to typeset it via \xtable.

The xtable as defined below works, it splits over several pages, but the
header does not repeat. I have seen examples in the mailing list where
people put the "\startxtable.\stopxtable" within a \placefigure, but
as soon as I try this, I get an error message: "missing } or endgroup",
although I doublechecked the "}" and I see no error.

The other issue I have: Since xtable requires me to read the header line
separately in order to put it between \startxtablehead and
\stopxtablehead, I access the csv buffer twice: the first time, I only
read the first line, and the second time, I read starting from the
second line. My problem here is that I do not know beforehand the number
of lines in the csv file. So in my second \doloopfromto I give the
second argument a number high enough to be sure it reads all the lines.
It works fine, but I would like to know if there is a way to read the
number of lines in the csv file to use the exact number of lines,
instead of guessing.

\usemodule[handlecsv]


\opencsvfile{systaprov2.csv}

\starttext


\startbuffer[loop]

\startxrow

\startxcell[left] \cA \stopxcell

\startxcell[left] \cB \stopxcell

\startxcell[left] \cC \stopxcell

\startxcell[left] \cD \stopxcell

\startxcell \cE \stopxcell

\startxcell[left] \cF \stopxcell

\startxcell \cG \stopxcell

\startxcell \cH \stopxcell

\doifdefined{cI}{\startxcell \cI \stopxcell}

\doifdefined{cJ}{\startxcell \cJ \stopxcell}

\doifdefined{cK}{\startxcell [left] \cK \stopxcell}

\stopxrow

\stopbuffer

\setupxtable[offset=0cm,

frame=off,

bottomframe=on,

framecolor=gray,

option=stretch,

align=middle]

\setupxtable[head][background=color,

backgroundcolor=gray,

topframe=on,

bottomframe=on,

framecolor=black,

foregroundcolor=blue]

\setupxtable[left][align=right]

\startxtable[header=repeat]

\startxtablehead[head]

\doloopfromto{1}{1}{\getbuffer[loop]}

\stopxtablehead

\startxtablebody

\doloopfromto{2}{500}{\getbuffer[loop]}

\stopxtablebody

\stopxtable

\stoptext

___
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] lmtx vs mkiv

2020-04-03 Thread Hans Hagen

Hi,

One problem of mixed usage of mkiv (with luatex) and lmtx (with 
luametatex) is that in the later we use a different (initial) context 
runner. Basically all platforms are now handled the same (in mkiv there 
was a stub and no texlua, in unix something shebang with texlua because 
of argument passing limitations).


However, the main context script can be told to use a specific engine:

context --luatex foo.tex

so in principle one can use both lmtx and mkiv with the same binary 
tree, given that luametatex and luatex are both present and that 
luametatex is in charge.


For that reason the latest lmtx installer now (for the time being) also 
includes the luatex binary (plus mkiv files needed) so that one can 
install lmtx and run both engines. Instead of the --luatex switch one 
can also force the engine in the usual way with "% engine=luatex" at the 
top line of the source file (but no pdftex and xetex in this installer).


FWIW, the lmtx installation ships with the latest experimental luatex 
binary but normally that should not have consequences, but it does 
permits testing occasional updates.


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
___


Re: [NTG-context] \placenamedfloat and \setuphead[aftersection=...] broken?

2020-04-03 Thread Benjamin Buchmuller
Thank you, Wolfgang, this works; apparently, the chapter has to be set with 
\startchapter … \stopchapter and footnotes after \chapter won’t be flushed 
unless \startchapter \footnote{something} \stopchapter.

This makes sense to me. 

I guess, internally \head (e.g. \section, \chapter etc.) is simply not 
“converted" to \starthead ... \stophead before the next invocation of \head or 
the end of \stoptext?

Cheers


Benjamin

> On 2 Apr 2020, at 19:51, Wolfgang Schuster 
>  wrote:
> 
> Benjamin Buchmuller schrieb am 02.04.2020 um 19:29:
>> Potentially on the same lines, placing delayed element seems currently not 
>> to work properly (or the syntax has changed?).
>> I think these features of MkIV are very elegant and useful. I’m just 
>> wondering if they are/were temporarily not working (tried on 2019.12.27 
>> 16:34 MKIV beta and the Wiki’s ConTeXt online) or have been disabled/changed 
>> for some reason?
>> Thanks!
>> Benjamin
>> (1) palcenamedfloat
>> ---
>> This is the example from the Wiki:
>> [...]
>> (2) Footnotes at the end of each chapter
>> 
>> Also an example from the Wiki:
>> \startsetups
>>  chapter:after
>>  \ifcase\rawcountervalue[footnote]\relax
>>  \or
>>  \startsubject[title=Footnote]
>>  \placefootnotes
>>  \stopsubject
>>  \else
>>  \startsubject[title=Footnotes]
>>  \placefootnotes
>>  \stopsubject
>>  \fi
>> \stopsetups
>> \setupnotes[location=none]
>> \setupnotation[way=bychapter]
>> \setuphead[chapter][aftersection=\setups{chapter:after}]
> 
> Here is a slightly reformatted version of Hans code which works for me with 
> the latest ConTeXt version (I checked only LMTX).
> 
> \startsetups[chapter:after]
>  \ifcase\rawcountervalue[footnote]\relax
>%
>  \or
>\startsubject[title=Footnote]
>  \placefootnotes
>\stopsubject
>  \else
>\startsubject[title=Footnotes]
>  \placefootnotes
>\stopsubject
>  \fi
> \stopsetups
> 
> \setupnote [footnote] [location=none]
> \setupnotation [footnote] [way=bychapter]
> 
> \setuphead[chapter][aftersection=\setups{chapter:after}]
> 
> \starttext
> 
> \dorecurse{4}
>  {\startchapter[title={Number #1}]
>   A few notes\dorecurse{\numexpr#1-1\relax}{\footnote{Note #1.##1}}.
>   \stopchapter}
> 
> \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
___