Re: [NTG-context] Using ConTeXt-LMTX for modern Mathematically-Literate-Programming 1/2

2020-12-03 Thread Stephen Gaito
Taco,

Thanks for your comments... see below...

On Thu, 3 Dec 2020 12:15:46 +0100
Taco Hoekwater  wrote:

> > On 3 Dec 2020, at 11:35, Stephen Gaito 
> > wrote:
> > 
> > Hans,
> > 
> > As I said my desktop is elderly... it has a 2.8GHz processor, 16Gb
> > of DDR3 memory, and a couple of old SATA1 hard disks, and only 3Mb
> > of CPU cache...
> > 
> > ... all well past its use by date for single threaded ConTeXt. ;-(
> > 
> > So one way to get better performance for ConTeXt is to invest in a
> > new ultra fast processor. Which will cost a lot, and use a lot of
> > power which has to be cooled, which uses even more power  
> 
> Startup time can be improved quite a bit with an SSD. Even a cheap
> SATA SSD is already much faster than a traditional harddisk. Doesn’t
> help with longer documents, but it could be a fairly cheap upgrade.
> 
> I can’t comment on how to speed up the rest of what you are doing,
> but generally multi-threading TeX typesetting jobs is so hard as to
> be impossible in practise. About the only step that can be split off
> is the generation of the PDF, and even there the possible gain is 
> quite small (as you noticed already).
> 
> Typesetting is a compilation job, so the two main ways to speed things
> along are
> 
> 1) split the source into independent tasks, like in a code compiler
>that splits code over separate .c / .cpp / .m / .p etc. files,
>and then combine the results (using e.g. mutool)
> 

This is basically my approach... *However*, while the dependency graph
for a standard compilation has been engineered to be an acyclic tree,
for a ConTeXt "compilation", the "*.tex" file has a cyclic dependency
on the (generated) "*.tuc" file.

Basically my parallelization "build manager" has to unroll or other
wise reimplement the mtx-context.lua 

```
  for currentrun=1,maxnofruns do
...
  end
```

loop until the `multipass_changed(oldhash,newhash)` returns `false`.

Followed by a "pdf-linking" stage (possibly implemented, as you suggest,
by `mutool`) 

Not great but it might work... (and I am willing to give it a
try)...

> 2) precompile recurring stuff (in TeX, that would mean embedding
>separately generated pdfs or images)
> 
> Best wishes,
> Taco
> 
> 
> 
> 
> 
> ___
> 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] Using ConTeXt-LMTX for modern Mathematically-Literate-Programming 1/2

2020-12-03 Thread Hans Hagen

On 12/3/2020 12:15 PM, Taco Hoekwater wrote:




On 3 Dec 2020, at 11:35, Stephen Gaito  wrote:

Hans,

As I said my desktop is elderly... it has a 2.8GHz processor, 16Gb of
DDR3 memory, and a couple of old SATA1 hard disks, and only 3Mb of CPU
cache...

... all well past its use by date for single threaded ConTeXt. ;-(

So one way to get better performance for ConTeXt is to invest in a new
ultra fast processor. Which will cost a lot, and use a lot of power
which has to be cooled, which uses even more power


Startup time can be improved quite a bit with an SSD. Even a cheap SATA
SSD is already much faster than a traditional harddisk. Doesn’t help
with longer documents, but it could be a fairly cheap upgrade.


also, an empty context run

\starttext
\stoptext

only takes 0.490 seconds on my machine, which means:

- starting mtxrun, which includes quite a bit of lua plus loading the
file database etc
- loading mtx-context that itself does some checking
- and then launches the engine (it could be intgerated but then we run 
into issues when we have fatal errors as well as initializations so in 
the end it doesn't pay off at all)
- the tex runs means: loading the format and initializing hundreds of 
lua scripts including all kind of unicode related stuff


so, the .5 sec is quite acceptable to me and i knwo that when i would 
have amore recent machine it would go down to half of that


now, making a tex run persistent is not really a solution: one has to 
reset all kinds of counters, dimensions etc wipe node and token space, 
etc an done would also have to reset the pdf output which includes all 
kind of housekeeping states ... adding all kind of resetters and hooks 
for that (plus all the garbage collection needed) will never pay back 
and a 'wipe all and reload' is way more efficient then


of course, when i ever run into a secenario where I have to creeate tens 
of thousands of one/few page docs very fast i might add some 'reset the 
pdf state' because that is kind of doable with some extra code but to be 
honest, no one ever came up with a project that had any real demands on 
the engine that could not be met (the fact that tex is a good solution 
for rendering doesn't mean that there is demand for it ... it is seldom 
on the radar of those who deal with that, who then often prefer some pdf 
library, also because quality doesn't really matter)


these kind of performance things are demand driven (read: i need a 
pretty good reason to spend time on it)



I can’t comment on how to speed up the rest of what you are doing,
but generally multi-threading TeX typesetting jobs is so hard as to
be impossible in practise. About the only step that can be split off
is the generation of the PDF, and even there the possible gain is
quite small (as you noticed already).


indeed, see above


Typesetting is a compilation job, so the two main ways to speed things
along are

1) split the source into independent tasks, like in a code compiler
that splits code over separate .c / .cpp / .m / .p etc. files,
and then combine the results (using e.g. mutool)

2) precompile recurring stuff (in TeX, that would mean embedding
separately generated pdfs or images)

right

(and we are old enough and have been around long enough to have some gut 
feeling about that)


Hans

ps. When it comes to performance of tex, lua, context etc it is no 
problem, when googling a bit, to run into 'nonsense' arguments of why 
something is slow ... so don't take it for granted, just ask here on 
this list


-
  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] Using ConTeXt-LMTX for modern Mathematically-Literate-Programming 1/2

2020-12-03 Thread Taco Hoekwater


> On 3 Dec 2020, at 11:35, Stephen Gaito  wrote:
> 
> Hans,
> 
> As I said my desktop is elderly... it has a 2.8GHz processor, 16Gb of
> DDR3 memory, and a couple of old SATA1 hard disks, and only 3Mb of CPU
> cache...
> 
> ... all well past its use by date for single threaded ConTeXt. ;-(
> 
> So one way to get better performance for ConTeXt is to invest in a new
> ultra fast processor. Which will cost a lot, and use a lot of power
> which has to be cooled, which uses even more power

Startup time can be improved quite a bit with an SSD. Even a cheap SATA
SSD is already much faster than a traditional harddisk. Doesn’t help
with longer documents, but it could be a fairly cheap upgrade.

I can’t comment on how to speed up the rest of what you are doing,
but generally multi-threading TeX typesetting jobs is so hard as to
be impossible in practise. About the only step that can be split off
is the generation of the PDF, and even there the possible gain is 
quite small (as you noticed already).

Typesetting is a compilation job, so the two main ways to speed things
along are

1) split the source into independent tasks, like in a code compiler
   that splits code over separate .c / .cpp / .m / .p etc. files,
   and then combine the results (using e.g. mutool)

2) precompile recurring stuff (in TeX, that would mean embedding
   separately generated pdfs or images)

Best wishes,
Taco





___
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] Using ConTeXt-LMTX for modern Mathematically-Literate-Programming 1/2

2020-12-03 Thread Stephen Gaito
Hans,

As I said my desktop is elderly... it has a 2.8GHz processor, 16Gb of
DDR3 memory, and a couple of old SATA1 hard disks, and only 3Mb of CPU
cache...

... all well past its use by date for single threaded ConTeXt. ;-(

So one way to get better performance for ConTeXt is to invest in a new
ultra fast processor. Which will cost a lot, and use a lot of power
which has to be cooled, which uses even more power

Alternatively, for the same costs (or less), I can buy cheaper slower
processors but have lots of threads (a cluster of Raspberry Pi 4 8Gb
cards)...

Alas this requires finding some way to parallelize ConTeXt

(Fools rush in where Angels fear to tread ;-(

Regards,

Stephen Gaito 

On Wed, 2 Dec 2020 14:04:18 +0100
Hans Hagen  wrote:

> On 12/2/2020 10:40 AM, Stephen Gaito wrote:
> 
> > Many thanks for your swift and helpful comments.
> > 
> > After some *very crude* tests using the `luametatex` and
> > `luametafun` documents, I find that while I *can* stop effective
> > processing at various points in the LuaMetaTeX pipeline, the time
> > difference overall is not really significant enough to bother with
> > this approach.
> > 
> > The principle problem is, as you suggested below, "stopping" the
> > pipeline at the PDF stage (using for example the
> > `pre_output_filter`) corrupted the `*.tuc` data which is for my
> > purposes, critical.
> > 
> > Your comment was:
> >   
> >> but keep in mind that multipass data is flushed as part of the
> >> shipout (because it is often location and order bound)  
> > 
> > For the record, using the `append_to_vlist_filter` callback, I did
> > manage to drastically reduce the "pages" (which were all blank, not
> > surprisingly).
> > 
> > However, on my elderly desktop from 2008, both callbacks
> > essentially cut only 6-8 seconds out of 18 seconds, for the
> > `luametatex` document, and 190 seconds, for the `luametafun`
> > document.  
> 
> hm, on my 2013 laptop the luametatex manual needs 10 sec (i have all
> the fonts, so that includes a bunch) and a metafun manual should do
> about 20
> 
> a test on am M1 mini needs half those times as reported yesterday
> 
> i bet that on a modern desktop the luatex manual will do < 5 sec
> 
> > In the case of the `luametafun` document, it is the MetaFun/MetaPost
> > processing which, of course, is taking a long time (as it should,
> > the graphics computations represent important but complex
> > computations).  
> 
> One run or many due to xref? Maybe your machine has no significant
> cpu cache? Do you run from disk or ssd? How much memory?
> 
> > My ultimate goal is to parallelize the production of large, heavily
> > cross-referenced, ConTeXt documents... more on this in a future
> > email...  
> 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] Using ConTeXt-LMTX for modern Mathematically-Literate-Programming 2/2

2020-12-03 Thread Stephen Gaito
Hans,

If my only constraints were ease of programming and moderate
performance, I would completely agree that using mostly Lua plus
(possibly) some C code for some targeted stuff that is really slow in
Lua is the correct solution we are actually in agreement.

Unfortunately, I have the *non-functional* requirement to *prove* the
code's correctness this is the heart of what I have to write about.

There is no getting out of this requirement

So, some day it would be very useful to be able to directly embed a
Lua wrapped ANSI-C shared library inside the new LuaMetaTex

However, at the moment, as part of my parallelization attempts I can
interact with my ANSI-C code over a network so I will use this
approach for the near to medium time frames.

Regards,

Stephen Gaito



On Wed, 2 Dec 2020 14:17:54 +0100
Hans Hagen  wrote:

> On 12/2/2020 11:43 AM, Stephen Gaito wrote:
> 
> > Again, to my knowledge, Lua v5.4 has only one implementation (though
> > this implementation *can* be compiled for a very wide range of
> > CPU's).  
> 
> Lua has not many demands ... it can even run on tiny cpu's. It's all 
> rather plain C code. (And in luametatex we have no c++ ... all is
> just C.)
> 
> > Finally, the computational complexity of my proof engine, will be
> > comparable to MetaFun/MetaPost... which I suspect you would not
> > consider implementing in pure Lua. Some things are faster in C.  
> 
> Hard to say ... I think that the parser / expansion machinery in mp
> is the bottleneck here (no fun to do that in lua). Redoing it in Lua
> also is asking for compatibility issues. (btw, extensions are done in
> lua anyway, as is the mp backend)
> 
> > So yes I do need to implement it in ANSI-C wrapped in Lua (so that
> > it can be used from *inside* ConTeXt).  
> 
> I would have to see the 'kind of code involved' in order to comment
> on that.
> 
> An option is to do most in lua and maybe some helpers for crititical 
> code in C.
>   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] Using ConTeXt-LMTX for modern Mathematically-Literate-Programming 2/2

2020-12-02 Thread Hans Hagen

On 12/2/2020 11:43 AM, Stephen Gaito wrote:


Again, to my knowledge, Lua v5.4 has only one implementation (though
this implementation *can* be compiled for a very wide range of CPU's).


Lua has not many demands ... it can even run on tiny cpu's. It's all 
rather plain C code. (And in luametatex we have no c++ ... all is just C.)



Finally, the computational complexity of my proof engine, will be
comparable to MetaFun/MetaPost... which I suspect you would not
consider implementing in pure Lua. Some things are faster in C.


Hard to say ... I think that the parser / expansion machinery in mp is 
the bottleneck here (no fun to do that in lua). Redoing it in Lua also 
is asking for compatibility issues. (btw, extensions are done in lua 
anyway, as is the mp backend)



So yes I do need to implement it in ANSI-C wrapped in Lua (so that it
can be used from *inside* ConTeXt).


I would have to see the 'kind of code involved' in order to comment on 
that.


An option is to do most in lua and maybe some helpers for crititical 
code in C.

 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] Using ConTeXt-LMTX for modern Mathematically-Literate-Programming 1/2

2020-12-02 Thread Hans Hagen

On 12/2/2020 10:40 AM, Stephen Gaito wrote:


Many thanks for your swift and helpful comments.

After some *very crude* tests using the `luametatex` and `luametafun`
documents, I find that while I *can* stop effective processing at
various points in the LuaMetaTeX pipeline, the time difference overall
is not really significant enough to bother with this approach.

The principle problem is, as you suggested below, "stopping" the
pipeline at the PDF stage (using for example the `pre_output_filter`)
corrupted the `*.tuc` data which is for my purposes, critical.

Your comment was:


but keep in mind that multipass data is flushed as part of the
shipout (because it is often location and order bound)


For the record, using the `append_to_vlist_filter` callback, I did
manage to drastically reduce the "pages" (which were all blank, not
surprisingly).

However, on my elderly desktop from 2008, both callbacks essentially cut
only 6-8 seconds out of 18 seconds, for the `luametatex` document, and
190 seconds, for the `luametafun` document.


hm, on my 2013 laptop the luametatex manual needs 10 sec (i have all the 
fonts, so that includes a bunch) and a metafun manual should do about 20


a test on am M1 mini needs half those times as reported yesterday

i bet that on a modern desktop the luatex manual will do < 5 sec


In the case of the `luametafun` document, it is the MetaFun/MetaPost
processing which, of course, is taking a long time (as it should, the
graphics computations represent important but complex computations).


One run or many due to xref? Maybe your machine has no significant cpu 
cache? Do you run from disk or ssd? How much memory?



My ultimate goal is to parallelize the production of large, heavily
cross-referenced, ConTeXt documents... more on this in a future email...

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] Using ConTeXt-LMTX for modern Mathematically-Literate-Programming 1/2

2020-12-02 Thread Stephen Gaito
Hans,

Many thanks for your swift and helpful comments.

After some *very crude* tests using the `luametatex` and `luametafun`
documents, I find that while I *can* stop effective processing at
various points in the LuaMetaTeX pipeline, the time difference overall
is not really significant enough to bother with this approach.

The principle problem is, as you suggested below, "stopping" the
pipeline at the PDF stage (using for example the `pre_output_filter`)
corrupted the `*.tuc` data which is for my purposes, critical.

Your comment was: 

> but keep in mind that multipass data is flushed as part of the
> shipout (because it is often location and order bound)

For the record, using the `append_to_vlist_filter` callback, I did
manage to drastically reduce the "pages" (which were all blank, not
surprisingly).

However, on my elderly desktop from 2008, both callbacks essentially cut
only 6-8 seconds out of 18 seconds, for the `luametatex` document, and
190 seconds, for the `luametafun` document.

In the case of the `luametafun` document, it is the MetaFun/MetaPost
processing which, of course, is taking a long time (as it should, the
graphics computations represent important but complex computations).

My ultimate goal is to parallelize the production of large, heavily
cross-referenced, ConTeXt documents... more on this in a future email...

Again, many thanks for your comments!

Regards,

Stephen Gaito

On Mon, 30 Nov 2020 19:59:07 +0100
Hans Hagen  wrote:

> On 11/30/2020 10:51 AM, Stephen Gaito wrote:
> > Hello,
> > 
> > I am slowly working on a Mathematical problem requiring underlying
> > computation.
> > 
> > As Mathematicians (myself included) are rather "conservative", I
> > need to discuss each "chunk" of code with the full set of
> > Mathematical notation.
> > 
> > A couple of years ago I started using ConTeXt-MKIV as a
> > Mathematically-Literate-Programming tool by using its excellent Lua
> > interface to capture the code and dump it to disk for external
> > compilation.
> > 
> > I am now revisiting my original design and want to redo my tools
> > using ConTeXt-LMTX.
> > 
> > I would *like* to be able to "stop" the ConTeXt typesetting at
> > various points for differing purposes:
> > 
> > 1. After all macro expansions (and hence after *my* calls into Lua)
> > but before line/paragraph/page layout begins.
> 
> maybe something
> 
> \startmystuff
> 
> \stopmystuff
> 
> and then you can hook something into startmystuff and \stopmystuff
> 
> > 2. After line/paragraph/page layout but before PDF generation.
> 
> pdf is generated per page, if needed one can kick in a shipout
> overload
> 
> but keep in mind that multipass data is flushed as part of the
> shipout (because it is often location and order bound)
> 
> > 3. After all PDF generated (ie. a "normal" "full" ConTeXt run).
> > 
> > Stopping after all macro expansions would allow my code generation
> > builds to proceed without the un-needed page setting or PDF
> > generation.
> 
> hm, the problem is always in the 'state' of all kind of variables
> 
> > Stopping after the line/paragraph/page layout would allow multiple
> > "faster(?)" ConTeXt runs while the "*.tuc" file converges to a
> > complete set of page numbers and cross references (etc). Then, once
> > the "*.tuc" file has converged, a full ConTeXt run with PDF output
> > could be done.
> 
> not sure what you mean here ... what is fast? or: how slow is it now? 
> what is the bottleneck? can you cache data that didn't change?
> 
> a large document is normally split up in sections that can be
> processed independent
> 
> \starttext
>  \dorecurse{1}{\samplefile{ward}\par}
> \stoptext
> 
> runs on my 2013 laptop at over 65 pages per second
> 
> quite often performance is hit by inefficient styling and such ..
> it's no problem to bring a tex system a grinding halt
> 
> > I am very aware that *internally* ConTeXt is probably structured as
> > a tight pipeline with each of the "traditional" TeX stages "Mouth",
> > "Stomach", "page setting", PDF generation tightly "chained"...
> > This means that there is no "one" place in the code where all macro
> > expansions have completed but before the page setting "starts", or
> > similarly, after the page setting has finished but before the PDF
> > generation "starts".
> 
> yes and often something is left over for a next page so it's kind of
> fluid
> 
> > 
> > QUESTION: Is it possible to u

Re: [NTG-context] Problem with word not hyphenating

2020-11-30 Thread Wolfgang Schuster

Pablo Rodriguez schrieb am 30.11.2020 um 17:16:

On 11/30/20 4:48 PM, Bruce Horrocks wrote:

The word "re-implementation" refuses to hyphenate and consequently
stick outs into the right margin.

I've tried using \hyphenation but it makes no difference.
[...]
Any suggestions, please?

Hi Bruce,

here you have a sample:

   \setuphyphenation[method=traditional]
   \registerhyphenationexception[en][re-im-ple-men-ta-tion]
   \starttext
   \startTEXpage[offset=1em]
   \hyphenatedword{re-implementation}\\
   \hyphenatedword{re||implementation}\\
   \hyphenatedword{re--implementation}\\
   \hyphenatedword{reimplementation}
   \stopTEXpage
   \stoptext

If you comment the first line, only "||" allows hyphenation.


Another option is to add \setbreakpoints[compound] to the document.

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] Problem with word not hyphenating

2020-11-30 Thread Pablo Rodriguez
On 11/30/20 4:48 PM, Bruce Horrocks wrote:
> The word "re-implementation" refuses to hyphenate and consequently
> stick outs into the right margin.
>
> I've tried using \hyphenation but it makes no difference.
> [...]
> Any suggestions, please?

Hi Bruce,

here you have a sample:

  \setuphyphenation[method=traditional]
  \registerhyphenationexception[en][re-im-ple-men-ta-tion]
  \starttext
  \startTEXpage[offset=1em]
  \hyphenatedword{re-implementation}\\
  \hyphenatedword{re||implementation}\\
  \hyphenatedword{re--implementation}\\
  \hyphenatedword{reimplementation}
  \stopTEXpage
  \stoptext

If you comment the first line, only "||" allows hyphenation.

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] How to reproduce a particular head/title style (reformat)

2020-11-15 Thread Pablo Rodriguez
On 11/15/20 7:53 PM, Garulfo wrote:
> [...]
> Initial PDF document:
> https://www.hautconseilclimat.fr/wp-content/uploads/2020/10/hcc_rapport_maitriser-lempreinte-carbone-de-la-france-1.pdf
> [...]
> ConTeXt output :
> https://wiki.contextgarden.net/images/4/45/2020_hcc_rapport_maitriser-l-empreinte-carbone-de-la-france.pdf
>
> Any feedback is welcome (even if source code is not really clean)

Congratulations, Garulfo.

It’s a really good work.

Just a comment, to get clean bookmarks and PDF info, use:

  \enabledirectives[references.bookmarks.preroll]
  \enabledirectives[interaction.identity.preroll]

Just in case it helps,

Pablo
--
http://www.ousia.tk
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] figure library

