[NTG-context] METAPOST subpath rounding issue

2020-05-07 Thread Gerben Wierda
I have a METAPOST algorithm that splits a path at a certain time in two, does 
something with both ends (not the ends where they were split) and then rejoins 
them.

In very rare cases this crashes, because the subpath doesn’t work as expected.

  firstPart := subpath (0,halfWayTime) of workingConn;
  secondPart := subpath (halfWayTime,pathTimeLen) of workingConn;

may sometimes result in something like this:

metapost log> >> Path at line 0:
metapost log> (273,-427)..controls (259.50,-427) and 
(246.013335,-427)
metapost log>  ..(232.520001,-427)
metapost log> 
metapost log> >> Path at line 0:
metapost log> (232.519998,-427)..controls (161.680001,-427) 
and (90.84000
metapost log> 03,-427)
metapost log>  ..(20,-427)

As can be seen in these (rare) cases the two calls to subpath result in a 
different point resulting from both. so, when I later try to rejoin them with & 
it fails:

metapost log> ! Paths don't touch; '&' will be changed to '..'.
metapost log>  

Which means subpath doesn’t always exactly do what I expect it to do (and many 
explanations, but not the official manual) state. Again, this is rare.

I’ve done this to work around it but I wondered if there was a better 
(reliable) solution

  save cutFirstPart; path cutFirstPart; cutFirstPart := firstPart 
maxcutbefore fromPicOutline;
  save cutSecondPart; path cutSecondPart; cutSecondPart := secondPart 
maxcutafter toPicOutline;
  if ((xpart point 0 of cutSecondPart) <> (xpart point infinity of 
cutFirstPart))
or ((ypart point 0 of cutSecondPart) <> (ypart point infinity of 
cutFirstPart)):
resultConn := cutFirstPart--cutSecondPart;
  else:
resultConn := cutFirstPart & cutSecondPart;
  fi

G___
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] METAPOST subpath rounding issue

2020-05-07 Thread ntg


> On 7 May 2020, at 20:28, Gerben Wierda  wrote:
> 
> I have a METAPOST algorithm that splits a path at a certain time in two, does 
> something with both ends (not the ends where they were split) and then 
> rejoins them.
> 
> In very rare cases this crashes, because the subpath doesn’t work as expected.
> 
>   firstPart := subpath (0,halfWayTime) of workingConn;
>   secondPart := subpath (halfWayTime,pathTimeLen) of workingConn;
> 
> may sometimes result in something like this:
> 
> metapost log> >> Path at line 0:
> metapost log> (273,-427)..controls (259.50,-427) and 
> (246.013335,-427)
> metapost log>  ..(232.520001,-427)
> metapost log> 
> metapost log> >> Path at line 0:
> metapost log> (232.519998,-427)..controls 
> (161.680001,-427) and (90.84000
> metapost log> 03,-427)
> metapost log>  ..(20,-427)
> 
> As can be seen in these (rare) cases the two calls to subpath result in a 
> different point resulting from both. so, when I later try to rejoin them with 
> & it fails:
> 
> metapost log> ! Paths don't touch; '&' will be changed to '..'.
> metapost log>  
> 
> Which means subpath doesn’t always exactly do what I expect it to do (and 
> many explanations, but not the official manual) state. Again, this is rare.
> 
> I’ve done this to work around it but I wondered if there was a better 
> (reliable) solution
> 
>   save cutFirstPart; path cutFirstPart; cutFirstPart := firstPart 
> maxcutbefore fromPicOutline;
>   save cutSecondPart; path cutSecondPart; cutSecondPart := secondPart 
> maxcutafter toPicOutline;
>   if ((xpart point 0 of cutSecondPart) <> (xpart point infinity of 
> cutFirstPart))
> or ((ypart point 0 of cutSecondPart) <> (ypart point infinity of 
> cutFirstPart)):
> resultConn := cutFirstPart--cutSecondPart;
>   else:
> resultConn := cutFirstPart & cutSecondPart;
>   fi

A crude test of 

  path pb;
  pb:=(5.5cm,0cm)--(5.5cm,0cm)--(10.5cm,0cm);
  draw pb;

gives no errors so why not just join using -- all the time and save the test?

--
Bruce Horrocks
Hampshire, UK

___
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] mkiv digits/units zero padding not working

2020-05-07 Thread Benjamin Buchmuller
Following up on the work-around, here is my improved code for xtable.

