Re: [NTG-context] Typing within doifmode leads to error

2021-03-18 Thread Aditya Mahajan
On Fri, 19 Mar 2021, Christoph Reller wrote:

> Hi,
> 
> Consider the following MWE:
> 
> \definetyping[T]
> \definemode[mode][yes]
> \starttext
> \doifmode{mode}{%
>   \startT
> Bla
>   \stopT}
> \stoptext
> 
> Compilation with the currently latest ConTeXt LMTX (ver: 2021.03.17 17:46
> LMTX  fmt: 2021.3.18) fails with:
> 
> tex error   > runaway error: end of file encountered
> mtx-context | fatal error: return code: 1
> 
> Compilation is successful if I replace doifmode{mode}{...} by
> \startmode[mode]...\stopmode.
> 
> Is there anything I'm missing? (This could be a bug.)

Has to be with how tex works. The argument of any macro (\doifmode{mode}{...} 
in this case) is scanned under the current catcode regime. So, any environment 
(like typing) which changes catcodes does work inside the argument to another 
macro. 

So, either use the environment version of \doifmode (which doesn't _capture_ it 
content):

\definetyping[T]
\definemode[mode][yes]
\starttext
\startmode[mode]
  \startT
Bla
  \stopT
\stopmode
\stoptext

Or use buffers (to avoid catcode all together):

\definetyping[T]
\definemode[mode][yes]
\starttext
\startbuffer[code]
\startT
Bla
\stopT
\stopbuffer

\doifmode{mode}{\getbuffer[code]}
\stoptext

or (note type**T**buffer so that the output is formatting according to the 
options of \definetyping[T])

\definetyping[T]
\definemode[mode][yes]
\starttext
\startbuffer[code]
Bla
\stopbuffer

\doifmode{mode}{\typeTbuffer[code]}
\stoptext

Perhaps this should be added to the FAQ on the wiki.

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] Typing within doifmode leads to error

2021-03-18 Thread Christoph Reller
Hi,

Consider the following MWE:

\definetyping[T]
\definemode[mode][yes]
\starttext
\doifmode{mode}{%
  \startT
Bla
  \stopT}
\stoptext

Compilation with the currently latest ConTeXt LMTX (ver: 2021.03.17 17:46
LMTX  fmt: 2021.3.18) fails with:

tex error   > runaway error: end of file encountered
mtx-context | fatal error: return code: 1

Compilation is successful if I replace doifmode{mode}{...} by
\startmode[mode]...\stopmode.

Is there anything I'm missing? (This could be a bug.)

Cheers,

Christoph Reller
___
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] lmt_followtext and cycle

2021-03-18 Thread Hans Hagen

On 3/18/2021 10:26 PM, Pablo Rodriguez wrote:

Hans,

I’m afraid that lmt_followtext has problems with cycle again.

  \starttext
  \startMPcode{doublefun}
   path p ; p := (0,0)..(3,3.5)..(9,-3.5)..
 (12,0)..(9,3.5)..(3,-3.5)..cycle;
   draw p xsized TextWidth ;
   draw lmt_followtext [
   text = "\dorecurse{9}{Just random text · } ",
   path = p,
   autoscaleup = "max",
   reverse=true,
   ] xsized TextWidth ;
  \stopMPcode
  \stoptext
You can't expect two overlayed graphics to know of each others 
independent applied scaling. So you need to do this:


 \starttext
 \startMPcode{doublefun}
  path p ; p := (0,0)..(3,3.5)..(9,-3.5).. 
(12,0)..(9,3.5)..(3,-3.5)..cycle;

  p := p xsized TextWidth;
  draw p ;
  draw lmt_followtext [
  text = "\dorecurse{9}{Just random text· }",
  path = p,
  autoscaleup = "max",
  reverse=true,
  ] ;
 \stopMPcode
 \stoptext


-
  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] Ligatures missing with Times New Roman

2021-03-18 Thread denis.maier
Thanks, that solved it.

Denis

-Ursprüngliche Nachricht-
Von: ntg-context  Im Auftrag von Wolfgang Schuster
Gesendet: Donnerstag, 18. März 2021 17:44
An: mailing list for ConTeXt users 
Betreff: Re: [NTG-context] Ligatures missing with Times New Roman