2020-10-12 Thread Jörg Hagmann
I have used figure libraries in the mkII past. But my recent attempts with
mkIV, following the instructions on ConTeXt Wiki
(https://wiki.contextgarden.net/Image_Database), have failed. The following
happens:

1. When running the command "context --input=figure-lib.xml
   auto:x-res-01.mkiv --result=figure-lib" in an EMPTY directory, 2 pages
   with buttons and titles are created.
2. When providing an image and an xml file (copied from the website above
   and including the image name and the missing ">" at the end), these are
   ignored -- the same 2 empty pages are created.

Could somebody tell me what's wrong (with me, most likely)?

Details: mkiV and LMTX, MacOS and FreeBSD, recent ConTeXt installations.

The xml file on ConTeXt Wiki:




   
   Organisation
   ConTeXt Wiki
   product pictures
   pictures for ConTeXt Wiki
   

   
  filename
  reference
  owner
  comment
   
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] Local custom notes affect regular footnotes

2020-10-09 Thread Henning Hraban Ramm
If I use local notes, regular footnotes disappear in the following example:


\definenote[testnote]

\starttext

\startlocalnotes[testnote]

Test\testnote{Custom note}

Other text inbetween with normal footnotes.\footnote{Footnote}

Test\testnote{Another custom note}

Other text afterwards with normal footnotes.\footnote{Other Footnote}

:::\placelocalnotes[testnote] :::

---\placelocalnotes[footnote] --- % just to be sure, no output
%\stoplocalnotes % a NOP?

\stoptext


(LMTX or MkIV 2020.09.20 23:02)

The use case is a commented edition of historical letters. Footnotes of letter 
contents should be local and numbered per letter, while general footnotes 
should behave as usual and are numbered by text.
(This setup works otherwise, no need to explain.)
Actually, the “normal text” part appears only after a letter, but before 
\placelocalnotes.


The logical structure would be:

\startlocalnotes[testnote]

\startnarrower
\input lorem\testnote{bla bla}

\input lorem\testnote{bla bla}
\stopnarrower

\stoplocalnotes % forgets local notes

\input knuth\footnote{Donald dixit}

\placelocalnotes[testnote] % nothing


In the MWE, the footnotes just disappear. In the actual project the problem is 
different, but I couldn’t reproduce it in a MWE. I guess the interference of 
different note types is the cause of both problems.

I tried using the same custom note for the last comment as a workaround, but it 
gets placed twice: once at the bottom of the current page (i.e. like a normal 
footnote, out of order) and once after the other custom notes.
(The letter is in a delimitedtext environment.)



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
___


Re: [NTG-context] numbering pages included by \copypages

2020-09-28 Thread Alan Bowen
After further testing guided by Hans’ suggestion, I now have

\setupexternalfigures[location=default]
\setuplayer[preset=rightbottom, method=overlay]{}
\setuppagenumbering[color=darkmagenta]
\starttext
\getfiguredimensions[HannahBW.pdf]

\dorecurse{\noffigurepages}{
\startTEXpage[pagestate=start]
\layeredtext[]
[boffset=3pc, roffset=3pc]
{\darkmagenta\subpagenumber}
{\externalfigure[HannahBW.pdf][page=#1]}
\stopTEXpage
}
\stoptext

which works, though it would arguably be better if there is a way to
prevent the subpage number on the first page of every included file.

Alan

On Fri, Sep 25, 2020 at 6:12 AM Hans Hagen  wrote:

> On 9/25/2020 5:53 AM, Aditya Mahajan wrote:
> > On Fri, 25 Sep 2020, Wolfgang Schuster wrote:
> >
> >> Aditya Mahajan schrieb am 24.09.2020 um 23:48:
> >>> On Thu, 24 Sep 2020, Alan Bowen wrote:
> >>>> Any suggestions or pointers will be most welcome.
> >>>
> >>> See if this gives you any ideas 
> >>>
> >>> https://adityam.github.io/context-blog/post/include-multi-page-pdf/
> >>
> >> When both document have the same size you can replace TeXpage with a
> "page"
> >> layout.
> >>
> >> \startlayout[page]
> >> \dorecurse{\noffigurepages}{\externalfigure[...][page=\recurselevel]}
> >> \stoplayout
> >
> > Thanks for the comment (also I didn't know about \startlayout ..
> \stoplayout). Unfortunately, in my use case, the paper sizes may not be the
> same.. I am typically attaching published journal articles and some are
> published on letter paper and some on A4.
>
> \setupexternalfigures[location=default]
>
> \starttext
>
> \dorecurse {5} {Before #1\page}
>
> \getfiguredimensions[oeps.pdf]
>
> \startsetups SomeNumber
>  \vbox to \overlayheight \bgroup
>  \vss
>  \hbox to \overlaywidth \bgroup
>  \hss
>  \bfd \red You can figure it out: \pagenumber
>  \hss
>  \egroup
>  \vss
>  \egroup
> \stopsetups
>
> \defineoverlay[SomeNumber][\setups{SomeNumber}]
>
> \dorecurse {\noffigurepages} {
>  \startTEXpage[pagestate=start]
>  \externalfigure[oeps.pdf][page=#1,background=SomeNumber]%
>  \stopTEXpage
> }
>
> \dorecurse {5} {After #1\page}
>
> \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
>
> ___
>
___
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] numbering pages included by \copypages

2020-09-25 Thread Hans Hagen

On 9/25/2020 5:53 AM, Aditya Mahajan wrote:

On Fri, 25 Sep 2020, Wolfgang Schuster wrote:


Aditya Mahajan schrieb am 24.09.2020 um 23:48:

On Thu, 24 Sep 2020, Alan Bowen wrote:

Any suggestions or pointers will be most welcome.


See if this gives you any ideas 

https://adityam.github.io/context-blog/post/include-multi-page-pdf/


When both document have the same size you can replace TeXpage with a "page"
layout.

\startlayout[page]
\dorecurse{\noffigurepages}{\externalfigure[...][page=\recurselevel]}
\stoplayout


Thanks for the comment (also I didn't know about \startlayout .. \stoplayout). 
Unfortunately, in my use case, the paper sizes may not be the same.. I am 
typically attaching published journal articles and some are published on letter 
paper and some on A4.


\setupexternalfigures[location=default]

\starttext

\dorecurse {5} {Before #1\page}

\getfiguredimensions[oeps.pdf]

\startsetups SomeNumber
\vbox to \overlayheight \bgroup
\vss
\hbox to \overlaywidth \bgroup
\hss
\bfd \red You can figure it out: \pagenumber
\hss
\egroup
\vss
\egroup
\stopsetups

\defineoverlay[SomeNumber][\setups{SomeNumber}]

\dorecurse {\noffigurepages} {
\startTEXpage[pagestate=start]
\externalfigure[oeps.pdf][page=#1,background=SomeNumber]%
\stopTEXpage
}

\dorecurse {5} {After #1\page}

\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] numbering pages included by \copypages

2020-09-24 Thread Aditya Mahajan
On Fri, 25 Sep 2020, Wolfgang Schuster wrote:

> Aditya Mahajan schrieb am 24.09.2020 um 23:48:
> > On Thu, 24 Sep 2020, Alan Bowen wrote:
> > > Any suggestions or pointers will be most welcome.
> > 
> > See if this gives you any ideas 
> > 
> > https://adityam.github.io/context-blog/post/include-multi-page-pdf/
> 
> When both document have the same size you can replace TeXpage with a "page"
> layout.
> 
> \startlayout[page]
> \dorecurse{\noffigurepages}{\externalfigure[...][page=\recurselevel]}
> \stoplayout

Thanks for the comment (also I didn't know about \startlayout .. \stoplayout). 
Unfortunately, in my use case, the paper sizes may not be the same.. I am 
typically attaching published journal articles and some are published on letter 
paper and some on A4. 

Thanks,
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] odd behaviour with \definefontfamily

2020-08-25 Thread jbf
I intend to use it! So, yes, I had not used it at this point, and your 
explanation now makes sense.


In the test example I have, I have now placed a line:  \ss My text, and 
I see that it now loads the sans serif font. But can you explain why it 
loads the math font, given that I have not, as yet, used that anywhere 
(and may not - it is there for insurance in case such a glyph is needed)?


Julian

On 26/8/20 11:58 am, Aditya Mahajan wrote:

On Wed, 26 Aug 2020, jbf wrote:


Can someone tell me why, when I define my typefaces as follows below, I get:

mkiv lua stats  > loaded fonts: 2 files: baskervaldadfstd.otf,
texgyrepagella-math.otf

when in fact my font definitions are:

\definefontfamily [mainface] [rm] [baskervaldadfstd]
[tf=file:BaskervaldADFStd.otf]
\definefontfamily [mainface] [ss] [librisadfstd]
[tf=file:LibrisADFStd-Regular.otf]
\definefontfamily [mainface] [mm] [TeX Gyre Pagella Math]

\setupbodyfont[mainface]

-

ConTeXt loads the [rm] and the [mm] but not the [ss]. Be assured that
the ss typeface is available. So if, for example, I comment out the
first line ([rm]) and change the Libris to rm instead, I am told:

mkiv lua stats  > loaded fonts: 2 files: librisadfstd-regular.otf,
texgyrepagella-math.otf

In other words, only two, not three definitions are working at any one
time. Or is it not accepting [ss] for some reason regardless? I have
tried any number of existing sans serif fonts and none of them will
load. I know the family names are correct, so that is not the problem.
What could I be doing wrong?

Are you actually using sans serif text in your document? If not, then context 
has no reason to embed a subset of it in the PDF. It is the same reason by the 
teletype [tt] font has not been loaded.

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] odd behaviour with \definefontfamily

2020-08-25 Thread Aditya Mahajan
On Wed, 26 Aug 2020, jbf wrote:

> Can someone tell me why, when I define my typefaces as follows below, I get:
> 
> mkiv lua stats  > loaded fonts: 2 files: baskervaldadfstd.otf, 
> texgyrepagella-math.otf
> 
> when in fact my font definitions are:
> 
> \definefontfamily [mainface] [rm] [baskervaldadfstd] 
> [tf=file:BaskervaldADFStd.otf]
> \definefontfamily [mainface] [ss] [librisadfstd] 
> [tf=file:LibrisADFStd-Regular.otf]
> \definefontfamily [mainface] [mm] [TeX Gyre Pagella Math]
> 
> \setupbodyfont[mainface]
> 
> -
> 
> ConTeXt loads the [rm] and the [mm] but not the [ss]. Be assured that 
> the ss typeface is available. So if, for example, I comment out the 
> first line ([rm]) and change the Libris to rm instead, I am told:
> 
> mkiv lua stats  > loaded fonts: 2 files: librisadfstd-regular.otf, 
> texgyrepagella-math.otf
> 
> In other words, only two, not three definitions are working at any one 
> time. Or is it not accepting [ss] for some reason regardless? I have 
> tried any number of existing sans serif fonts and none of them will 
> load. I know the family names are correct, so that is not the problem. 
> What could I be doing wrong?

Are you actually using sans serif text in your document? If not, then context 
has no reason to embed a subset of it in the PDF. It is the same reason by the 
teletype [tt] font has not been loaded.

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] odd behaviour with \definefontfamily

2020-08-25 Thread jbf

Can someone tell me why, when I define my typefaces as follows below, I get:

mkiv lua stats  > loaded fonts: 2 files: baskervaldadfstd.otf, 
texgyrepagella-math.otf


when in fact my font definitions are:

\definefontfamily [mainface] [rm] [baskervaldadfstd] 
[tf=file:BaskervaldADFStd.otf]
\definefontfamily [mainface] [ss] [librisadfstd] 
[tf=file:LibrisADFStd-Regular.otf]

\definefontfamily [mainface] [mm] [TeX Gyre Pagella Math]

\setupbodyfont[mainface]

-

ConTeXt loads the [rm] and the [mm] but not the [ss]. Be assured that 
the ss typeface is available. So if, for example, I comment out the 
first line ([rm]) and change the Libris to rm instead, I am told:


mkiv lua stats  > loaded fonts: 2 files: librisadfstd-regular.otf, 
texgyrepagella-math.otf


In other words, only two, not three definitions are working at any one 
time. Or is it not accepting [ss] for some reason regardless? I have 
tried any number of existing sans serif fonts and none of them will 
load. I know the family names are correct, so that is not the problem. 
What could I be doing wrong?


Julian

___
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] About documented code

2020-08-16 Thread Wolfgang Schuster

Jairo A. del Rio schrieb am 15.08.2020 um 16:24:
Hi list! I have some questions about the template used by module 
documentation. When I apply


context --extra=module t-mymodule.mkvi --autopdf

I obtain a nice file, but, among other things, 1) the cover page seems 
to be a bit... greenish? So I want to know how to customize it, at 
least at a minimum, and 2) \showframe is enabled by default. How to 
disable it? Maybe 1) can answer 2) too. Thank you very much.


There is no way to change the color of the title page from your module 
itself, the only way is to change the value module (s-module-basic.mkiv) 
which is used to create the formatted source.


The same has to be done to disable the frame where you have to comment 
the \showframe line in the module mentioned above.


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] compilation error in LMTX

2020-08-14 Thread Jannik Voges
Hello Lutz,


I can confirm this. Compiling luametafun.tex (see luametafun.zip; I
included the log-file, but the log-file doesn't include all the output I
can see on the console (therefore I included the file output_console.txt
with a copy of my console-output). I used linux aarch64.
Yes, commenting things out in my own tex-documents might result in a
successful compilation, but I had a document (which compiles normaly
now, but not two days before) where I got the same error at another
position in the file (after deleting all chapters after the one where
the error occurred including the one with the error).


Greetings

Jannik

Am 14.08.20 um 13:38 schrieb Lutz Haseloff:
> Hi all
> 
> I have a similar problem compiling luametafun.tex in the doc sources.
> It fails with different errorcodes on win64 and linux aarch64. On linux
> aarch64 i get a bonus "Segmentation fault".
> I append the console outputs of the context runs.
> 
> If i comment out the input of luametafun-axis and luametafun-followtext
> i get a readeable pdf.
> 
> So perhaps only the code is changing too rapidly.
> 
> Greetings Lutz
> 
> Am 14. August 2020 13:04:52 MESZ schrieb Hans Hagen :
> 
> On 8/14/2020 11:41 AM, Jannik Voges wrote:
> 
> Hello Pablo,
> 
> 
> thank you for your suggestions, but I don't use LMTX
> productively, so I
> have no problem with a broken LMTX-version. I only use it to check
> whether there are breaking changes in LMTX by typesetting all of my
> documents with the newest LMTX-version (to see if I need to
> change them
> in the future). And by doing so I recognized this error, which
> seemed to
> happen randomly.
> 
> you can try to run with
> 
> \tracingall
> 
> and/or
> 
> \enabletrackers[*]
> 
> and see where it crashes
> 
> 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
> 
> 
> 
> ___
> 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
> ___
> 
<>


0x805A4918E8698418.asc
Description: application/pgp-keys
___
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] compilation error in LMTX

2020-08-14 Thread Hans Hagen

On 8/14/2020 1:38 PM, Lutz Haseloff wrote:

Hi all

I have a similar problem compiling luametafun.tex in the doc sources.
It fails with different errorcodes on win64 and linux aarch64. On linux 
aarch64 i get a bonus "Segmentation fault".

I append the console outputs of the context runs.

If i comment out the input of luametafun-axis and luametafun-followtext 
i get a readeable pdf.


So perhaps only the code is changing too rapidly.
i found the issue ... i switched to a more efficient method of piping a 
path back to mp ...


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] compilation error in LMTX

2020-08-14 Thread Lutz Haseloff
Hi all

I have a similar problem compiling luametafun.tex in the doc sources.
It fails with different errorcodes on win64 and linux aarch64. On linux aarch64 
i get a bonus "Segmentation fault".
I append the console outputs of the context runs.

If i comment out the input of luametafun-axis and luametafun-followtext i get a 
readeable pdf.

So perhaps only the code is changing too rapidly.

Greetings Lutz

Am 14. August 2020 13:04:52 MESZ schrieb Hans Hagen :
>On 8/14/2020 11:41 AM, Jannik Voges wrote:
>> Hello Pablo,
>> 
>> 
>> thank you for your suggestions, but I don't use LMTX productively, so
>I
>> have no problem with a broken LMTX-version. I only use it to check
>> whether there are breaking changes in LMTX by typesetting all of my
>> documents with the newest LMTX-version (to see if I need to change
>them
>> in the future). And by doing so I recognized this error, which seemed
>to
>> happen randomly.
>you can try to run with
>
>\tracingall
>
>and/or
>
>\enabletrackers[*]
>
>and see where it crashes
>
>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
>___


aarch64.log
Description: Binary data


win64.log
Description: Binary data
___
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] \setfirstline is applied to whole paragraph

2020-08-12 Thread Nicola
When I typeset the example at

https://wiki.contextgarden.net/Command/definefirstline

(reported below for your convenience), \setfirstline is applied to the
whole first paragraph, which is laid out on a single line (hence, it is
cropped at the edge of the page). Besides, the second \setfirstline is
not applied at all, i.e., there are no small caps. If I comment out the
first \setfirstline, then the second one does produce small caps, but
again, a whole paragraph is set in small caps, not just the first line.

$ context --version
mtx-context | ConTeXt Process Management 1.03
mtx-context |
mtx-context | main context file: 
/Users/nicola/Applications/context-osx-64/tex/texmf-context/tex/context/base/mkiv/context.mkiv
mtx-context | current version: 2020.08.11 15:59
mtx-context | main context file: 
/Users/nicola/Applications/context-osx-64/tex/texmf-context/tex/context/base/mkiv/context.mkxl
mtx-context | current version: 2020.08.11 15:59

Nicola


\setupbodyfont [heros] %% important: smallcaps capable font!

\definefirstline [italicfirstline] [
  alternative=line,
  style=italic,
]

\definefirstline [smallcapsfirstline] [
  alternative=line,
  color=darkred,
  style=smallcaps,
]

\starttext

  % \setfirstline[italicfirstline]\input knuth \par
  \setfirstline[smallcapsfirstline] \input knuth \par

\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] \title with extra content in toc

2020-08-11 Thread Aditya Mahajan

On Wed, 12 Aug 2020, jbf wrote:

Still dealing with \title, but am creating a separate thread because the 
question is different.


As well as using \title within frontmatter (my previous question was 
about the header not appearing on final page if it is an odd/recto page) 
I am also using it in the main body for 'chapters' that I don't want 
numbered, and of course, have ensured that such \title items can appear 
in the TOC. But I want to add a one-word comment in brackets to the 
title that appears in the TOC, so that I get:


Chapter title (comment).. 5  or whatever the page number is.

Is there are way I can add  extra content to an item that appears in the 
TOC?


\startchapter
[
  title={Title of chapter},
  list={What appears in TOC},
  bookmark={What appears in bookmarks},
]


\stopchapter

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] \title with extra content in toc

2020-08-11 Thread jbf
Still dealing with \title, but am creating a separate thread because the 
question is different.


As well as using \title within frontmatter (my previous question was 
about the header not appearing on final page if it is an odd/recto page) 
I am also using it in the main body for 'chapters' that I don't want 
numbered, and of course, have ensured that such \title items can appear 
in the TOC. But I want to add a one-word comment in brackets to the 
title that appears in the TOC, so that I get:


Chapter title (comment).. 5  or whatever the page number is.

Is there are way I can add  extra content to an item that appears in the 
TOC? In this case it would be the same comment in each instance, but my 
question assumes that there could also be a need for different comments, 
none of which appear in the 'chapter' title in the main body.


Am using MkIV BTW,

Julian

___
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] How can I use ConTeXt from TeXLive2020 ?

2020-08-10 Thread Axel Kielhorn

> The luatools script was there to offer some kpse like functionality but it 
> has been obsolete for ages (the generate was in mtx-base at that time). Just 
> use
> 
>  mtxrun --generate

Should the comment in the engine file change?

Context is called with:

mtxrun --script context --autogenerate --synctex=1 "$1“

Greetings
Axel

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

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


Re: [NTG-context] How can I use ConTeXt from TeXLive2020 ?

2020-08-10 Thread Axel Kielhorn


> Am 10.08.2020 um 14:59 schrieb Otared Kavian :
> 
> It is possible that the version of mtxrun or luatools scripts in TeXLive are 
> not working.

Well, one more suggestion:
Use TeX Live Manager to update TeX-Live.
I didn’t see any comments about context not working, but maybe the update fixes 
something.
(You can filter for context related packages.)

There has been one update to „context“ in June 2020.

> I don't remember what I did with TeXLive2019 to fix the issue, but my concern 
> is that if including ConTeXt in TeXLive is intended for people to use it, 
> then it SHOULD run without such tweakings which, even for someone who is a 
> regular user of ConTeXt, are not easy to find.

Well, it works here on a (relatively) clean install of 10.13.

> The solution consisting of installing a standalone tree of ConTeXt, is not a 
> real solution because many people do not know how to do it and, even if they 
> could, then what would be the point of doing so much work for people who 
> include a ConTeXt tree in TeXLive?

It should work.

> Anyway, I apologize for my acrimonius remarks, and I thank you again for your 
> help.

One more thing:
Please look at environment variables starting with TEX and comment them, they 
will cause problems.

And another one:
Please look into the home directory for a local .texlive2020 folder.
There shouldn’t be any and it shouldn’t contain anything context related.

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

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


Re: [NTG-context] orphans and widows not working in LMTX?

2020-08-09 Thread Pablo Rodriguez
On 8/9/20 9:59 PM, Joseph Canedo wrote:
> Hi Pablo,
> I've reported similar issue to Hans 2 days ago, from my checks he fixed
> it in LMTX version 2020.08.07 23:37. I have not downloaded more recent
> version yet.
> Hoping it helps

Hi Joseph,

many thanks for your comment and your previous issue report.