What doesn’t work is:

* alignment on the decimal separator takes place only in the first column with 
decimals (i.e. B), not on the  following one; this is independent of R1 having 
a decimal value in this column or not

* row spanning is now tricky since the width of the header column is taken for 
the first of the three rows spanned, which becomes even more complicated with 
option=stretch, I guess if I right align the second column and would phantomize 
the hsize of the header, this could work with a bit of optimization.

What I like about this approach however is that one could read the two 
arguments from a CSV file, which would save a lot of typing (and to manually 
specify the padding).

\def\mpm#1#2{
\doifsomethingelse{#2}{
\startxcell[align=left] \digits{#1} \stopxcell
\startxcell ± \stopxcell
\startxcell \digits{#2} \stopxcell
}{
\startxcell[align=left] \digits{#1} \stopxcell
\startxcell \stopxcell
\startxcell \digits{#2} \stopxcell
}
}

\startxtable[split=repeat, aligncharacter=yes, alignmentcharacter={.}]

\startxtablehead
\startxrow[topframe=on, foregroundstyle=bold]
\startxcell A \stopxcell
\startxcell[align=left, nx=3] Bla bla bla bla bla bla bla bla 
\stopxcell
\startxcell C \stopxcell
\stopxrow
\stopxtablehead

\startxtablebody
\startxrow[topframe=on]
\startxcell R1 \stopxcell
\mpm{12.3}{}%{1.5}
\startxcell one \stopxcell
\stopxrow

\startxrow
\startxcell R2 \stopxcell
\mpm{0.01}{0.023}
\startxcell two \stopxcell
\stopxrow

\startxrow
\startxcell R3 \stopxcell
\mpm{2.3}{0.1}
\startxcell three\stopxcell
\stopxrow

\stopxtablebody

\stopxtable 

> On 7 May 2020, at 21:22, Benjamin Buchmuller  
> wrote:
> 
> Hi Wolfgang,
> 
> you are (of course) right again. I realised that I wouldn’t get the expected 
> behaviour after checking the snippet isolated from my document’s context, 
> where it is embedded in a \startplacetable[…]{}{}. I’m still learning to get 
> the gist of the \doifs, the curly and square bracketed arguments and so on. 
> Thanks for the hint! 
> 
> Seems like I’m going to make three cells and span the header column for now, 
> though I guess it would be a nice feature to have the padding working in the 
> other cases.
> 
> I’ll write a feature request for no 4.
> 
> Thanks!
> 
> 
>> On 7 May 2020, at 20:00, Wolfgang Schuster 
>>  wrote:
>> 
>> Benjamin Buchmuller schrieb am 07.05.2020 um 19:41:
>>> Hi Wolfang,
>>> Thank you for your reply. I have indeed not explained my intended result 
>>> very clearly.
>>> 1.
>>> Primarily, I need to get the two values aligned at the digit separator of 
>>> the first and second number respectively and overall at the ± sign. I’m 
>>> working in an xtable, where I have entries such as
>>> \startxcell \mpm{14.0==}{_1.5==} \stopxcell
>>> \startxcell \mpm{_0.034}{_0.013} \stopxcell
>>> and defined
>>> \def\mpm#1#2{
>>> \ifsecondargument
>>> \digits{#1}\,±\,\digits{#2}%
>>> \else
>>> \digits{#1}%
>>> \fi
>>> }
>> 
>> Is there something missing in here because the \ifsecondargument check here 
>> makes non sense because the second argument is mandatory and not optional.
>> 
>> Is this what you want?
>> 
>> \define[2]\mpm
>> {\digits{#1}%
>>  \doifsomething{#2}{\,±\,\digits{#2}}}
>> 
>>> Since I was hoping that I could exploit the zeropadding of \digits to get 
>>> the format right. Indeed, it would save a lot of typing, if I wouldn’t have 
>>> to specify the padding manually and I vaguely recall that there is 
>>> somewhere a ConTeXt solution that can make such alignments, but I simply 
>>> can’t find it any more …
>> 
>> You can align number on the decimal point (comma) but this works only when 
>> you have only one number in a cell.
>> 
>> \starttext
>> 
>> \startxtable[aligncharacter=yes,alignmentcharacter=±]
>>   \startxrow
>>   \startxcell
>>   \digits {14.0} ± \digits {1.5}
>>   \stopxcell
>>   \stopxrow
>>   \startxrow
>>   \startxcell
>>   \digits {0.034} ± \digits {0.013}
>>   \stopxcell
>>   \stopxrow
>> \stopxtable
>> 
>> \stoptext
>> 
>>> 2. + 3.
>>> Absolutely right, this is my bad. I have badly mixed from Hans’ solution to 
>>> a similar problem,
>>> https://www.mail-archive.com/ntg-context@ntg.nl/msg00724.html
>>> which was actually \def\zeroamount{-} and the example in the source, I 
>>> didn’t read properly. Just skip that part. :)
>> 
>> The message is from 2003!
>> 
>>> 4.
>>> Indeed,
>>> \startxcell \mpm{14.==}{_1.5=} \stopxcell
>>> 

[NTG-context] mkiv \digits{2.0=} zero padding feature request

2020-05-07 Thread Benjamin Buchmuller
Hi,


As Wolfgang has figured out, zero padding in \digits only works for trailing 
(and omitted) zeroes when immediately preceded by the decimal separator.

It would be nice if this would work even if there is a number preceding, so that

\digits{3.1=}x\crlf
\digits{3.==}x\crlf
\digits{3.14}x

would align at the decimal separator when right aligned. This is useful in some 
circumstances, where the number of significant digits varies between sources, 
so that one needs to typset for example 

\digits{3.1=}±\digits{0.5}\crlf
\digits{3.28}±\digits{0.12}


Thanks!


Benjamin
___
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] mkiv digits/units zero padding not working

2020-05-07 Thread Benjamin Buchmuller
Hi Wolfgang,

you are (of course) right again. I realised that I wouldn’t get the expected 
behaviour after checking the snippet isolated from my document’s context, where 
it is embedded in a \startplacetable[…]{}{}. I’m still learning to get the gist 
of the \doifs, the curly and square bracketed arguments and so on. Thanks for 
the hint! 

Seems like I’m going to make three cells and span the header column for now, 
though I guess it would be a nice feature to have the padding working in the 
other cases.

I’ll write a feature request for no 4.

Thanks!


> On 7 May 2020, at 20:00, Wolfgang Schuster 
>  wrote:
> 
> Benjamin Buchmuller schrieb am 07.05.2020 um 19:41:
>> Hi Wolfang,
>> Thank you for your reply. I have indeed not explained my intended result 
>> very clearly.
>> 1.
>> Primarily, I need to get the two values aligned at the digit separator of 
>> the first and second number respectively and overall at the ± sign. I’m 
>> working in an xtable, where I have entries such as
>> \startxcell \mpm{14.0==}{_1.5==} \stopxcell
>> \startxcell \mpm{_0.034}{_0.013} \stopxcell
>> and defined
>> \def\mpm#1#2{
>>  \ifsecondargument
>>  \digits{#1}\,±\,\digits{#2}%
>>  \else
>>  \digits{#1}%
>>  \fi
>> }
> 
> Is there something missing in here because the \ifsecondargument check here 
> makes non sense because the second argument is mandatory and not optional.
> 
> Is this what you want?
> 
> \define[2]\mpm
>  {\digits{#1}%
>   \doifsomething{#2}{\,±\,\digits{#2}}}
> 
>> Since I was hoping that I could exploit the zeropadding of \digits to get 
>> the format right. Indeed, it would save a lot of typing, if I wouldn’t have 
>> to specify the padding manually and I vaguely recall that there is somewhere 
>> a ConTeXt solution that can make such alignments, but I simply can’t find it 
>> any more …
> 
> You can align number on the decimal point (comma) but this works only when 
> you have only one number in a cell.
> 
> \starttext
> 
> \startxtable[aligncharacter=yes,alignmentcharacter=±]
>\startxrow
>\startxcell
>\digits {14.0} ± \digits {1.5}
>\stopxcell
>\stopxrow
>\startxrow
>\startxcell
>\digits {0.034} ± \digits {0.013}
>\stopxcell
>\stopxrow
> \stopxtable
> 
> \stoptext
> 
>> 2. + 3.
>> Absolutely right, this is my bad. I have badly mixed from Hans’ solution to 
>> a similar problem,
>> https://www.mail-archive.com/ntg-context@ntg.nl/msg00724.html
>> which was actually \def\zeroamount{-} and the example in the source, I 
>> didn’t read properly. Just skip that part. :)
> 
> The message is from 2003!
> 
>> 4.
>> Indeed,
>> \startxcell \mpm{14.==}{_1.5=} \stopxcell
>> \startxcell \mpm{_0.03}{_0.01} \stopxcell
>> aligns properly. But sometimes, I have the first digit specified, but not 
>> the second and unfortunately this doesn’t work
>> \startxcell \mpm{14.5=}{_1.5=} \stopxcell
>> \startxcell \mpm{_0.03}{_0.01} \stopxcell
>> because = is not immediately preceded by .
> 
> Can you write another mail with a request for this.
> 
> 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] mkiv digits/units zero padding not working

2020-05-07 Thread Wolfgang Schuster

Benjamin Buchmuller schrieb am 07.05.2020 um 19:41:

Hi Wolfang,

Thank you for your reply. I have indeed not explained my intended result very 
clearly.

1.

Primarily, I need to get the two values aligned at the digit separator of the 
first and second number respectively and overall at the ± sign. I’m working in 
an xtable, where I have entries such as

\startxcell \mpm{14.0==}{_1.5==} \stopxcell
\startxcell \mpm{_0.034}{_0.013} \stopxcell

and defined

\def\mpm#1#2{
\ifsecondargument
\digits{#1}\,±\,\digits{#2}%
\else
\digits{#1}%
\fi
}


Is there something missing in here because the \ifsecondargument check 
here makes non sense because the second argument is mandatory and not 
optional.


Is this what you want?

\define[2]\mpm
  {\digits{#1}%
   \doifsomething{#2}{\,±\,\digits{#2}}}


Since I was hoping that I could exploit the zeropadding of \digits to get the 
format right. Indeed, it would save a lot of typing, if I wouldn’t have to 
specify the padding manually and I vaguely recall that there is somewhere a 
ConTeXt solution that can make such alignments, but I simply can’t find it any 
more …


You can align number on the decimal point (comma) but this works only 
when you have only one number in a cell.


\starttext

\startxtable[aligncharacter=yes,alignmentcharacter=±]
\startxrow
\startxcell
\digits {14.0} ± \digits {1.5}
\stopxcell
\stopxrow
\startxrow
\startxcell
\digits {0.034} ± \digits {0.013}
\stopxcell
\stopxrow
\stopxtable

\stoptext


2. + 3.

Absolutely right, this is my bad. I have badly mixed from Hans’ solution to a 
similar problem,

https://www.mail-archive.com/ntg-context@ntg.nl/msg00724.html

which was actually \def\zeroamount{-} and the example in the source, I didn’t 
read properly. Just skip that part. :)


The message is from 2003!


4.

Indeed,

\startxcell \mpm{14.==}{_1.5=} \stopxcell
\startxcell \mpm{_0.03}{_0.01} \stopxcell

aligns properly. But sometimes, I have the first digit specified, but not the 
second and unfortunately this doesn’t work

\startxcell \mpm{14.5=}{_1.5=} \stopxcell
\startxcell \mpm{_0.03}{_0.01} \stopxcell

because = is not immediately preceded by .


Can you write another mail with a request for this.

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] mkiv digits/units zero padding not working

2020-05-07 Thread Benjamin Buchmuller
Hi Wolfang,

Thank you for your reply. I have indeed not explained my intended result very 
clearly. 

1. 

Primarily, I need to get the two values aligned at the digit separator of the 
first and second number respectively and overall at the ± sign. I’m working in 
an xtable, where I have entries such as

\startxcell \mpm{14.0==}{_1.5==} \stopxcell
\startxcell \mpm{_0.034}{_0.013} \stopxcell

and defined 

\def\mpm#1#2{
\ifsecondargument
\digits{#1}\,±\,\digits{#2}%
\else
\digits{#1}%
\fi
}

Since I was hoping that I could exploit the zeropadding of \digits to get the 
format right. Indeed, it would save a lot of typing, if I wouldn’t have to 
specify the padding manually and I vaguely recall that there is somewhere a 
ConTeXt solution that can make such alignments, but I simply can’t find it any 
more …

2. + 3.

Absolutely right, this is my bad. I have badly mixed from Hans’ solution to a 
similar problem, 

https://www.mail-archive.com/ntg-context@ntg.nl/msg00724.html

which was actually \def\zeroamount{-} and the example in the source, I didn’t 
read properly. Just skip that part. :)

4. 

Indeed, 

\startxcell \mpm{14.==}{_1.5=} \stopxcell
\startxcell \mpm{_0.03}{_0.01} \stopxcell

aligns properly. But sometimes, I have the first digit specified, but not the 
second and unfortunately this doesn’t work

\startxcell \mpm{14.5=}{_1.5=} \stopxcell
\startxcell \mpm{_0.03}{_0.01} \stopxcell

because = is not immediately preceded by .



> On 7 May 2020, at 18:21, Wolfgang Schuster 
>  wrote:
> 
> Benjamin Buchmuller schrieb am 07.05.2020 um 17:31:
>> Hi,
>> I’m trying to get
>> \digits{15.0=}±\digits{1.00}
>> \digits{_8.12}±\digits{0.34}
>> horizontally aligned as
>> 15.0 ±1.00
>>  8.12±0.34
>> But I get
>> 15.0±1.00
>>  8.12±0.34
>> instead.
>> From the source (phys-dim.mkiv), I can see that “=“ should expand to 
>> \hphantom{0}. (I think \zeropoint in the table is outdated, since 
>> \def\zeropoint\hphantom{0} does not solve the problem either.)
> 
> 1. Which table?
> 
> 2. This is not how \def works.
> 
> 3. When you redefine \zeropoint (which isn't a macro) you're going to break 
> everything.
> 
>> I can’t use tabulate or alignment in math mode for this problem 
>> unfortunately.
> 
> I looked at the code and the problem is = can only be used to insert space 
> for two digits (e.g. 100.==).
> 
> 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] mkiv digits/units zero padding not working

2020-05-07 Thread Wolfgang Schuster

Benjamin Buchmuller schrieb am 07.05.2020 um 17:31:

Hi,

I’m trying to get

\digits{15.0=}±\digits{1.00}

\digits{_8.12}±\digits{0.34}

horizontally aligned as

15.0 ±1.00
  8.12±0.34

But I get

15.0±1.00
  8.12±0.34

instead.

 From the source (phys-dim.mkiv), I can see that “=“ should expand to 
\hphantom{0}. (I think \zeropoint in the table is outdated, since 
\def\zeropoint\hphantom{0} does not solve the problem either.)


1. Which table?

2. This is not how \def works.

3. When you redefine \zeropoint (which isn't a macro) you're going to 
break everything.



I can’t use tabulate or alignment in math mode for this problem unfortunately.


I looked at the code and the problem is = can only be used to insert 
space for two digits (e.g. 100.==).


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] Compile only one new component in a project

2020-05-07 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 07.05.2020 um 17:21:

Hi Aditya,
It does not work ; the compilation encounters errors with each command 
that I created. I guess it comes from the components.


You have to load all environment files in your components.

In your case where you use multiple files you can use
a project file where you load all environments and load
then the project file in your product and component files.


##chapter-4-seconde.tex##

\startcomponent chapter-4-seconde


Add here

\environment ...

or

\project ...


\startchapter[title=]
...
\stopchapter

\stopcomponent


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] mkiv digits/units zero padding not working

2020-05-07 Thread Benjamin Buchmuller
Hi,

I’m trying to get

\digits{15.0=}±\digits{1.00}

\digits{_8.12}±\digits{0.34}

horizontally aligned as

15.0 ±1.00
 8.12±0.34

But I get

15.0±1.00
 8.12±0.34

instead.

From the source (phys-dim.mkiv), I can see that “=“ should expand to 
\hphantom{0}. (I think \zeropoint in the table is outdated, since 
\def\zeropoint\hphantom{0} does not solve the problem either.)

I can’t use tabulate or alignment in math mode for this problem unfortunately.

Any hints would be very welcome.

Thanks


Benjamin
___
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 only one new component in a project

2020-05-07 Thread Fabrice Couvreur
Hi Aditya,
It does not work ; the compilation encounters errors with each command that
I created. I guess it comes from the components.
Fabrice

##chapter-4-seconde.tex##

\startcomponent chapter-4-seconde

\startchapter[title=]
...
\stopchapter

\stopcomponent


Le jeu. 7 mai 2020 à 16:01, Aditya Mahajan  a écrit :

> On Thu, 7 May 2020, Fabrice Couvreur wrote:
>
> > Hi,
> > Here is part of a project that is starting to be heavy ; when i add a
> > chapter i do context seconde.tex
> > How do I compile only the chapter I just added ?
> > Thank you.
> > Fabrice
> >
> > \startproduct Seconde
> >
> > \environment modules
> > \environment specialite-style
> > \environment specialite-macros
> >
> >  \startfrontmatter
> >  \component specialite-titlepage
> >  \component specialite-contents
> >  \stopfrontmatter
> >
> >  \startbodymatter
> >\component chapter-1-seconde
> >\component chapter-2-seconde
> >\component chapter-3-seconde
> >\component chapter-4-seconde
> >  \stopbodymatter
> > \stopproduct
>
> context chapter-4-seconde
>
> There is a MyWay which shows how you can share cross-refs etc.
>
> 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
>
> ___
>
___
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] Retrieving original value of enviroment variable HOME

2020-05-07 Thread context

Hello Hans,

- I would need to work with the original value in run-time (Win7 / 
WinX; ConTeXt MkIV).

I'll add

  environment.oldhome

being the original one (but no testing done here)


would be great, thank you!

I guess it will be available over the night (= ConTeXt latest)?

Lukas


Hans

___
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 only one new component in a project

2020-05-07 Thread Aditya Mahajan

On Thu, 7 May 2020, Fabrice Couvreur wrote:


Hi,
Here is part of a project that is starting to be heavy ; when i add a
chapter i do context seconde.tex
How do I compile only the chapter I just added ?
Thank you.
Fabrice

\startproduct Seconde

\environment modules
\environment specialite-style
\environment specialite-macros

 \startfrontmatter
 \component specialite-titlepage
 \component specialite-contents
 \stopfrontmatter

 \startbodymatter
   \component chapter-1-seconde
   \component chapter-2-seconde
   \component chapter-3-seconde
   \component chapter-4-seconde
 \stopbodymatter
\stopproduct


context chapter-4-seconde

There is a MyWay which shows how you can share cross-refs etc.

Aditya
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Compile only one new component in a project

2020-05-07 Thread Fabrice Couvreur
Hi,
Here is part of a project that is starting to be heavy ; when i add a
chapter i do context seconde.tex
How do I compile only the chapter I just added ?
Thank you.
Fabrice

\startproduct Seconde

\environment modules
\environment specialite-style
\environment specialite-macros

  \startfrontmatter
  \component specialite-titlepage
  \component specialite-contents
  \stopfrontmatter

  \startbodymatter
\component chapter-1-seconde
\component chapter-2-seconde
\component chapter-3-seconde
\component chapter-4-seconde
  \stopbodymatter


\stopproduct
___
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] \placetable[location=split] reference ??

2020-05-07 Thread Benjamin Buchmuller
Okay, I found the solution myself: Need to specify \startxtable[split=repeat] 
or else. 

It’s actually a bit surprising that the value of the “outer” enivornment 
(placetable) depends on the settings in the inner one (xtable). I speculate 
this might be because the order of the tables might be different as soon as 
xtable tries to place them …

Cheers

\startplacetable[reference=tab1,title={A table},location=split]
\startxtable[split=repeat]
\startxrow
\startxcell hi \stopxcell
\stopxrow
\stopxtable
\stopplacetable


> On 22 Apr 2020, at 21:10, Benjamin Buchmuller  
> wrote:
> 
> Hi,
> 
> I would like to reference a table of the following structure. 
> 
> \starttext
> 
> \startplacetable[reference=tab1,title={A table},location=split]
> \startxtable
> \startxrow
> \startxcell hi \stopxcell
> \stopxrow
> \stopxtable
> \stopplacetable
> 
> In Table \in[tab1]
> 
> \stoptext
> 
> 
> It has [location=split], which I need this because xtable doesn’t like to be 
> placed without a split; and apparently neither does it accept the 
> \placetable[ref]{...} syntax. However, the reference is now no longer 
> detected.
> 
> I can see that the split table’s caption is about to become "Table 1.a.", 
> "Table 1.b" etc. and I appreciate that this is potentially a quite complex 
> mechanism anyways, but if there was any chance to  get a reference as “Table 
> 1”, I would be helped a lot.
> 
> On similar lines, is there a way to have “Table 1 (continued).” in the 
> caption?
> 
> Cheers
> 
> 
> Benjamin
> 
> 

___
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] long caption in 2-page spread

2020-05-07 Thread jbf
After trying Hraban's two suggestions to resolve the problem of a 
caption ('title=') for an image across a two-page spread (and I have 
tried a variety of adaptations of those two possible solutions), I still 
have not resolved the issue.


To repeat what Hans gave me, to resolve the 2-page spread in the first 
instance:


\startpostponing
    \setuppagenumbering[state=stop]
    \startspread
    \startplacefigure[location=here,title={This is a cow!}]
    \externalfigure[cow.pdf][height=\textheight]%
    \stopplacefigure
    \stopspread
    \setuppagenumbering[state=start]
\stoppostponing

The problem I have is that the figure has a title/caption much longer 
than 'This is a cow', and the end result is that it commences on the 
verso page but then runs across (repeats, part of it) on the recto page. 
Hraban suggests, first of all:


title={\hbox to \textwidth{\vbox{Your lengthy caption}}}

but this results in the first part of the caption properly located 
left-flushed on the verso page, and the other part right-flushed (and to 
the right of the figure, so running off the page) on the recto page.


The second solution is

title={\framedtext[width=\textwidth,frame=off,align=right]{Your lengthy 
caption}}

and this almost works, but this time part of the caption repeats on the 
left  of the recto page more or less within the inner margin, so I can 
live with that, knowing that it will not be visible ultimately at the 
binding stage.


Of course, what I really want to achieve is that the caption (aka 
'title') appears either on the verso or the recto page, but not both. Is 
that achievable? The actual coding for all this as I have it at the 
moment is as follows:


\startpostponing
    \setuppagenumbering[state=stop]
    \startspread
    \startplacefigure[location=here,title={{\sc Plates 12/13.} 
\switchtobodyfont[9.5pt] My very, very,_very long\\ caption for this_ 
figure}]

    \externalfigure[plate12-13.jpg][height=.8\textheight]%
    \stopplacefigure
    \stopspread
    \setuppagenumbering[state=start]
\stoppostponing

but

..._very long caption_
_for this _...

is repeated on the recto page. This is what I want to avoid.
Julian

On 5/5/20 4:18 pm, Henning Hraban Ramm wrote:

Am 05.05.2020 um 03:31 schrieb jbf :

The following excellent solution (see below) to a 2-page spread of an image was 
given me by Hans (I had been completely unaware of the command \startspread. It 
appears to be recent and undocumented, but it certainly simplifies matters).

But in my case the title is a lengthy sentence, rather than the 4-word 'This is 
a cow'. And even though I have been able to split the line, e.g. title={this is 
my very, very, very,\\ very etc. etc. long title}, what happens is that part of 
the caption still appears on the right-hand page of the spread.

Is there a way that I can limit the appearance of the caption to just one (the 
left-hand) page? In other words, so the figure is spread but not the caption? 
Or alternatively, have the caption neatly split across the two pages with 
appropriate space inbetween? I tried various combinations, including an \hfill 
halfway through the title, but to no avail. Perhaps this is asking too much, 
but there may be a workaround.

I guess you need something like

title={\hbox to \textwidth{\vbox{Your lengthy caption}}}

or

title={\framedtext[width=\textwidth,frame=off,align=right]{Your lengthy 
caption}}


HTH
Hraban
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___
___
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] Retrieving original value of enviroment variable HOME

2020-05-07 Thread Hans Hagen

On 5/6/2020 5:43 PM, cont...@vivaldi.net wrote:

Hello,

before I run ConTeXt, I set a (new) variable "HOME" to point to a 
particular directory.


ConTeXt changes its value during startup - it sets its value to 
%USERPROFILE% - I guess it is to unify environment somehow for all 
platforms ConTeXt supports; probably here:


 data-ini.lua, ln. ~86
do

     local homedir = osgetenv(ostype == "windows" and 'USERPROFILE' or 
'HOME') or ''


     if not homedir or homedir == "" then
     homedir = char(127) -- we need a value, later we wil trigger on it
     end

     homedir = file.collapsepath(homedir)

     ossetenv("HOME",   homedir) -- can be used in unix cnf files 
<< HERE

     ossetenv("USERPROFILE",homedir) -- can be used in windows cnf files

     environment.homedir = homedir

end


But anyway - would it be possible to store the original value of HOME 
environment variable (if set) before it gets changed during 
initialization - e.g. to a Lua table?


- I would need to work with the original value in run-time (Win7 / WinX; 
ConTeXt MkIV).

I'll add

  environment.oldhome

being the original one (but no testing done here)

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
___