Hans Hagen schrieb am 18.03.2021 um 17:00:
> On 3/18/2021 4:12 PM, denis.ma...@ub.unibe.ch wrote:
>> Ok. But where are they coming from in Word? I'm on Windows.
> 
> i don't see them in word when i enter 'effe' and select times, but i 
> admit that my knowledge of word is zero so


\definefontfeature [default] [default] [dlig=yes]

\definefontfamily [times] [rm] [Times New Roman]

\setupbodyfont[times]

\starttext

ff fi  fl ffi ffl

\utfchar{"FB00}
\utfchar{"FB01}
\utfchar{"FB02}
\utfchar{"FB03}
\utfchar{"FB04}

\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
___
___
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] lmt_followtext and cycle

2021-03-18 Thread Pablo Rodriguez
Hans,

I’m afraid that lmt_followtext has problems with cycle again.

 \starttext
 \startMPcode{doublefun}
  path p ; p := (0,0)..(3,3.5)..(9,-3.5)..
(12,0)..(9,3.5)..(3,-3.5)..cycle;
  draw p xsized TextWidth ;
  draw lmt_followtext [
  text = "\dorecurse{9}{Just random text · } ",
  path = p,
  autoscaleup = "max",
  reverse=true,
  ] xsized TextWidth ;
 \stopMPcode
 \stoptext

Many thanks for your help,

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] working on page refs with MP

2021-03-18 Thread Hans Hagen

On 3/18/2021 6:14 PM, Werner Hennrich wrote:


metafun > log >
metafun > log > error: Improper subscript has been replaced by zero
metapost    > log > <*> ... numeric numFirst; numFirst := \ref [page]
watch closely to the previous log line ... you're missing quotes so mp 
sees \ref [page] and as it ignores a \ it sees ref[page] which unless 
you defined 'ref' and 'page' triggers an error


-
  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] Math: Nested Cases?

2021-03-18 Thread Aditya Mahajan
On Thu, 18 Mar 2021, Weber, Matthias wrote:

> Hello,
> 
> Is it possible to nest cases in math, like so:

In principle, it should be. But we never tested this and I suspect that there 
is some macro which doesn't get initialized correctly in nested cases. 

> \starttext
> \startformula
> x=
>\startcases[align={right,left},distance=3pt]
>\NC  a \NC =
>\startcases[align={right,left},distance=3pt]
>\NC  1 \NC  \text{case  a1} \NR
>\NC  2 \NC  \text{case  a2} \NR
>\stopcases
>\NR
>\NC b \NC =
>\startcases[align={right,left},distance=3pt]
>\NC  3 \NC  \text{case  b3}\NR
>\NC 4  \NC  \text{case  b4}\NR
>\stopcases
>\NR
>\stopcases
> \stopformula
> \stoptext
> 
> I get an error about a missing $ when I try a nested start/stop-cases.

The missing $ error is because the cases environment uses two column separators 
(for the second column): \NC for "normal text column" and \MC for "math 
column". This is so that in the typical case, you can just use:

\startformula
  x = \startcases
  \NC 1 \NC case $a_1$ \NR
  \NC 2 \NC case $a_2$ \NR
  \stopcases
\stopformula

So, in your cases, you should have used:

\starttext
\startformula
x=
   \startcases[align={right,left},distance=3pt]
   \NC  a \MC =
   \startcases[align={right,left},distance=3pt]
   \NC  1 \NC  case  a1 \NR
   \NC  2 \NC  case  a2 \NR
   \stopcases
   \NR
   \NC b \MC =
   \startcases[align={right,left},distance=3pt]
   \NC  3 \NC  case  b3\NR
   \NC 4  \NC  case  b4\NR
   \stopcases
   \NR
   \stopcases
\stopformula
\stoptext


But, something goes wrong and that doesn't work either (with a different error 
message). I suspect that something is not getting initialized correctly at 
\startcases and will look into that. 

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] Math: Nested Cases?

2021-03-18 Thread Weber, Matthias
Hello,

Is it possible to nest cases in math, like so:

\starttext
\startformula
x=
   \startcases[align={right,left},distance=3pt]
   \NC  a \NC =
   \startcases[align={right,left},distance=3pt]
   \NC  1 \NC  \text{case  a1} \NR
   \NC  2 \NC  \text{case  a2} \NR
   \stopcases
   \NR
   \NC b \NC =
   \startcases[align={right,left},distance=3pt]
   \NC  3 \NC  \text{case  b3}\NR
   \NC 4  \NC  \text{case  b4}\NR
   \stopcases
   \NR
   \stopcases