The issue has been fixed in current latest from 2020.08.09 22:03.

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] margin notes (was: lmtx update)

2020-08-01 Thread Otared Kavian
Hi Hraban,

Thanks for the hint… indeed I did see that \ColWidth command but didn't think 
about its definition… Sorry!

Now with \ColWidth defined, your code works fine and it has the advantage that 
the text of the sidenote begins in the margin at the level where the \footnote 
command appears. However, it cannot control the overflow of a sidenote to the 
next page, whereas the code given by Hans can do that. I admit that this does 
not happen very often since a well designed text should not have too many long 
sidenotes…

In case other users would like to use your code, I put the whole example below.

Best regards: Otared
%%% sidenotes, or footnotes in the margin
%%% example given by Hraban:
%%% here the tweaking of the width of the sidenote is turned off
%%% remove the comment where there is \ColWidth
%%% in order to adapt to your layout
\showframe
\setuplayout
[cutspace=7cm,
width=middle,
margin=5cm,
margindistance=7mm]

%\def\ColWidth{57mm}
\setupmargindata[inmargin]
[location=right,
stack=continue,
align=flushright,
]

\setupmargindata[inouter]
[location=right,
stack=continue,
align=flushright,
]

\def\FNVOffset{0} % Negative vertical offset of footnotes in lines
% Manual tweaking was necessary for a while, when stacking didn’t work reliably.

\def\MarginNote#1{%
\inmargin[
voffset=\dimexpr-\FNVOffset\lineheight\relax,
%   width=\ColWidth,
align=flushleft,
]{%
\inframed[
%   width=\ColWidth,
align=right,
frame=off,
offset=overlay,
strut=yes,
]{#1}%
}%
}

\define\PlaceFootnote{%
\inmargin[
voffset=\dimexpr-\FNVOffset\lineheight\relax,
%   width=\ColWidth,
]{%
\vtop{\placelocalnotes[footnote][before=,after=]}}%
}



\def\FNo#1{{#1~}}
% I never managed to get number and text in consecutive lines without indented 
text
% or at least a constant whitespace after the number.


\setupnote[footnote]
[location=text,
bodyfont=,
indenting=no,
before={\noindentation},
next=\PlaceFootnote,
]

\setupnotation[footnote]
[way=bychapter,
align=flushleft,
indenting=no,
location=serried,
alternative=serried,
width=broad,
numbercommand=\FNo,
] % footnote text

\setuptexttexts[margin][]
[%
{\framed[
align={flushright,bottom},
frame=off,
height=\textheight,
%   width=\ColWidth,
]{%
\strut\vfill\placenotes[footnote]}}%
]

\starttext
 \dorecurse{6}{\input ward\expanded{\footnote{This is a footnote 
\recurselevel}} }
test
\dorecurse{10}{
test \footnote{\input ward }\input tufte.tex \par
test \footnote{This is a note about Ward, who says: \par \input 
ward.tex} \input ward.tex \par
test \footnote{This is a note about Donald Knuth.} \input knuth.tex \par
}
This is a last note. \footnote{This last note is here to see what happens in 
the next page\dots\par \input knuth.tex}
\par 
\dorecurse{3}{\input knuth.tex }

\stoptext

> On 1 Aug 2020, at 23:01, Henning Hraban Ramm  wrote:
> 
> 
>> Am 01.08.2020 um 22:36 schrieb Otared Kavian :
>> 
>> Hi Hraban,
>> 
>> Thank you for taking the time to send your code for sidenotes.
>> Unfortunately when I add
>> 
>> \starttext
>> test\footnote{A footnote in the margin.}
>> \stoptext
>> 
>> to your code, I get an error and unfortunately with recent versions of LMTX 
>> the error message 
>> !  Undefined control sequence
>> is not helpful to find the error… (LMTX considers \footnote as an undefined 
>> control sequence…).
>> 
> 
> Of course it’s not \footnote that is undefined but something else from my 
> code – I didn’t take the time to strip it of all the references to other 
> setups in the same environment, probably \ColWidth that was just a shortcut 
> for the column width:
> \def\ColWidth{57mm}
> 
> 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
> ___

_

Re: [NTG-context] Store images and text in the right margin

2020-07-03 Thread Marco Patzer
On Fri, 3 Jul 2020 08:40:22 +0200
Fabrice Couvreur  wrote:

> Thanks, it works but only for a comment and a picture. Indeed, if I
> add a comment and an image, the first image is placed on the second
> comment. Fabrice
> 
> \starttext
> \startuserdata[margintext]
>  \input ward
> \stopuserdata
> \marginfigure{\externalfigure[dummy][width=\rightmarginwidth,location=high]}

\marginfigure{\externalfigure[dummy][width=\rightmarginwidth,location=top]}

> \startuserdata[margintext]
>  \input ward
> \stopuserdata
> \marginfigure{\externalfigure[dummy][width=\rightmarginwidth,location=high]}

\marginfigure{\externalfigure[dummy][width=\rightmarginwidth,location=top]}

Marco
___
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] Store images and text in the right margin

2020-07-03 Thread Fabrice Couvreur
Hi Marco,
Thanks, it works but only for a comment and a picture. Indeed, if I add a
comment and an image, the first image is placed on the second comment.
Fabrice

\starttext
\startuserdata[margintext]
 \input ward
\stopuserdata
\marginfigure{\externalfigure[dummy][width=\rightmarginwidth,location=high]}
\startuserdata[margintext]
 \input ward
\stopuserdata
\marginfigure{\externalfigure[dummy][width=\rightmarginwidth,location=high]}
\startchapter[title=First chapter]
\dorecurse{2}{\input knuth}
\stopchapter
\stoptext

Le jeu. 2 juil. 2020 à 19:04, Marco Patzer  a écrit :

> On Thu, 2 Jul 2020 17:20:07 +0200
> Fabrice Couvreur  wrote:
>
> Try:
>
> > \useMPlibrary[dum]
> >
> > \setuppapersize[A4]
> >
> > \setuplayout
> >   [width=12cm,
> >rightmargin=5cm]
> >
> > \definemargindata[marginfigure][inright]
> > \setupmargindata [marginfigure][command=\vbox,align=middle]
>
> \setupmargindata [marginfigure][command=\vbox,align=middle,stack=yes]
>
> > \startsetups [userdata:margintext]
> >   \margindata
> > [inright]
> > [%style=\smallbodyfont,
> >  style={\switchtobodyfont[9pt]},
> >  width=\rightmarginwidth,
>
>   stack=yes,
>
> >  align={flushleft,broad}]
> > {{\bf Remarque — }\getinlineuserdata}
> > \stopsetups
>
> > \marginfigure{\externalfigure[dummy][width=\rightmarginwidth]}
>
>
> \marginfigure{\externalfigure[dummy][width=\rightmarginwidth,location=high]}
>
> Marco
>
> ___
> 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] spacing before items

2020-06-25 Thread David Rogers

Mike Cooper  writes:


Thanks David!

I don't think I've ever been quite so frustrated at trying to 
learn anything else in my life!  If it wasn't required by my 
job, I wouldn't have made it past the first day or two (3 months 
ago).  But I'm slogging away and it's gradually coming together 
(I think).  I spent my whole day yesterday figuring out how to 
do some very basic formatting/layout that would have taken 5-10 
minutes in Word or HTML/CSS.


People have been very helpful and patient with me!!  Thanks to 
all of you for that!


And thanks David for this explanation of the situation.

regards,
Mike


You may already be doing what I'm about to suggest. If so, please 
disregard.


One source that has helped me a lot is the archive of this mailing 
list, where I've searched for any messages that mention whatever 
it is that I'm looking for. Of course such a search is slower than 
scrolling through the index of a manual, and sometimes it's hard 
to figure out "What keyword do I search on? If I knew the correct 
keyword, I'd be done this already!" - but quite often I've "hit 
the jackpot" and found exactly what I needed, or close enough that 
I only had to change some details.


You will soon notice that there are some people on the list who 
consistently see through the problems that are presented, and who 
say something like "I think you probably want something like 
this:" - followed by a solution that makes you say confidently 
"A-ha! So THAT'S how that's done!".


The really good problem-solving sessions on the list, both the 
elegant answers and the questions that precede them, could form a 
pretty good start on a manual. Of course such a method is 
hit-or-miss, but in this case there are quite a few hits. Just 
watch out (in much older messages) that you're not fully relying 
on an answer based on ConTeXt Mk II, because many of those 
solutions no longer work in the newer versions.


... which has accidentally led me to another documentation 
comment. Hans's programming philosophy is not something I'm an 
expert on, but it seems clear that he values "usability, good 
function, and getting the job done well" much higher than he 
values "backward compatibility forever". In other words, if 
something is broken or not good enough, he doesn't hesitate to fix 
it or improve it in the best way he can see. This is good for the 
software in that it is constantly improving in every direction, 
but it does also make it a bit more of a challenge to document, 
and a bit more of a challenge to find someone who *wants* to 
document it - "How ConTeXt Used To Work Last Year" is clearly not 
going to be a top-selling title. :) But despite that, the majority 
of what you want to know has not changed in quite some time, and 
usually only *very* old solutions will fail completely.


I want to finish this message by saying: When you read through 
"SomeFile.tex" that you've created, every switch and command in it 
should make sense to you. In the beginning that might not always 
be the case, but it's easier for you to get there than it might 
sound, and you'll see that all the best solutions you get from 
others share that quality of "Ah, I see, that makes sense, I get 
how this works". Most of the time, a solution that doesn't give 
you that feeling is not quite the right way to do it. Of course a 
poor solution is better than nothing, but please don't stay 
satisfied with hairy-looking clusters of commands that sort of 
work but no one knows why. (I've written lots of those, that's why 
I say this.) :) Simple and direct writing means the mistakes will 
soon become obvious; the worst thing to do in ConTeXt is to make a 
complicated mysterious mistake that you can't even find.


Well. THAT turned out longer than I intended. :)

--
David
___
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] error running wiki example with labels

2020-06-24 Thread Wolfgang Schuster

Jan-Erik Hägglöf schrieb am 24.06.2020 um 21:05:

Hello All!

In the page https://wiki.contextgarden.net/Labels

I’ve tried with no success to run those examples given at the page. The 
error complaint as the log shows below


Can you comment (or remove) the following two lines which load the IBM 
Plex fonts.


\usetypescriptfile  [plex]
\setupbodyfont  [ibmplex,ss,11pt]

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] \asciimode and \type{%%}

2020-06-24 Thread Hans Hagen

On 6/24/2020 7:59 PM, Wolfgang Schuster wrote:

Hans Hagen schrieb am 24.06.2020 um 19:06:

On 6/24/2020 6:33 PM, Wolfgang Schuster wrote:

Hi,

when asciimode is enabled the \type command ignores double comment 
symbols.


\starttext

\quotation{\type{%}}

\quotation{\type{%%}}

\asciimode

\quotation{\type{%}}

\quotation{\type{%%}}

\stoptext


It's actually a feature: in ascimode double % is the comment and 
content is preprocessed. originally asciimode was just for math and we 
still wanted a way to have comments.


I can't remember the details when the command was added (I know there 
was \nonknuthmode) but in this example it works in a unexpected way (the 
% are removed but the following text is kept).


There is no need for \asciimode in my document but I use it sometimes 
when I have symbols I don't want to replace.


It's a side effect of buffers: each \type ends up in a buffer and that 
actually is a file on its own.



But ... we can have

\unexpanded\def\literalmode{\setcatcodetable\txtcatcodes}

and then:

[...]

I'll add that command, assuming that someone will document it somewhere.


Not really needed in this case but I'm going to document it.

I already bet on that -)

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] \asciimode and \type{%%}

2020-06-24 Thread Wolfgang Schuster

Hans Hagen schrieb am 24.06.2020 um 19:06:

On 6/24/2020 6:33 PM, Wolfgang Schuster wrote:

Hi,

when asciimode is enabled the \type command ignores double comment 
symbols.


\starttext

\quotation{\type{%}}

\quotation{\type{%%}}

\asciimode

\quotation{\type{%}}

\quotation{\type{%%}}

\stoptext


It's actually a feature: in ascimode double % is the comment and 
content is preprocessed. originally asciimode was just for math and we 
still wanted a way to have comments.


I can't remember the details when the command was added (I know there 
was \nonknuthmode) but in this example it works in a unexpected way (the 
% are removed but the following text is kept).


There is no need for \asciimode in my document but I use it sometimes 
when I have symbols I don't want to replace.



But ... we can have

\unexpanded\def\literalmode{\setcatcodetable\txtcatcodes}

and then:

[...]

I'll add that command, assuming that someone will document it somewhere.


Not really needed in this case but I'm going to document it.

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] spacing before items

2020-06-24 Thread Mike Cooper
g like context:
> 
> - you often bring with your experience (and exposure) to different
> systems and these don't translate; recently i was playing with some css
> setup for a rather complex xml -> html mapping and things that would
> have taken me 5 minutes in tex costs me plenty of time in css due to all
> kind of interactions; just as with tex, one can end up with hacks found
> on the web (it was hobyism of course)

Sure.  I suppose this is the same as my "jargon" comment above.

I don't mean to be a jerk or anything.  I'm trying to learn this stuff.  It's 
just extremely frustrating...

___
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] \asciimode and \type{%%}

2020-06-24 Thread Hans Hagen

On 6/24/2020 6:33 PM, Wolfgang Schuster wrote:

Hi,

when asciimode is enabled the \type command ignores double comment symbols.

\starttext

\quotation{\type{%}}

\quotation{\type{%%}}

\asciimode

\quotation{\type{%}}

\quotation{\type{%%}}

\stoptext


It's actually a feature: in ascimode double % is the comment and content 
is preprocessed. originally asciimode was just for math and we still 
wanted a way to have comments.


But ... we can have

\unexpanded\def\literalmode{\setcatcodetable\txtcatcodes}

and then:

\starttext

\quotation{\type{%}}

\quotation{\type{%%}}

\literalmode

\quotation{\type{%}}

\quotation{\type{%%}}

test 10% test

\stoptext

I'll add that command, assuming that someone will document it somewhere.

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] \asciimode and \type{%%}

2020-06-24 Thread Wolfgang Schuster

Hi,

when asciimode is enabled the \type command ignores double comment symbols.

\starttext

\quotation{\type{%}}

\quotation{\type{%%}}

\asciimode

\quotation{\type{%}}

\quotation{\type{%%}}

\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] margin comment above heading

2020-06-18 Thread Pablo Rodriguez
On 6/17/20 11:26 PM, Henning Hraban Ramm wrote:
> [...]
> Pablo, do I understand right that you’re converting XML and the
> comment comes last in that structure, but you need it first?> I.e.
> the real question is how to process the XML structure in a different
> order, right?
Hraban,

yes, this is my real question. I have to learn how to select the last
child using lpath ("[position()==last()]", I guess).

> That would avoid shifting boxes around, which might be possible, but
> ugly and hard to control.

This make sense. Messing code to force ConTeXt to work as it isn’t
intended may to other unintended consequences as well.

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] margin comment above heading

2020-06-18 Thread Pablo Rodriguez
On 6/17/20 10:47 PM, Wolfgang Schuster wrote:
> Pablo Rodriguez schrieb am 16.06.2020 um 22:17:
>> Dear list,
>>
>> I have the following sample:
>>
>>\startsetups[tinytiny]
>>  \setupwhitespace[-2em]
>>  \setupbodyfont[0.01pt]
>>  \setupinterlinespace[1sp]
>>\stopsetups

This was from a previous form of the sample. If the paragraph is really
tiny, it would be easier not to have a page break between that paragraph
and the

>>\setupinteraction[state=start]
>>\showframe\showgrid
>>\starttext
>>  \blank[force, 10em]
>>  \section{Move comment above this heading}
>>  \startparagraph[setups=tinytiny]
>>   \dontleavehmode
>>   \comment[location={rightmargin}, color=orange]
>>   {comment}
>>  \stopparagraph
>>\stoptext
>>
>> Is there a way to move the comment above the heading that goes before?
>
> Like this?
>
> \setupinteraction[state=start]
>
> \showframe
> \showgrid
>
> \starttext
>
> \blank[force,10em]
>
> \comment[location={rightmargin},color=orange]{comment}
> \section{Move comment above this heading}
>
> \stoptext

This is what I intend, but not changing the order of \section before
\comment (if that is possible, which I don’t know).

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] margin comment above heading

2020-06-17 Thread Henning Hraban Ramm

> Am 17.06.2020 um 22:47 schrieb Wolfgang Schuster 
> :
> 
> Pablo Rodriguez schrieb am 16.06.2020 um 22:17:
>> Dear list,
>> I have the following sample:
>>   \startsetups[tinytiny]
>> \setupwhitespace[-2em]
>> \setupbodyfont[0.01pt]
>> \setupinterlinespace[1sp]
>>   \stopsetups
> 
> ???
> 
>>   \setupinteraction[state=start]
>>   \showframe\showgrid
>>   \starttext
>> \blank[force, 10em]
>> \section{Move comment above this heading}
>> \startparagraph[setups=tinytiny]
>>  \dontleavehmode
>>  \comment[location={rightmargin}, color=orange]
>>  {comment}
>> \stopparagraph
>>   \stoptext
>> Is there a way to move the comment above the heading that goes before?
> 
> Like this?
> 
> \setupinteraction[state=start]
> 
> \showframe
> \showgrid
> 
> \starttext
> 
> \blank[force,10em]
> 
> \comment[location={rightmargin},color=orange]{comment}
> \section{Move comment above this heading}
> 
> \stoptext

Pablo, do I understand right that you’re converting XML and the comment comes 
last in that structure, but you need it first?
I.e. the real question is how to process the XML structure in a different 
order, right?
That would avoid shifting boxes around, which might be possible, but ugly and 
hard to control.

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
___


Re: [NTG-context] margin comment above heading

2020-06-17 Thread Wolfgang Schuster

Pablo Rodriguez schrieb am 16.06.2020 um 22:17:

Dear list,

I have the following sample:

   \startsetups[tinytiny]
 \setupwhitespace[-2em]
 \setupbodyfont[0.01pt]
 \setupinterlinespace[1sp]
   \stopsetups


???


   \setupinteraction[state=start]
   \showframe\showgrid
   \starttext
 \blank[force, 10em]
 \section{Move comment above this heading}
 \startparagraph[setups=tinytiny]
  \dontleavehmode
  \comment[location={rightmargin}, color=orange]
  {comment}
 \stopparagraph
   \stoptext

Is there a way to move the comment above the heading that goes before?


Like this?

\setupinteraction[state=start]

\showframe
\showgrid

\starttext

\blank[force,10em]

\comment[location={rightmargin},color=orange]{comment}
\section{Move comment above this heading}

\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] margin comment above heading

2020-06-16 Thread Pablo Rodriguez
Dear list,

I have the following sample:

  \startsetups[tinytiny]
\setupwhitespace[-2em]
\setupbodyfont[0.01pt]
\setupinterlinespace[1sp]
  \stopsetups
  \setupinteraction[state=start]
  \showframe\showgrid
  \starttext
\blank[force, 10em]
\section{Move comment above this heading}
\startparagraph[setups=tinytiny]
 \dontleavehmode
 \comment[location={rightmargin}, color=orange]
 {comment}
\stopparagraph
  \stoptext

Is there a way to move the comment above the heading that goes before?

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] issue with \comment

2020-06-16 Thread Pablo Rodriguez
On 6/16/20 8:00 PM, Wolfgang Schuster wrote:
> Pablo Rodriguez schrieb am 16.06.2020 um 19:20:
>> [...]
>> I think it might be a bug. Could anyone confirm this?
>
> Why is everything a bug?
>
> Some elements like margin blocks or register entries need an anchor.

Sorry, Wolfgang, I discovered after reporting the issue that inmargin
comments need to be in horizontal mode.

Many thanks for your help and sorry for the noise,

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] issue with \comment

2020-06-16 Thread Wolfgang Schuster

Pablo Rodriguez schrieb am 16.06.2020 um 19:20:

Dear list,

when trying to report another issue, I found the following one (using
latest from 2020.06.12 17:43):

   \setupinteraction[state=start]
   \starttext
 a\contextversion

 \comment[location={rightmargin}]{comment}
   \stoptext

For some strange reason, \comment isn’t added when there is no other
content in the paragraph.

I think it might be a bug. Could anyone confirm this?


Why is everything a bug?


Some elements like margin blocks or register entries need an anchor.

\enabletrackers[typesetters.margindata]

\starttext

\inrightmargin{Hello!}xxx

\inrightmargin{Here!}
%\inrightmargin{Here!}\dontleavehmode

\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] wrong page for annotation and \pagenumber

2020-06-16 Thread Aditya Mahajan

On Tue, 16 Jun 2020, Pablo Rodriguez wrote:


On 6/16/20 4:58 PM, Wolfgang Schuster wrote:

Pablo Rodriguez schrieb am 16.06.2020 um 16:31:

[...]
I’m afraid that you get the same result, so there may be a bug there.


There is no bug. When you take a look at my pagenumber example you see a
few lines at the top show the number of the previous page, this happens
because TeX collects more than necessary which means in your example
above the layer is placed when TeX was still on the first page.


Many thanks for your reply, Wolfgang.

I’m afraid that TeX is too tricky for me in that case (or I simply think
that it is misbehaving there).


In your example you can add \testpage to \section to force a page break
when there isn't enough space available to place the heading, this moves
also the layer placement to the next page.


I’m afraid this doesn’t work with my real document.

I need another approach. This sample reflects my problem:

 \setupinteraction[state=start]
 %~ \showframe\showgrid
 \starttext
   \dorecurse{41}{one line\par}

   \ \comment[location={rightmargin}]{comment}
 \stoptext

