Re: [NTG-context] Using two versions of ConTeXt

2020-04-17 Thread Aditya Mahajan

On Fri, 17 Apr 2020, Jairo A. del Rio wrote:


Hi everyone! I'm using the ConTeXt version packaged with TeX Live 2020 and
recently I have downloaded LMTX. Both of them work, but when I call
"context" from terminal, I compile with the TeX Live version, whereas I
have to use a fully specified path to get LMTX output. Is there a way to
call both from terminal, say, using "lmtx" or other shortcut for the
standalone version? I work on Ubuntu 18.04. Thank you in advance.


Adding

alias lmtx="path-to-context/texmf-linux-64/bin/context"

in your .bashrc, .zshrc, or equivalent should work.

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] "Remember picture" does not work (again)

2020-04-17 Thread Jairo A. del Rio
Sorry, I tested again and it worked. Thank you very much.

El mar., 7 de abr. de 2020 a la(s) 06:18, Jairo A. del Rio (
jairoadelr...@gmail.com) escribió:

> It does not work. I get the following error message:
>
> You can't use `the character 6' after \the
>
>
> l.1 6
>
> 120806
>
> \lastxpos ->\clf_lastxpos
>
>  \noexpand \pgfsyspdfmark {pgfid1}{\the \lastxpos
>
> }{\the \lastypos }
>
> 
>
> }\endwrite
>
>  \shipoutscratchbox
>
> \page_shipout_box #1->\clf_shipoutpage #1
>
> \relax \setbox #1\emptybox \global ...
>
> ...
>
> l.22 \stoptext
>
> El mar., 7 de abr. de 2020 a la(s) 02:32, Hans Hagen (j.ha...@xs4all.nl)
> escribió:
>
>> On 4/7/2020 4:07 AM, Jairo A. del Rio wrote:
>> > I've tried using the fix in
>> > https://tex.stackexchange.com/a/492197/193767 in order to make TikX's
>> > remember picture feature usable, Code below, just in case:
>> >
>> > |\unprotect% This fixes the present
>> >
>> bug\unexpanded\def\pdflastxpos{\numexpr\clf_lastxpos\relax}\unexpanded\def\pdflastypos{\numexpr\clf_lastypos\relax}%
>>
>> > This might be needed if you run PGF 3.1.3% see
>> >
>> https://github.com/pgf-tikz/pgf/issues/675\def\XC@tgt@mod#1{#1}\def\XC@sdef#1#2{\edef#1{#2}}\protect\usemodule[tikz]\starttext\starttikzpicture[remember
>> > picture]\node(A){Node 1}; \stoptikzpictureHi world
>> > \starttikzpicture[remember picture]\node(B){Node 2};
>> > \stoptikzpicture\starttikzpicture[overlay,remember
>> > picture]\draw(B)--++(0,0.5)-| (A); \stoptikzpicture\stoptext|
>>
>>
>> \unprotect
>>
>> \ifcase\contextlmtxmode \else
>>  \unexpanded\def\pdflastxpos{\numexpr\clf_lastxpos\relax}
>>  \unexpanded\def\pdflastypos{\numexpr\clf_lastypos\relax}
>> \fi
>>
>> % This might be needed if you run PGF 3.1.3
>> % see https://github.com/pgf-tikz/pgf/issues/675
>>
>> % \def\XC@tgt@mod  #1{#1}
>> % \let\XC@sdef\edef
>>
>> \protect
>>
>> \usemodule[tikz]
>>
>> >
>> > However, the following appears:
>> >
>> > l.1 6
>> >
>> > 120806
>> >
>> > \lastxpos ->\clf_lastxpos
>> >
>> >  \noexpand \pgfsyspdfmark {pgfid1}{\the \lastxpos
>> >
>> > }{\the \lastypos }
>> >
>> > 
>> >
>> > }\endwrite
>> >
>> >  \shipoutscratchbox
>> >
>> > \page_shipout_box #1->\clf_shipoutpage #1
>> >
>> > \relax \setbox #1\emptybox \global ...
>> >
>> > ...
>> >
>> > l.20 \stoptext
>> >
>> >
>> > I use LuaTeX 1.10 7127 + ConTeXt MkIV 2019.03.21 21:39 (TeX Live
>> > version), in case this helps. Is another fix necessary? A Metapost
>> > alternative would be fine, too.
>> >
>> >
>> >
>> ___
>> > 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
>> >
>> ___
>> >
>>
>>
>> --
>>
>> -
>>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] Using two versions of ConTeXt