\stopformula
\stoptext

I get an error about a missing $ when I try a nested start/stop-cases.

Thanks,

Matthias
___
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] working on page refs with MP

2021-03-18 Thread Werner Hennrich

Hello everyone,

I'm having page references and want to calc / draw 'Page x of y' for
some subsections in MP.
How can I pass 'em down so I end up with numbers to do calculations with?

   \setuplayout[header=15mm]
   \def\myHeader[#1]#2{
   \ignorespaces
   \getdummyparameters[ref=,next=,#1]
   \pagebreak[yes]
   \pagereference[\dummyparameter{ref}]
   \doassign[header][first=\dummyparameter{ref}]
   \doassign[header][next=\dummyparameter{next}]
   {\tfc\bf{#2}}\par
   \vskip3mm
   }
   \def\fillWithText[#1]{
   \dorecurse{#1}{
   \input tufte
   \input knuth
   }
   }
   \setupheadertexts[\setups{page:header}]%
   \startsetups page:header
   \setupMPvariables[hdrPgs]
   [curr=\pagenumber,
   first={\ref[page][\headerfirst]},
   next={\ref[page][\headernext]}]
   \framed[
   frame=off,
   background={hdrPgs}
   ]{}% all to be done in MP
   \stopsetups
   \defineoverlay[hdrPgs][\useMPgraphic{hdrPgs}]
   \startuseMPgraphic{hdrPgs}
   StartPage; % calc and draw 'Page x of y'
   numeric numCurr; numCurr := \MPvar{curr};
   string strFirst; strFirst := "\MPvar{first}";
   string strNext; strNext := "\MPvar{next}";
   message("===");
   message("MP_hdrPageNrs: curr="& tostring numCurr & ", sFirst="&
   strFirst & ", sNext="& strNext);
   % fails:
   numeric numFirst; numFirst := \MPvar{first};
   StopPage;
   \stopuseMPgraphic
   \starttext
   \myHeader[ref=a,next=b]{  AaAaAaAa}
   \fillWithText[10]
   \myHeader[ref=b,next=c]{  BbBbBbBbBb}
   \fillWithText[3]
   \myHeader[ref=c,next=d]{ c CcCcCcCc}
   \fillWithText[8]
   \myHeader[ref=c,next=last]{ d DdDdDdDdDd}
   \fillWithText[8]
   \pagebreak[yes]
   \pagereference[last]
   This is the last page, goodby
   \stoptext

metapost    > message : MP_hdrPageNrs: curr=1, sFirst=\ref
[page][a], sNext=\ref [page][b]
metafun > log >
metafun > log > error: Improper subscript has been replaced by zero
metapost    > log > <*> ... numeric numFirst; numFirst := \ref [page]
metafun > log >
metafun > log > A bracketed subscript must have a known numeric
value;

So MP gets the macro and tries array access... I tried \expanded,
\numeric, and resolving the page numbers via \ref[page][id] at the
various code levels - unsuccessfully so far - and out of wit now.

TIA, Werner


___
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] Ligatures missing with Times New Roman

2021-03-18 Thread Wolfgang Schuster

Hans Hagen schrieb am 18.03.2021 um 17:00:

On 3/18/2021 4:12 PM, denis.ma...@ub.unibe.ch wrote:

Ok. But where are they coming from in
Word? I'm on Windows.


i don't see them in word when i enter 'effe' and select times, but i 
admit that my knowledge of word is zero so



\definefontfeature [default] [default] [dlig=yes]

\definefontfamily [times] [rm] [Times New Roman]

\setupbodyfont[times]

\starttext

ff fi  fl ffi ffl

\utfchar{"FB00}
\utfchar{"FB01}
\utfchar{"FB02}
\utfchar{"FB03}
\utfchar{"FB04}

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


Re: [NTG-context] Ligatures missing with Times New Roman

2021-03-18 Thread Hans Hagen

On 3/18/2021 4:12 PM, denis.ma...@ub.unibe.ch wrote:

Ok. But where are they coming from in
Word? I'm on Windows.


i don't see them in word when i enter 'effe' and select times, but i 
admit that my knowledge of word is zero so


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] Ligatures missing with Times New Roman

2021-03-18 Thread denis.maier
Ok. But where are they coming from in
Word? I'm on Windows.

Von: Hans Hagen 
Gesendet: Donnerstag, 18. März 2021 15:43:45
An: mailing list for ConTeXt users; Maier, Denis Christian (UB)
Betreff: Re: [NTG-context] Ligatures missing with Times New Roman

On 3/18/2021 2:02 PM, denis.ma...@ub.unibe.ch wrote:
> Hi
>
> I’m have to use Times New Roman for a text, and I’m finding that
> ligatures don’t seem to work properly.
>
> \starttext
>
> \definedfont[name:timesnewromanpsmt*default at 12 pt]
>
> ff fl
>
> \definedfont[name:linlibertineo*default at 12 pt]
>
> ff fl
>
> \switchtobodyfont[pagella]
>
> ff fl
>
> \stoptext
>
> The ff and fl ligatures work out of the box with Linux Libertine O, and
> with TeX Gyre Pagella, but not with Times New Roman. I can use the
> ligatures in MS Word so the font has them, but I don’t see why they
> shouldn’t work with ConTeXt (LMTX).
the windows version hasn o such ligatures (it has a few arabic ones)

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] Ligatures missing with Times New Roman

2021-03-18 Thread Hans Hagen

On 3/18/2021 2:02 PM, denis.ma...@ub.unibe.ch wrote:

Hi

I’m have to use Times New Roman for a text, and I’m finding that 
ligatures don’t seem to work properly.


\starttext

\definedfont[name:timesnewromanpsmt*default at 12 pt]

ff fl

\definedfont[name:linlibertineo*default at 12 pt]

ff fl

\switchtobodyfont[pagella]

ff fl

\stoptext

The ff and fl ligatures work out of the box with Linux Libertine O, and 
with TeX Gyre Pagella, but not with Times New Roman. I can use the 
ligatures in MS Word so the font has them, but I don’t see why they 
shouldn’t work with ConTeXt (LMTX).

the windows version hasn o such ligatures (it has a few arabic ones)

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] Ligatures missing with Times New Roman

2021-03-18 Thread denis.maier
Hi

I'm have to use Times New Roman for a text, and I'm finding that ligatures 
don't seem to work properly.

\starttext
\definedfont[name:timesnewromanpsmt*default at 12 pt]
ff fl
\definedfont[name:linlibertineo*default at 12 pt]
ff fl
\switchtobodyfont[pagella]
ff fl
\stoptext

The ff and fl ligatures work out of the box with Linux Libertine O, and with 
TeX Gyre Pagella, but not with Times New Roman. I can use the ligatures in MS 
Word so the font has them, but I don't see why they shouldn't work with ConTeXt 
(LMTX).

Best
Denis
___
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] Add items to list with arbitrary page number

2021-03-18 Thread denis.maier
That's neat Hans. Thanks. Especially didn't know about \writedatatolist. 

What I want is basically to manually construct a toc entry, but in compliance 
with the overall styling of the contents list.

So, I was hoping for something like this?

\writetolist[chapter][location=here,pagenumber=4]{5}{It's a test}

Maybe I'm missing an easier way to achieve this?

Denis

P.S.: I don't really understand  what these \installXprocessor commands do. Is 
that documented somewhere?

-Ursprüngliche Nachricht-
Von: Hans Hagen  
Gesendet: Donnerstag, 18. März 2021 00:22
An: mailing list for ConTeXt users ; Maier, Denis Christian 
(UB) 
Betreff: Re: [NTG-context] Add items to list with arbitrary page number

On 3/17/2021 6:19 PM, denis.ma...@ub.unibe.ch wrote:
> Hi,
> 
> I need to add an item to a list with an arbitrary page number. (The 
> reason is that I have a multivolume book, and I want to add 
> information about the other books to the TOC)
> 
> I know about this:
> 
> \writetolist[section]{}{It's a test}
> 
> But how can you add an arbitrary page number ?
It all depends on what you want to do 


\starttext

\installstructurelistprocessor{chapter:userdata}
   {\startlinecorrection[blank]
\hfill \inframed{you really need to look at 
\structurelistuservariable{pagenumber}}%
\stoplinecorrection}

\placelist[chapter]

\chapter{one}

\writebetweenlist[chapter][location=here]{\blank page 4\blank}

\writedatatolist[chapter][location=here][pagenumber=4]

\writetolist[chapter]{}{It's a test}

\chapter{two}

\stoptext

wikifyable

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
___