Since layers are problematic for the task, I insert the comments right
after the text (which actually comes from \xmlflush{#1} [XML sources]).

I’m afraid that the paragraph before \comment comes from \xmlflush, so I
cannot avoid it.

This is unproblematic for most cases, but the sample above displays the
problem of adding a comment in a new paragraph. It might add a new page.

To avoid this issue: how could I prevent the pagebreak before \comment
and the addition of a pagebreak above?

If that were possible, I could add a \blank[-2*line] that would place
the comment right.


Try

\removeunwantedwhitespace

or

\blank[samepage]

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] wrong page for annotation and \pagenumber

2020-06-16 Thread Pablo Rodriguez
On 6/16/20 4:58 PM, Wolfgang Schuster wrote:
> Pablo Rodriguez schrieb am 16.06.2020 um 16:31:
>> [...]
>> I’m afraid that you get the same result, so there may be a bug there.
>
> There is no bug. When you take a look at my pagenumber example you see a
> few lines at the top show the number of the previous page, this happens
> because TeX collects more than necessary which means in your example
> above the layer is placed when TeX was still on the first page.

Many thanks for your reply, Wolfgang.

I’m afraid that TeX is too tricky for me in that case (or I simply think
that it is misbehaving there).

> In your example you can add \testpage to \section to force a page break
> when there isn't enough space available to place the heading, this moves
> also the layer placement to the next page.

I’m afraid this doesn’t work with my real document.

I need another approach. This sample reflects my problem:

  \setupinteraction[state=start]
  %~ \showframe\showgrid
  \starttext
    \dorecurse{41}{one line\par}

\ \comment[location={rightmargin}]{comment}
  \stoptext

Since layers are problematic for the task, I insert the comments right
after the text (which actually comes from \xmlflush{#1} [XML sources]).

I’m afraid that the paragraph before \comment comes from \xmlflush, so I
cannot avoid it.

This is unproblematic for most cases, but the sample above displays the
problem of adding a comment in a new paragraph. It might add a new page.

To avoid this issue: how could I prevent the pagebreak before \comment
and the addition of a pagebreak above?

If that were possible, I could add a \blank[-2*line] that would place
the comment right.

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
___


[NTG-context] issue with \comment

2020-06-16 Thread Pablo Rodriguez
Dear list,

when trying to report another issue, I found the following one (using
latest from 2020.06.12 17:43):

  \setupinteraction[state=start]
  \starttext
a\contextversion

\comment[location={rightmargin}]{comment}
  \stoptext

For some strange reason, \comment isn’t added when there is no other
content in the paragraph.

I think it might be a bug. Could anyone confirm this?

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] wrong page for annotation and \pagenumber

2020-06-15 Thread Rudolf Bahr
On Mon, Jun 15, 2020 at 02:52:49PM +0200, Pablo Rodriguez wrote:
> Dear list,
> 
> I have the following number with wrong annotation placement and wrong
> page number, which would be both on the second page:
> 
>   \setupinteraction[state=start]
>   \definelayer[pgnumber]
>   \setupbackgrounds[page][background=pgnumber]
>   \starttext
>   \placelist[section][alternative=d]
>   \dorecurse{16}{\section{Section}}
>   \pagenumber/\lastpagenumber
>   \setlayer[pgnumber]
> {\comment{\pagenumber}}
>   \stoptext
> 
> Could anyone confirm the issue?
> 
> Many thanks for your help,
> 
> Pablo


Hi Pablo,

I fear I don't understand what issue you mean, therefore I append my output 
here.

I'm using:
LuaMetaTeX, Version 2.04.02
ConTeXt  ver: 2020.02.17 19:36 MKIV beta  fmt: 2020.2.23

Best wishes,
Rudolf


annotation-u-pagenumber.pdf
Description: Adobe PDF document
___
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] wrong page for annotation and \pagenumber

2020-06-15 Thread Wolfgang Schuster

Pablo Rodriguez schrieb am 15.06.2020 um 14:52:

Dear list,

I have the following number with wrong annotation placement and wrong
page number, which would be both on the second page:

   \setupinteraction[state=start]
   \definelayer[pgnumber]
   \setupbackgrounds[page][background=pgnumber]
   \starttext
   \placelist[section][alternative=d]
   \dorecurse{16}{\section{Section}}
   \pagenumber/\lastpagenumber
   \setlayer[pgnumber]
 {\comment{\pagenumber}}
   \stoptext

Could anyone confirm the issue?


\pagenumber is only reliable headers/footer texts or page backgrounds, 
for everything else you need a multi pass mechanism (save the page 
number in the first run and provide it in the second).


\setuppapersize[A6]

\definepagestate[pagenumber]

\starttext

\subject{\tex{pagenumber}}

\dorecurse{50}{\twodigits{\recurselevel}: \pagenumber\par}

\page

\subject{\tex{pagestaterealpage}}

\dorecurse{50}
  {\twodigits{\recurselevel}:
   \setpagestate[pagenumber]%
   \pagestaterealpage{pagenumber}{\recurselevel}\par}

\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] wrong page for annotation and \pagenumber

2020-06-15 Thread Pablo Rodriguez
Dear list,

I have the following number with wrong annotation placement and wrong
page number, which would be both on the second page:

  \setupinteraction[state=start]
  \definelayer[pgnumber]
  \setupbackgrounds[page][background=pgnumber]
  \starttext
  \placelist[section][alternative=d]
  \dorecurse{16}{\section{Section}}
  \pagenumber/\lastpagenumber
  \setlayer[pgnumber]
{\comment{\pagenumber}}
  \stoptext

Could anyone confirm the issue?

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] Filter module for R

2020-06-15 Thread Aditya Mahajan

On Mon, 15 Jun 2020, Aditya Mahajan wrote:


On Sun, 14 Jun 2020, Fabrice L wrote:


Hi,

Following a question about the broken R module (R the statistical 
software), Aditya suggested me the filter module (thanks to him). I’m about 
to distribute a set of course notes to colleagues, and I need to deal with 
details now. I have one problem and two questions.


1) the filter collect R code between \startR / \stopR and submit this code 
to R. As it can be seen in the following minimal example, when a label 
contains an accented character (« Fréquence » in my example), the pdf 
graphic does not contains the « é ». Strangely, the snippet of code (which 
is saved locally as « test2-temp-R-0.tmp » (for test2.tex)) when submitted 
with the same command as the filtercommand, works correctly; that means the 
same file works when submitted to R outside of ConTeXt. I have no idea how 
to solve this.


Are you running the exact same command as the `filtercommand`. If so, I don't 
know why running the `filtercommand` through context vs directly typing it on 
the terminal should behave differently. The filter module effectively just 
runs os.execute("filtercommand"). I don't use R so I am unable to debug 
further.


I can reproduce this output side the filter module. If I directly run os.execute(...) 
from a lua session, the output is correct but running it through context gives the wrong 
output. I am guessing this is something to do with locale. I notice that the output of 
os.execute("locale") from context is different from that from my shell. But I 
don't know why locale should affect UTF characters in R. Perhaps someone with more 
knowledge of R can comment on that.

\starttext

\startluacode
  lfs.mkdir("output/")
\stopluacode

\startbuffer[code]
   pdf("output/MyHistogram.pdf",5,5)
   X <- rnorm(200,mean=10,sd=2)
   hist(X, col =  "red3" ,  xlab="Score QI" , main="", ylab="fréquence")
\stopbuffer

\savebuffer[prefix=no, list=code, file={output/code.r}]

\startluacode
  print(">>>>", "RUNNING R CMD")
  os.execute("R CMD BATCH --no-timing --save --restore output/code.r 
output/out")
\stopluacode

\externalfigure[RPlots/MyHistogram.pdf][width=.5\textwidth]

\stoptext

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] using annotations for extended print handling

2020-06-14 Thread Pablo Rodriguez
Dear list,

I have an over a thousand pages document generated with ConTeXt.

I need to print and chapters and part of chapters (or send to other people).

/PrintPageRange is great (and you can even generate a new document
containing only the pages in /PrintPageRange). But the issue here is
that I would need to recompile the document again for each new required
/PrintPageRange.

Another approach would be to add PDF annotations (outside page
boundaries) to store the desired information.

So I created text annotations (using \comment) with author information
composed from unit number (such as "i3", "ii9" or "iii28"), info on the
unit part (such as "-explanation", "-synopsis", "-exercises", or others)
and position ("-start" and "-stop").

This would make author fields such as "i3-start" (which has a
corresponding "i3-stop", or "ii22-synopsis-start" (with the
corresponding closing annotation).

To make easier to identify these annotations, they all share the same
title. As contents, all these text annotations have the page number.

From the generated PDF document, I need to read all text annotations in
order to extract two fields from those annotations that contain a
"whatever" /Subj. These fields are /T and /Contents.

I guess that the way to deal with the (over 700) annotations would be to
store both fields in a Lua table. But this is only a suspicion, since I
don’t know how to read the values, how to store them, or how to compare
them with specific units or unit parts to get these page numbers.

I mean, with a command such as
\extractpages{i5,i8-exercises,i15-explanation} would get the pages for
each "-start" and "-stop" that could be passed automatically to a
\filterpages command.

A sample that generates something similar:

  \setuppapersize[A8]
  \setupinteraction[state=start]
  \starttext
  \dorecurse{5}{\part{\romannumerals{\recurselevel}}
  \dorecurse{15}{\chapter{\recurselevel}
  \comment
  [title=whatever,
   color=yellow,
  %~ the following code is to have expansion in interaction
   author={\ctxlua{context([[\namedstructurevariable{part}{title}%
\namedstructurevariable{chapter}{title}]].."-start")}}]
  {\pagenumber}
  \doloopoverlist{explanation,exercises,synopsis}{\chapter{\recurselevel}
  %~ I would like to use \recursestring, but it is undefined here
  \comment
  [title=whatever,
   color=green,
   author={\ctxlua{context([[\namedstructurevariable{part}{title}%
    \namedstructurevariable{chapter}{title}]]..
  [[-\recurselevel]].."-start")}}]
  {\pagenumber}
  \dorecurse{5}{\null\page}
  \comment
  [title=whatever,
   color=blue,
   author={\ctxlua{context([[\namedstructurevariable{part}{title}%
\namedstructurevariable{chapter}{title}]]..
  [[-\recurselevel]].."-stop")}}]
  {\pagenumber}
  }
  \comment
  [title=whatever,
   color=red,
   author={\ctxlua{context([[\namedstructurevariable{part}{title}%
\namedstructurevariable{chapter}{title}]].."-stop")}}]
  {\pagenumber}
  }
  }
  \stoptext

Is there a way to deal with the annotations in the document generated
from the code above, in the way I described before?

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] using modeset

2020-06-12 Thread Jan Willem Flamma
Thank you Wolfgang, BPJ and Robert for your answers and feedback. Much appreciated.  I will explorer the solutions that have been offered to extend my knowledge on using ConTeXt but at the same time I value the advice of not going down that route for large document. In any case, I have learned something! Kind regards,Jan Willem Flamma  From: r.erm...@hccnet.nlSent: Friday, 12 June 2020 07:56To: mailing list for ConTeXt usersSubject: Re: [NTG-context] using modeset I tried this too, a number of times. For lengthy texts it makes little sense. One important thing is that, as BPJ says, you loose the flow during writing. When the document is finished, it is difficult to get an overview. If you consider it using for lengthy documents, I would consider to set up an xml file. You can then have the overview via scripts. Yet for short texts it can be a solution. I have case material for my trainings in both English and Dutch in the same file. Instead of modes, I use blocks. Like this: \defineblock[ENblok]\defineblock[NLblok] \setupblock[NLblok][before={\mainlanguage[nl]},after=]\setupblock[ENblok][before={\mainlanguage[en]},after=] Then, determine which blocks you want to use in your file: \hideblocks[NLblok]%\hideblocks[ENblok] For the titles I use another method: %\def\NL#1{#1}\def\NL#1{{}}%\def\EN#1{}\def\EN#1{#1} You have to comment and uncomment, depending on the language, but I think you can put them in the NLblok or ENbloks instead. \definecomplexenumeration[Casus]… definition \def\refno#1{{\em{(no. \small #1})}} My files look like this: \starttext \startCasus[casus-349][\NL{Een moeilijke zaak}\EN{A complicated case}] \refno{casus-349}\crlf The casus-349 element is used as a label. After the text I have a list of questions for this case in a separate block for questions, introduced by \in[casus-349]). You can probably also use something like \section[\NL{Een moeilijke zaak}\EN{A complicated case}]{} \begin[NLblok]\startlinenumberingtext ... \stoplinenumbering\end[NLblok] \begin[Enblok]\startlinenumberingtext... \stoplinenumbering\end[Enblok]\stoptext I hope this helps finding a solution. Robert  Op 11 jun. 2020, om 20:53 heeft BPJ <b...@melroch.se> het volgende geschreven: Den tors 11 juni 2020 10:45Jan Willem Flamma <register...@gmail.com> skrev: Dear list members, I write training manuals and use the Modes mechanism a lot to create documents at various competency levels using a single set of source files. So far the manuals have been written in English but now a separate Dutch translation has to be created. It is important that the two manuals are setup similarly so the section/subsection numbers and question numbers are the same in the English manual and the Dutch manual. Note: I do not intend to create a manual that has the English and Dutch text at opposite sides (as can be done using streams) I’m keen to continue using a single set of source files and thought it would be best to simply type the translated sections and subsections just below the original English sections and subsections using modeset. This gives me the option of creating an English case and a Dutch case. Within this two cases I would still apply all sorts of other modes using \startmode and \doifmode. I have done that with LaTeX and IMHO that way lies madness. It may work for shorter text but for text(s) of any length it gets messy. You lose the "flow"  in both texts, and it shows when you read the typeset text, and the source becomes hard to navigate. You are probably better off using an editor which allows you to have the two versions open side by side in their own viewports (I use what Vim calls "windows").  If each section heading is on its own line you might try something like a Perl script to loop over the lines in the English version and print only the section headings to a new file, where you translate them and build up the Dutch version around them. It's even better if the editor has the capacity to show an outline pane for each version — if there is an outline mode which understands ConTeXt. I'm sorry to discourage you but chances are that you end up with an intractable mess which you will have to spend much time disentangling later.___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-contextwebpage  : http://www.pragma-ade.nl / http://context.aanhet.netarchive  : 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-ad

Re: [NTG-context] using modeset

2020-06-11 Thread r . ermers
I tried this too, a number of times. For lengthy texts it makes little sense. 
One important thing is that, as BPJ says, you loose the flow during writing. 
When the document is finished, it is difficult to get an overview.

If you consider it using for lengthy documents, I would consider to set up an 
xml file. You can then have the overview via scripts.

Yet for short texts it can be a solution. I have case material for my trainings 
in both English and Dutch in the same file. Instead of modes, I use blocks. 
Like this:

\defineblock[ENblok]
\defineblock[NLblok]

\setupblock[NLblok][before={\mainlanguage[nl]},after=]
\setupblock[ENblok][before={\mainlanguage[en]},after=]

Then, determine which blocks you want to use in your file:

\hideblocks[NLblok]
%\hideblocks[ENblok]

For the titles I use another method:

%\def\NL#1{#1}
\def\NL#1{{}}
%\def\EN#1{}
\def\EN#1{#1}

You have to comment and uncomment, depending on the language, but I think you 
can put them in the NLblok or ENbloks instead.

\definecomplexenumeration[Casus]
… definition

\def\refno#1{{\em{(no. \small #1})}}

My files look like this:

\starttext

\startCasus[casus-349][\NL{Een moeilijke zaak}\EN{A complicated case}] 
\refno{casus-349}\crlf

The casus-349 element is used as a label. After the text I have a list of 
questions for this case in a separate block for questions, introduced by 
\in[casus-349]).

You can probably also use something like 
\section[\NL{Een moeilijke zaak}\EN{A complicated case}]{}

\begin[NLblok]
\startlinenumbering
text ...

\stoplinenumbering
\end[NLblok]

\begin[Enblok]
\startlinenumbering
text...

\stoplinenumbering
\end[Enblok]
\stoptext

I hope this helps finding a solution.

Robert



> Op 11 jun. 2020, om 20:53 heeft BPJ  het volgende geschreven:
> 
> Den tors 11 juni 2020 10:45Jan Willem Flamma  <mailto:register...@gmail.com>> skrev:
>  
> 
> Dear list members,
> 
>  
> 
> I write training manuals and use the Modes mechanism a lot to create 
> documents at various competency levels using a single set of source files. So 
> far the manuals have been written in English but now a separate Dutch 
> translation has to be created.
> 
>  
> 
> It is important that the two manuals are setup similarly so the 
> section/subsection numbers and question numbers are the same in the English 
> manual and the Dutch manual. Note: I do not intend to create a manual that 
> has the English and Dutch text at opposite sides (as can be done using 
> streams)
> 
>  
> 
> I’m keen to continue using a single set of source files and thought it would 
> be best to simply type the translated sections and subsections just below the 
> original English sections and subsections using modeset. This gives me the 
> option of creating an English case and a Dutch case. Within this two cases I 
> would still apply all sorts of other modes using \startmode and \doifmode.
> 
> 
> I have done that with LaTeX and IMHO that way lies madness. It may work for 
> shorter text but for text(s) of any length it gets messy. You lose the "flow" 
>  in both texts, and it shows when you read the typeset text, and the source 
> becomes hard to navigate. You are probably better off using an editor which 
> allows you to have the two versions open side by side in their own viewports 
> (I use what Vim calls "windows").  If each section heading is on its own line 
> you might try something like a Perl script to loop over the lines in the 
> English version and print only the section headings to a new file, where you 
> translate them and build up the Dutch version around them. It's even better 
> if the editor has the capacity to show an outline pane for each version — if 
> there is an outline mode which understands ConTeXt.
> 
> I'm sorry to discourage you but chances are that you end up with an 
> intractable mess which you will have to spend much time disentangling later.
> ___
> 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] ConTeXt source browser website update

2020-06-10 Thread Willi Egger
This is really a nice interface! Thank you so much for all this work!

Willi

> On 7 Jun 2020, at 16:25, Taco Hoekwater  wrote:
> 
> Hi all,
> 
> I just replaced the software of https://source.contextgarden.net/ by a Lua 
> implementation that uses Hans Hagen’s SciTE lexers for syntax highlighting 
> and a Lua-generated search index.
> 
> There is no official documentation yet (because I may want to change some 
> stuff still) but here is some relevant information:
> 
> * The search field uses a Lua string pattern to match a single word (no 
> multi-word search as of yet). 
> 
> See https://www.lua.org/manual/5.3/manual.html#6.4.1 for the syntax of lua 
> string patterns.
> 
> * The search index only contains 7-bit ASCII ‘words’ that contain at least 
> one of 'a-zA-Z’ (writing an LPEG for unicode matching is a tricky and 
> probably would be quite slow even if I could make it work). 
> 
> Still, this should be ok-ish because most of the ConTeXt source is ASCII, 
> except for the interface files.
> 
> * The files context-en.xml, mtxrun{.lua}, and all of the files in the 
> tex/context/patterns subtree are skipped in the search index. Also skipped 
> are words shorter than 3 bytes, lua keywords, and words having more than 
> (approx) 1500 hits
> 
> * On the plus side, because of the SciTE lexer, “contextversion’ and 
> “\contextversion” are separate entries in the search index. And you can 
> search for “\@@kldirection”.
> 
> * For text file types that have no SciTE lexer there is no syntax 
> highlighting, and binary files are ignored altogether.
> 
> The rest of the interface should be self-explanatory.
> 
> Suggestions for improvements are welcome.
> 
> 
> Index statistics:
> 
> 4085 files processed, 178 skipped, 3744 with matches
> 120733 words found
> 119154 words exported to word.idx
> 37928 comment words found
> 36880 words exported to comment.idx
> 26756 documentation words found
> 26018 words exported to docs.idx
> 
> The word.idx is roughly 11 megabytes.
> 
> Have fun,
> 
> Taco
> 
> 
> 
> 
> ___
> 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] start/stop executed conditionally on mode ?