2020-04-17 Thread Jairo A. del Rio
Hi everyone! I'm using the ConTeXt version packaged with TeX Live 2020 and
recently I have downloaded LMTX. Both of them work, but when I call
"context" from terminal, I compile with the TeX Live version, whereas I
have to use a fully specified path to get LMTX output. Is there a way to
call both from terminal, say, using "lmtx" or other shortcut for the
standalone version? I work on Ubuntu 18.04. Thank you in advance.
___
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] Best way to create a large number of documents from database

2020-04-17 Thread Hans Hagen

On 4/17/2020 4:37 PM, Mojca Miklavec wrote:


One of the interesting statistics.
I used a bunch of images (the same png images in all documents; cca.
290k in total).


It can actually make a difference what kind of png image you use. Some 
png images demand a conversion (or split of map etc) to the format 
supported by pdf. Often converting the png to pdf and include those is 
faster.

 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] Best way to create a large number of documents from database

2020-04-17 Thread Mojca Miklavec
On Thu, 16 Apr 2020 at 16:38, Mojca Miklavec wrote:
> On Thu, 16 Apr 2020 at 11:29, Taco Hoekwater wrote:
> > > On 16 Apr 2020, at 11:12, Mojca Miklavec wrote:
> > >
> > > I have been asked to create a few thousand PDF documents from a CSV
> > > "database" today
> >
> > In CPU cycles, the fastest way is to do a single context —once
> > run generating all the pages as a single document, then using
> > mutool merge to split it into separate documents using a (shell)
> > loop.
>
> Just to make it clear: I don't really need to optimize on the CPU end,

... says the optimist ... :) :) :)

> as the bottleneck is on the other side of the keyboard, so as long as
> the CPU can process 5k pages today, I'm fine with it :) :) :)

While the bottleneck was in fact at the other side of the keyboard
(preparation was certainly longer than the execution), it still took
cca 2,5 hours to generate the full batch.

(I'm pretty sure I could have further optimised the code, even though
1 second per run is still pretty fast [when I started using context it
was more like 30 seconds per run], it just adds up when talking about
thousands of pages. This greatly reminds me on the awesome speedup
that Hans achieved when rewriting the mplib code & the initial
\sometxt changes inside metapost which also lead to 100-fold speedups
as one no longer needed to start TeX a zillion times.)

While waiting I wanted to start being clever and do the processing in
the same folder in parallel (I have lots of cores after all), and
ended up calling a script with
context --N={n} --output=doc-{}.pdf template.tex
context --purge
only to notice much later that running multiple context runs in the
same folder (some of them compiling and some of them deleting the
temporary files) might not have been the best idea on the planet, many
documents ended up missing, and many corrupted. So I had to rerun half
of the documents.

One of the interesting statistics.
I used a bunch of images (the same png images in all documents; cca.
290k in total).

The generated documents were 1,5 GB in size. When compressed with
tar.gz, there was almost no noticeable difference between the
compressed and non-compressed data size (1,4 GB vs. 1,5 GB). But when
compressing with tar.xz, it compressed 1,5 GB worth of document into
merely 27 MB (a single document is 360 k).

The documents have been e-mailed out, but now they need to print hard
copies for archive. I'm happy I don't need to be the one printing and
storing that :) :) :)

Mojca
___
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] Colors in lmt_surface and luametafun

2020-04-17 Thread Hans Hagen

On 4/17/2020 3:33 PM, Otared Kavian wrote:

Hi Hans,

On page 36 of luametafun.pdf there is the following example of using 
lmt_surface:

\startMPcode{doublefun}
draw lmt_surface [
preamble  = "local sin, cos = math.sin, math.cos",
code = "sin(x*x) - cos(y*y)",
color = "f, f/2, 1-f",
color = "f, f, 0",
xstep = .02,
ystep = .02,
xvector = {-0.4, -0.4},
height = 10cm,
lines = true,
] xsized .TextWidth ;
\stopMPcode

What is the meaning of « f » in « color = "f, f/5, 1-f" »?
Is it possible to specify other colors and how can it be done?

f = fraction

you can write some function yourself

\starttext

\startMPcode{doublefun}
draw lmt_surface [
preamble = "local sin, cos = math.sin, math.cos",
code = "sin(x*x) - cos(y*y)",
color= "f, f, 0",
xstep= .02,
ystep= .02,
xvector  = {-0.4, -0.4},
height   = 5cm,
lines= true,
] ysized (TextHeight/4) ;
\stopMPcode