2020-06-10 Thread Jan Willem Flamma
Dear list, I have seen the use of blocks mechanism with and without a start/stop combination. It is not clear to me in which cases it is required to also include a start/stop combination in this mechanism. \beginquestion\startquestionQuestion A\stopquestion\endquestion\beginanswer\startanswerAnswer A\stopanswer\endanswer Regards,Jan Willem Flamma  From: Hans HagenSent: Tuesday, 9 June 2020 09:37To: mailing list for ConTeXt users; Fabrice LSubject: Re: [NTG-context] start/stop executed conditionally on mode ? On 6/8/2020 9:53 PM, Fabrice L wrote:> > >> Le 7 juin 2020 à 23:19, Aditya Mahajan >> > a écrit :>> >> On Sun, 7 Jun 2020, Fabrice L wrote:>> >>> Dear List,>>> >>> I would like to insert a page using (ideally) start/stop >>> instructions. The problem is that this page should be inserted only >>> in a certain mode. Consulting the mailing list, I thought the >>> following code was working, but it’s not ! The code is executed in >>> the mode as expected, but the following instructions ("Some other >>> text... » in the exemple) is not typeset.>>> >>> Here is a minimal (not working!) example:>>> >>> % >>> \unexpanded\def\StartQuestionsList{>>> \startmode[ClassRoom]  \page[yes] Here are some questions: \blank>>> }>>> \unexpanded\def\StopQuestionsList{>>> \page[yes] \stopmode>>> }>>> \definestartstop[Questions][>>> before=\StartQuestionsList,>>> after=\StopQuestionsList>>> ]>>> >>> >>> \startQuestions>>> Question A….>>> Question B….>>> \stopQuestions>>> >>> Some other text...>>> % One of the oldest mechanism available ... blocks: \enablemode[classroom] % comment this \defineblock[Question] \doifmode {classroom} { \keepblocks[Question]} \starttext  Text A  \beginQuestion Question A…. \endQuestion      Text B  \beginQuestion Question B…. \endQuestion  \page  \doifnotmode {classroom} { \useblocks[Question] } \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-contextwebpage  : http://www.pragma-ade.nl / http://context.aanhet.netarchive  : 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] start/stop executed conditionally on mode ?

2020-06-09 Thread Fabrice L


> Le 9 juin 2020 à 03:37, Hans Hagen  a écrit :
> 
> On 6/8/2020 9:53 PM, Fabrice L wrote:
>>> Le 7 juin 2020 à 23:19, Aditya Mahajan >> <mailto:adit...@umich.edu>> a écrit :
>>> 
>>> On Sun, 7 Jun 2020, Fabrice L wrote:
>>> 
>>>> Dear List,
>>>> 
>>>> I would like to insert a page using (ideally) start/stop instructions. The 
>>>> problem is that this page should be inserted only in a certain mode. 
>>>> Consulting the mailing list, I thought the following code was working, but 
>>>> it’s not ! The code is executed in the mode as expected, but the following 
>>>> instructions ("Some other text... » in the exemple) is not typeset.
>>>> 
>>>> Here is a minimal (not working!) example:
>>>> 
>>>> % 
>>>> \unexpanded\def\StartQuestionsList{
>>>> \startmode[ClassRoom]  \page[yes] Here are some questions: \blank
>>>> }
>>>> \unexpanded\def\StopQuestionsList{
>>>> \page[yes] \stopmode
>>>> }
>>>> \definestartstop[Questions][
>>>> before=\StartQuestionsList,
>>>> after=\StopQuestionsList
>>>> ]
>>>> 
>>>> 
>>>> \startQuestions
>>>> Question A….
>>>> Question B….
>>>> \stopQuestions
>>>> 
>>>> Some other text...
>>>> % 
> One of the oldest mechanism available ... blocks:
> 
> \enablemode[classroom] % comment this
> 
> \defineblock[Question]
> 
> \doifmode {classroom} {
>\keepblocks[Question]
> }
> 
> \starttext
> 
>Text A
> 
>\beginQuestion
>Question A….
>\endQuestion
> 
>Text B
> 
>\beginQuestion
>Question B….
>\endQuestion
> 
>\page
> 
>\doifnotmode {classroom} {
>\useblocks[Question]
>}
> 
> \stoptext

You are right of course... In fact I already use blocks, for another purpose, 
but I did not think about this solution because I needed a lot of formatting 
(these blocks should occupy whole page, different background color…), but 
blocks can adapt to my current need (I have try this morning) using the 
\setupblock[][before=..,after=…] command. And there is a bonus; I can « collect 
» these blocks and put them all together at the end of my courses notes, this 
is perfect.


___
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] start/stop executed conditionally on mode ?

2020-06-09 Thread Hans Hagen

On 6/8/2020 9:53 PM, Fabrice L wrote:



Le 7 juin 2020 à 23:19, Aditya Mahajan <mailto:adit...@umich.edu>> a écrit :


On Sun, 7 Jun 2020, Fabrice L wrote:


Dear List,

I would like to insert a page using (ideally) start/stop 
instructions. The problem is that this page should be inserted only 
in a certain mode. Consulting the mailing list, I thought the 
following code was working, but it’s not ! The code is executed in 
the mode as expected, but the following instructions ("Some other 
text... » in the exemple) is not typeset.


Here is a minimal (not working!) example:

% 
\unexpanded\def\StartQuestionsList{
\startmode[ClassRoom]  \page[yes] Here are some questions: \blank
}
\unexpanded\def\StopQuestionsList{
\page[yes] \stopmode
}
\definestartstop[Questions][
before=\StartQuestionsList,
after=\StopQuestionsList
]


\startQuestions
Question A….
Question B….
\stopQuestions

Some other text...
% 

One of the oldest mechanism available ... blocks:

\enablemode[classroom] % comment this

\defineblock[Question]

\doifmode {classroom} {
\keepblocks[Question]
}

\starttext

Text A

\beginQuestion
Question A….
\endQuestion

Text B

\beginQuestion
Question B….
\endQuestion

\page

\doifnotmode {classroom} {
\useblocks[Question]
}

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


[NTG-context] ConTeXt source browser website update

2020-06-07 Thread Taco Hoekwater
Hi all,

I just replaced the software of https://source.contextgarden.net/ by a Lua 
implementation that uses Hans Hagen’s SciTE lexers for syntax highlighting and 
a Lua-generated search index.

There is no official documentation yet (because I may want to change some stuff 
still) but here is some relevant information:

* The search field uses a Lua string pattern to match a single word (no 
multi-word search as of yet). 

  See https://www.lua.org/manual/5.3/manual.html#6.4.1 for the syntax of lua 
string patterns.

* The search index only contains 7-bit ASCII ‘words’ that contain at least one 
of 'a-zA-Z’ (writing an LPEG for unicode matching is a tricky and probably 
would be quite slow even if I could make it work). 

  Still, this should be ok-ish because most of the ConTeXt source is ASCII, 
except for the interface files.

* The files context-en.xml, mtxrun{.lua}, and all of the files in the 
tex/context/patterns subtree are skipped in the search index. Also skipped are 
words shorter than 3 bytes, lua keywords, and words having more than (approx) 
1500 hits

* On the plus side, because of the SciTE lexer, “contextversion’ and 
“\contextversion” are separate entries in the search index. And you can search 
for “\@@kldirection”.

* For text file types that have no SciTE lexer there is no syntax highlighting, 
and binary files are ignored altogether.

The rest of the interface should be self-explanatory.

Suggestions for improvements are welcome.


Index statistics:

4085 files processed, 178 skipped, 3744 with matches
120733 words found
119154 words exported to word.idx
37928 comment words found
36880 words exported to comment.idx
26756 documentation words found
26018 words exported to docs.idx

The word.idx is roughly 11 megabytes.

Have fun,

Taco




___
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] Custom color schemes in t-vim

2020-05-17 Thread Aditya Mahajan

On Sat, 16 May 2020, Aditya Mahajan wrote:


On Sat, 16 May 2020, Nicola wrote:


On 2020-05-16, Aditya Mahajan  wrote:

On Sat, 16 May 2020, Aditya Mahajan wrote:



Moreover, if you comment line line 126 of `2context.vim`

 "let s:id  = synIDtrans (s:id)

[If you make a local copy of 2context.vim, then you need to run the
file with `--mode=dev-vim` to ensure that the local copy is used]

Then the ruby example generates the following file:

\SYNBOL{}\SYN[rubyComment]{# Ruby program listing}\SYNEOL{}
\SYNBOL{}\SYN[rubyDefine]{def}\SYN[rubyMethodBlock]{ 

}\SYN[rubyMethodName]{foobar}\SYNEOL{}
\SYNBOL{}\SYN[rubyMethodBlock]{ 
print(}\SYN[rubyStringDelimiter]{"}\SYN[rubyString]{Hello 
World}\SYN[rubyStringDelimiter]{"}\SYN[rubyMethodBlock]{)}\SYNEOL{}

\SYNBOL{}\SYN[rubyDefine]{end}\SYNEOL{}

So, if you are willing to define wrappers for all ruby syntax blocks,
then I can provide a configuration option so that `2context` does not
apply that line.



That might provide a finer control over the highlighting, but the main
issue here seems to be that the generated file has Identifier instead of
Function, Special instead of Delimiter and Constant instead of String.
Looking at 2context.vim, AFAICS s:id_name seems computed correctly.
Maybe, the script does not set the appropriate filetype?


filetype is set correctly (since we get `ruby` options), but something 
weird is happening even with 2html.vim. Here is a minimal example:


Figured out what is happening. From `:he syntax`

"The names marked with * are the preferred groups; the others are minor groups.
For the preferred groups, the "syntax.vim" file contains default highlighting.
The minor groups are linked to the preferred groups, so they get the same
highlighting.  You can override these defaults by using ":highlight" commands
after sourcing the "syntax.vim" file."

All three `Function`, `Delimiter` and `String` are minor groups, so they get 
mapped to the preferred groups, which are `Identifier`, `Special`, and 
`Constant`, respectively. Most colorschemes define colors for minor groups as 
well, but since we are not loading any colorscheme, the minor groups are mapped 
to preferred groups, and we only get the preferred groups in the output.

Now that I know what is happening, it is relatively easy to fix.

```
\definecolor[colorone][r=0.251, g=0.349, b=0.322]
\definecolor[colortwo][r=0.612, g=0.608, b=0.478]
\definecolor[colorthree]  [r=1.0,   g=0.827, b=0.576]
\definecolor[colorfour]   [r=1.0,   g=0.592, b=0.310]
\definecolor[colorfive]   [r=0.960, g=0.310, b=0.161]
\definecolor[nearlywhite] [r=0.988, g=0.988, b=0.988]

\setupinteraction[state=start]
\setupcolors[textcolor=colorone]
\setupbackgrounds[page][background=color,backgroundcolor=nearlywhite]

\usemodule[vim]

\startvimrc[name=minor-groups]
hi Function  cterm=NONE
hi Stringcterm=NONE
hi Delimiter cterm=NONE
\stopvimrc


\startcolorscheme[oceansunset]
  \definesyntaxgroup[Comment] [color={colorfive},style=italic]
  \definesyntaxgroup[Function][color={colorfive},style=italic]
\stopcolorscheme

\definevimtyping[RUBY]
[
  syntax=ruby,
  alternative=oceansunset,
  escape=on, %NOTE, the comma was missing in your test file
  % Without the comma, the option is not set
  extras=minor-groups,
]

\starttext
\startRUBY
# Ruby program listing
def foobar
  print("Hello World")
end
\stopRUBY
\stoptext
```

Since I already map the minor groups to preferred groups in `t-vim`, I think 
that a good compromise is to enable the minor groups by default. I can do that 
by adding statements similar to those above in `2context.vim`. This will not 
have any visual impact on any existing code, but will allow those who want to 
tweak the highlighting of minor groups to define their own syntax highlighting.

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] Custom color schemes in t-vim

2020-05-16 Thread Aditya Mahajan

On Sat, 16 May 2020, Nicola wrote:


On 2020-05-16, Aditya Mahajan  wrote:

On Sat, 16 May 2020, Aditya Mahajan wrote:



Moreover, if you comment line line 126 of `2context.vim`

 "let s:id  = synIDtrans (s:id)

[If you make a local copy of 2context.vim, then you need to run the
file with `--mode=dev-vim` to ensure that the local copy is used]

Then the ruby example generates the following file:

\SYNBOL{}\SYN[rubyComment]{# Ruby program listing}\SYNEOL{}
\SYNBOL{}\SYN[rubyDefine]{def}\SYN[rubyMethodBlock]{ 
}\SYN[rubyMethodName]{foobar}\SYNEOL{}
\SYNBOL{}\SYN[rubyMethodBlock]{  
print(}\SYN[rubyStringDelimiter]{"}\SYN[rubyString]{Hello 
World}\SYN[rubyStringDelimiter]{"}\SYN[rubyMethodBlock]{)}\SYNEOL{}
\SYNBOL{}\SYN[rubyDefine]{end}\SYNEOL{}

So, if you are willing to define wrappers for all ruby syntax blocks,
then I can provide a configuration option so that `2context` does not
apply that line.



That might provide a finer control over the highlighting, but the main
issue here seems to be that the generated file has Identifier instead of
Function, Special instead of Delimiter and Constant instead of String.
Looking at 2context.vim, AFAICS s:id_name seems computed correctly.
Maybe, the script does not set the appropriate filetype?


filetype is set correctly (since we get `ruby` options), but something 
weird is happening even with 2html.vim. Here is a minimal example:

```test.rb
# Ruby program listing
def foobar
  print("Hello World")
end
```

Run:

vim -u NONE -c "syntax manual" -c "set syntax=ruby" -c "source 
/usr/share/nvim/runtime/syntax/2html.vim" -c "wqa" test.rb

gives

```test.rb.html
http://www.w3.org/TR/html4/strict.dtd;>


...



# Ruby program listing
def foobar
  print(Hello World)
end





```

which is similar to what 2context.vim gets. If I source tohtml.vim or 
2context.vim from an existing vim session, then the tags are correct. I have 
not been able to figure out why this is happening.

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] Custom color schemes in t-vim

2020-05-16 Thread Nicola
On 2020-05-16, Aditya Mahajan  wrote:
> On Sat, 16 May 2020, Aditya Mahajan wrote:

> Moreover, if you comment line line 126 of `2context.vim`
>
>  "let s:id  = synIDtrans (s:id)
>
> [If you make a local copy of 2context.vim, then you need to run the
> file with `--mode=dev-vim` to ensure that the local copy is used]
>
> Then the ruby example generates the following file:
>
> \SYNBOL{}\SYN[rubyComment]{# Ruby program listing}\SYNEOL{}
> \SYNBOL{}\SYN[rubyDefine]{def}\SYN[rubyMethodBlock]{ 
> }\SYN[rubyMethodName]{foobar}\SYNEOL{}
> \SYNBOL{}\SYN[rubyMethodBlock]{  
> print(}\SYN[rubyStringDelimiter]{"}\SYN[rubyString]{Hello 
> World}\SYN[rubyStringDelimiter]{"}\SYN[rubyMethodBlock]{)}\SYNEOL{}
> \SYNBOL{}\SYN[rubyDefine]{end}\SYNEOL{}
>
> So, if you are willing to define wrappers for all ruby syntax blocks,
> then I can provide a configuration option so that `2context` does not
> apply that line.

That might provide a finer control over the highlighting, but the main
issue here seems to be that the generated file has Identifier instead of
Function, Special instead of Delimiter and Constant instead of String.
Looking at 2context.vim, AFAICS s:id_name seems computed correctly.
Maybe, the script does not set the appropriate filetype?

Nicola


___
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] Custom color schemes in t-vim

2020-05-16 Thread Aditya Mahajan

On Sat, 16 May 2020, Aditya Mahajan wrote:


On Sat, 16 May 2020, Nicola wrote:


On 2020-05-14, Aditya Mahajan  wrote:

On Thu, 14 May 2020, Nicola wrote:


Quick question: Is \startcolorscheme... \stopcolorscheme (still)
supported by t-vim?



It is supposed to work. If it doesn't, then it is a bug. Could you
provide a complete MWE.


Please find a MWE at the bottom of this post.

The expected behaviour is that the keyword `function` in the JavaScript
snippet and `foobar` in the Ruby snippet should be colored and in
italics, as comments are. The respective Vim highlight groups are
`javaScriptFunction` and `rubyMethodName`, which both resolve to
`Function`.


The reason that there is no highlighting is because the generated `.vimout` 
does not contain any `\SYN[rubyMethodName]` or `\SYN[javaScriptFunction]` for 
the following reason:


Vim has the concept of a hierarchy of names for the syntax highlighting 
regions. For example, $VIMRUNTIME/syntax/ruby.rb contains the following 
lines:


hi def link rubyMethodName  rubyFunction
hi def link rubyFunction  Function

So, `rubyMethodName` maps to `rubyFunction`, which in turn maps to 
`Function`. Now, a vim colorscheme first checks if a highlighting style is 
available for `rubyMethodName`; if not it tries `rubyFunction`; and if not it 
tries `Function`.


Although something similar might have been possible in 2context.vim, I follow 
the `TOHtml` function of vim, and simply created a single tag for each syntax 
highlighting element, which in this case is `Function`. So, there is no tag 
generated for `rubyMethodName` and that is why changing the syntaxhighlight 
for that doesn't change anything.


Moreover, if you comment line line 126 of `2context.vim`

"let s:id  = synIDtrans (s:id)

[If you make a local copy of 2context.vim, then you need to run the file with 
`--mode=dev-vim` to ensure that the local copy is used]

Then the ruby example generates the following file:

\SYNBOL{}\SYN[rubyComment]{# Ruby program listing}\SYNEOL{}
\SYNBOL{}\SYN[rubyDefine]{def}\SYN[rubyMethodBlock]{ 
}\SYN[rubyMethodName]{foobar}\SYNEOL{}
\SYNBOL{}\SYN[rubyMethodBlock]{  
print(}\SYN[rubyStringDelimiter]{"}\SYN[rubyString]{Hello 
World}\SYN[rubyStringDelimiter]{"}\SYN[rubyMethodBlock]{)}\SYNEOL{}
\SYNBOL{}\SYN[rubyDefine]{end}\SYNEOL{}

So, if you are willing to define wrappers for all ruby syntax blocks, then I 
can provide a configuration option so that `2context` does not apply that line.

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] Arithmetic Overflow error in MetaFun

2020-05-16 Thread Keith McKay

Answering my own problem here.

I've just searched through the mailing list archives and it seems that 
if I add [instance=doublefun] I do not get the Arithmetic Overflow 
error. Joy!


Thanks

Best Wishes

Keith McKay

On 16/05/2020 15:36, Keith McKay wrote:


Colleagues

I'm having problems with an Arithmetic Overflow error when calculating 
the x and y values for functions of the form:


y = ax^4 + bx^3 + cx^2 + dx + e

to which I then add a bit of randomness and other embellishments. I 
have had a look in the Metafun and Metafont manuals but nothing jumps 
out at me. In the minimum working example below, this Arithmetic 
Overflow occurs when xord =13.5 but I can get the calculation to work 
if I separate out the equation and then add together, since it seems 
to be failing on the pow(xord,4) instruction. Is there a switch in 
MetaFont that should be set or a better way of getting round this 
Arithmetic Overflow error?


Thanks

Best Wishes

Keith McKay

%MWE%%%

\setuppapersize [A4,landscape]

\starttext

\startMPpage

StartPage;

width := PaperWidth ; height := PaperHeight ; unit := cm ;

path p;

p := unitsquare scaled .1cm ;

path pat;

pat := (0.0*cm,19.935*cm);

for xord = 0 step 0.1 until 25:

show xord;

fails at xord = 13.5%

yord := ((-0.000268117) * pow(xord,4)) +(0.0136949 * pow(xord, 3)) + 
((-0.16608) * sqr(xord)) + ((-0.771743) * xord) + 19.935;


%comment out above and uncomment below and it works

% yord1 := (-0.000268117) * sqr(xord);

% yord1a := yord1 * sqr(xord);

% yord2 := (0.0136949 * pow(xord, 3));

% yord3 := ((-0.16608) * sqr(xord));

% yord4 := ((-0.771743) * xord);

% yord := yord1 + yord1a + yord2 + yord3 + yord4 + 19.935;

xrand := (uniformdeviate(1) - 0.5)*2;

yrand := uniformdeviate(1) - 0.5;

xcoord := xord + xrand;

ycoord := yord + yrand;

if odd xord:

pat := pat ... (xcoord*cm, ycoord*cm);

else:

pat := pat --- (xcoord*cm, ycoord*cm);

fill p shifted (xcoord*cm, ycoord*cm) withcolor 
(uniformdeviate(1),uniformdeviate(1),uniformdeviate(1)) ;


fi;

draw pat withpen pencircle scaled (uniformdeviate(0.75)*mm) withcolor 
(uniformdeviate(1),uniformdeviate(1),uniformdeviate(1)); 
%withtransparency (1, .5);


drawdot (xcoord*cm, ycoord*cm) withpen pencircle scaled 
(uniformdeviate(2.5)*mm) withcolor 
(uniformdeviate(1),uniformdeviate(1),uniformdeviate(1));


endfor;

StopPage;

\stopMPpage

\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] Arithmetic Overflow error in MetaFun

2020-05-16 Thread Keith McKay

Colleagues

I'm having problems with an Arithmetic Overflow error when calculating 
the x and y values for functions of the form:


y = ax^4 + bx^3 + cx^2 + dx + e

to which I then add a bit of randomness and other embellishments. I have 
had a look in the Metafun and Metafont manuals but nothing jumps out at 
me. In the minimum working example below, this Arithmetic Overflow 
occurs when xord =13.5 but I can get the calculation to work if I 
separate out the equation and then add together, since it seems to be 
failing on the pow(xord,4) instruction. Is there a switch in MetaFont 
that should be set or a better way of getting round this Arithmetic 
Overflow error?


Thanks

Best Wishes

Keith McKay

%MWE%%%

\setuppapersize [A4,landscape]

\starttext

\startMPpage

StartPage;

width := PaperWidth ; height := PaperHeight ; unit := cm ;

path p;

p := unitsquare scaled .1cm ;

path pat;

pat := (0.0*cm,19.935*cm);

for xord = 0 step 0.1 until 25:

show xord;

fails at xord = 13.5%

yord := ((-0.000268117) * pow(xord,4)) +(0.0136949 * pow(xord, 3)) + 
((-0.16608) * sqr(xord)) + ((-0.771743) * xord) + 19.935;


%comment out above and uncomment below and it works

% yord1 := (-0.000268117) * sqr(xord);

% yord1a := yord1 * sqr(xord);

% yord2 := (0.0136949 * pow(xord, 3));

% yord3 := ((-0.16608) * sqr(xord));

% yord4 := ((-0.771743) * xord);

% yord := yord1 + yord1a + yord2 + yord3 + yord4 + 19.935;

xrand := (uniformdeviate(1) - 0.5)*2;

yrand := uniformdeviate(1) - 0.5;

xcoord := xord + xrand;

ycoord := yord + yrand;

if odd xord:

pat := pat ... (xcoord*cm, ycoord*cm);

else:

pat := pat --- (xcoord*cm, ycoord*cm);

fill p shifted (xcoord*cm, ycoord*cm) withcolor 
(uniformdeviate(1),uniformdeviate(1),uniformdeviate(1)) ;


fi;

draw pat withpen pencircle scaled (uniformdeviate(0.75)*mm) withcolor 
(uniformdeviate(1),uniformdeviate(1),uniformdeviate(1)); 
%withtransparency (1, .5);


drawdot (xcoord*cm, ycoord*cm) withpen pencircle scaled 
(uniformdeviate(2.5)*mm) withcolor 
(uniformdeviate(1),uniformdeviate(1),uniformdeviate(1));


endfor;

StopPage;

\stopMPpage

\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] Custom color schemes in t-vim

2020-05-16 Thread Nicola
On 2020-05-14, Aditya Mahajan  wrote:
> On Thu, 14 May 2020, Nicola wrote:
>
>> Quick question: Is \startcolorscheme... \stopcolorscheme (still)
>> supported by t-vim?

> It is supposed to work. If it doesn't, then it is a bug. Could you
> provide a complete MWE.

Please find a MWE at the bottom of this post.

The expected behaviour is that the keyword `function` in the JavaScript
snippet and `foobar` in the Ruby snippet should be colored and in
italics, as comments are. The respective Vim highlight groups are
`javaScriptFunction` and `rubyMethodName`, which both resolve to
`Function`.

The actual behaviour is that comments are highlighted correctly, but
I do not get any syntax highlighting for functions.

Thanks for t-vim, btw: I can't express in words how nice an idea it is!

Nicola


\setupcolors[state=start]

\definecolor[colorone][r=0.251, g=0.349, b=0.322]
\definecolor[colortwo][r=0.612, g=0.608, b=0.478]
\definecolor[colorthree]  [r=1.0,   g=0.827, b=0.576]
\definecolor[colorfour]   [r=1.0,   g=0.592, b=0.310]
\definecolor[colorfive]   [r=0.960, g=0.310, b=0.161]
\definecolor[nearlywhite] [r=0.988, g=0.988, b=0.988]

\setupinteraction[state=start]
\setupcolors[textcolor=colorone]
\setupbackgrounds[page][background=color,backgroundcolor=nearlywhite]

\usemodule[vim]
\unprotect
\startcolorscheme[oceansunset]
  \definesyntaxgroup[Comment][\c!color={colorfive},\c!style=italic]
  \definesyntaxgroup[Function][\c!color={colorfive},\c!style=italic]
  % \definesyntaxgroup[rubyMethodName][\c!color={colorfive},\c!style=italic]
  % \definesyntaxgroup[javaScriptFunction][\c!color={colorfive},\c!style=italic]
\stopcolorscheme
\protect

\definevimtyping[JAVASCRIPT][
  syntax=javascript,
  alternative=oceansunset,
  escape=on
]

\definevimtyping[RUBY][
  syntax=ruby,
  alternative=oceansunset,
  escape=on
]

\starttext
\startJAVASCRIPT
// JavaScript program listing
function foobar() {
  print("Hello World");
}
\stopJAVASCRIPT

\startRUBY
# Ruby program listing
def foobar
  print("Hello World")
end
\stopRUBY
\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] Custom list layout with PDF bookmarks

2020-05-16 Thread Henning Hraban Ramm

> Am 16.05.2020 um 08:30 schrieb Wolfgang Schuster 
> :
> 
> Bruce Horrocks schrieb am 16.05.2020 um 00:47:
>> When I customise the table of contents layout I lose the automatic 
>> hyperlinks. Is there a simple configuration option that I have missed or do 
>> I need to create my own links somehow?
>> 
>> Example:
>> 
>> \setupinteraction[state=start]
>> \setupinteractionscreen[option=bookmark]
>> 
>> \define[3]\SectionListEntry
>>   {\par \leftaligned\bgroup
>>  \hbox to 2em{#3}%
>>  \hskip   1em
>>  \vtop{\hsize\dimexpr\textwidth-3em\relax#2}
>>   \egroup \par}
>> 
>> % Comment out this next line to regain section hyperlinks in the ToC
>> \setuplist[section][alternative=command,command=\SectionListEntry]
> 
> alternative=command : Cutsom TOC without hyperlinks
> 
> alternative=interactive : Custom TOC with hyperlinks

Thank you! Wikified: https://wiki.contextgarden.net/Command/setuplist

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
___


Re: [NTG-context] Custom list layout with PDF bookmarks

2020-05-16 Thread Wolfgang Schuster

Bruce Horrocks schrieb am 16.05.2020 um 00:47:

When I customise the table of contents layout I lose the automatic hyperlinks. 
Is there a simple configuration option that I have missed or do I need to 
create my own links somehow?

Example:

\setupinteraction[state=start]
\setupinteractionscreen[option=bookmark]

\define[3]\SectionListEntry
   {\par \leftaligned\bgroup
  \hbox to 2em{#3}%
  \hskip   1em
  \vtop{\hsize\dimexpr\textwidth-3em\relax#2}
   \egroup \par}

% Comment out this next line to regain section hyperlinks in the ToC
\setuplist[section][alternative=command,command=\SectionListEntry]


alternative=command : Cutsom TOC without hyperlinks

alternative=interactive : Custom TOC with hyperlinks

 begin example
\define[3]\SectionListEntry
  {\hbox\bgroup
 \hbox to 2em{#1}%
 \hfill
 \vtop{\hsize\dimexpr\textwidth-3em\relax#2}%
   \egroup}

\setuplist
  [section]
  [alternative=interactive,
   command=\SectionListEntry,
    before=\endgraf,
 after=\endgraf]
 end example

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] Custom list layout with PDF bookmarks

2020-05-16 Thread Henning Hraban Ramm

> Am 16.05.2020 um 00:47 schrieb Bruce Horrocks :
> 
> When I customise the table of contents layout I lose the automatic 
> hyperlinks. Is there a simple configuration option that I have missed or do I 
> need to create my own links somehow?
> 
> Example:
> 
> \setupinteraction[state=start]
> \setupinteractionscreen[option=bookmark] 
> 
> \define[3]\SectionListEntry
>  {\par \leftaligned\bgroup
> \hbox to 2em{#3}%
> \hskip   1em
> \vtop{\hsize\dimexpr\textwidth-3em\relax#2}
>  \egroup \par}
> 
> % Comment out this next line to regain section hyperlinks in the ToC
> \setuplist[section][alternative=command,command=\SectionListEntry]
> 
> \starttext
> Table of Contents
> \placecontent[criterium=all]
> \placebookmarks[chapter,subject]

Should be \placebookmarks[chapter,section]. Move it in front of \starttext.

But that still doesn’t set chapter bookmarks - strange.


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
___


[NTG-context] Custom list layout with PDF bookmarks

2020-05-15 Thread Bruce Horrocks
When I customise the table of contents layout I lose the automatic hyperlinks. 
Is there a simple configuration option that I have missed or do I need to 
create my own links somehow?

Example:

\setupinteraction[state=start]
\setupinteractionscreen[option=bookmark] 

\define[3]\SectionListEntry
  {\par \leftaligned\bgroup
 \hbox to 2em{#3}%
 \hskip   1em
 \vtop{\hsize\dimexpr\textwidth-3em\relax#2}
  \egroup \par}

% Comment out this next line to regain section hyperlinks in the ToC
\setuplist[section][alternative=command,command=\SectionListEntry]

\starttext
Table of Contents
\placecontent[criterium=all]
\placebookmarks[chapter,subject]

\chapter{Tufte}
\section{Section 1}
\input tufte
\page
\section{Section 2}
\input tufte
\page
\section{Section 3}
\input tufte
\page
\stoptext


Thanks in advance.
--
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] Custom color schemes in t-vim

2020-05-14 Thread Aditya Mahajan

On Thu, 14 May 2020, Nicola wrote:


Quick question: Is \startcolorscheme... \stopcolorscheme (still)
supported by t-vim?

In a template I wrote long time ago to typeset code, I have:

   \usemodule[vim]
   \unprotect
   \startcolorscheme[oceansunset]
 \definesyntaxgroup[Comment][\c!color={colortwo},\c!style=italic]
 % etc.
   \stopcolorscheme
   \protect

which I use as described in the wiki:

   \definevimtyping
[...]
[...
 alternative=oceansunset,
 ...]

But that does not seem to have any effect (if I change the colors, the
syntax highlighting does not change). I can use pscolor and
blackandwhite, though. I see that \startcolorscheme is not documented,
so maybe there is another mechanism?


It is supposed to work. If it doesn't, then it is a bug. Could you provide a 
complete MWE.

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] Custom color schemes in t-vim

2020-05-14 Thread Nicola
Quick question: Is \startcolorscheme... \stopcolorscheme (still)
supported by t-vim?

In a template I wrote long time ago to typeset code, I have:

\usemodule[vim]
\unprotect
\startcolorscheme[oceansunset]
  \definesyntaxgroup[Comment][\c!color={colortwo},\c!style=italic]
  % etc.
\stopcolorscheme
\protect

which I use as described in the wiki:

\definevimtyping
 [...]
 [...
  alternative=oceansunset,
  ...]

But that does not seem to have any effect (if I change the colors, the
syntax highlighting does not change). I can use pscolor and
blackandwhite, though. I see that \startcolorscheme is not documented,
so maybe there is another mechanism?

Nicola

___
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] Is it possible to make xml.load a bit more 'verbose' when it encounters errors?

2020-05-14 Thread Hans van der Meer
Gerben,Maybe this is of some use. The Lua code in the file checks the xml and returns info when something is wrong.I am using it for example in my takenotes module as:And this is a sketch of how it is embedded in that module:	% Prerun an xml check.	\doifinset{\xmlatt{#1}{checkxml}}{yes,on,true}%		{\xmlcommand{#1}{.}{xmlcommon:checkxml}}	% Execute this code if no error was found.		etc.
dr. Hans van der Meer

\startluacode
-- Define our namespace as hvdm
hvdm = hvdm or {}

-- Function checks the correctness of an XML tree.
hvdm.checkXMLtree = function (xml, linesep)

local xml = xml and xml or ""
local linesep = linesep and linesep or "\n"
local badspace = {}

-- Empty files do not need processing.
if xml == "" then
return ""
end

-- Step one is remove leading characters before first node.
local leadingnode = string.find(xml, "<", 1) or 1
if leadingnode ~= 1 then
xml = string.sub(xml, leadingnode, -1)
end

-- Strip all comments  but node pairs inside make it 
complicated.
local c1, c2 = string.find(xml, "", c2 + 1, true)
    if c3 then
-- Remove comment.
xml = string.sub(xml, 1, c1 - 1) .. string.sub(xml, c4 
+ 1, -1)

-- Search for next comment.
c1, c2 = string.find(xml, "

Re: [NTG-context] Retrieving original value of enviroment variable HOME

2020-05-10 Thread context

Hello, Hans,

I've just renewed the Ctx Beta installation, but 'environment.oldhome' 
seems be unavailable.


Was I "too quick" with renewing Ctx?

Testing sample:


\starttext
  Ahoj
  \startluacode
context(environment.oldhome or "??")
  \stopluacode
\stoptext


- prints "??".

I also attache the "status-of-update.lua" and the batch 
"first-setup.bat" (maybe a bit obsolete, but working so far) I used to 
renew Ctx.


Also result of "dir /s" is available here (~84 k packed):

  http://leteckaposta.cz/302654804

What am I doing wrong?

Best regards,

Lukas


On 2020-05-08 14:18, Hans Hagen wrote:


You can check it. Btw, when you're using lmtx there should be no real
differences between for instance unix and windows, although on windows
lmtx does support wide characters in environment variables, command
line arguments, filenames, filelinks etc. (not that that matters much
as one will seldom use more than ascii). Specific environment
variables like HOME are a bit tricky on windows as they come in
variants, so let me know if some more magic is needed.

Hans
\starttext
  Ahoj
  \startluacode
context(environment.oldhome or "??")
  \stopluacode
\stoptext


ChkEnv.pdf
Description: Adobe PDF document
-- generator : luat-sta.lua
-- state tag : whatever

return {
 ["context"]={
  ["version"]="beta",
 },
 ["engines"]={
  ["luatex"]=true,
  ["pdftex"]=true,
  ["xetex"]=true,
 },
 ["formats"]={
  ["cont-en"]=true,
  ["cont-nl"]=true,
  ["metafun"]=true,
 },
 ["info"]={
  ["comment"]="this file contains the settings of the last 'mtxrun --script 
update' run",
  ["count"]=138,
  ["date"]="2020-05-10 11:59:36",
  ["runtime"]=94.039,
  ["version"]=0.1,
 },
 ["modules"]={
  ["all"]=true,
 },
 ["paths"]={
  ["root"]="d:\\Ctx-Beta\\tex",
 },
 ["platforms"]={
  ["mswin"]=true,
  ["win64"]=true,
 },
 ["repositories"]={
  ["current"]=true,
 },
 ["rsync"]={
  ["flags"]={
   ["delete"]="--delete",
   ["normal"]="-rpztlv",
  },
  ["module"]="minimals",
  ["program"]="rsync",
  ["server"]="contextgarden.net::",
 },
}@echo off

setlocal

echo okay > ok.log
ruby -e "File.delete('ok.log')"
if not exist "ok.log" goto okay

echo.
echo You need to install Ruby first (if you want to use pdfTeX or XeTeX).
echo Fetching files anyway.
echo.

:okay


set OWNPATH=%~dp0
set CONTEXTROOT=%OWNPATH%tex

set PATH=%OWNPATH%bin;%CONTEXTROOT%\texmf-mswin\bin;%PATH%

set CYGWIN=nontsec

rsync -av --exclude 'rsync.exe' --exclude 'cygwin1.dll' --exclude 'cygiconv-2.dll' rsync://contextgarden.net/minimals/setup/mswin/bin/ bin

mtxrun --script ./bin/mtx-update.lua --force --update --make --engine=all --context=beta --texroot=%CONTEXTROOT% %*

echo.
echo When you want to use context, you need to initialize the tree with:
echo.
echo   %CONTEXTROOT%\setuptex.bat %CONTEXTROOT%
echo.
echo You can associate this command with a shortcut to the cmd prompt.
echo.

if not exist "ok.log" goto end

echo.
echo If you want to use pdfTeX or XeTeX you need to install Ruby first.
echo Remake formats or rerun this script afterwards.
echo.

del /q ok.log

:end

endlocal

___
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] How do I add cyrillic to my typescript/document?

2020-05-04 Thread Pablo Rodriguez
On 5/4/20 6:38 PM, Gerben Wierda wrote:
> [...]
> The above works (including using macOS Helvetica as the font for
> cyrillic). Thank you.

Hi Gerben,

glad to read it worked.

> I have no idea why (earlier I got the typescript suggestion for my
> fonts management, but this uses another approach). Is it the case that
> the ‘family’ and ’typescript’ approaches don’t really mix? The above is
> a lot simpler than that what I had and it works fine.

I don’t know how to use typescripts and the approach I suggested is the
only one I know to deal with fonts in ConTeXt.

\definefontfamily (and \definefallbackfamily) were created to avoid
using typescripts in the vast majority of cases.

> Any reason to leave these commented? And does uncommenting is plan
> TeX-uncommenting, so only the % goes away? Makes me wonder what ‘~’ means.
>
>> %~ tf=style:light,

They are just an option. The tilde (~) is added after the percent sign
(%), because “Geany” (the text editor I use) adds it after the comment
sign in different programming languages. It has no special meaning.

> What I try to do is to have english as the default (and fallback)
> language and Optima as the default font, but there may be snippets in
> other languages which should be typeset in a font that can handle
> cyrillic. Helvetica is an option. So is dejavu.

Now I get it: a fallback typeface for Russian and the main typeface as
Optima.

This might read the following way:

\setuplanguage[en][patterns={en, ru}]

\definefallbackfamily
[mainface]
[rm]
[Helvetica]
[preset=range:cyrillic,
 force=yes,
 rscale=0.9]

\definefontfamily [mainface] [rm] [Optima]

\setupbodyfont[mainface]

The first command loads both English and Russian hyphenation patterns in
English, so that you don’t have to bother to mark the texts that use the
Cyrillic alphabet (although all hyphenation of Cyrillic will be
according the Russian rules).

The second command defines the fallback family. It has four option groups.

1. The first group sets up the name to be used in ConTeXt (mainly in
\setupbodyfont and \switchtobodyfont).

2. The second group specifies which kind of typeface is: serif,
sans-serif, typewriter, math and others. Of course, this isn’t a
declaration of what kind of font the selected one is, but how ConTeXt
will handle it. So, if your document is sans-serif only, it is safe to
use "[rm]" with sans-serif fonts as above.

3. The third group specifies the font name as specified in your OS. This
selects it.

4. The fourth group specifies different options. Here for the fallback
font, I specify:

a. Range: for which Unicode blocks (alphabets) will the font be used.
You can use "range=cyrillic", but it is safer to use
"preset=range:cyrillic" (this avoids specifying
"range={cyrillicextendeda, cyrillicextendedb,
cyrillicsupplement}").

b. Force: it is important to set it up to "yes", since otherwise if the
main font (Optima in this case) has any glyph for the Cyrillic block, it
would use that glyph in Optima, mixing it with the other ones from the
fallback font. In my personal experience, this looks crappy.

c. Relative scale to the main font: increase or decrease the fallback
font to match similar x-height with the main font. In this case,
Helvetica has a higher x-height that Optima, so I decreased it.

All the previous options where related to \definefallbackfamily.

\definefontfamily has also three option groups, which are the same that
the ones explained for \definefallbackfamily.

The values for the first and second groups should be the same, values
for the third group should differ. Otherwise, glyph substition won’t
take place (either the font family or typeface won’t match, or the
fallback font won’t be actually a different one).

> I still am totally in the dark how this works and what made the
> earlier setup find Optima but not find Helvetica.

I hope it is clear now: the fallback mechanism for your setup should
read different than the one I provided.

I think it could be better for you to use \definefallbackfamily and
\definefontfamily. It is way simpler.

> And I’m curious why this adaptation doesn’t work:
>
>  \definefallbackfamily
>[abc]
>[ss]
>[dejavu]

As explained above, the third option group should contain the font name
(as your OS would display it, not as ConTeXt names it [probably, in a
typescript]). So, the value should read "[DejaVu Sans]".

> Anyway, I can go on, not wiser but helped further. Thanks again.

Please, ask what you don’t understand. And if you need help with your
font code, post it on the list and we may help you.

Sorry if the message contains errors (it’s too late for me to write on
these topics).

Pablo
--
http://www.ousia.tk
___
If your question is o

Re: [NTG-context] \definehead behaving differently when in an environment file versus \input'ed

2020-05-02 Thread Wolfgang Schuster

n...@scorecrow.com schrieb am 02.05.2020 um 17:14:

I'm having trouble with \definehead behaving differently depending upon whether 
I process a file that includes it via a \input statement versus a project 
structure that calls it via an environment file referenced from a component 
file.

Overall aim:

I currently produce a small circulation journal in Word that I'm hoping to 
switch to ConTeXt. Each article is written by a different author and I 
currently provide a Word template so they can see how their article will 
eventually look and how long it is, etc. I want to do the same for the ConTeXt 
version so I have created a template tex file they can simply \input at the top 
of their article. Processing the single article gives the desired output. So 
far so good.

When I receive the articles, I want to use the project/product/component 
structure to allow me to produce an entire issue of the journal in one go. (I 
would simply comment out the \input line and add \startproject \startcomponent 
etc lines as necessary from each received article.)

Problem:

I've created a custom chapter heading, but the font size changes depending on 
whether I'm processing the \input version of the article or the \component 
version and I don't know why. Obviously, I would like the heading to be the 
same in each case so that authors see what I see and vice versa.


Your simple version sets the bodyfont before \starttext

 begin example
\setupbodyfont[termes,14pt]

\starttext

{\bfc Cheesy double boxed title}

\stoptext
 end example

while your complexer version loads the bodyfont after \starttext 
(\startcomponent acts here as \starttext)


 begin example
\starttext

\setupbodyfont[termes,14pt]

{\bfc Cheesy double boxed title}

\stoptext
 end example

When you use a non standard font size (e.g. 14pt) size switches are 
sometimes ignored even with ConTeXt's fallback mechanism.


To get the correct size for the header you can either use a standard 
font size (14.4pt) or you add the following line before you set the 
global font for your document (ConTeXt does this by itself in most cases 
but it can fail).


\definebodyfontenvironment [14pt]

I attached a slightly modified version of your project structure to show 
a different way to organize documents. What I would change is to use a 
better section name for each article, e.g. \Article (or \startArticle) 
is better than \MyTitle as first level header in each article.


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] \definehead behaving differently when in an environment file versus \input'ed

2020-05-02 Thread ntg
I'm having trouble with \definehead behaving differently depending upon whether 
I process a file that includes it via a \input statement versus a project 
structure that calls it via an environment file referenced from a component 
file.

Overall aim:

I currently produce a small circulation journal in Word that I'm hoping to 
switch to ConTeXt. Each article is written by a different author and I 
currently provide a Word template so they can see how their article will 
eventually look and how long it is, etc. I want to do the same for the ConTeXt 
version so I have created a template tex file they can simply \input at the top 
of their article. Processing the single article gives the desired output. So 
far so good.

When I receive the articles, I want to use the project/product/component 
structure to allow me to produce an entire issue of the journal in one go. (I 
would simply comment out the \input line and add \startproject \startcomponent 
etc lines as necessary from each received article.)

Problem:

I've created a custom chapter heading, but the font size changes depending on 
whether I'm processing the \input version of the article or the \component 
version and I don't know why. Obviously, I would like the heading to be the 
same in each case so that authors see what I see and vice versa.

I've attached a small zip file with a directory structure containing a minimal 
example. There are two directories: "input_version" and "project" version and 
the article.pdf files in each show the difference in the heading.

I'm using TeX Live 2020 on a Mac. The console reports: ConTeXt  ver: 2020.03.10 
14:44 MKIV beta  fmt: 2020.4.18  int: english/english

--
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] Project setup query

2020-04-30 Thread Henning Hraban Ramm
Hi Alan!

> Am 30.04.2020 um 15:07 schrieb Alan Bowen :
> 
> Is there a way to identify the TEX root for each of the common files (in 
> Directory02) so that
> the file will be processed when I process any one of the prd files in 
> Directory01?
> 
> I have tried 
> % !TEX root=../prd_\mystring.tex

Processing single components won’t work in your project, since I defined 
several metadata macros in the product. More off list.

> with, e.g., \def\mystring{Name01} in the prd_Name01.tex file, but that does 
> not seem to work—the various .tex files re not found.

Comment lines are not handled by TeX, and therefore don’t get expanded.


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


Re: [NTG-context] Right-to-left pagecolumns and markings in ConTeXt

2020-04-29 Thread Joey McCollum
If I change the line containing that in my MWE to


\setupheadertexts[top: {\getmarking[TestMark][column:top]}][bottom:
{\getmarking[TestMark][column:bottom]}][top:
{\getmarking[TestMark][column:top]}][bottom:
{\getmarking[TestMark][column:bottom]}]

or


\setupheadertexts[top: {\fetchmark[TestMark][column:top]}][bottom:
{\fetchmark[TestMark][column:bottom]}][top:
{\fetchmark[TestMark][column:top]}][bottom:
{\fetchmark[TestMark][column:bottom]}]


then the problem is not fixed. Is this what you had in mind, or were you
suggesting to use it in conjunction with the column number as a second
argument? In that case, the line would look like


\setupheadertexts[top: {\getmarking[TestMark][1][column:top]}][bottom:
{\getmarking[TestMark][2][column:bottom]}][top:
{\getmarking[TestMark][1][column:top]}][bottom:
{\getmarking[TestMark][2][column:bottom]}]


If I use that line, then I do get markings from the first column (i.e., the
right column in this case), but they don't seem to be correct; marking 1
isn't referenced in the header of the first page, and the first new mark on
the second page is treated as the top mark for that page, rather than the
current mark at the time the second page begins (which may be correct, but
still does not seem consistent with the behavior on the first page). If
this is the correct behavior, then is there something I should change in my
syntax to make marking "1" appear as the top mark for that page?

On Wed, Apr 29, 2020 at 7:22 AM Hans Hagen  wrote:

> On 4/28/2020 2:09 PM, Joey McCollum wrote:
> > I am trying to typeset a two-column text in a right-to-left language
> > using ConTeXt. Because I want footnotes in this text to be set
> > ragged-bottom, I am using pagecolumns instead of standard columns. I
> > also want to track the first and last textual division markers on each
> > page using markings. Combining all of these ingredients seems to create
> > a problem in ConTeXt: when the pagecolumns are set in right-to-left
> > order, the top and bottom marks fetched are always the top and bottom
> > marks in the left column, while the true top mark should be the top mark
> > of the right column. I've observed this behavior using text in an actual
> > right-to-left language, but the following minimal (non-)working example
> > with an English sample text demonstrates the same behavior:
> >
> > ```
> > %Create a new markset to use:
> > \definemarking[TestMark]
> > %Setup header to reflect top and bottom marks:
> > \setupheadertexts[top: {\fetchmark[TestMark][top]}][bottom:
> > {\fetchmark[TestMark][bottom]}][top:
> > {\fetchmark[TestMark][top]}][bottom: {\fetchmark[TestMark][bottom]}]
> > %even left, even right, odd left, odd right
> > %Setup the columns layout:
> > \definepagecolumns [example] [
> >  n=2, %number of columns
> >  direction=reverse, %does not work if ending comma is removed!
> > ]
> > \starttext
> > \startpagecolumns[example]
> >  \marking[TestMark]{1}(1) \input knuth\par
> >  \marking[TestMark]{2}(2) \input knuth\par
> >  \marking[TestMark]{3}(3) \input knuth\par
> >  \marking[TestMark]{4}(4) \input knuth\par
> >  \marking[TestMark]{5}(5) \input knuth\par
> >  \marking[TestMark]{6}(6) \input knuth\par
> >  \marking[TestMark]{7}(7) \input knuth\par
> >  \marking[TestMark]{8}(8) \input knuth\par
> > \stoppagecolumns
> > \stoptext
> > ```
> >
> > I typeset this using ConTeXt version 2020.03.10, as released with
> > TeXLive 2020. As my comment in the MWE points out, there also seems to
> > be a bug in the key-value parsing of \definepagecolumns that causes it
> > not to parse the direction=reverse input unless it is followed by a
> comma.
> >
> > Is there some way I can improve my syntax to avoid this issue, or is it
> > just a bug that needs to be fixed? I've tried fetching other marks
> > (e.g., first and last), but the only marks that ConTeXt seems to find
> > are the ones for the left column.
> what if you prefix with column:, like column:top and so
>
> -
>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 / h

Re: [NTG-context] Right-to-left pagecolumns and markings in ConTeXt

2020-04-29 Thread Hans Hagen

On 4/28/2020 2:09 PM, Joey McCollum wrote:
I am trying to typeset a two-column text in a right-to-left language 
using ConTeXt. Because I want footnotes in this text to be set 
ragged-bottom, I am using pagecolumns instead of standard columns. I 
also want to track the first and last textual division markers on each 
page using markings. Combining all of these ingredients seems to create 
a problem in ConTeXt: when the pagecolumns are set in right-to-left 
order, the top and bottom marks fetched are always the top and bottom 
marks in the left column, while the true top mark should be the top mark 
of the right column. I've observed this behavior using text in an actual 
right-to-left language, but the following minimal (non-)working example 
with an English sample text demonstrates the same behavior:


```
%Create a new markset to use:
\definemarking[TestMark]
%Setup header to reflect top and bottom marks:
\setupheadertexts[top: {\fetchmark[TestMark][top]}][bottom: 
{\fetchmark[TestMark][bottom]}][top: 
{\fetchmark[TestMark][top]}][bottom: {\fetchmark[TestMark][bottom]}] 
%even left, even right, odd left, odd right

%Setup the columns layout:
\definepagecolumns [example] [
     n=2, %number of columns
     direction=reverse, %does not work if ending comma is removed!
]
\starttext
\startpagecolumns[example]
     \marking[TestMark]{1}(1) \input knuth\par
     \marking[TestMark]{2}(2) \input knuth\par
     \marking[TestMark]{3}(3) \input knuth\par
     \marking[TestMark]{4}(4) \input knuth\par
     \marking[TestMark]{5}(5) \input knuth\par
     \marking[TestMark]{6}(6) \input knuth\par
     \marking[TestMark]{7}(7) \input knuth\par
     \marking[TestMark]{8}(8) \input knuth\par
\stoppagecolumns
\stoptext
```

I typeset this using ConTeXt version 2020.03.10, as released with 
TeXLive 2020. As my comment in the MWE points out, there also seems to 
be a bug in the key-value parsing of \definepagecolumns that causes it 
not to parse the direction=reverse input unless it is followed by a comma.


Is there some way I can improve my syntax to avoid this issue, or is it 
just a bug that needs to be fixed? I've tried fetching other marks 
(e.g., first and last), but the only marks that ConTeXt seems to find 
are the ones for the left column.

what if you prefix with column:, like column:top and so

-
  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] Right-to-left pagecolumns and markings in ConTeXt

2020-04-28 Thread Joey McCollum
I am trying to typeset a two-column text in a right-to-left language using
ConTeXt. Because I want footnotes in this text to be set ragged-bottom, I
am using pagecolumns instead of standard columns. I also want to track the
first and last textual division markers on each page using markings.
Combining all of these ingredients seems to create a problem in ConTeXt:
when the pagecolumns are set in right-to-left order, the top and bottom
marks fetched are always the top and bottom marks in the left column, while
the true top mark should be the top mark of the right column. I've observed
this behavior using text in an actual right-to-left language, but the
following minimal (non-)working example with an English sample text
demonstrates the same behavior:

```
%Create a new markset to use:
\definemarking[TestMark]
%Setup header to reflect top and bottom marks:
\setupheadertexts[top: {\fetchmark[TestMark][top]}][bottom:
{\fetchmark[TestMark][bottom]}][top: {\fetchmark[TestMark][top]}][bottom:
{\fetchmark[TestMark][bottom]}] %even left, even right, odd left, odd right
%Setup the columns layout:
\definepagecolumns [example] [
n=2, %number of columns
direction=reverse, %does not work if ending comma is removed!
]
\starttext
\startpagecolumns[example]
\marking[TestMark]{1}(1) \input knuth\par
\marking[TestMark]{2}(2) \input knuth\par
\marking[TestMark]{3}(3) \input knuth\par
\marking[TestMark]{4}(4) \input knuth\par
\marking[TestMark]{5}(5) \input knuth\par
\marking[TestMark]{6}(6) \input knuth\par
\marking[TestMark]{7}(7) \input knuth\par
\marking[TestMark]{8}(8) \input knuth\par
\stoppagecolumns
\stoptext
```

I typeset this using ConTeXt version 2020.03.10, as released with TeXLive
2020. As my comment in the MWE points out, there also seems to be a bug in
the key-value parsing of \definepagecolumns that causes it not to parse the
direction=reverse input unless it is followed by a comma.

Is there some way I can improve my syntax to avoid this issue, or is it
just a bug that needs to be fixed? I've tried fetching other marks (e.g.,
first and last), but the only marks that ConTeXt seems to find are the ones
for the left column.

Thank you,

Joey
___
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] Typesetting Markdown - Part 8

2020-04-28 Thread Jan U. Hasecke
Hi Dave,

Am 28.04.20 um 04:00 schrieb Thangalin:
> Hi folks!
> 
> Second last part in the series. The project, product, component, and
> environment relations were a bit finicky. Those willing to point out
> improvements that can be made---Hans, Taco, Wolfgang, Aditya, and
> others---would be very much appreciated.
> 
> Specifically, it seems that some project environment settings can be
> overruled inside products, but other project settings cannot. It's not
> really clear to me whether this is due to dependency order or that
> definitions cannot be redefined across environments. Thoughts?
> 
> https://dave.autonoma.ca/blog/2020/04/28/typesetting-markdown-part-8/

thank you very much. I really appreciate your series. There is so much
in it that suits to my needs that I have to read it carefully later. But
I have some short remarks anyway.

Some topics are especially of interest to me:

1. Nameing and organizing the project, product and environments files. I
am currently reorganising the files for my cooperative. I think that
besides some nameing conventions it is more or less up to me how I
organise our print work. Any recommendations welcome.

2. The "Deutsches Text Archiv" has prepared a text corpus of German
texts up to 1900 in TEI PS XML, so we could use them directly to typeset
books. What I am looking for is a script to extract all XML tags/tokens
from their files to have a complete list of things that should be
handled in a ConTeXt style file. Five years ago I tried to create such a
style file by hand, but I gave up.

https://github.com/juh2/tei-style-dta-context

The tokens/tags differ from text to text and I think the structure too
so that it was beyond my knowledge to generate a general style file for
all texts.

3. Being a writer I think that Markdown --> ConTeXt is the best way to
achieve what I want: easy writing and professional looking books. Up to
now I used Pablos way via pandoc and XHTML described here:
http://www.from-pandoc-to-context.tk/

The problem with pandoc is that it does not generate a perfect ConTeXt
source to build the file as some things are missing.

Annotations and eg. your classify.lua might be a second approach to
achieve what I want.

So thanks a lot for your work.

@all: Feel free to comment on my three topics any hints are welcome.

Ciao!
juh
___
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 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] Why does this METAPOST vardef 'save' statement fail?

2020-03-14 Thread Gerben Wierda
Answering myself: pth2 is not a valid variable name. Digits are not allowed.

> On 14 Mar 2020, at 15:45, Gerben Wierda  wrote:
> 
> I have this vardef:
> 
> vardef Foo(expr w, h) =
>save pth; path pth;
>%save pth2; path pth2;
>save pic; picture pic;
>pth = fullsquare xysized (w, h);
>%pth2 = fullsquare xysized (h/4, h/8)
>pic := image (
>draw pth;
>%draw pth2 shifted (-w/2, -h/4);
>% all kind of stuff here
>);
>setbounds pic to pth;
>pic
> enddef ;
> 
> As soon as I uncomment the bold line (first comment) a mtxrun fails. Whatever 
> I try, a single save statement, etc., I fail in getting a second local 
> variable. The METAPOST manual is no help.
> 
> The error shown is:
> 
> metapost log> ! Extra tokens will be flushed.
> metapost log>  
> metapost log>2
> metapost log> Foo->...h;path.pth;save.pth2
> metapost log>   
> ;path.pth2;save.pic;pictur...
> metapost log> <*> ... ; s := Foo(8cm, 2cm)
> metapost log>   ; draw s; 
> drawdot center l...
> metapost log> 
> 
> Why?
> 
> 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
> ___

___
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] Why does this METAPOST vardef 'save' statement fail?

2020-03-14 Thread Gerben Wierda
I have this vardef:

vardef Foo(expr w, h) =
   save pth; path pth;
   %save pth2; path pth2;
   save pic; picture pic;
   pth = fullsquare xysized (w, h);
   %pth2 = fullsquare xysized (h/4, h/8)
   pic := image (
   draw pth;
   %draw pth2 shifted (-w/2, -h/4);
   % all kind of stuff here
   );
   setbounds pic to pth;
   pic
enddef ;

As soon as I uncomment the bold line (first comment) a mtxrun fails. Whatever I 
try, a single save statement, etc., I fail in getting a second local variable. 
The METAPOST manual is no help.

The error shown is:

metapost log> ! Extra tokens will be flushed.
metapost log>  
metapost log>2
metapost log> Foo->...h;path.pth;save.pth2
metapost log>   
;path.pth2;save.pic;pictur...
metapost log> <*> ... ; s := Foo(8cm, 2cm)
metapost log>   ; draw s; 
drawdot center l...
metapost log> 

Why?

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] Some questions regarding math typesetting

2020-02-29 Thread TeXnician
Bump

On 06.12.19 14:59, Hans Hagen wrote:
> On 12/6/2019 9:24 AM, TeXnician wrote:
>> Dear list,
>>
>> while doing some math typesetting, I have found the following features not
>> working in LMTX:
>>
>> 3. \startformulas does not allow numbering formulas because the number will 
>> run
>>     into the next column. I have posted this at
>>
>> https://tex.stackexchange.com/questions/518262/context-number-formulas-side-by-side
>>
>>     and Henri Menke tested that it broke in 2017. Aditya Mahajan mentioned 
>> that
>>     it is a bug.
> 
> This one is for Aditya who knows more about these math alignments (needs) 
> than I
> do.
> 
> Aditya: when we comment the \aligntab it's ok but i'm hesitant to do that 
> patch
> ... so do you see bad consequences?
> 
> \def\math_alignment_NR_indeed[#1][#2]%
>   {%\aligntab % HERE
>    \dostoptagged % finish cell
>    \strc_formulas_place_number_nested{#1}{#2}%
>    \math_number_right_of_eqalign
>    \global\settrue\c_math_eqalign_first
>    \crcr
>    \dostoptagged} % finish row
> 
> 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] attachments working again (issue with /EmbeddedFiles)

2020-02-08 Thread Pablo Rodriguez
On 2/7/20 10:37 PM, Hans Hagen wrote:
> Peter is stepwise looking into all these issues but we decided to also
> see how that checking and standards evolve in cases where it's a
> confusing mess. And these 'appearance dicts' are an example of a mess.
> On the one hand there's predefined appearances and on the other hand
> enforced renderings which gives some chicken-egg issue. It smells a lot
> like bugs became features (standards) or 'acrobat behaviour' made the
> standard or ... (like the zero rect thing, which, given t e plenty of
> flags there are and verbosity there is in pdfm is pretty weird and
> actually can make viewers bark. Irr the current approach we follow is
> kind of a compromise.

Just a comment on one of the issues.

Maybe the simplest way to avoid the issues with the annotation flag is
not including it at all.

Once annotations have appearance dictionaries, Acrobat will print those
ones with an annotation flag set to print.

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] line numbering within frame

2020-01-24 Thread Tomas Hala

Hi Thomas,

I compiled (TL2019) it with as well as without \setbreakpoints[compound] and
I got the same result -- in both case I see both colours. 

Wishes,

Tomáš

Fri, Jan 24, 2020 ve 06:45:06PM +0100 Thomas A. Schmitz napsal(a):
# 
# 
# > On 23. Jan 2020, at 12:45, Tomas Hala  wrote:
# > 
# > Hi Thomas,
# > 
# > move definitions and setups for Three and Four before the use of \framed.
# > (With TL2019 works.)
# > 
# > Wishes,
# > 
# > Tomáš
# 
# Thank you for the hint - we’re still waiting for an answer to Wolfgang’s 
bonus question. But I have continued testing and discovered what is certainly a 
bug. Here’s a new example:
# 
# \setbreakpoints [compound]
# 
# \definelinenumbering  
#[original]
#[style=\tx\ss,distance=-1ex,step=5,location=inleft,start=10,color=darkred]
# 
# \definelinenumbering
#[translation]
#[style=\tx\ss,distance=-1ex,step=5,location=inleft,start=50,color=darkblue]
# 
# \starttext
# 
# \framed 
#   [background=color,
#backgroundcolor=gray,
#align={normal},
#frame=off,
#loffset=6ex,
#width=\textwidth,
#foregroundstyle=\ss]
# {\startlinenumbering[original]
#  \input knuth 
#  \stoplinenumbering
#   \blank [line]
#\startlinenumbering[translation]
#\input klein
#\stoplinenumbering}
# 
# \stoptext
# 
# If you compile it, you will see that the “color” key of the two defined 
linenumbering environments is not followed. If you comment out the first line 
\setbreakpoints [compound], you will get two colors, as expected. I leave it as 
an exercise for Hans and Wolfgang to explain what’s going on here :-)
# 
# Thomas
# 
___
# 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
# 
___

 Tomáš Hála

Mendelova univerzita, Provozně ekonomická fakulta, ústav informatiky
Zemědělská 1, CZ-613 00 Brno,  tel. +420 545 13 22 28

http://akela.mendelu.cz/~thala
___
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] line numbering within frame

2020-01-24 Thread Thomas A. Schmitz


> On 23. Jan 2020, at 12:45, Tomas Hala  wrote:
> 
> Hi Thomas,
> 
> move definitions and setups for Three and Four before the use of \framed.
> (With TL2019 works.)
> 
> Wishes,
> 
> Tomáš

Thank you for the hint - we’re still waiting for an answer to Wolfgang’s bonus 
question. But I have continued testing and discovered what is certainly a bug. 
Here’s a new example:

\setbreakpoints [compound]

\definelinenumbering
   [original]
   [style=\tx\ss,distance=-1ex,step=5,location=inleft,start=10,color=darkred]

\definelinenumbering
   [translation]
   [style=\tx\ss,distance=-1ex,step=5,location=inleft,start=50,color=darkblue]

\starttext

\framed 
  [background=color,
   backgroundcolor=gray,
   align={normal},
   frame=off,
   loffset=6ex,
   width=\textwidth,
   foregroundstyle=\ss]
{\startlinenumbering[original]
 \input knuth 
 \stoplinenumbering
  \blank [line]
   \startlinenumbering[translation]
   \input klein
   \stoplinenumbering}

\stoptext

If you compile it, you will see that the “color” key of the two defined 
linenumbering environments is not followed. If you comment out the first line 
\setbreakpoints [compound], you will get two colors, as expected. I leave it as 
an exercise for Hans and Wolfgang to explain what’s going on here :-)

Thomas
___
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] Indentation problem inside enumeration

2020-01-02 Thread Mikael P. Sundqvist
On Tue, Dec 17, 2019 at 8:39 AM Mikael P. Sundqvist 
wrote:

> Hi!
>
> I've met a strange problem with indentation in consecutive enumerations.
> It seems to me that if
>
> 1) the first enumeration uses indentnext=no
> AND
> 2) the next enumeration uses a background
>
> then the second(?) paragraph of the second enumeration is not indented.
>
> Here is a small example (see what lines to comment to avoid the problem).
>
> %%%
> \defineenumeration[losning][
> text=Lösning,
> title=yes,
> alternative=serried,
> width=fit,
> number=no,
> headstyle={\em},
> titlestyle=,
> indentnext=no,% another way to get indentation is to comment this line
> indenting={yes,medium},
> ]
>
> \defineframedtext[anmärkningsbakgrunden][
> width=\textwidth,
> background=color,
> backgroundcolor=gray,
> ]
>
> \defineenumeration[anmarkning][
> text=Anmärkning,
> title=yes,
> headstyle={\definedfont[Bold*default]\WORD},
> alternative=serried,
> width=fit,
> number=no,
> prefix=no,
> indentnext=no,
> indenting={yes,medium},
> before={\startanmärkningsbakgrunden},% if these two lines are commented
> then
> after={\stopanmärkningsbakgrunden},% the indentation works
> ]
>
> \starttext
>
> \startlosning
> This environment destroys indentation in the next.
> \stoplosning
>
> \startanmarkning
> This is just a first paragraph.
>
> This paragraph should be indented.
>
> This paragraph is always indented.
> \stopanmarkning
> \stoptext
> %%%
>
> (This is a stripped down example with some settings removed. But it shows
> the point.)
>
> Am I doing something wrong? The resulting pdf is attached.
>
> /Mikael
>
> PS I think I saw this problem both with mkiv and lmtx.
>
>
Bump. (Am I doing something wrong?)