\startluacode
function MyColor(f) return f/2, f/3, .5 end
\stopluacode

\startMPcode{doublefun}
draw lmt_surface [
preamble = "local sin, cos = math.sin, math.cos",
code = "sin(x*x) - cos(y*y)",
color= "MyColor(f)",
xstep= .02,
ystep= .02,
xvector  = {-0.4, -0.4},
height   = 5cm,
lines= true,
] ysized (TextHeight/4) ;
\stopMPcode

\startMPcode{doublefun}
draw lmt_surface [
preamble = "local sin, cos = math.sin, math.cos " &
   "function MyColor(f) return 0, f/3, .5 end",
code = "sin(x*x) - cos(y*y)",
color= "MyColor(f)",
xstep= .02,
ystep= .02,
xvector  = {-0.4, -0.4},
height   = 5cm,
lines= true,
] ysized (TextHeight/4) ;
\stopMPcode



-
  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] Colors in lmt_surface and luametafun

2020-04-17 Thread Otared Kavian
Hi Hans,

On page 36 of luametafun.pdf there is the following example of using 
lmt_surface:

\startMPcode{doublefun}
draw lmt_surface [
preamble  = "local sin, cos = math.sin, math.cos",
code = "sin(x*x) - cos(y*y)",
color = "f, f/2, 1-f",
color = "f, f, 0",
xstep = .02,
ystep = .02,
xvector = {-0.4, -0.4},
height = 10cm,
lines = true,
] xsized .TextWidth ;
\stopMPcode

What is the meaning of « f » in « color = "f, f/5, 1-f" »?
Is it possible to specify other colors and how can it be done?

Thanks for your attention: Otared 
___
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] Text around an image

2020-04-17 Thread Hans Hagen

On 4/17/2020 11:07 AM, Fabrice Couvreur wrote:

Hi,
I found a way to solve it using the command \flushsidefloats
Is this the best solution ?


sure, it's a valid way to do it

-
  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] Text around an image

2020-04-17 Thread Fabrice Couvreur
Hi,
I found a way to solve it using the command \flushsidefloats
Is this the best solution ?
Thank you.
Fabrice

\startitem
Programmer une fonction \m{A(x)} qui renvoie l'aire totale du
terrain en fonction de la longueur \m{x}.
\stopitem
\flushsidefloats



Le jeu. 16 avr. 2020 à 12:33, Fabrice Couvreur 
a écrit :

> Hi,
> I know that this question has been raised several times (especially by me
> !), but the solutions provided sometimes work and sometimes not, especially
> in this example.
> Thanks for your help.
> Fabrice
>
>   \useMPlibrary [dum]
>
>\define\ItemCommand
>{\hskip\zeropoint\relax\autoinsertnextspace}
>
>   \setupitemgroup
> [itemize]
> [color=black,
>  style=bold,
>  distance=\zeropoint]
>
>   \setupitemgroup
> [itemize:1]
> [option={n,packed,fit,intext},
> command=\ItemCommand]
>
>   \setupitemgroup
> [itemize:2]
> [lefttext=,
> righttext=,
> option={a,text}]
>
>   \starttext
>
> \startitemize
>   \startitem
> Justifier que \m{x>4} et \m{y>2}.
>   \stopitem
>   \placefigure[right,none]{}{\externalfigure [dummy]}
>   \startitem
> Pour calculer la valeur de \m{y} en fonction de \m{x}, l'urbaniste
> a écrit la fonction en Python.
>
> \startitemize
>   \startitem
> Son algorithme est-il correct ?
>   \stopitem\par
>   \startitem
> Programmer une fonction \m{A(x)} qui renvoie l'aire totale du
> terrain en fonction de la longueur \m{x}.
>   \stopitem
> \stopitemize
>   \stopitem
>   \startitem
> On considère la fonction suivante.
>
> \startitemize
>   \startitem
> Qu'affiche l'instruction ?
>   \stopitem\par
>   \startitem
> Interpréter les résultats renvoyés.
>   \stopitem
> \stopitemize
>   \stopitem
> \stopitemize
>   \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] [LMTX] error updating luametatex

2020-04-17 Thread Aditya Mahajan

On Thu, 16 Apr 2020, kaddour kardio wrote:


Pablo yes I meant 'mtxrun'.

Hans by googling about my issue I found a commentary by Aditya of the issue
on the git repos.


Which git repo?

I maintain the luametatex AUR for archlinux. So, if the install script 
asked you to run `mtx-run --generate` instead of `mtxrun --generate` then 
there is a typo somewhere.


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
___