/Mikael
___
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] Adjust kern for one character

2019-12-26 Thread Rik Kabel


On 12/23/2019 18:45, Rik Kabel wrote:


On 12/22/2019 21:34, Henri Menke wrote:



On 12/23/19 3:33 PM, Henri Menke wrote:

On 12/23/19 2:30 PM, Rik Kabel wrote:


On 12/22/2019 17:40, mf wrote:

Il 22/12/19 22:19, Rik Kabel ha scritto:

List,

Is there a way in ConTeXt to adjust the left-side kern for one
character? The cap J in the font I am using is being set too 
close to

the preceding characters and I would rather not insert a thinspace
before each. (Inserting a thinspace is sufficient, but finer control
is welcome.)


\definecharacterspacing[distantJ]
\setupcharacterspacing[distantJ]["004A][left=.15,alternative=1] % 
004A

is the unicode hex index of letter J
\starttext
    normal: AJB\par
    \setcharacterspacing[distantJ] more space on the left: AJB\par
    \resetcharacterspacing normal again: AJB\par
\stoptext


Thank you for that, Massi.

Unfortunately, that is too blunt an instrument in this case -- in
addition to the body font where the problem exists, it works on the
heading and titling font, which does not share the problem.

As Henri's answer hints, I was a bit unclear in my request. It is a 
kern

between a word space and the cap J that is the issue. Perhaps a font
feature file is the place to do such a thing.


\startluacode
fonts.handlers.otf.addfeature {
  name = "kern",
  type = "kern",
  data = {
  [" "] = {
  ["J"] = 1000 % exaggerated value


Should of course be a Lua comment

    ["J"] = 1000 -- exaggerated value


  }
  }
}
\stopluacode

\setupbodyfont[modern] % have to reload the font

\starttext

No Jokes!

\stoptext


Henri,

This looks very promising. It works, mostly. That is, all fonts that 
use default fontfeatures pick up the change. So, for example, the 
companion sansserif for my body font also gets it even though that is 
not what I want.


I can remove kerning from the default fontfeatures and add it back 
just for the problematic font, but that means no kerning for the sans 
font.


Is there a way to apply this to one font only (serif upright, bold, 
italic, ...) or even a single face (upright), perhaps by giving it a 
unique name? I have tried a few variations but had no success. The 
fonts-mkiv manual has very little on this, and the cld manual nothing.


Okay, I have progressed further but have run into something (else) I 
cannot understand. Consider the following example:


   \definefontfeature   [myserif] [mode=node,kern=yes,xkern=yes]
   \definefontfeature   [mysans]  [mode=node,kern=yes,xkern=no]
   \definefontfeature   [none][mode=node]
   \definefontfamily[mykerns] [serif] [Baskervaldx][features=myserif]
   \definefontfamily[mykerns] [sans]  [Dejavusans] [features=mysans]
   \definefontfamily[default] [serif] [Baskervaldx][features=default]
   \definefontfamily[default] [sans]  [Dejavusans] [features=default]
   \definefontfamily[nokerns] [serif] [Baskervaldx][features=none]
   \definefontfamily[nokerns] [sans]  [Dejavusans] [features=none]
   \definefontfamily[legends] [mono]  [Dejavusansmono] [features=default]

   \startluacode
  fonts.handlers.otf.addfeature {
  name = "kern",
  type = "kern",
  data = {
  ["x"] = { ["x"] = -300 },
  [" "] = { ["A"] = 1000 }
  }
  }
  fonts.handlers.otf.addfeature {
  name = "xkern",
  type = "kern",
  data = {
  ["x"] = { ["x"] = 500 },
  [" "] = { ["J"] = 500 }
  }
  }
   \stopluacode

   \startbuffer[Sample]
  g, Jaxxb AJon
   \stopbuffer

   \define[2]\Test{
  {\switchtobodyfont[#1]#2\getbuffer[Sample]}}

   \setupbodyfont[legends]

   \starttext
   \starttabulate[|l|l|l|]
   \NC test \NC  Serif\NC  Sans \NC \NR
   \NC nokerns  \NC  \Test{nokerns}{\tf}  \NC  \Test{nokerns}{\ss}  \NC \NR
   \NC default  \NC  \Test{default}{\tf}  \NC  \Test{default}{\ss}  \NC \NR
   \NC mykerns  \NC  \Test{mykerns}{\tf}  \NC  \Test{mykerns}{\ss}  \NC \NR
   \stoptabulate
   \stoptext

It shows, as far as I see, that the kern feature type supports " ", but 
only when it is named kern. When it is named xkern, as here, it does not 
support spaces, but does support other characters.


If I can get support for a separate feature name, I can easily apply 
this corrective kern to the single problematic font.


I also tried a goodie file, but it, too, did not support the " ".

--
Rik

___
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] Adjust kern for one character

2019-12-23 Thread Rik Kabel


On 12/22/2019 21:34, Henri Menke wrote:



On 12/23/19 3:33 PM, Henri Menke wrote:

On 12/23/19 2:30 PM, Rik Kabel wrote:


On 12/22/2019 17:40, mf wrote:

Il 22/12/19 22:19, Rik Kabel ha scritto:

List,

Is there a way in ConTeXt to adjust the left-side kern for one
character? The cap J in the font I am using is being set too close to
the preceding characters and I would rather not insert a thinspace
before each. (Inserting a thinspace is sufficient, but finer control
is welcome.)


\definecharacterspacing[distantJ]
\setupcharacterspacing[distantJ]["004A][left=.15,alternative=1] % 004A
is the unicode hex index of letter J
\starttext
    normal: AJB\par
    \setcharacterspacing[distantJ] more space on the left: AJB\par
    \resetcharacterspacing normal again: AJB\par
\stoptext


Thank you for that, Massi.

Unfortunately, that is too blunt an instrument in this case -- in
addition to the body font where the problem exists, it works on the
heading and titling font, which does not share the problem.

As Henri's answer hints, I was a bit unclear in my request. It is a 
kern

between a word space and the cap J that is the issue. Perhaps a font
feature file is the place to do such a thing.


\startluacode
fonts.handlers.otf.addfeature {
  name = "kern",
  type = "kern",
  data = {
  [" "] = {
  ["J"] = 1000 % exaggerated value


Should of course be a Lua comment

    ["J"] = 1000 -- exaggerated value


  }
  }
}
\stopluacode

\setupbodyfont[modern] % have to reload the font

\starttext

No Jokes!

\stoptext


Henri,

This looks very promising. It works, mostly. That is, all fonts that use 
default fontfeatures pick up the change. So, for example, the companion 
sansserif for my body font also gets it even though that is not what I want.


I can remove kerning from the default fontfeatures and add it back just 
for the problematic font, but that means no kerning for the sans font.


Is there a way to apply this to one font only (serif upright, bold, 
italic, ...) or even a single face (upright), perhaps by giving it a 
unique name? I have tried a few variations but had no success. The 
fonts-mkiv manual has very little on this, and the cld manual nothing.


--
Rik

___
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] Adjust kern for one character

2019-12-22 Thread Henri Menke



On 12/23/19 3:33 PM, Henri Menke wrote:

On 12/23/19 2:30 PM, Rik Kabel wrote:


On 12/22/2019 17:40, mf wrote:

Il 22/12/19 22:19, Rik Kabel ha scritto:

List,

Is there a way in ConTeXt to adjust the left-side kern for one
character? The cap J in the font I am using is being set too close to
the preceding characters and I would rather not insert a thinspace
before each. (Inserting a thinspace is sufficient, but finer control
is welcome.)


\definecharacterspacing[distantJ]
\setupcharacterspacing[distantJ]["004A][left=.15,alternative=1] % 004A
is the unicode hex index of letter J
\starttext
    normal: AJB\par
    \setcharacterspacing[distantJ] more space on the left: AJB\par
    \resetcharacterspacing normal again: AJB\par
\stoptext


Thank you for that, Massi.

Unfortunately, that is too blunt an instrument in this case -- in
addition to the body font where the problem exists, it works on the
heading and titling font, which does not share the problem.

As Henri's answer hints, I was a bit unclear in my request. It is a kern
between a word space and the cap J that is the issue. Perhaps a font
feature file is the place to do such a thing.


\startluacode
fonts.handlers.otf.addfeature {
  name = "kern",
  type = "kern",
  data = {
  [" "] = {
  ["J"] = 1000 % exaggerated value


Should of course be a Lua comment

["J"] = 1000 -- exaggerated value


  }
  }
}
\stopluacode

\setupbodyfont[modern] % have to reload the font

\starttext

No Jokes!

\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] Indentation problem inside enumeration

2019-12-16 Thread Mikael P. Sundqvist
Hi!

I've met a strange problem with indentation in consecutive enumerations. It
seems to me that if

1) the first enumeration uses indentnext=no
AND
2) the next enumeration uses a background

then the second(?) paragraph of the second enumeration is not indented.

Here is a small example (see what lines to comment to avoid the problem).

%%%
\defineenumeration[losning][
text=Lösning,
title=yes,
alternative=serried,
width=fit,
number=no,
headstyle={\em},
titlestyle=,
indentnext=no,% another way to get indentation is to comment this line
indenting={yes,medium},
]

\defineframedtext[anmärkningsbakgrunden][
width=\textwidth,
background=color,
backgroundcolor=gray,
]

\defineenumeration[anmarkning][
text=Anmärkning,
title=yes,
headstyle={\definedfont[Bold*default]\WORD},
alternative=serried,
width=fit,
number=no,
prefix=no,
indentnext=no,
indenting={yes,medium},
before={\startanmärkningsbakgrunden},% if these two lines are commented then
after={\stopanmärkningsbakgrunden},% the indentation works
]

\starttext

\startlosning
This environment destroys indentation in the next.
\stoplosning

\startanmarkning
This is just a first paragraph.

This paragraph should be indented.

This paragraph is always indented.
\stopanmarkning
\stoptext
%%%

(This is a stripped down example with some settings removed. But it shows
the point.)

Am I doing something wrong? The resulting pdf is attached.

/Mikael

PS I think I saw this problem both with mkiv and lmtx.


debugging.pdf
Description: Adobe PDF document
___
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] Filling a page with \thinrules

2019-12-07 Thread Rik Kabel

On 12/7/2019 04:10, Otared Kavian wrote:

Hi Rik,

Thanks a lot for the link to that message dating back to 2010…

I tried to put that solution on the wiki but I could not create a new page. 
I'll try later.

For the record, below is a transcript of what I adapted from Wolfgang's 
solution, but maybe nowadays one could also right a more readable lua code to 
achieve the same.

Best regards: Otared K.

\define\thinrulesfillpage%
{
\hphantom{Answer} % this is necessary, I don't know why...
\blank  

\scratchcounter\dimexpr(\pagegoal-\pagetotal-2\lineheight)/(\dimexpr\lineheight+2.2ex\relax)\relax
\thinrules[n=\number\scratchcounter,inbetween={\blank[2.2ex]}]
\page
}

\showframe
\starttext
\dorecurse{2}{\input knuth.tex\par}

\thinrulesfillpage

\thinrulesfillpage

\input ward.tex
\thinrulesfillpage

\stoptext


On 7 Dec 2019, at 03:49, Rik Kabel  wrote:

On 12/6/2019 17:50, Otared Kavian wrote:

Hi all,

I am preparing a test for my students where I would like to have the statement 
of the problem on the top of a page and the remainder to the bottom of that 
page filled with \thinrules, for them to write the solution. And sometimes 
there might be an empty page filled with thinrules when the solution to the 
exercise is longer.

The following minimal example gives the idea of what I want to achieve, but 
since the statement of each exercise may be longer or shorter, I would like 
ConTeXt to compute how many \thinrules can be put in the remainder of the page.
That is, can one imagine a macro named (say) \fillpagewiththinrules which puts 
the exact number of thinrules before ejecting the page?
Is this possible or have I to do it by hand for each page?

\showframe
\starttext
\dorecurse{2}{\input knuth.tex\par}

\thinrules[n=20] % On the first page I can put 20 thinrules

\page

\thinrules[n=40] % On an empty page I can put 40 thinrules
\page

\input ward.tex

\thinrules[n=37] % On the third page there can be 37 thinrules

\stoptext

Thanks for any hint and help,
Best regards: Otared K.


It looks like Wolfgang answered this a while back. See Re: [NTG-context] Room 
for comment on the backside of form. .

--
Rik



Replace the \hphantom{...} with \dontleavehmode.

--
Rik

___
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] issue with beta from 2019.11.29 21:47 in Windows

2019-12-07 Thread Hans Hagen

On 12/7/2019 2:40 PM, Pablo Rodriguez wrote:


I know, but he was one of my bosses. And I remember I was totally
shocked when he explained to me that the standard document format for
any word processor was OpenOffice.org.


Anyone claiming that something is a standard (esp in computer science) 
is unaware of history. I bet that our ancestors of thousands of years 
ago also considered themselves modern, with standards etc. But sometimes 
I think that many folks today think of themselves as being on top of the 
human (intelligence, progress, morale, etc) pyramid compared to whoever 
came before. History proved them wrong. (Similar are claims of this or 
that being better (software, operating systems, etc) while in the end 
much converges to the same.)


Anyway, it's a waste of time and energy discussing with those folks.

And we as texies should also be honest: how many of the acclaimed 
'happy' tex users are really 'happy' with their system and are those 
'millions' really (unforced) users who couldn't as well be using word or 
google docs or ... given what and how they deal with documents. And 
let's not add the quality argument because a coupel of weeks ago I 
noticed how bad tex output didn't look any better in a display of some 
80 summaries at some meeting (the, oh, look how bad that table looks 
experience).


(I'm sure Arthur, when reading this, can comment as we sort of had this 
at a theme of a talk!)


(And, yes I consider myself a happy tex user, but I also admit that I 
don't have to write much. And yes, it's a specific kind of user and usage.)



I cannot recall the accurate details from his explanation, but he seemed
to think that even Microsoft Word was at fault for not implementing the
Open Document Text format (.odt) as its native format.


I suppose he read the specs of both formats in detail (in print of course).


The reasoning was so bizarre and shocking to me that I understood that
it was better to me simply to decline the discussion. Also other factual
inaccuracies about the work done in other departments made me clear that
it was better to avoid the conversation.


Indeed. Waste of time. Just think of this: you could kind of check his 
claims, so how about all the other claims someone makes ... stuff you 
know little about ... how valid are those claims then.



OOo was the cause of many compatibility issues in that company, because
they simply uninstalled Microsoft Office and installed OpenOffice.org
(no previous warning) in one evening.


Well, as long as they're happy ... in most cases no one cares how output 
looks, nor cares about long term storage and exchange of data. Going 
belly up means 'delete all data and thrash the machines'.



The installation was so poorly performed that they forgot to assign
Microsoft Office extensions to OOo programs in Windows. AOnly this minor
incident was a huge problem for the vast majority of users.


And then they entered denial state.


It was clear to me what I knew decades ago: free software isn’t programs
for free. I think they still have to deal with issues in OOo.


Although, not all free software comes for free. I'm not that sure of 
online tex services are cheaper than bulk microsoft licenses.



I only talked no more than five times with that guy. But if he was the
evangelist of free software in that company, I’m afraid I totally agree
with the people working there that hated OOo.


It's all about honnesty isn't it? And about people spending time and 
energy, That doesn't always goes well with commercial objectives. And 
there's always the knowledge issue. And expecially when open source and 
such starts looking like a religion (one without a long history of 
dealing with itself and communicating properly) it gets even trickier.


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] Filling a page with \thinrules

2019-12-07 Thread Hans Hagen

On 12/7/2019 10:10 AM, Otared Kavian wrote:

Hi Rik,

Thanks a lot for the link to that message dating back to 2010…

I tried to put that solution on the wiki but I could not create a new page. 
I'll try later.


Think TeX (and a little ConTeXt):

\starttexdefinition thinrulesfillpage
\par
\verticalstrut
\vskip-.5\lineheight
\leaders
\hbox to 
\hsize{\blackrule[width=\hsize,height=1pt,depth=1pt,color=red]\strut}

\vfilll
\verticalstrut
\vskip-1.5\lineheight
\page
\stoptexdefinition

\showframe

\starttext

\dorecurse{2}{\input knuth.tex\par} \thinrulesfillpage

\thinrulesfillpage

\input ward.tex \thinrulesfillpage

\stoptext

Now Wolfgang can change the \leaders in the proper ConTeXt interface 
calls. Okay, we could as well make it into some feature or course, as 
occasionally we need to add something new anyway, just to show progress.




For the record, below is a transcript of what I adapted from Wolfgang's 
solution, but maybe nowadays one could also right a more readable lua code to 
achieve the same.

Best regards: Otared K.

\define\thinrulesfillpage%
{
\hphantom{Answer} % this is necessary, I don't know why...
\blank  

\scratchcounter\dimexpr(\pagegoal-\pagetotal-2\lineheight)/(\dimexpr\lineheight+2.2ex\relax)\relax
\thinrules[n=\number\scratchcounter,inbetween={\blank[2.2ex]}]
\page
}

\showframe
\starttext
\dorecurse{2}{\input knuth.tex\par}

\thinrulesfillpage

\thinrulesfillpage

\input ward.tex
\thinrulesfillpage

\stoptext


On 7 Dec 2019, at 03:49, Rik Kabel  wrote:

On 12/6/2019 17:50, Otared Kavian wrote:

Hi all,

I am preparing a test for my students where I would like to have the statement 
of the problem on the top of a page and the remainder to the bottom of that 
page filled with \thinrules, for them to write the solution. And sometimes 
there might be an empty page filled with thinrules when the solution to the 
exercise is longer.

The following minimal example gives the idea of what I want to achieve, but 
since the statement of each exercise may be longer or shorter, I would like 
ConTeXt to compute how many \thinrules can be put in the remainder of the page.
That is, can one imagine a macro named (say) \fillpagewiththinrules which puts 
the exact number of thinrules before ejecting the page?
Is this possible or have I to do it by hand for each page?

\showframe
\starttext
\dorecurse{2}{\input knuth.tex\par}

\thinrules[n=20] % On the first page I can put 20 thinrules

\page

\thinrules[n=40] % On an empty page I can put 40 thinrules
\page

\input ward.tex

\thinrules[n=37] % On the third page there can be 37 thinrules

\stoptext

Thanks for any hint and help,
Best regards: Otared K.
___
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

___


It looks like Wolfgang answered this a while back. See Re: [NTG-context] Room 
for comment on the backside of form. .

--
Rik

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




--

-
  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

Re: [NTG-context] Filling a page with \thinrules

2019-12-07 Thread Otared Kavian
Hi Rik,

Thanks a lot for the link to that message dating back to 2010…

I tried to put that solution on the wiki but I could not create a new page. 
I'll try later.

For the record, below is a transcript of what I adapted from Wolfgang's 
solution, but maybe nowadays one could also right a more readable lua code to 
achieve the same.

Best regards: Otared K.

\define\thinrulesfillpage%
{
\hphantom{Answer} % this is necessary, I don't know why...
\blank  

\scratchcounter\dimexpr(\pagegoal-\pagetotal-2\lineheight)/(\dimexpr\lineheight+2.2ex\relax)\relax
\thinrules[n=\number\scratchcounter,inbetween={\blank[2.2ex]}]
\page
}

\showframe
\starttext
\dorecurse{2}{\input knuth.tex\par}

\thinrulesfillpage 

\thinrulesfillpage 

\input ward.tex
\thinrulesfillpage 

\stoptext

> On 7 Dec 2019, at 03:49, Rik Kabel  wrote:
> 
> On 12/6/2019 17:50, Otared Kavian wrote:
>> Hi all,
>> 
>> I am preparing a test for my students where I would like to have the 
>> statement of the problem on the top of a page and the remainder to the 
>> bottom of that page filled with \thinrules, for them to write the solution. 
>> And sometimes there might be an empty page filled with thinrules when the 
>> solution to the exercise is longer.
>> 
>> The following minimal example gives the idea of what I want to achieve, but 
>> since the statement of each exercise may be longer or shorter, I would like 
>> ConTeXt to compute how many \thinrules can be put in the remainder of the 
>> page.
>> That is, can one imagine a macro named (say) \fillpagewiththinrules which 
>> puts the exact number of thinrules before ejecting the page?
>> Is this possible or have I to do it by hand for each page?
>> 
>> \showframe
>> \starttext
>> \dorecurse{2}{\input knuth.tex\par}
>> 
>> \thinrules[n=20] % On the first page I can put 20 thinrules
>> 
>> \page
>> 
>> \thinrules[n=40] % On an empty page I can put 40 thinrules
>> \page
>> 
>> \input ward.tex
>> 
>> \thinrules[n=37] % On the third page there can be 37 thinrules
>> 
>> \stoptext
>> 
>> Thanks for any hint and help,
>> Best regards: Otared K.
>> ___
>> 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
>> 
>> ___
>> 
> It looks like Wolfgang answered this a while back. See Re: [NTG-context] Room 
> for comment on the backside of form. .
> 
> -- 
> Rik
> 
> ___
> 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
___


<    1   2   3   4   5   6   7   8   9   10   >