Re: [NTG-context] Vertical space when surrounding with textbackground

2020-11-26 Thread Aditya Mahajan
On Thu, 26 Nov 2020, Johann Birnick wrote:

> On Thu, 2020-11-26 at 19:17 +0100, Wolfgang Schuster wrote:
> > Johann Birnick schrieb am 26.11.2020 um 19:10:
> > > On Thu, 2020-11-26 at 17:31 +0100, Wolfgang Schuster wrote:
> > > > Johann Birnick schrieb am 26.11.2020 um 17:00:
> > > > > On Thu, 2020-11-26 at 09:38 -0500, Aditya Mahajan wrote:
> > > > > > On Thu, 26 Nov 2020, Johann Birnick wrote:
> > > > > > 
> > > > > > > How to surround such things properly? I just want a background to
> > > > > > > these
> > > > > > > and
> > > > > > > a
> > > > > > > sidebar. No addition spacing / empty lines.
> > > > > > A MWE will help...
> > > > > > 
> > > > > > Aditya
> > > > > For example, take:
> > > > > 
> > > > > \definetextbackground[code][background=color, 
> > > > > backgroundcolor=lightgray,
> > > > > frame=off, location=paragraph]
> > > > > 
> > > > > \starttextbackground[code]
> > > > > \starttyping
> > > > > This is some code
> > > > > a second line
> > > > > \stoptyping
> > > > > \stoptextbackground
> > > > You missed the W (working) in MWE.
> > > > 
> > > > \definetextbackground
> > > >     [Code]
> > > >     [  frame=off,
> > > >   background=color,
> > > >  backgroundcolor=lightgray,
> > > >     location=paragraph]
> > > > 
> > > > \setuptyping
> > > >     [before={\blank\starttextbackground[Code]},
> > > >   after={\stoptextbackground\blank}]
> > > > 
> > > > \starttext
> > > > 
> > > > \starttyping
> > > > This is some code
> > > > a second line
> > > > \stoptyping
> > > > 
> > > > \stoptext
> > > > 
> > > > Wolfgang
> > > Okay so first sorry that the example missed the \starttext ... \stoptext.
> > > Won't
> > >   
> 
> I didn't want to copy paste it :D Just add [option=XML] to \starttext like 
> this:

\starttext does not take an `option=XML` argument.

> \definetextbackground[code][background=color, backgroundcolor=lightgray,
> frame=off, location=paragraph]
> 
> \setuptyping[before={\startbackground[code]}, after={\stopbackground}]
> 
> \starttext[option=XML]
> \starttyping
> This is some code
> a second line
> \stoptyping
> \stoptext
> 
> When I use \definetyping[Mytyping][option=XML] and then use \startMytyping ...
> \stopMytyping nothing changes.

Again, a MWE help to understand what is going wrong.


\definetextbackground[code][background=color, backgroundcolor=lightgray,
frame=off, location=paragraph]

\setuptyping[before={\startbackground[code]}, after={\stopbackground}]

\definetyping[XMLtyping]
 [
   option=XML,
   before={\startbackground[code]},
   after={\stopbackground},
 ]

\starttext
\startXMLtyping
This is some code
a second line
\stopXMLtyping
\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
___


Re: [NTG-context] Vertical space when surrounding with textbackground

2020-11-26 Thread Aditya Mahajan
On Thu, 26 Nov 2020, Johann Birnick wrote:

> On Thu, 2020-11-26 at 09:38 -0500, Aditya Mahajan wrote:
> > On Thu, 26 Nov 2020, Johann Birnick wrote:
> > 
> > > How to surround such things properly? I just want a background to these 
> > > and
> > > a
> > > sidebar. No addition spacing / empty lines.
> > 
> > A MWE will help...
> > 
> > Aditya
> 
> For example, take:
> 
> \definetextbackground[code][background=color, backgroundcolor=lightgray,
> frame=off, location=paragraph]
> 
> \starttextbackground[code]
> \starttyping
> This is some code
> a second line
> \stoptyping
> \stoptextbackground


\definetextbackground[code][background=color, backgroundcolor=lightgray,
frame=off, location=paragraph]

\setuptyping[before={\startbackground[code]}, after={\stopbackground}]

\starttext
\starttyping
This is some code
a second line
\stoptyping
\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
___


Re: [NTG-context] Vertical space when surrounding with textbackground

2020-11-26 Thread Aditya Mahajan
On Thu, 26 Nov 2020, Johann Birnick wrote:

> How to surround such things properly? I just want a background to these and a
> sidebar. No addition spacing / empty lines.

A MWE will help...

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] Unexpected underbar behaviour in sections

2020-11-24 Thread Aditya Mahajan


On Tue, 24 Nov 2020, Bruce Horrocks wrote:

> The following is giving me a section title with triple underbars instead of 
> single. 
> 
> \definehead [Heading] [section]
> \setuphead [Heading] [style={\underbar}]

Change this to:

\setuphead [Heading] [textcommand={\underbar}, numbercommand=\underbar]

> \starttext
> \Heading{First level section heading}
> \underbar{This is single underlined as expected}
> \stoptext
> 
> (Same with \startHeading .. \stopHeading and for subsections, which is where 
> I first noticed it.)
>
> It looks quite attractive in its own way - and certainly acts as a visual 
> highlight - just not quite what I was expecting. ;-)

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] autostart included video

2020-11-19 Thread Aditya Mahajan


On Thu, 19 Nov 2020, Hans Hagen wrote:

> On 11/19/2020 8:12 AM, Aditya Mahajan wrote:
> 
> > I use \externalfigure[filename.mp4] to include a video in a presentation. Is
> > it possible to autostart the video automatically when the page is loaded?
> Video (and audio) and acrobat ... any browser can play a video but it seems
> too complex for adobes pdf viewers and technology
>
> []

I understand and am pretty frustrated with Adobe (they had decent support on 
linux but simply gave up at some stage)However, sometimes videos are the 
best way to present some information in a presentation. The method that you 
sent in the other message:

\gotobox{\externalfigure[cow.pdf]}[url(woodwork.mp4)]

works (clicking on the file opens the file in an external viewer) but I prefer 
to show the video inside the PDF. 

My current solution is to use pdfpc (https://pdfpc.github.io/), which is able 
to play the usual \externalfigure[filename.mp4] videos well...just that I need 
to click the video in order to start it. They do have a latex specific method 
to autostart a video...I'll try to see if I can figure out what is the actual 
PDF code that needs to be embedded and try to replicate it in context.

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] autostart included video

2020-11-18 Thread Aditya Mahajan
Hi,

I use \externalfigure[filename.mp4] to include a video in a presentation. Is it 
possible to autostart the video automatically when the page is loaded? 

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] page ends with a section title followed by a table

2020-11-10 Thread Aditya Mahajan
On Tue, 10 Nov 2020, Sylvain Hubert wrote:
> Indeed. Thanks for the information!
> 
> For the record, this is how the problem is finally solved:
> 
> \setuphead[section][after={\blank[sampage]}]
> \begingroup\setupindenting[no]\dontleavehmode\startxtable …
> \stopxtable\endgroup

Unless you have other reasons to create a group, you can just use:

\noindentation\dontleavehmode
\startxtable
...
\stopxtable

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] removing many lines about font in log.

2020-11-10 Thread Aditya Mahajan
On Tue, 10 Nov 2020, Jeong Dal wrote:

> Dear Hans,
> 
> Thank you for the explanation.
> Since those messages takes too many lines in the log file, I ask about it.
> I prefer to suppress them. But, someone want to see them.
> 
> Since there is no problem to compile, it is OK to let them shown for some one 
> want to know what happened.
>  

You can also use

  \ctxlua{logs.disable("fonts")}

to get rid of all the messages.

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] Indentation after \placefigure

2020-11-10 Thread Aditya Mahajan
On Tue, 10 Nov 2020, mf wrote:

> Il 10/11/20 09:42, Sylvain Hubert ha scritto:
> > Dear List,
> > 
> > Does anyone know how to indent the paragraph beneath \placefigure in the 
> > following example?
> > 
> >      \indenting[2em]
> >      \setupindenting[yes]
> > 
> >      \starttext
> > 
> >      \dorecurse{50}{a b c }
> > 
> >      \placefigure[here,none][indentnext=yes]{}{
> >      \startMPcode
> >      draw fullcircle scaled 1cm;
> >      \stopMPcode
> >      }
> > 
> >      \dorecurse{50}{d e f } % not indented
> > 
> >      \dorecurse{50}{g h i }
> >      \stoptext
> > 
> 
> The second bracket group of \placefigure is for references.
> Instead of
> 
> \placefigure[here,none][indentnext=yes]{}{...
> 
> write
> 
> \setupfloat[figure][indentnext=yes]
> \placefigure[here,none]{}{...
> 
> That way you enable indentation after every figure.

If you want to change the behavior for a particular figure, you can also use 
the \start...stop variant:

\startplacefigure[location={here,none}, indentnext=yes]
   
\stopplacefigure

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] Running mtxrun in a continuous batch mode

2020-11-06 Thread Aditya Mahajan
On Fri, 6 Nov 2020, thierry horsin wrote:

> Hi Ramkumar,
> 
> Maybe you could have some scripts that check when the JSON file is modified
> and if so launches the compilation. I did that sort of script in order to have
> a continuous compilation process by checking every second if my current .tex
> file is modified.

Here is a script which does this for general tasks:

http://users.fred.net/tds/lab/ftp/atchange

It is also possible to build something on top of inotifywait on linux.

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] [save] [setmatrix] [restore] and [latelua] messages on terminal

2020-10-30 Thread Aditya Mahajan
HI,

With the recent versions of luamatatex (2020.09.20), in a moderate sized 
project, I get a multiple messages of on the terminal

... mode = 0 [save] [setmatrix] [save] 
[setmatrix] [setmatrix] [restore] [restore] 
[literal]... data = 0 w

S
0 g 0 G
0 g 0 G
32.875 67.393234 m
26.511902 72.707367 20.076431 76.811981 13.572296 82.470184 c

[etc]
...
 mode = 0 
[literal]...
 data = % mps graphic 1: end

It seems like metapost to PDF code is being printed to the terminal (not sure 
about that). 

I also see messages like:

 
[latelua].
 data = function: 0x5585588b4250 
[latelua]..
 data = table: 0x558557a5ab90floatblocks

Any idea what is causing these and how to I disable them. Here is a minimal 
example for the second message and I can also try to create one for the first:

\starttext

\startframedtext
  \startTABLE
\NC \input knuth
\NC[nr=2] 
\iftrialtypesetting\else\startplacefigure
  [location={right,high},
   title={Blah blah blah},]
\stopplacefigure\fi
\NC \NR
\NC \input ward
\NC \NR
  \stopTABLE
\stopframedtext


\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] troubles with \enablemode

2020-10-30 Thread Aditya Mahajan
On Fri, 30 Oct 2020, Damien Thiriet wrote:

> Hi @list,
> 
> 
> I don't fully understand the \enablemode mechanism. Given this MWE:
> 
> 
> \startmode[test]
> \setupframedtext [foregroundcolor=white,style={\tfa}]
> \stopmode
> 
> 
> \starttext
> \startframedtext
> ceci est un texte
> \stopframedtext
> \enablemode [test]
> \startframedtext
> ceci est un texte
> \stopframedtext
> \stoptext
> 
> I cannot see the expected effect when I compile, that is both texts are
> in black. When I compile with
> context --mode=test 
> both framed texts are in white, which is what I expect.
> 
> What did I miss?

When the compilation starts and context reads the line \startmode[test], the 
mode is not enabled, so the rest of the block is discarded. When you get to do 
enable the mode, it is too late. TeX does not do backtracking while compiling a 
document. Depending on what exactly you want, you could use:

\startsetups[test]

\stopsetups

...
\setups{test}



Or perhaps even (untested)

\setupframedtext[foregroundcolor={\doifmode{test}{white}}, style={\tfa}]


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] Bug: context/mtxrun makes Firefox eat up cpu

2020-10-29 Thread Aditya Mahajan
On Thu, 29 Oct 2020, Sylvain Hubert wrote:

> Hi,
> 
> sorry if this is not the best place to file a bug but I found no working
> bug tracker for context.
> 
> Environment:
> Manjaro 20.1.2, context 2020.09.20 23:02, firefox 82.0
> 
> Step to reproduce:
> 1. `firefox --safe-mode  # start firefox without add-ons`
> 2.a`context --version  # or --help, or without arguments`
> 2.b or: `mtxrun --script font --list --all`
> 
> Expected behavior:
> Nothing surprising should happen.
> 
> Actual behavior:
> Firefox suddenly eats 100% of cpu

I cannot reproduce this behavior (I am on manjaro but using firefox 81 rather 
than 82). My environment:

$uname -a
Linux hostname 5.4.67-1-MANJARO #1 SMP PREEMPT Wed Sep 23 14:20:18 UTC 2020 
x86_64 GNU/Linux

$firefox --version
Mozilla Firefox 81.0

$context --version
mtx-context | ConTeXt Process Management 1.03
mtx-context |
mtx-context | main context file: 
/opt/luametatex/texmf-context/tex/context/base/mkiv/context.mkiv
mtx-context | current version: 2020.09.15 18:11
mtx-context | main context file: 
/opt/luametatex/texmf-context/tex/context/base/mkiv/context.mkxl
mtx-context | current version: 2020.09.15 18:11

I followed your steps:
1. start `firefox --safe-mode`
2. On a different terminal, open htop and filter `firefox` so I can view 
firefox's CPU usage.
3. Run `mtxrun --script font --list --all`

The CPU usage of firefox does not change in any appreciable way (it was 0% and 
remains 0%). 

It is possible for you to check on a fresh install of manjaro in a virtual 
machine to rule out the possibility that something else in your system is 
causing this behavior. 

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] Unicode math input in LMTX

2020-10-29 Thread Aditya Mahajan
On Thu, 29 Oct 2020, Sylvain Hubert wrote:

> Hi all,
> 
> Does anyone know if it is possible to input unicode in math formulas in
> LMTX with the help of something similar to unicode-math in LaTeX?

You don't need any latex package. Simply inputing unicode math should work out 
of the box. 

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] invoking ConTeXt from .bat file in Win7

2020-10-28 Thread Aditya Mahajan
On Wed, 28 Oct 2020, Pablo Rodriguez wrote:

> On 10/27/20 9:40 PM, Pablo Rodriguez wrote:
> > Dear list,
> >
> > I have the following sample:
> >
> >   \mainlanguage[es]
> >   \setupbodyfont[dejavu]
> >   \starttext
> >
> >   %~ \startmode[*last]
> > \startluacode
> > io.write("¿Cuál es el mensaje? ")
> > document.message = io.read()
> > \stopluacode
> >   %~ \stopmode
> >
> >   El mensaje es: \cldcontext{document.message}
> >   \stoptext
> >
> I’d really appreciate to know how to request an extra pass in ConTeXt.

As the manual says, "This mode is set if the last run in a session is taking 
place. Normally this is not known in advance, unless one has asked for an 
additional imposition pass."

Why do you want to use the last mode for this? The new information can lead to 
an extra line-break or extra page-break, which might then need an extra run to 
resolve correctly. So, it might be better to ask the information in the first 
run and save it in the tuc file using the two pass mechanism:

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

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] The correct way to add emphasis to text using italics

2020-10-21 Thread Aditya Mahajan
On Wed, 21 Oct 2020, Andres Conrado Montoya wrote:

> I've seen in several articles on the Wiki, some differences about how this
> is done, and I'm confused about the differences:
> 
> *Font_Switching* says: "There is a font switch \em to emphasize text. This
> is somewhat special: it does automatic italic correction and changes the
> alternative depending on the current alternative. For example, if the
> current font alternative is normal (i.e. upright), \em switches to slanted;
> and if the current font alternative is slanted, \em switches to normal."
> And using \definebodyfontenvironment[default][em=italic] to use italic
> instead of slanted; for OpenType fonts, recommends using
> \definefontfeature[default][default][itlc=yes] to also activate the italic
> correction. However, this seems not to work in x(ht)ml export.

Did you also see **Before you start...** section on that page:
https://wiki.contextgarden.net/Font_Switching#Before_you_start_...

> If you go to *Export*, it says: "Also note that switches like \em don’t
> translate into output structure, you need to
> \definehighlight[emph][style={\em}] and use as \emph{emphasized}." This is
> what I'm currently using. Other parts of the Wiki show a similar solution,
> but using style=italic, or style={\it}; I've seen others, but now I can't
> find them.
> 
> Could you please guide me as to where is this documented in the manuals? Is
> there any particular reason to choose any of these approaches above the
> others? 

As far as PDF output is consider, both the font switch \em and the macro \emph 
defined using \definehighlight[emph][style=\em] are equivalent. You can test 
that:

\definehighlight[emph][style=\em]

\starttext
Normal text. \emph{This is \emph{emphasized} test}

Normal text. {\em This is {\em emphasized} test}
\stoptext

> What is the recommended option if you want to have the \em
> properties for emphasized text, but works for BOTH pdf and x(h)tml export?

The raw font switch \em is not exported to HTML while \definehighlight[emph] 
is. 

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] need help comparing strings

2020-10-13 Thread Aditya Mahajan
On Tue, 13 Oct 2020, Pablo Rodriguez wrote:

> Dear list,
> 
> I have the following sample:
> 
>   \starttext
>   \def\numbersfname
> {\cldcontext{string.match([[\env{fname}]], "\letterpercent d+")}}
>   \ctxlua{ c = context.getvariable("environment", "fname") or "a" }
>   \ctxlua{ d = [[\env{fname}]] }
> 
>   tex: \numbersfname\\
>   \doifelse{}
>   {123}{yes}{no}\\
>   c: \cldcontext{c}\\
>   \doifelse{\cldcontext{c:match("\letterpercent d+")}}
>   {123}{yes}{no}\\
>   d: \cldcontext{d}\\
>   \doifelse{\cldcontext{d:match("\letterpercent d+")}}
>   {123}{yes}{no}
>   \stoptext
> 
> For compilation, I run the command:
> 
>   context --purgeall --arguments=fname={abc123} test-file.tex
> 
> These things are failing:
> 
> 1. I don’t know how to get \numbersfname equal to "123". I don’t know
> what I’m doing wrong.
> 
> 2. Is there no Lua version of \getvariable{...}{...}?
> 
> 3. I’m trying this on a Linux box, but on Windows I would say that Lua
> variable "d" is empty.
> 
> I need to get the number from \env{fname} and I don’t know what I’m
> missing. \doif is the way to test whether it’s right.
> 
> Could anyone explain me what I’m missing here?

I find it simpler to write macros where there is  clean communicating between 
tex and lua. For example:

\startluacode
  userdata = userdata or {}
  function userdata.numbersfname(name)
  return string.match(name, "%d+")
  end
\stopluacode

\define[1]\numbersfname
{\cldcontext{userdata.numbersfname([==[#1]==])}}

\starttext
\numbersfname{abc123}

\numbersfname{\env{fname}}
\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
___


Re: [NTG-context] Beamer --> ConTeXt (sample)

2020-10-09 Thread Aditya Mahajan
> recently I ha dto quickly put together few presentations for online meetings
> and not knowing better (aka quicker) way, I took/installed LyX on my Fedora
> machine. The process is not so smooth and end result is OK if we forgive
> ourselves that all Beamer presentations are looking almost the same.

Agreed. I find that all beamer presentations look the same and it can be 
difficult to change the look and feel of beamer presentations.

> However, I'm not into diving deep into Beamer package studying/learning it
> more thoroughly  anticipating that soon I'd have to do the same thing with
> some other package. :-)
> 
> Otoh, ConTeXt is a different league and learning it will pay for itself in the
> long run.
> 
> However, in order to be at least somewhat productive, I need some help so I
> can have some starter and not postponing learning ConTeXt ad infinitum, so I'm
> attaching small Beamer sample and wonder if someone can help by providing
> somewhat similar thing for ConText? (no need for all the graphic - I'm more
> concerned with proper overlays and having content in more than single column).

A presentation is just a regular document with small margins and some color :-)
Here is an old blog post on how to get to a decent presentation layout 
step-by-step. 

https://adityam.github.io/context-blog/post/presentation-40-commits-redux/

I also extensively use layers for absolute placement of content, which is more 
powerful than the simple two columns which beamer provides. 

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] Citeproc

2020-10-05 Thread Aditya Mahajan
On Mon, 5 Oct 2020, Hans Hagen wrote:

> On 10/5/2020 2:47 AM, Aditya Mahajan wrote:
> > > John MacFarlane, the developper of Pandoc, has released a new Citeproc
> > > that generates citations and bibliographies using CSL style files (CSL=
> > > citation style language). While it is written in Haskell and while it's
> > > primarily intended for use with Pandoc, it can also be used in other
> > > contexts. Provided with a JSON encoded list of references via stdin, it
> > > can produce formatted output.
> > 
> > The man page of the new citeproc executable, for those who are interested:
> > 
> > https://github.com/jgm/citeproc/blob/master/man/citeproc.1.md
> > 
> > > I know that ConTeXt has its own infrastructure to format bibliographies
> > > and citations, but, given the enormous amount of available styles in
> > > CSL, I nevertheless think that this could be a worthwile addition. What
> > > would be necessary to make such a toll usable with ConTeXt? How
> > > complicated would that be?
> > 
> > In principle, this should be trivial. Define a new command, say
> > \citeproc[ref], which saves the values of `ref` to a lua table, and at the
> > end of the run, write that lua table to an aux .json file, call citeproc and
> > store output to a new file, and on the second run read from that file. This
> > is essentially how the old bibtex used to work.
> > 
> > Note that this scheme has a few drawbacks: First, it needs to call an
> > external executable, which can be slower than directly reading the bib file
> > via lua. Second, it creates a bunch of extra auxiliary files, which is
> > always annoying. But I do agree that it will provide us with the ability to
> > use the large number CSL styles.
> > 
> > Of course, a better option will be write a CSL processor in Lua, but that is
> > a lot of tedious (but relatively simple) task. I wonder if there is already
> > a CSL processor written in Lua.
> the bib module can read lua files (or whatever)
> 
> i have no clue what csl is but I assume it's just some key / value thing as
> the bib module itself should to the logic

It is similar to a bst file and specifies how the bibliography should be 
formatted. The specification is written as an XML file, for example, this is 
the specification for APA style:

https://www.zotero.org/styles/apa-5th-edition

The detailed schema is here:

https://github.com/citation-style-language/schema/tree/v1.0.1

There are a large number of such specifications available. For example: 

  https://www.zotero.org/styles

So, the user can easily search for a style that matches his/her needs and 
simply use it. The task of finding a reference from a reference database is 
left to a CSL processor and there a few of them available:

https://citationstyles.org/developers/

In principle, it should be relatively straight forward (but tedious) to write a 
processor in Lua. But I am not volunteering for that :-)


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

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


Re: [NTG-context] Citeproc

2020-10-04 Thread Aditya Mahajan
> John MacFarlane, the developper of Pandoc, has released a new Citeproc 
> that generates citations and bibliographies using CSL style files (CSL= 
> citation style language). While it is written in Haskell and while it's 
> primarily intended for use with Pandoc, it can also be used in other 
> contexts. Provided with a JSON encoded list of references via stdin, it 
> can produce formatted output.

The man page of the new citeproc executable, for those who are interested:

https://github.com/jgm/citeproc/blob/master/man/citeproc.1.md

> I know that ConTeXt has its own infrastructure to format bibliographies 
> and citations, but, given the enormous amount of available styles in 
> CSL, I nevertheless think that this could be a worthwile addition. What 
> would be necessary to make such a toll usable with ConTeXt? How 
> complicated would that be?

In principle, this should be trivial. Define a new command, say \citeproc[ref], 
which saves the values of `ref` to a lua table, and at the end of the run, 
write that lua table to an aux .json file, call citeproc and store output to a 
new file, and on the second run read from that file. This is essentially how 
the old bibtex used to work.

Note that this scheme has a few drawbacks: First, it needs to call an external 
executable, which can be slower than directly reading the bib file via lua. 
Second, it creates a bunch of extra auxiliary files, which is always annoying. 
But I do agree that it will provide us with the ability to use the large number 
CSL styles.

Of course, a better option will be write a CSL processor in Lua, but that is a 
lot of tedious (but relatively simple) task. I wonder if there is already a CSL 
processor written in Lua.

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

2020-09-24 Thread Aditya Mahajan
On Thu, 24 Sep 2020, Alan Bowen wrote:

> I need to include several documents in a single paginated file. Treating
> the source file (.tex) of each document as a component file in a .prd file
> is one way to go. But I was wondering if it might be possible to do get the
> same result using the .pdf files of each document instead.
> 
> \copypages is promising: it includes the. pdf files and the counter in the
> resultant .prd file is correct. But what I still have to get is the page
> number on all pages of the included .pdf files except the first page in
> each.
> 
> I looked at \startpagefigure but that would be a very cumbersome way to go
> since there over 350 pages to include, given that it handles only one page
> at a time.
> 
> I hope that this makes sense.

I don't completely understand the question

> 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/

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] More table questions

2020-09-22 Thread Aditya Mahajan
On Tue, 22 Sep 2020, Peter Münster wrote:

> On Tue, Sep 22 2020, Aditya Mahajan wrote:
> 
> > The same effect is rather easy to achieve when using natural tables as
> > well.
> 
> But it fails, when there is only one data-row... :(

Then don't create tables with only one data row :-)

A better solution is to create a dedicate framehandler which draws the bottom 
frame at half the thickness:

\startuseMPgraphic{booktabs_bottom}
   draw bottomboundary OverlayBox withpen pencircle scaled (OverlayLineWidth/2)
withcolor OverlayColor;
   setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay[booktabs_bottom] [\uniqueMPgraphic{booktabs_bottom}]
\installbottomframerenderer{booktabs}{\uniqueMPgraphic{booktabs_bottom}}


\startsetups booktabs
  \setupTABLE[each][each][frame=off, rulethickness=1.2bp]
  \setupTABLE[row][first][topframe=on, bottomframe=booktabs]
  \setupTABLE[row][last] [bottomframe=on]

  \setupTABLE[row][first][style=bold]
\stopsetups

\starttext

\startTABLE[setups=booktabs]
  \NC Heading 1 \NC Heading 2 \NC Heading 3 \NC \NR
  \NC Value 1   \NC Value 2   \NC Value 3   \NC \NR
  \NC Value 1   \NC Value 2   \NC Value 3   \NC \NR
  \NC Value 1   \NC Value 2   \NC Value 3   \NC \NR
\stopTABLE

\blank[2*line]

\startTABLE[setups=booktabs]
  \NC Heading 1 \NC Heading 2 \NC Heading 3 \NC \NR
  \NC Value 1   \NC Value 2   \NC Value 3   \NC \NR
\stopTABLE
\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
___


Re: [NTG-context] More table questions

2020-09-22 Thread Aditya Mahajan
On Tue, 22 Sep 2020, Denis Maier wrote:

> Also, how do you easiest define booktabs style tables? I mean: can you 
> define tables such that the last row end with thicker lines without 
> having to make this explicit? Is there a mechanism for this? 

You can get this behavior using any of table mechanism. The wiki has an example 
when using the (now deprecated) TaBlE macros

https://wiki.contextgarden.net/Table#Booktabs

The same effect is rather easy to achieve when using natural tables as well. 

\startsetups booktabs
  \setupTABLE[each][each][frame=off]
  \setupTABLE[row][first][topframe=on,rulethickness=1.2bp]
  \setupTABLE[row][2][topframe=on,rulethickness=0.6bp]
  \setupTABLE[row][last] [bottomframe=on, rulethickness=1.2bp]

  \setupTABLE[row][first][style=bold]
\stopsetups

\starttext

\startTABLE[setups=booktabs]
  \NC Heading 1 \NC Heading 2 \NC Heading 3 \NC \NR
  \NC Value 1   \NC Value 2   \NC Value 3   \NC \NR
  \NC Value 1   \NC Value 2   \NC Value 3   \NC \NR
  \NC Value 1   \NC Value 2   \NC Value 3   \NC \NR
\stopTABLE
\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
___


Re: [NTG-context] \dorecurse{}{} problem

2020-09-21 Thread Aditya Mahajan
On Mon, 21 Sep 2020, Wolfgang Schuster wrote:

> Aditya Mahajan schrieb am 21.09.2020 um 16:35:
> > On Mon, 21 Sep 2020, Jeong Dal wrote:
> > 
> > > Hi,
> > > 
> > > I tried to make a table using \dorecurse or \doloop as in the example.
> > > There is no error but \recurselevel is not increased, all are 0 in the
> > > first example and only two rows are created with the \recurselevel 0 and 2
> > > only in the second example.
> > > 
> > > Does the tabulate cause the error?
> > > What is wrong in this MWE?
> > \dorecurse does not expand its arguments. See this old blog post for a
> > discussion on this:
> > 
> > https://adityam.github.io/context-blog/post/tex-programming/
> 
> \starttext
> 
> \starttabulate[|c|]
> \dorecurse{8}{\NC ##1 \NC\NR}
> \stoptabulate
> 
> \stoptext

You gave the same reply 11 years ago :-) which is also listed in the blog post.

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] \dorecurse{}{} problem

2020-09-21 Thread Aditya Mahajan
On Mon, 21 Sep 2020, Jeong Dal wrote:

> Hi,
> 
> I tried to make a table using \dorecurse or \doloop as in the example.
> There is no error but \recurselevel is not increased, all are 0 in the first 
> example and only two rows are created with the \recurselevel 0 and 2 only in 
> the second example.
> 
> Does the tabulate cause the error?
> What is wrong in this MWE?

\dorecurse does not expand its arguments. See this old blog post for a 
discussion on this:

https://adityam.github.io/context-blog/post/tex-programming/

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] Bad argument #1 to 'prehypenchar'

2020-09-15 Thread Aditya Mahajan
On Tue, 15 Sep 2020, Wolfgang Schuster wrote:

> Aditya Mahajan schrieb am 15.09.2020 um 21:19:
> > On Tue, 15 Sep 2020, Wolfgang Schuster wrote:
> > 
> > > You have to add \resetbreakpoints to the vim/filter module.
> > 
> > Thanks. I had:
> > 
> >\doifnotinset{\v!hyphenated}{\externalfilterparameter\c!option}
> >{\language\minusone}%
> > 
> > which I changed to
> > 
> >\doifnotinset{\v!hyphenated}{\externalfilterparameter\c!option}
> >{\language\minusone
> > \resetbreakpoints}%
> > 
> > and this fixed the error.
> 
> Don't use the \language hack, the official and supported commands are
> \nohypens and \dohyphens or when you need a interface for it use
> 
> \usehyphensparameter\...parameter
> 
> which allows
> 
> \setup...[hyphens=yes|no]

This is a leftover from the old days. Thank for the suggestion on how to fix 
this. I'll play around a bit and perhaps add the  option `hyphens=yes|no`  
instead of the current `option=hyphenated`.

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] Bad argument #1 to 'prehypenchar'

2020-09-15 Thread Aditya Mahajan
On Tue, 15 Sep 2020, Wolfgang Schuster wrote:

> Aditya Mahajan schrieb am 15.09.2020 um 05:30:
> > The following MWE gives an error with LMTX 2020.09.05
> > 
> > 
> > \usemodule[vim]
> > \definevimtyping[MATLABCODE][syntax=matlab]
> > 
> > \starttext
> > \startMATLABCODE
> >saveas(gcf(), "output/same-sigma.png")
> > \stopMATLABCODE
> > \stoptext
> > 
> > The error message is:
> > 
> > callback error:
> > ...metatex/texmf-context/tex/context/base/mkiv/lang-ini.lua:509: bad
> > argument #1 to 'prehyphenchar' (luatex.lang expected, got no value)
> > stack traceback:
> >  [C]: in function 'lang.prehyphenchar'
> >  ...metatex/texmf-context/tex/context/base/mkiv/lang-ini.lua:509: in
> > field 'prehyphenchar'
> >  ...metatex/texmf-context/tex/context/base/mkiv/typo-brk.lua:171: in
> > local 'method'
> >  ...metatex/texmf-context/tex/context/base/mkiv/typo-brk.lua:392: in
> > upvalue 'typesetters_breakpoints_handler'
> >  [string "local tonut  = nodes.tonut..."]:16: in function <[string
> > "local tonut  = nodes.tonut..."]:11>
> >  (...tail calls...)
> >  ...metatex/texmf-context/tex/context/base/mkiv/node-pro.lua:88: in
> > function <...metatex/texmf-context/tex/context/base/mkiv/node-pro.lua:79>
> > 
> > 1 >>  \SYNBOL{}saveas(gcf(), \SYN[String]{"output/same-sigma.png"})\SYNEOL{}
> > 2
> > mtx-context | fatal error: return code: 256
> > 
> > Any idea what is going on?
> 
> You have to add \resetbreakpoints to the vim/filter module.

Thanks. I had:

  \doifnotinset{\v!hyphenated}{\externalfilterparameter\c!option}
  {\language\minusone}%

which I changed to

  \doifnotinset{\v!hyphenated}{\externalfilterparameter\c!option}
  {\language\minusone
   \resetbreakpoints}%

and this fixed the error. 

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
___


[NTG-context] Bad argument #1 to 'prehypenchar'

2020-09-14 Thread Aditya Mahajan
The following MWE gives an error with LMTX 2020.09.05


\usemodule[vim]
\definevimtyping[MATLABCODE][syntax=matlab]

\starttext
\startMATLABCODE
  saveas(gcf(), "output/same-sigma.png")
\stopMATLABCODE
\stoptext

The error message is:

callback error: 
...metatex/texmf-context/tex/context/base/mkiv/lang-ini.lua:509: bad argument 
#1 to 'prehyphenchar' (luatex.lang expected, got no value)
stack traceback:
[C]: in function 'lang.prehyphenchar'
...metatex/texmf-context/tex/context/base/mkiv/lang-ini.lua:509: in 
field 'prehyphenchar'
...metatex/texmf-context/tex/context/base/mkiv/typo-brk.lua:171: in 
local 'method'
...metatex/texmf-context/tex/context/base/mkiv/typo-brk.lua:392: in 
upvalue 'typesetters_breakpoints_handler'
[string "local tonut  = nodes.tonut..."]:16: in function <[string 
"local tonut  = nodes.tonut..."]:11>
(...tail calls...)
...metatex/texmf-context/tex/context/base/mkiv/node-pro.lua:88: in 
function <...metatex/texmf-context/tex/context/base/mkiv/node-pro.lua:79>

1 >>  \SYNBOL{}saveas(gcf(), \SYN[String]{"output/same-sigma.png"})\SYNEOL{}
2 
mtx-context | fatal error: return code: 256

Any idea what is going on?

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] \definefontfamily not finding fonts

2020-09-10 Thread Aditya Mahajan
On Thu, 10 Sep 2020, Wolfgang Schuster wrote:

> >>> Any idea on what is going on and how to debug.
> >> I can't reproduce your Libertinus problem but the sans serif and monospaced
> >> fonts just use the wrong names.
> > In by defense, it used to work for the last 5 years :-)
> 
> Are you mixing \definetypeface and \definefontfamily?

This is an old style and I understand that the current syntax is wrong. But it 
did work previously. But the correct syntax does not find the fonts either.

Anyways, for now, I switched to typeface based interface

\starttypescript[mainface]
  \definetypeface[mainface][rm][serif][libertine][default] 
  \definetypeface[mainface][ss][sans] [heros][default]  
  \definetypeface[mainface][tt][mono] [dejavu]   [default] [rscale=0.85]
  \definetypeface[mainface][mm][math] [libertine][default] 
\stoptypescript

and it works correctly. So, it appears to be an issue with font name to 
filename mapping.

I'll try a clean install on a docker image and check it that works ... or just 
wait for the newer version, which often fixes such things :-)

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] \definefontfamily not finding fonts

2020-09-10 Thread Aditya Mahajan
On Thu, 10 Sep 2020, Wolfgang Schuster wrote:

> Aditya Mahajan schrieb am 10.09.2020 um 05:16:
> > Did something change with regard to \definefontfamily recently.
> > 
> > I have an old document where I use:
> > 
> > \starttypescript[mainface]
> >\definefontfamily[mainface][rm][Libertinus Serif][features=default]
> >\definefontfamily[mainface][ss] [heros]  [features=default]
> >\definefontfamily[mainface][tt] [dejavu] [features=none, rscale=0.85]
> >\definefontfamily[mainface][mm] [LibertinusMath]
> > \stoptypescript
> > 
> > \setupbodyfont[mainface,12pt]
> > 
> > On the recent LMTX (2020.09.05) I get
> > 
> > selectfont  > the requested font 'Libertinus Serif' has no files for the
> > 'tf' alternative, Latin Modern is used instead.
> > selectfont  > the requested font 'heros' has no files for the 'tf'
> > alternative, Latin Modern is used instead.
> > selectfont  > the requested font 'dejavu' has no files for the 'tf'
> > alternative, Latin Modern is used instead.
> > selectfont  > the requested font 'LibertinusMath' has no files for the
> > 'tf' alternative, Latin Modern is used instead.
> > 
> > 
> > I can find the fonts using mtxrun --script fonts. For example:
> > 
> > $mtxrun --script fonts --list --pattern="LibertinusSerif" --all
> > identifier   familynamefontname
> > filename  subfont   instances
> > 
> > libertinusserif  libertinusserif   libertinusserif
> > libertinusserif-regular.otf
> > libertinusserifdisplaynormal libertinusserifdisplay
> > libertinusserifdisplaylibertinusserifdisplay-regular.otf
> > libertinusserifdisplayregularlibertinusserifdisplay
> > libertinusserifdisplaylibertinusserifdisplay-regular.otf
> > libertinusserifinitialsnormallibertinusserifinitials
> > libertinusserifinitials   libertinusserifinitials-regular.otf
> > libertinusserifinitialsregular   libertinusserifinitials
> > libertinusserifinitials   libertinusserifinitials-regular.otf
> > libertinusserifnormallibertinusserif
> > libertinusserifitalic libertinusserif-italic.otf
> > libertinusserifregular   libertinusserif   libertinusserif
> > libertinusserif-regular.otf
> > 
> > and similar for the other fonts.
> > 
> > Any idea on what is going on and how to debug.
> 
> I can't reproduce your Libertinus problem but the sans serif and monospaced
> fonts just use the wrong names.

In by defense, it used to work for the last 5 years :-)

I'll try to dig deeper on why the fonts are not being found.

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] \definefontfamily not finding fonts

2020-09-09 Thread Aditya Mahajan
Did something change with regard to \definefontfamily recently. 

I have an old document where I use:

\starttypescript[mainface]
  \definefontfamily[mainface][rm][Libertinus Serif][features=default]
  \definefontfamily[mainface][ss] [heros]  [features=default] 
  \definefontfamily[mainface][tt] [dejavu] [features=none, rscale=0.85]
  \definefontfamily[mainface][mm] [LibertinusMath]
\stoptypescript

\setupbodyfont[mainface,12pt]

On the recent LMTX (2020.09.05) I get

selectfont  > the requested font 'Libertinus Serif' has no files for the 
'tf' alternative, Latin Modern is used instead.
selectfont  > the requested font 'heros' has no files for the 'tf' 
alternative, Latin Modern is used instead.
selectfont  > the requested font 'dejavu' has no files for the 'tf' 
alternative, Latin Modern is used instead.
selectfont  > the requested font 'LibertinusMath' has no files for the 'tf' 
alternative, Latin Modern is used instead.


I can find the fonts using mtxrun --script fonts. For example:

$mtxrun --script fonts --list --pattern="LibertinusSerif" --all
identifier   familynamefontname 
 filename  subfont   instances

libertinusserif  libertinusserif   libertinusserif  
 libertinusserif-regular.otf
libertinusserifdisplaynormal libertinusserifdisplay
libertinusserifdisplaylibertinusserifdisplay-regular.otf
libertinusserifdisplayregularlibertinusserifdisplay
libertinusserifdisplaylibertinusserifdisplay-regular.otf
libertinusserifinitialsnormallibertinusserifinitials   
libertinusserifinitials   libertinusserifinitials-regular.otf
libertinusserifinitialsregular   libertinusserifinitials   
libertinusserifinitials   libertinusserifinitials-regular.otf
libertinusserifnormallibertinusserif   
libertinusserifitalic libertinusserif-italic.otf
libertinusserifregular   libertinusserif   libertinusserif  
 libertinusserif-regular.otf

and similar for the other fonts. 

Any idea on what is going on and how to debug.

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] defining font family for several options

2020-09-03 Thread Aditya Mahajan
On Fri, 4 Sep 2020, jbf wrote:

> Thanks Otared. That clears up that little item :-)
> 
> BTW I know how to reduce font size in the headers (chapter titles) that 
> appear on the recto pages, which I can do with something like 
> \setupheader [style={\ss\switchtobodyfont[10pt]}], but it doesn't seem 

Better to use style={\switchtobodyfont[10pt,ss]} or 
\switchtobodyfont[10pt]\ss...

> to affect the header (title of the book) on the verso pages, which is 
> drawn from the simple statement:
> 
> \startdocument
>    [metadata:title={Book title}]
> 
> Shouldn't  \setupheader affect both headers? Or is it possible I have 
> left something out of my \setupheader declaration?

A minimal example will make the debugging process much easier.

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] defining font family for several options

2020-09-01 Thread Aditya Mahajan
On Tue, 1 Sep 2020, jbf wrote:

> Perhaps someone can assist me with the following query. I have a 
> situation where I need to use more than one sans serif fonts (especially 
> within complicated chapter heads). I currently have the following:
> 
> \definefontfamily [mainface] [rm] [alegreya]
> \definefontfamily [mainface] [ss] [dax][tf=file:dax-regular]
> \definefontfamily [mainface] [mm] [alegreya]
> \setupbodyfont[mainface]
> \setupbodyfont[11pt]
> 
> But what if I need to have, in addition to the Dax sans serif typeface, 
> an additional sans serif typeface such as ITCAvantGarde? How do I 
> declare that? Do I just give it another name, e.g. 
> \definefontfamily[chapter][itcavantgarde] etc? If I did that, how then 
> do I refer to it? Obviously not just as {\ss my text} since that would 
> call in the dax font.

{\switchtobodyfont[chapter]\ss my text}

I tried to improve the explanation on the wiki: 
https://wiki.contextgarden.net/Font_Switching#Switching_typefaces

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] Tagged PDFs from Context

2020-08-28 Thread Aditya Mahajan
On Thu, 27 Aug 2020, Karl Pettersson wrote:

> See this discussion.
> https://github.com/jgm/pandoc/issues/5409#issuecomment-678781349
> 
> Would it be possible to generate PDFs with headings tagged like H1, H2,
> H3, H4..., instead of using the H tag for all levels, which seems to be
> required for proper rendering with some screenreaders? It seems to me
> that it would require modfications to the Context source code.
> https://source.contextgarden.net/tex/context/base/mkiv/strc-tag.lua
> 
> Any ideas?

From what I understand, the current implementation assumes that the same tag 
will be used for all section levels. So, changing the tag at each section level 
will require a rewrite of the internal logic. 

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 Aditya Mahajan

On Wed, 26 Aug 2020, jbf wrote:

> 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)?

A complete minimal working example will help ... (some symbols, like the bullet 
in itemize is taken from the math font).

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


Re: [NTG-context] Overriding the number on a float

2020-08-25 Thread Aditya Mahajan
On Mon, 24 Aug 2020, Taco Hoekwater wrote:

> 
> 
> > On 24 Aug 2020, at 19:59, Wolfgang Schuster 
> >  wrote:
> >> \setcounter[figure][5] % next figure is no.6
> 
> For this subfigure stuff, perhaps this is useful?
> 
> [...] 
> 
> I could not find a safe way to increment the subfigure number automatically, 
> unfortunately.

Another option is to define:

\startplacesubfigure ... \stopplacesubfigure

which could use the current value of figure counter as prefix and increment the 
subfigure counter. Something similar is there for subformulas in the math mode, 
but I'll have to go back and check the implementation details. 

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] memoir-style chapter heading

2020-08-17 Thread Aditya Mahajan
On Mon, 17 Aug 2020, jbf wrote:

> Am completely new to using Metafun, which I presume I would need to use 
> to achieve a Hansen Memoir-style Chapter heading (chapter title 
> overlayed on a large lightgray number). Of course, I am assuming I would 
> need to use Metafun to create this...
> 
> So my first question is to ask if I could achieve the same effect 
> without Metafun?
> 
> I have read through the Metafun manual, and I think I can understand how 
> to overlay text on a graphic (MP), but it would be currently beyond me 
> to draw numbers of the kind we find in, say, the Memoir examples.
> 
> Has anyone created such an example? I was keenly looking for one in the 
> manual and elsewhere, in terms of ConTeXt/Metafun commands, but could 
> not find one. But I'd be quite prepared to 'have a go' at this, if I had 
> some pointers of just where to start! I assume I would have to 
> \defineoverlay[number] and then add text on top \framed (but without the 
> frame borders). Am I at least correct about this?

You don't need metafun for something this simple. Here is a crude 
implementation:

\setuphead[chapter]
  [
numberstyle={\switchtobodyfont[48pt]},
numbercolor=gray,
alternative=command,
command=\MemoirChapter,
  ]

\define[2]\MemoirChapter%
  {\startoverlay
  {#1}
  {#2}
\stopoverlay}
  

\starttext
\startchapter[title={This is a test}]
\stopchapter

\stoptext

Overlays don't allow tuning the location...for that you need layers. See the 
chapter on ornaments in the details manual, which also explains an alternative 
method to set title of chapters (toward the end of that chapter), which is 
useful if you need absolute positioning.

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] Two questions about color in MetaFun

2020-08-13 Thread Aditya Mahajan
On Thu, 13 Aug 2020, Jairo A. del Rio wrote:

> Hi, list! I have two questions concerning MetaFun:
> 
> 1st:
> 
> What is the correct way to pass a ConTeXt named color (e.g. xwi's "maroon")
> to MetaFun. Using (with \usecolors[xwi] loaded in the preamble):
> 
> withcolor maroon
> 
> does not work. 

You need:

withcolor \MPcolor{maroon}

or (note the quotes)

withcolor "maroon"  

> 2nd:
> 
> I was trying to do some stuff for my girlfriend using ConTeXt and I tried
> to randomize colors in MetaFun using normaldeviate. However, something
> interesting happens. The following:
>
> [snip]
> 
> changes the color of every letter. I don't complain (in fact it does look
> better), but I still have a question: what should I do if I wanted to
> select a random color first and then use it for the entire content? Thanks
> in advance.


newcolor randomcolor; 
randomcolor := (normaldeviate, normaldeviate, normaldeviate);

 withcolor randomcolor;

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] headers again

2020-08-13 Thread Aditya Mahajan
On Thu, 13 Aug 2020, Wolfgang Schuster wrote:

> Aditya Mahajan schrieb am 13.08.2020 um 04:53:
> > On Thu, 13 Aug 2020, jbf wrote:
> > 
> > > Where running heads (headers) are concerned, if I use \chapter I have no
> > > problems, nor should I expect any. But because I am also using \title,
> > > given that I need some unnumbered chapters interspersed  among them, I
> > > run into difficulties with headers. Numbered chapters have the correct
> > > headers, unnumbered ones (with \title) either don't have them, or do not
> > > have the proper chapter header (they pick up the header from the
> > > previous numbered chapter).
> > > 
> > > At the moment the only thing I have in the preamble is the expected set
> > > of commands for the numbered chapters:
> > > 
> > >    [{\hfill\getmarking[chapter]\hfill}][]
> > >     [{\hfill\documentvariable{metadata:title}\hfill}][]
> > > 
> > > I thought that might work for the unnumbered ones (\title), thinking
> > > that maybe \title inherits from \chapter, but it doesn't. But no amount
> > > of variations on the above commands (repeating them but replacing
> > > 'chapter' with 'title'; adding [title] or just title, in the first set
> > > of commands in various positions...) gives me the correct result.
> > > 
> > > I am assuming, of course, that there is a solution to this difficulty,
> > > and that it may be simple. But I haven't found it. Is the problem that I
> > > am using \title in the main body to get my unnumbered chapters? I
> > > wouldn't think so? It produces the correct result, utlimatley, in the
> > > TOC, Is it possible that I may have something else in my preamble that
> > > is causing the problem? If so, I can't expect someone to 'guess' that
> > > from outside! But at the moment I don't think that is the problem.
> > > 
> > > If not a direct solution, are there any clues someone might give me that
> > > will lead me to finding my own solution? It would be much appreciated.
> > 
> > A rose by any other name would smell as sweet ...
> > 
> > \showframe
> > \setupheadertexts[\setups{header}]
> > 
> > \startsetups header
> >\getmarking[chapter]
> > \stopsetups
> > 
> > \starttext
> > \startchapter[title={This is a chapter}]
> >\input knuth
> >\page
> >\input knuth
> > \stopchapter
> > 
> > \startchapter[title={This is a title}, number=no]
> >\input ward
> >\page
> >\input knuth
> > \stopchapter
> > \stoptext
> 
> Don't do this, unnumbered chapter still increase the counter and
> when you add another chapter afterwards you wonder why the number
> is wrong. 

(this reply is in jest )

incrementnumber=no, 

> The correct way here is to reset the marking entries
> at the begin of a new chapter or title with
> 
> \setuphead
>   [chapter,title]
>   [marking=reset]

Agreed. This is a better solution. Any idea why this is not the default?

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] headers again

2020-08-12 Thread Aditya Mahajan
On Thu, 13 Aug 2020, jbf wrote:

> Almost as perfect as Shakespeare's Juliet! Is there any reason why the header
> for the Introduction, done using your approach (it is in frontmatter), does
> not produce the header on the last recto page? This intro consists of 8 pages.
> Page 7 does not produce the 'Introduction' header. The other relevant recto
> pages are all headed 'Introduction' as they should be.

A minimal working example will help in diagnosing what is going on ...

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] headers again

2020-08-12 Thread Aditya Mahajan
On Thu, 13 Aug 2020, jbf wrote:

> Where running heads (headers) are concerned, if I use \chapter I have no 
> problems, nor should I expect any. But because I am also using \title, 
> given that I need some unnumbered chapters interspersed  among them, I 
> run into difficulties with headers. Numbered chapters have the correct 
> headers, unnumbered ones (with \title) either don't have them, or do not 
> have the proper chapter header (they pick up the header from the 
> previous numbered chapter).
> 
> At the moment the only thing I have in the preamble is the expected set 
> of commands for the numbered chapters:
> 
>   [{\hfill\getmarking[chapter]\hfill}][]
>    [{\hfill\documentvariable{metadata:title}\hfill}][]
> 
> I thought that might work for the unnumbered ones (\title), thinking 
> that maybe \title inherits from \chapter, but it doesn't. But no amount 
> of variations on the above commands (repeating them but replacing 
> 'chapter' with 'title'; adding [title] or just title, in the first set 
> of commands in various positions...) gives me the correct result.
> 
> I am assuming, of course, that there is a solution to this difficulty, 
> and that it may be simple. But I haven't found it. Is the problem that I 
> am using \title in the main body to get my unnumbered chapters? I 
> wouldn't think so? It produces the correct result, utlimatley, in the 
> TOC, Is it possible that I may have something else in my preamble that 
> is causing the problem? If so, I can't expect someone to 'guess' that 
> from outside! But at the moment I don't think that is the problem.
> 
> If not a direct solution, are there any clues someone might give me that 
> will lead me to finding my own solution? It would be much appreciated.

A rose by any other name would smell as sweet ...

\showframe
\setupheadertexts[\setups{header}]

\startsetups header
  \getmarking[chapter]
\stopsetups

\starttext
\startchapter[title={This is a chapter}]
  \input knuth
  \page
  \input knuth
\stopchapter

\startchapter[title={This is a title}, number=no]
  \input ward
  \page
  \input knuth
\stopchapter
\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
___


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
___


Re: [NTG-context] How to set pdfminorversion in LMTX?

2020-08-10 Thread Aditya Mahajan

On Mon, 10 Aug 2020, Henri Menke wrote:


On 10/08/20, 01:20, Aditya Mahajan wrote:

Hi,

How do I set pdfminorversion in LTMX. Both \pdfminorversion and \pdfvariable 
minorversion fail with undefined control sequence.


Does lpdf.setversion(major, minor) work in LMTX?


It does not give an error, but it doesn't change the minor version either.

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] How to set pdfminorversion in LMTX?

2020-08-09 Thread Aditya Mahajan

Hi,

How do I set pdfminorversion in LTMX. Both \pdfminorversion and \pdfvariable 
minorversion fail with undefined control sequence.

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] lmtx update

2020-08-01 Thread Aditya Mahajan

On Fri, 31 Jul 2020, Hans Hagen wrote:

Thanks for the update.

Other work in progress is: better columns in itemize, esp proper 
footnote support (not that I ever need that but I know users do so ...), 
experiments work ok, but I need to check spacing. In general, footnotes 
(will) behave a bit better, especially those used nested in other 
mechanisms. A side effect of more control is that we can do other tricks 
too and we're playing with it (kind of fun).


Does this mean we can get two-column footnotes in two-column documents?

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] Unknown script 'fonts.lua' or 'mtx-fonts.lua'

2020-07-30 Thread Aditya Mahajan

On Thu, 30 Jul 2020, Marcus Vinicius Mesquita wrote:


Hi, Hans

I'm on a linux64 machine, and there is indeed a mtx-fonts.lua file:

~/context/tex/texmf-context/scripts/context/lua/mtx-fonts.lua

Am I missing something?


Refresh the database:

luatools --generate

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] tabulate inside itemize

2020-07-29 Thread Aditya Mahajan

On Wed, 29 Jul 2020, Mike Cooper wrote:


I would normally use tab stops and line breaks to achieve the following in a 
numbered list:

1.  DC =  3.20 bbl =   420 ft
   HWDP   =  3.90 bbl =   450 ft
   DP = 34.63 bbl = 2,037 ft
   Totals = 41.73 bbl = 2,907 ft

2.  [next step …]


This is what I tried, but the output has a blank line at the number.  I can’t 
find anything about tabulate inside itemize.

\starttext

\startitemize[n]
   \startitem \starttabulate[|l|l|r|l|r|]
   \NC DC \NC = \NC 3.20 bbl \NC = \NC 420 ft 
\NC \NR
   \NC HWDP \NC = \NC 3.90 bbl \NC = \NC 450 ft 
\NC \NR
   \NC DP \NC = \NC 34.63 bbl \NC =  \NC 2,037 
ft \NC \NR
   \NC DC \NC = \NC 41.73 bbl \NC =  \NC 2,907 
ft \NC \NR
   \stoptabulate \stopitem
   \startitem Convert 2,907 to TVD: \\TVD = 2,907 × cosine 45° = 2,907 
× 0.707 = 2,056 ft \stopitem
   \startitem ΔP = 2,056 ft × 0.052 × (15 - 7.2) = 834 psi
\stopitemize

\stoptext


Naive solution: Add a \hbox around tabulate:


\defineframed[tabulateframed][location=top,frame=off]

\starttext

\startitemize[n]
\startitem \dontleavehmode
  \tabulateframed{\starttabulate[|l|l|r|l|r|]
\NC DC \NC = \NC 3.20 bbl \NC = \NC 420 ft 
\NC \NR
\NC HWDP \NC = \NC 3.90 bbl \NC = \NC 450 
ft \NC \NR
\NC DP \NC = \NC 34.63 bbl \NC =  \NC 2,037 
ft \NC \NR
\NC DC \NC = \NC 41.73 bbl \NC =  \NC 2,907 
ft \NC \NR
\stoptabulate} \stopitem
\startitem Convert 2,907 to TVD: \\TVD = 2,907 × cosine 45° = 2,907 
× 0.707 = 2,056 ft \stopitem
\startitem ΔP = 2,056 ft × 0.052 × (15 - 7.2) = 834 psi
\stopitemize

\stoptext

Normally, you can fix such issues by appending a \dontleavehmode in front of 
the command but that doesn't work here. The offending code is line 1300 of 
tabl-tbl.mkxl:

\unexpanded\def\tabl_tabulate_outside_before
  {\ifhmode\par\fi
   \ifhmode
 \vbox\bgroup
 \let\tabl_tabulate_outside_after\egroup
 \let\tabl_tabulate_outside_inbetween\relax
   \orelse\ifinner
 \let\tabl_tabulate_outside_after\relax
 \let\tabl_tabulate_outside_inbetween\relax
   \else
 \whitespace
 \tabulationparameter\c!before
 \relax
 \let\tabl_tabulate_outside_after\tabl_tabulate_outside_after_indeed
 \let\tabl_tabulate_outside_inbetween\tabl_tabulate_outside_inbetween_indeed
   \fi}
\protect

When you use \dontleavehmode\starttabulate, \starttabulate starts in horizontal 
mode but the first \par in the above command takes it back to vertical mode. 
The next \ifhmode then evaluates to false, \ifinner also evaluates to false, so 
we enter the \else loop which inserts a \whitespace.

The reason why adding a \hbox{...} (which is what \framed without an align key 
does) works is because inside an \hbox{...} \par doesn't take TeX back to 
vertical mode. So, we enter the first branch.

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] french translation of ConTeXt interface - progress (v3)

2020-07-19 Thread Aditya Mahajan

On Sun, 19 Jul 2020, Garulfo wrote:


Thanks a lot !!

I'm beginning to be able to typeset some simple example without any struggle.

https://wiki.contextgarden.net/File:modele_bonjour_le_monde.pdf

The input file is attached in this mail.


Thanks for all the hard work. Some minor comments on the sample file (some of 
them also apply to the English version).

1. You don't need

  \configurercouleurs[état=activé]

That is the default in MkIV and LMTX.

2. Also:

   \utiliserURL[wiki]   [http://wiki.contextgarden.net][][wiki 
\ConTeXt\ ]

It may be better to use `\ConTeXT{}` with no space afterwards.

3. Why use abbreviated names:

   \configurerpdp[style=\italique]
   \configurertextespdp[\date \hfill Modèle \ConTeXt]

I am guessing `pdp` is somehow an abbreviation of `footer`. One of the things 
that I really like about ConTeXt compared to LaTeX is that there are no funny 
abbreviations.

It might be better to use

\configurertextespdp[\date][Modèle \ConTeXt]

4. It may be better to reword \citer. That might create confusion with the 
bibliography commands which use \cite.

5. I am not sure why you include an example of buffers in this document. If it 
was just to have some filler text, I think that after all this work you can 
persuade Hans to include a sample file from a French author in the distribution 
:-)

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] help with confusion re chapter number

2020-07-09 Thread Aditya Mahajan

On Fri, 10 Jul 2020, jbf wrote:


Hi, I wonder if someone could lead me out of my current confusion.

In a test example with MWE as follows, I get exactly what I want:

\setuplabeltext [en] [chapter=~]
\define[2]\MyChapter
  {\framed[frame=off,width=broad,align=middle]{#1\blank[1cm]#2}}
\setuphead [chapter] [command=\MyChapter]
\chapter{Chapter title}

which gives me a chapter number (without the word 'Chapter') and 1cm 
below it the chapter title, e.g.:


 1

  My chapter title

But when I transfer this to the actual tex file I am working with, I 
lose the chapter number. Admittedly, there is more complication to my 
setup in the 'real' example, and maybe that's where I've gone wrong, but 
why am I losing the chapter number?


\define[2]\MyChapter
{\framed[frame=off,width=broad,align=middle,number=yes]{#1\blank[1cm]#2}}
\setuphead
[chapter][header=empty,alternative=middle,style=bold,numbercommand=\groupedcommand{}{\blank[2cm]},after={\blank[3cm]},command=\MyChapter]


What happens if you remove `numbercommand=...,`?

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] Minimum METAPOST code produces problematic PDF

2020-07-09 Thread Aditya Mahajan

On Wed, 8 Jul 2020, Gerben Wierda wrote:


I found out this in the PDF spec:

The minimum page size should be 3 by 3 units in default user space; the maximum 
should be 14,400 by 14,400 units.


So, does the following work:

\startMPpage[instance=doublefun, offset=2pt]
  draw (0,0)--(100,0) dashed withdots;
\stopMPpage

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] overfull message

2020-07-03 Thread Aditya Mahajan

On Fri, 3 Jul 2020, Taco Hoekwater wrote:


\hbadness affects reports on stretched/shrunk box glue, but not
overfull boxes. You need \hfuzz for that

\hfuzz = 12pt


Or, for something more drastic:

\dontcomplain

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] Converting from LaTeX for PDF accessibility tagging?

2020-06-28 Thread Aditya Mahajan

On Mon, 29 Jun 2020, Alasdair McAndrew wrote:


(For matrices and arrays I still prefer the neat LaTeX implementation, but
maybe that's simply my general unfamiliarity with ConTeXt.)  Thanks again!


Matrices can also be entered using MATLAB syntax (you need to specify a 
`simplecommand` for mathmatrix:

\definemathmatrix[bmatrix][matrix:brackets][simplecommand=BMATRIX]

\starttext

Default style:

\startformula
  \startbmatrix
\NC 1 \NC 2 \NC 3 \NR
\NC 4 \NC 5 \NC 6 \NR
\NC 7 \NC 8 \NC 9 \NR
  \stopbmatrix
\stopformula

Compact style:

\startformula
  \BMATRIX{1, 2, 3; 4, 5, 6; 7, 8, 9}
\stopformula

\stoptext

I'd say this is more compact (and natural) than amsmath :-)

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] Converting from LaTeX for PDF accessibility tagging?

2020-06-28 Thread Aditya Mahajan

On Sun, 28 Jun 2020, Alasdair McAndrew wrote:


I tried ConTeXt a few years ago, then gave up on it because of its
wordiness and verbosity.  The 2006 article on creating AMSTeX output in
ConTeXt at https://www.ntg.nl/maps/34/06.pdf shows exactly what I mean: the
LaTeX commands are small and neat; the ConTeXt commands are not.


As explained in the last paragraph, there are pre-built shortcuts for the main 
alignments and you can define your own to match amsmath style, if you wish.

If you are worried about typing, look into tab completion for your editor of choice. For 
example, in vim, I can do `for` which expands to `\startformula ... 
\stopformula` and `fora` expands to `\startformula \startalign ... \stopalign 
\stopformula`.


However, I need now to use ConTeXt for accessibility tagging, so I'm
prepared to give it another try.  And this means converting some LaTeX
documents into ConTeXt.  Is there a better way than using pandoc?  I ran a
LaTeX document through pandoc, but the result is certainly not fully
"ConTeXt compliant", and generates errors instead of compiling.


AFAIK, pandoc is not aware of context math. When I convert latex to context, I 
find it simpler to do it some hand written regex which translate commands 
according to my writing style.


I can get easily lost on the ConTeXt site: the documentation is there in
plenty, but seems hard to search.  The main problem for me is mathematics
and alignment: not just for equations, but for matrices and arrays.  What
I'd love - if it exists - is a document showing how to rewrite LaTeX into
ConTeXt.  Something like the above document, which is now 14 years old.


The user-interface is still the same.


Anyway, as I say, my main issues are converting LaTeX into ConTeXt. and
dealing with mathematics.  Any pointers would be gratefully received!


Can you post an example of LaTeX math that you are having difficulty in 
converting? It is hard to answer this in the abstract.

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] Macros which scan subscripts/superscripts in ConTeXt

2020-06-25 Thread Aditya Mahajan

On Thu, 25 Jun 2020, Jairo A. del Rio wrote:


Hi, list! I've seen the following in Stack Exchange:

https://tex.stackexchange.com/questions/503208/define-macro-that-scans-ahead-for-super-and-or-subscript-absorbs-them-and-mo

The answer is:

\documentclass{article}\usepackage{amsmath}\usepackage{xparse}
\NewDocumentCommand{\mymathsym}{e{^_}}{%
 x^{\mathrm{foo}\IfValueT{#1}{,#1}}_{\mathrm{bar}\IfValueT{#2}{,#2}}%}
\begin{document}
\begin{gather}\mymathsym \\\mymathsym^{\mathrm{extrasup}}
\\\mymathsym_{\mathrm{extrasub}}
\\\mymathsym^{\mathrm{extrasup}}_{\mathrm{extrasub}}
\\\mymathsym_{\mathrm{extrasub}}^{\mathrm{extrasup}}   \end{gather}
\end{document}

Such a macro contextually defines a behavior for a subscript and a
superscript even if they aren't displayed in a specific order, so

\mymacro_{a}^{b}

\mymacro^{b}_{a}


have the same output, even if the intended behavior is not the typical
one (I could redefine it so subscripts change colors, for instance).
Although I could just port the macro using xparse-generic because it
works in ConTeXt too, how to define a macro like that the ConTeXt way,
i.e., using only ConTeXt macros?


Return of the dodo :-)

% Must be outside \unprotect .. \protect so that _ has usual catcodes
\def\capturemathoplimits#1%
  {\doifnextcharelse _%
{\docapturemathoplimitsA{#1}}
{\doifnextcharelse ^%
  {\docapturemathoplimitsB{#1}}
  {\redocapturemathoplimits{#1

\def\docapturemathoplimitsA#1#2#3%
  {\doifnextcharelse ^%
{\dodocapturemathoplimitsA{#1}{#2}{#3}}
{\dodocapturemathoplimitsA{#1}{#2}{#3}\empty\empty}}

\def\dodocapturemathoplimitsA#1#2#3#4#5{#1{#5}{#3}}

\def\docapturemathoplimitsB#1#2#3%
  {\doifnextcharelse _%
{\dodocapturemathoplimitsB{#1}{#2}{#3}}
{\dodocapturemathoplimitsB{#1}{#2}{#3}\empty\empty}}

\def\dodocapturemathoplimitsB#1#2#3#4#5{#1{#3}{#5}}

\def\redocapturemathoplimits#1{#1\empty\empty\empty\empty\empty}


% Usage:

\define\mymacro{\capturemathoplimits\domymacro}

\def\domymacro#1#2%
  % #1 is supscript, #2 is subscript
  
{x^{\mathrm{foo}\doifsomething{#1}{,#1}}_{\mathrm{bar}\doifsomething{#2}{,#2}}}

\starttext
\startlines
$\mymacro$ 
$\mymacro^{\mathrm{extrasup}}$
$\mymacro_{\mathrm{extrasub}}$ 
$\mymacro^{\mathrm{extrasup}}_{\mathrm{extrasub}}$ 
$\mymacro_{\mathrm{extrasub}}^{\mathrm{extrasup}}$ 
\stoplines

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


Re: [NTG-context] error running wiki example with labels

2020-06-24 Thread Aditya Mahajan

On Wed, 24 Jun 2020, Jan-Erik Hägglöf wrote:


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


Works okay here with both MkIV (version 2020.05.25) and LTMX (2020.06.10).


open source > level 1, order 1, name 'cont-yes.mkiv'
system  >
system  > ConTeXt  ver: 2020.03.10 14:52 MKIV beta  fmt: 2020.4.13  
int: english/english


Might be a temporary bug. Could you update and try again?

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] Checking for singlesided/doublesided at run-time

2020-06-24 Thread Aditya Mahajan

On Wed, 24 Jun 2020, Henning Hraban Ramm wrote:



I wanted to refer to the mmodes manual, but it’s gone.
Was it accidentally removed, or are modes now explained in some other manual? I 
didn’t find it.


http://www.pragma-ade.com/general/manuals/mmodes.pdf

and my tugboat article wikified at:
https://wiki.contextgarden.net/Modes

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] Undefined control sequence: \pdfpxdimen

2020-06-22 Thread Aditya Mahajan

On Mon, 22 Jun 2020, Aditya Mahajan wrote:

Replying to an old thread ... but drops module does not work with lmtx 
because 
\pxdimen is not defined.


On Thu, 10 Mar 2016, Hans Hagen wrote:


On 3/10/2016 12:03 AM, Aditya Mahajan wrote:

The drops module uses the primitive \pdfpxdimen in a couple of places,
but that is no longer defined in the current beta. What is the
equivalent command now?

Examples of usage:

\pdfpxdimen1in\relax\divide\pdfpxdimen\numexpr\dropsparameter\c!
resolution\relax % set actual pixel dimension


just \pxdimen (as it's not related to pdf)


What will be the equivalent of \pxdimen in LMTX?


Just realized that this is a bug in t-drops: Line 143 of t-dropx.mkiv says

\doifundefined{pdfvariable} {\let\pxdimen\pdfpxdimen} % \pxdimen in luatex 0.85

Commenting that out fixes the bug.

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] Undefined control sequence: \pdfpxdimen

2020-06-22 Thread Aditya Mahajan
Replying to an old thread ... but drops module does not work with lmtx because 
\pxdimen is not defined.


On Thu, 10 Mar 2016, Hans Hagen wrote:


On 3/10/2016 12:03 AM, Aditya Mahajan wrote:

The drops module uses the primitive \pdfpxdimen in a couple of places,
but that is no longer defined in the current beta. What is the
equivalent command now?

Examples of usage:

\pdfpxdimen1in\relax\divide\pdfpxdimen\numexpr\dropsparameter\c!
resolution\relax % set actual pixel dimension


just \pxdimen (as it's not related to pdf)


What will be the equivalent of \pxdimen in LMTX?

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

2020-06-15 Thread Aditya Mahajan

On Mon, 15 Jun 2020, Fabrice L wrote:


Dear Aditya,


Le 15 juin 2020 à 01:45, Aditya Mahajan  a écrit :

This is an adapted version of the code that I use for my course where I use the 
vim module to do the typesetting:

\usemodule[filter]
\usemodule[vim]

\definecolor  [darkblue]   [r=0.1,  g=0.11, b=0.84]
\definecolor  [darkgreen]  [g=0.7]
\definecolor  [lightblue]   [h=87cefa]
\definecolor  [lightgreen]  [g=0.95,b=0.8,r=0.8]

\defineframedtext
 [leftbartext]
 [
   width=local,
   frame=off,
   framecolor=darkblue,
   leftframe=on,
   rulethickness=1ex,
   offset=0.25ex,
   loffset=3ex,
   background=color,
   backgroundcolor=lightblue,
 ]

\definevimtyping
 [RCODE]
 [
   syntax=r,
   directory=output,
   strip=yes,
   escape=yes,
   before={\blank[quarterline]\startleftbartext},
   after={\stopleftbartext},
 ]

\define[1]\ShowOutput
   {\typeRCODEfile{\externalfilterinputfile}
\startleftbartext[framecolor=darkgreen, backgroundcolor=lightgreen]
  \setupalign[flushleft, verytolerant]
  % range={1,-1} not currently supported
  % See below for details
  \typefile[range={1,-1}]{#1}
\stopleftbartext}


\defineexternalfilter
 [R]
 [ filtercommand={R CMD BATCH -q --no-timing --save --restore
\externalfilterinputfile\space \externalfilteroutputfile},
output=\externalfilterbasefile.out,
directory=output,
readcommand=\ShowOutput,
read=no,
cache=yes,
purge=yes, % THE COMMA WAS MISSING
  ]

\starttext

Some text...

\startR[read=yes]
  pdf("RPlots/MyHistogram.pdf",5,5)
  X <- rnorm(200,mean=10,sd=2)
  hist(X, col =  "red3" ,  xlab="Score QI" , main="", ylab="fréquence")
\stopR

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

\stoptext





Thanks so much for your answer. I had (of course) to install nvim in order the 
code to work, but this works !


Sorry, that was a leftover. I was testing in a docker container where I did not 
have vim installed. This will also work with regular vim.


Thanks also for your additional work regarding the locale setting.. this is 
really deep magic for me.



I think the facility to run R code directly from context can open ConTeXt to 
new users. The alliance between R and LaTeX is a winning combination to a lot 
of my colleagues. Do you think this would be appropriate to do a simple page on 
the wiki explaining how R code can be done in ConTeXt, with eventual 
formatting, with some simple examples, or this is too much noise ?


Definitely. I think there is already a short page. But it will be good to add 
more detailed instructions.

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

2020-06-15 Thread Aditya Mahajan

On Mon, 15 Jun 2020, Aditya Mahajan wrote:


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.


It is indeed related to locale. Here is a minimal example that works. I use a 
beforebuffer to set the locale so that you don't have to do it in each snippet 
and then filter out the first line in the typeset code listing and filter out 
the first two lines in the output.

\usemodule[filter]
\usemodule[vim]

\definecolor  [darkblue]   [r=0.1,  g=0.11, b=0.84]
\definecolor  [darkgreen]  [g=0.7]
\definecolor  [lightblue]   [h=87cefa]
\definecolor  [lightgreen]  [g=0.95,b=0.8,r=0.8]

\defineframedtext
  [leftbartext]
  [
width=local,
frame=off,
framecolor=darkblue,
leftframe=on,
rulethickness=1ex,
offset=0.25ex,
loffset=3ex,
background=color,
backgroundcolor=lightblue,
  ]

\definevimtyping
  [RCODE]
  [
vimcommand=nvim,
syntax=r,
directory=output,
strip=yes,
escape=yes,
before={\blank[quarterline]\startleftbartext},
after={\stopleftbartext},
  ]

\define[1]\ShowOutput
{\typeRCODEfile[start=2]{\externalfilterinputfile}
 \startleftbartext[framecolor=darkgreen, backgroundcolor=lightgreen]
   \setupalign[flushleft, verytolerant]
   \typefile[range={3,-1}]{#1}
 \stopleftbartext}

\startbuffer[locale]
   Sys.setlocale(category="LC_ALL", locale="en_US.UTF-8")
\stopbuffer

\defineexternalfilter
  [R]
  [ filtercommand={R CMD BATCH -q --no-timing --save --restore
\externalfilterinputfile\space \externalfilteroutputfile},
 output=\externalfilterbasefile.out,
 directory=output,
 readcommand=\ShowOutput,
 read=no,
 bufferbefore=locale,
 cache=yes,
 purge=yes,
   ]



\starttext

Some text...

\startR[read=yes]
   pdf("RPlots/MyHistogram.pdf",5,5)
   X <- rnorm(200,mean=10,sd=2)
   hist(X, col =  "red3" ,  xlab="Score QI" , main="", ylab="fréquence")
\stopR

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


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
___


Re: [NTG-context] Filter module for R

2020-06-14 Thread Aditya Mahajan

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.


2) In a teaching context, we may want sometimes to show the code. The filter 
module actually permits to show the output of the code submitted to R (which 
can include or not the input commands); would it be possible to typeset the 
submitted code ?


This is an adapted version of the code that I use for my course where I use the 
vim module to do the typesetting:

\usemodule[filter]
\usemodule[vim]

\definecolor  [darkblue]   [r=0.1,  g=0.11, b=0.84]
\definecolor  [darkgreen]  [g=0.7]
\definecolor  [lightblue]   [h=87cefa]
\definecolor  [lightgreen]  [g=0.95,b=0.8,r=0.8]

\defineframedtext
  [leftbartext]
  [
width=local,
frame=off,
framecolor=darkblue,
leftframe=on,
rulethickness=1ex,
offset=0.25ex,
loffset=3ex,
background=color,
backgroundcolor=lightblue,
  ]

\definevimtyping
  [RCODE]
  [
syntax=r,
directory=output,
strip=yes,
escape=yes,
before={\blank[quarterline]\startleftbartext},
after={\stopleftbartext},
  ]

\define[1]\ShowOutput
{\typeRCODEfile{\externalfilterinputfile}
 \startleftbartext[framecolor=darkgreen, backgroundcolor=lightgreen]
   \setupalign[flushleft, verytolerant]
   % range={1,-1} not currently supported
   % See below for details
   \typefile[range={1,-1}]{#1}
 \stopleftbartext}


\defineexternalfilter
  [R]
  [ filtercommand={R CMD BATCH -q --no-timing --save --restore
\externalfilterinputfile\space \externalfilteroutputfile},
 output=\externalfilterbasefile.out,
 directory=output,
 readcommand=\ShowOutput,
 read=no,
 cache=yes,
 purge=yes, % THE COMMA WAS MISSING
   ]

\starttext

Some text...

\startR[read=yes]
   pdf("RPlots/MyHistogram.pdf",5,5)
   X <- rnorm(200,mean=10,sd=2)
   hist(X, col =  "red3" ,  xlab="Score QI" , main="", ylab="fréquence")
\stopR

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

\stoptext



3) Finally, using "R CMD BATCH… » as the filtercommand add an extra line at the 
end of the output file which can be typeset to visualize results. Would it be 
possible by a magic trick to deleter the last line of the file ?


It is possible to filter lines using `\typefile[range={start, 
stop}]{filename}`. You can use `range={1,3}` to only include lines 1 upto 3 or 
`range={1, +2}` to include line 1 followed by 2 lines. What you want is 
something like `range={1,-1}`, i.e., include from the first to last-1 line, but 
this is not currently supported. You could ask Hans to do so, as it is 
relatively simple to add. Of course, you will then need to document this on the 
wiki.

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

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


Re: [NTG-context] wiki update - status

2020-06-08 Thread Aditya Mahajan

On Mon, 8 Jun 2020, Garulfo wrote:


- Remove former "manually made links bar" at the top of the pages
  current structure should be enough now have an easier understanding of
  the wiki structure.


Along that line, we should also considering fixing the getting started navbox 
or removing it altogether. It used to have a nice visual layout, but that was 
lost when upgrading the wiki. In the current form, it uses too much vertical 
space and it might be redundant with the new wiki structure.

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

2020-06-07 Thread Aditya Mahajan

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...
% 


So to be clear, I would like the result in the « ClassRoom » mode to be:
% 
Here are some questions:

Question A….
Question B….

Some other text...
% 

Otherwise to be:
% 
Some other text...
% 


If you only set `ClassRoom` mode at compile time (rather than setting and 
unsetting it the middle of the document), then you can do:

\definebuffer[Questions]

\startmode[ClassRoom]
\define\StopQuestionsList {...}

\definestartstop[Questions][...]
\stopmode


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] use parentheses in itemize

2020-06-02 Thread Aditya Mahajan

On Wed, 3 Jun 2020, Tomas Hala wrote:


Hi Mike,

use this:

\setupitemize[left=(,stopper=)]
\startitemize[a]
\item  415,668 lb
\item  415,668 lb
\stopitemize


For symmetry, I prefer

\setupitemize[left=(, right=), stopper=]

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] Let chapter start on odd page and make the even page before show an image

2020-05-29 Thread Aditya Mahajan

On Fri, 29 May 2020, Henning Hraban Ramm wrote:


In a similar setup I wanted to start every chapter with image and short vita 
the author and came up with the following (of course not without help from our 
wizards):


 \doifelse{\structureuservariable{image}}{}{% if image empty
 }{%
 ...
 }
   \doifnot{\structureuservariable{vita}}{}{% if vita
  ...
 }%
   }%
 }%


You can use  `\doifsomething{\structureuservariable{image}}` etc which is 
slightly more readable than \doifelse{...}\empty{}{} or \doifnot{...}\empty{}.

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] Let chapter start on odd page and make the even page before show an image

2020-05-29 Thread Aditya Mahajan

On Fri, 29 May 2020, Jan U. Hasecke wrote:



One and a half question.
Why did you set \ChapterCounter explizitly and why is \ChapterCounter
part of the datasetvariable?


\dataset... is a high level interface for collecting two-pass data in ConTeXt. 
Here is a simple example:


\definedataset[name]

\starttext

The values of the three dataset variables are:

\startlines
\datasetvariable{name}{hash1}{key}
\datasetvariable{name}{hash2}{key}
\datasetvariable{name}{hash3}{key}
\stoplines

Now we set the values.

\setdataset[name][hash1][key=value1]
\setdataset[name][hash2][key=value2]
\setdataset[name][hash3][key=value3]

\stoptext

Note that we are using the values stored in different hash-ids before they are 
defined. ConTeXt stores the values in the `.tuc` file and uses them. This is 
what is stored in the `.tuc` file:

utilitydata.job.datasets.collected={
 ["name"]={
  ["hash1"]={
   ["key"]="value1",
  },
  ["hash2"]={
   ["key"]="value2",
  },
  ["hash3"]={
   ["key"]="value3",
  },
 },
}

The magic of loading and reusing them happens behind the scenes, so the user 
doesn't have to worry about it. See 
https://wiki.contextgarden.net/System_Macros/Key_Value_Assignments#Multi-pass_data
 for more details.

Now, suppose you wanted to use the image defined as part of `\startchapter` as 
the background image of the _current_ page, then you could access the value of 
the \structureuservariable. For example,

\startchapter[title=whatever][image=filename]

\structureuservariable{image}

\stopchapter

But you want to use the value of the image _before_ the start of the chapter. 
So, Wolfgang is using the two-pass mechanism to store the value of the image in 
the database named 'chapter` in the hash-location `\ChapterCounter` and then 
retrieving it before it is defined!

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] Wiki - Proposal to update the Welcome page

2020-05-23 Thread Aditya Mahajan

On Sat, 23 May 2020, Garulfo wrote:




1/ Concerning the Manuals Page
   - As proposed, "obsolete banners" are added to thumbnails  of the
 oldest manuals.

Looks good. A few minor comments:
I haven't tested it, but the natural tables in context examples (in 
Sec 3.6) should still work with latest versions.
The "context rehab for amsmath addicts" should be in math (or 
sciences) rather than tables. (This reminds me, I should update that 
reference).


Both corrections are made, thanks for your help.



   - About providing zips of manuals per topics: maybe we could just
 add a index.html in the distribution structure, to provide the
 user with a browsing system similar to the wiki's one.
   - If the admistrators wish, I can now replace the current page.


One concern that I have is how easy it is to navigate the page on the 
phone. Currently, it does not really work on the phone. Is there some 
way to make it more responsive?


Thanks again, of primary importance.

Should be far better now (quickly checked on two smartphones, one 
android and one ios)


Thanks. Both pages look good on mobile now. I am okay with merging this with 
the old manuals page. A small suggestion is that we could omit the table of 
content on this page, as it is almost redundant in the new format.


2/ After  the Manuals,  please find a proposal for the Welcome Page,
   which is probably trickier
   - https://wiki.contextgarden.net/Main_Page_TempProposal
   - https://wiki.contextgarden.net/Main_Page (the current)
   - 4 objectives :
1/ do something more visual, reduce the amount of text,
Some of us prefer text. What was earlier a one step process for me (go 
to home page, search for keyword, go to page), is now a two step 
process. But I agree that the new proposed layout is more friendly to 
new users and support it.


Yes, I suspected that the current version had advantages as a result of 
past iterations.


It would be interesting to identify the links that people want to access 
in one step. We can list them in 
https://wiki.contextgarden.net/Talk:Main_Page_TempProposal, and I will 
try to find ways to integrate them.


Personally, I don't think that it is a big deal.


2/ provide a fairly comprehensive overview with less than 15
   topics,
    3/ but hold in one (big) screen,
4/ avoid redundancies on the Welcome Page,
5/ match both the Wiki's structure & the Manuals' structure.

Again, depending on  your feedbacks, I would be happy to improve it.

It's built from scripts  ==>  not too hard now to reorder, to adapt.
You should also document your work flow somewhere (perhaps the talk 
page of the same page or a dedicated page on the wiki). That is useful 
for long term maintainability of the wiki.


Done: two zip files are uploaded, with link and brief description in the 
Talk zone of the respective pages.


Thanks.

I am okay with changing the main page as well. But since this is the main page, 
let's wait for the other mods to chime in as well.

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] Wiki - Proposal to update the Welcome page

2020-05-22 Thread Aditya Mahajan

On Fri, 22 May 2020, Garulfo wrote:


Hi all,

thanks for your encouraging feedbacks.

1/ Concerning the Manuals Page
   - As proposed, "obsolete banners" are added to thumbnails  of the
 oldest manuals.


Looks good. A few minor comments:

I haven't tested it, but the natural tables in context examples (in Sec 3.6) 
should still work with latest versions.

The "context rehab for amsmath addicts" should be in math (or sciences) rather 
than tables. (This reminds me, I should update that reference).


   - About providing zips of manuals per topics: maybe we could just
 add a index.html in the distribution structure, to provide  the
 user with a browsing system similar to the wiki's one.

   - If the admistrators wish, I can now replace the current page.


One concern that I have is how easy it is to navigate the page on the phone. 
Currently, it does not really work on the phone. Is there some way to make it 
more responsive?


2/ After  the Manuals,  please find a proposal for the Welcome Page,
   which is probably trickier

   - https://wiki.contextgarden.net/Main_Page_TempProposal
   - https://wiki.contextgarden.net/Main_Page (the current)

   - 4 objectives :
1/ do something more visual, reduce the amount of text,


Some of us prefer text. What was earlier a one step process for me (go to home 
page, search for keyword, go to page), is now a two step process. But I agree 
that the new proposed layout is more friendly to new users and support it.


2/ provide a fairly comprehensive overview with less than 15
   topics,
3/ but hold in one (big) screen,


This looks more reasonable on the phone. The 2nd half of the page looks okay, 
but the first half still looks weird (too narrow and long columns). Perhaps 
there is a way to may it a bit more responsive on the phone.


4/ avoid redundancies on the Welcome Page,
5/ match both the Wiki's structure & the Manuals' structure.

Again, depending on  your feedbacks, I would be happy to improve it.

It's built from scripts  ==>  not too hard now to reorder, to adapt.


You should also document your work flow somewhere (perhaps the talk page of the 
same page or a dedicated page on the wiki). That is useful for long term 
maintainability of the wiki.

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

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


Re: [NTG-context] context --purgeall filename does not delete all temporary files

2020-05-21 Thread Aditya Mahajan

On Thu, 21 May 2020, Hans Hagen wrote:


On 5/21/2020 10:43 AM, Aditya Mahajan wrote:

On Thu, 21 May 2020, Aditya Mahajan wrote:


Hi,

`context --purgeall filename` behaves differently from `context 
--purgeall`.


`context --purgeall` deletes all files with the name `*-temp-*`. I would 
have thought that `context --purgeall filename` will delete all files with 
the name `\jobname-temp-*` but it does not.


Is there a way to delete the `\jobname-temp-*` files without requiring an 
extra `context --purgeall` run? This is needed for deleting extra files by 
`t-filter` module or deleting extra files generated by automatic EPS to 
PDF conversion (with figures.cachepaths.prefix="\jobname-temp"), etc.


As an aside, I also noticed that in both mkiv and lmtx, mtx-context.lua has

local extra_runfiles = {
     "^l_m_t_x_.-%.pdf$",
}

but graph-inc.lua has

local defaultprefix = "m_k_i_v_"

So, the default generated files are never deleted.

i can add it ... originally that was for the temporary pdf jobname i think


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] Text to be placed into the free space after columns and end of the page

2020-05-21 Thread Aditya Mahajan

On Thu, 21 May 2020, cont...@vivaldi.net wrote:


Hello,

at least a short reaction would be appreciated - is it possible to get 
the desired with ConTeXt?


- I need to typeset a column-shaped document with a colofon in the 
bottom of the page, so my interest is not academical but very practical;
and the code presented bellow is a minimalistic version ("abcd" stands 
for colofon).


Best regards,

Lukas


On 2020-05-20 16:38, cont...@vivaldi.net wrote:

Hello,

suppose the minimal example:


\showboxes
\starttext
  \startcolumns[n=2,balance=no,]
\input knuth
  \stopcolumns
  \vfill
  abcd
\stoptext


This produces two page document with columns on the first page and
text "abcd" on the second.


It is not clear to me why you are using columns here. If you want balanced 
columns, you could use:

\starttext
\startsimplecolumns[n=2]
\input knuth
\stopsimplecolumns
\vfill
abcd
\stoptext


But - I want the text "abcd" to be placed to the bottom of the same
page as columns are (thus I attempted to put \vfill into the code, but
it doesn't work), so to get one page document looking like:

+-- page width -+
Column text | (unused)
column text |
column text |
column text |
column text |
column text |

(some vertical space)

abcd
+- end of page -+

- How to achieve this?


If you just want a narrower one column output (since using balance=no and 
\vfill after that only makes sense if the length of the content is less than a 
single column), you can use

\setupnarrower[right=0.5\textwidth]
\startnarrower[right]
\input knuth
\stopnarrower

or to get right frame:

\startframedtext[width=0.45\textwidth,frame=off, rightframe=on, roffset=0.5em]
  \input knuth
\stopframedtext

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] context --purgeall filename does not delete all temporary files

2020-05-21 Thread Aditya Mahajan

On Thu, 21 May 2020, Aditya Mahajan wrote:


Hi,

`context --purgeall filename` behaves differently from `context --purgeall`.

`context --purgeall` deletes all files with the name `*-temp-*`. I would have 
thought that `context --purgeall filename` will delete all files with the 
name `\jobname-temp-*` but it does not.


Is there a way to delete the `\jobname-temp-*` files without requiring an 
extra `context --purgeall` run? This is needed for deleting extra files by 
`t-filter` module or deleting extra files generated by automatic EPS to PDF 
conversion (with figures.cachepaths.prefix="\jobname-temp"), etc.


As an aside, I also noticed that in both mkiv and lmtx, mtx-context.lua has

local extra_runfiles = {
"^l_m_t_x_.-%.pdf$",
}

but graph-inc.lua has

local defaultprefix = "m_k_i_v_"

So, the default generated files are never deleted.

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] context --purgeall filename does not delete all temporary files

2020-05-21 Thread Aditya Mahajan

Hi,

`context --purgeall filename` behaves differently from `context --purgeall`.

`context --purgeall` deletes all files with the name `*-temp-*`. I would have 
thought that `context --purgeall filename` will delete all files with the name 
`\jobname-temp-*` but it does not.

Is there a way to delete the `\jobname-temp-*` files without requiring an extra `context 
--purgeall` run? This is needed for deleting extra files by `t-filter` module or deleting 
extra files generated by automatic EPS to PDF conversion (with 
figures.cachepaths.prefix="\jobname-temp"), etc.

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] metapost boxes error

2020-05-20 Thread Aditya Mahajan

On Wed, 20 May 2020, jk...@inradius.net wrote:


Is there a different approach to use boxes.mp?

MNWE:

\startMPpage
input boxes.mp;
 boxit.bl("left");
 boxit.br("right");
 br.sw - bl.ne = (20,0);
 drawboxed(bl,br);
\stopMPpage


Move `input boxes` outside the `\startMPpage`.


\startMPdefinitions
  input boxes.mp;
\stopMPdefinitions

\starttext
\startMPpage
  boxit.bl("left");
  boxit.br("right");
  br.sw - bl.ne = (20,0);
  drawboxed(bl,br);
\stopMPpage
\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
___


Re: [NTG-context] Minimal code for exporting custom tags

2020-05-19 Thread Aditya Mahajan

On Tue, 19 May 2020, Aditya Mahajan wrote:


On Mon, 18 May 2020, Aditya Mahajan wrote:


Thanks! This also helped me find the documentation in hybrid.pdf.


Also epub-mkiv.pdf. Not sure why I didn't think of looking there.


How do I pass options so that the export is

...

(or some variant of that). I thought that

\startelement[mycommand][name=whatever]

should work (there are some such examples in the texmf tree), but it does 
not.


epub-mkiv.pdf states that I need `\setupexport[properties=yes]`, but that 
doesn't work either:


There is a bug in back-exp.lua:

--- /tmp/back-exp.lua   2020-05-19 02:13:54.961276226 -0400
+++ /opt/luametatex/texmf-context/tex/context/base/mkiv/back-exp.lua
2020-05-19 02:13:01.687385009 -0400
@@ -2305,8 +2305,10 @@
 if not p then
 -- skip
 elseif exportproperties == v_yes then
+n = n+1
 r[n] = attributes(p)
 else
+n = n+1
 r[n] = properties(p)
 end
 end

Patching this fixes the export.

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] Minimal code for exporting custom tags

2020-05-18 Thread Aditya Mahajan

On Mon, 18 May 2020, Aditya Mahajan wrote:


Thanks! This also helped me find the documentation in hybrid.pdf.


Also epub-mkiv.pdf. Not sure why I didn't think of looking there.


How do I pass options so that the export is

...

(or some variant of that). I thought that

\startelement[mycommand][name=whatever]

should work (there are some such examples in the texmf tree), but it does 
not.


epub-mkiv.pdf states that I need `\setupexport[properties=yes]`, but that 
doesn't work either:

```
\setupbackend[export=xml]
\setupexport [properties=my]

\setelementbackendtag[mycommand]
\setelementnature[mycommand][mixed]

\starttext
\startsection[title={Sample document}]
  \startparagraph
This is a paragraph
  \stopparagraph
  \startelement[mycommand][name=whatever]
This is mycommand
  \stopelement
\stopsection
\stoptext
```

gives

```






http://www.w3.org/1998/Math/MathML;>
 
 
 
  
   1
   Sample document
  
  
   This is a paragraph
   This is mycommand
  
 

```

What am I still missing?

On a different note, I didn't realize that interfaces.implement could create 
macros which could be used like this:

```
\unexpanded\def\dostartexport
  {%\glet\dostartexport\relax
   \let\currentexport\empty
   \clf_setupexport
   align  {\exportparameter\c!align}%
   bodyfont   \dimexpr\exportparameter\c!bodyfont\relax
   width  \dimexpr\exportparameter\c!width\relax
   properties {\exportparameter\c!properties}%
   hyphen {\exportparameter\c!hyphen}%
   title  {\exportparameter\c!title}%
   subtitle   {\exportparameter\c!subtitle}%
   author {\exportparameter\c!author}%
   firstpage  {\exportparameter\c!firstpage}%
   lastpage   {\exportparameter\c!lastpage}%
   svgstyle   {\exportparameter\c!svgstyle}%
   cssfile{\exportparameter\c!cssfile}%
   file   {\exportparameter\c!file}%
   export {\backendparameter\c!export}%
   \relax}

```

This nicely gets around TeX's limitation of 9 arguments!

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] Minimal code for exporting custom tags

2020-05-18 Thread Aditya Mahajan

On Mon, 18 May 2020, Aditya Mahajan wrote:


On Mon, 18 May 2020, Hans Hagen wrote:


On 5/18/2020 9:09 AM, Aditya Mahajan wrote:

Hi,

What is needed to enable export of user defined macros? Consider the 
following example:


What am I missing in order to pass user-defined macros to the exporter?

you're probably missing documentation + a high level define command

This registers (extra) elements:

\setelementbackendtag[mycommand]
\setelementnature[mycommand][mixed]



Thanks! This also helped me find the documentation in hybrid.pdf.


How do I pass options so that the export is

...

(or some variant of that). I thought that

\startelement[mycommand][name=whatever]

should work (there are some such examples in the texmf tree), but it does not.

```
\setelementbackendtag[mycommand]
\setelementnature[mycommand][mixed]

\setupbackend[export=xml, level=0]

\starttext
\startsection[title={Sample document}]
  \startparagraph
This is a paragraph
  \stopparagraph
  \startelement[mycommand][name=whatever]
This is mycommand
  \stopelement
\stopsection
\stoptext
```

Using `\dostarttagged{mycommand}{whatever}` does export as ``, and looking at the code, I don't see why `\startelement` 
should behave differently.

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] Minimal code for exporting custom tags

2020-05-18 Thread Aditya Mahajan

On Mon, 18 May 2020, Hans Hagen wrote:


On 5/18/2020 9:09 AM, Aditya Mahajan wrote:

Hi,

What is needed to enable export of user defined macros? Consider the 
following example:


What am I missing in order to pass user-defined macros to the exporter?

you're probably missing documentation + a high level define command

This registers (extra) elements:

\setelementbackendtag[mycommand]
\setelementnature[mycommand][mixed]



Thanks! This also helped me find the documentation in hybrid.pdf.

I am not using a high-level interface because I was looking at how to get the 
output of `t-filter` and `t-vim` modules export correctly.

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] Minimal code for exporting custom tags

2020-05-18 Thread Aditya Mahajan

Hi,

What is needed to enable export of user defined macros? Consider the following 
example:


```
\def\startmycommand{\dostarttagged{mycommand}\empty}
\def\stopmycommand {\dostoptagged}

\setupbackend[export=xml, level=0]

\starttext
\startsection[title={Sample document}]
  \startparagraph
This is a paragraph
  \stopparagraph
  \startmycommand
This is mycommand
  \stopmycommand
\stopsection
\stoptext
```

If I compile using `context --trackers=structures.tags filename`, I get

```
backend > tags > U+0031:1 => U+0031:1 : 4 document>1 section>1 
sectioncaption>1 sectionnumber>1
backend > tags > U+0053:S => U+0074:t : 5 document>1 section>1 
sectioncaption>1 sectiontitle>1
backend > tags > U+0054:T => U+0068:h : 7 document>1 section>1 
sectioncontent>1 paragraph>1
backend > tags > U+0054:T => U+0064:d : 8 document>1 section>1 
sectioncontent>1 mycommand>1
```

so the tag is applied. I can also verify this by looking at the PDF which 
contains

```
<< /K 27 0 R /ParentTree 2 0 R /RoleMap << /document /Div /mycommand /Span /paragraph /P 
/section /Sect /sectioncaption /Div /sectioncontent /Div /sectionnumber /H /sectiontitle /H >> 
/Type /StructTreeRoot >>
```

and the tag `mycommand` is used at appropriate location.

However, the exported xml file contains no tag:

```






http://www.w3.org/1998/Math/MathML;>
 
 
 
  
   1
   Sample document
  
  
   This is a paragraph
  
 

```

What am I missing in order to pass user-defined macros to the exporter?

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

2020-05-17 Thread Aditya Mahajan

On Sun, 17 May 2020, Nicola wrote:

2. The wiki has no mention of \startcolorscheme... \stopcolorscheme or
  \setups. An example of two would be very welcome!


Added documentation: https://github.com/adityam/filter/blob/dev/vim-README.md

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-17 Thread Aditya Mahajan

On Sun, 17 May 2020, Nicola wrote:


On 2020-05-17, Aditya Mahajan  wrote:

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.


Uploaded a new version with a fix.


Thanks for looking into it. I will download and test that soon.

A couple of remarks:

1. In one of my old documents, I had this command inside the colorscheme
  block:

   \setups{vim-minor-groups}

  Was that to achieve the same purpose?


Yes. This setup maps the minor groups to preferred groups.


2. The wiki has no mention of \startcolorscheme... \stopcolorscheme or
  \setups. An example of two would be very welcome!


OK. I will add that.

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

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


Re: [NTG-context] Custom color schemes in t-vim

2020-05-17 Thread Aditya Mahajan
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.


Uploaded a new version with a fix.

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

2020-05-16 Thread Aditya Mahajan

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.

Now, as I was looking into this, I noticed that `foobar` gets mapped to 
`Identifier` rather than `Function`. I am not sure why that is happening and I 
will look into that.

Aditya

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

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


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
___


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

2020-05-07 Thread Aditya Mahajan

On Thu, 7 May 2020, Fabrice Couvreur wrote:


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

\startproduct Seconde

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

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

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


context chapter-4-seconde

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

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

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


Re: [NTG-context] Changing the font size in an environment changes the behavior of a macro

2020-05-04 Thread Aditya Mahajan

On Mon, 4 May 2020, Fabrice Couvreur wrote:


Hi,
Sorry to insist but I cannot fix this problem.
Thanks for any help.


I don't know the answer, but here is a simpler example without pgfplot which 
fails (different calligraphic C's):


\define[1]\cscript{\start\switchtobodyfont[xitsbidi]\m{{\mathscript{#1}}}\stop}

\starttext
\startTEXpage[offset=2mm]
\cscript{C}
\start
  \switchtobodyfont[9pt]
  \cscript{C}
\stop
\stopTEXpage
\stoptext

And here is a version with a minor change that works (same calligraphic C's)!

\usebodyfont[xitsbidi]

\define[1]\cscript{\start\m{{\mathscript{#1}}}\stop}

\starttext
\startTEXpage[offset=2mm]
\cscript{C}
\start
  \switchtobodyfont[9pt]
  \cscript{C}
\stop
\stopTEXpage
\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
___


Re: [NTG-context] Placing number in \sqrt

2020-05-04 Thread Aditya Mahajan

On Mon, 4 May 2020, cont...@vivaldi.net wrote:


Hello Aditya,

On 2020-05-04 10:42, Aditya Mahajan wrote:

On Mon, 4 May 2020, Hans Hagen wrote:


On 5/4/2020 8:47 AM, cont...@vivaldi.net wrote:

Hello,

compare placing "3" in the following examples:


\starttext
   $\sqrt[3]{5}$ % (1)
   \par
   $\sqrt[3~]{5}$ % (2)
\stoptext


In the first case, the "3" is placed naturally by ConTeXt and placed 
more in the centre of "V" part of the square sign.


In the second example, the "3" is shifted manually by adding "~" and 
the final placement seems to me a bit better.


What is your opinion - is the case (1) OK/intended and user should 
avoid any manual shifting?


Or manual shifting is OK? Or is there a way to affect this placement 
globally in ConTeXt, e.g. setting an internal variable?


If we can come up with a proper name for a parameter we can make it a 
setting. One of these things that Aditya and I will to discuss when we 
have time and are in math mood. (There is much more in math we could 
control if needed, but often in the end that control is not that much 
needed at all.)


As an example, see this question about customized square root signed
which was asked on TeX.SE a few years ago:

https://tex.stackexchange.com/a/406680/323


I tried the code from the link above, but:

- I had change some macro names: \mpvar -> \MPvar, \startuniquempgraphic 
-> \startuniqueMPgraphic and some others,


- there is still an error I'm not able to fix (see attachements).


I'll look into that..


Maybe your code is intented for Ctx LMTX, whilst I'm still working with 
Ctx MkIV (which uses Lua 5.3; AFAIK, Lua 5.4 exists just in RC 
versions).


No. This feature works with MkIV as well. I posted that code in 2017, much 
before LTMX was released. The feature is much older than 2017, IIRC. Similar 
interfaces exist for delimiters, accents, and other artifact.

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] Vertical lines in matrices

2020-05-04 Thread Aditya Mahajan

On Mon, 4 May 2020, Weber, Matthias wrote:


I was aware of this. While there is no solution that adds vertical lines into 
matrices,


It should not be too difficult to support "proper" vertical and horizontal 
lines. It should be possible to just add solid lines relatively easily. With dashed and 
other forms of lines, it is more a question of finding the right user-interface than 
anything else.

Can you give more details of the features and visual output that you are 
looking for?

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] Placing number in \sqrt

2020-05-04 Thread Aditya Mahajan

On Mon, 4 May 2020, Hans Hagen wrote:


On 5/4/2020 8:47 AM, cont...@vivaldi.net wrote:

Hello,

compare placing "3" in the following examples:


\starttext
   $\sqrt[3]{5}$ % (1)
   \par
   $\sqrt[3~]{5}$ % (2)
\stoptext


In the first case, the "3" is placed naturally by ConTeXt and placed 
more in the centre of "V" part of the square sign.


In the second example, the "3" is shifted manually by adding "~" and the 
final placement seems to me a bit better.


What is your opinion - is the case (1) OK/intended and user should avoid 
any manual shifting?


Or manual shifting is OK? Or is there a way to affect this placement 
globally in ConTeXt, e.g. setting an internal variable?


If we can come up with a proper name for a parameter we can make it a 
setting. One of these things that Aditya and I will to discuss when we 
have time and are in math mood. (There is much more in math we could 
control if needed, but often in the end that control is not that much 
needed at all.)


As an example, see this question about customized square root signed which was 
asked on TeX.SE a few years ago:

https://tex.stackexchange.com/a/406680/323

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] supp-ran.lua makes code unable to work in ConTeXt

2020-05-01 Thread Aditya Mahajan

If you or anyone else is going to play around with generating mazes,
definitely take a look at http://www.mazesforprogrammers.com/

and the live demos here: 
https://weblog.jamisbuck.org/2011/2/7/maze-generation-algorithm-recap


A nice overview of the relationship with spanning tress (by the same author) 
http://www.jamisbuck.org/presentations/rubyconf2011/index.html

And another set of visualizations
https://bost.ocks.org/mike/algorithms/#maze-generation

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] supp-ran.lua makes code unable to work in ConTeXt

2020-05-01 Thread Aditya Mahajan

On Sat, 2 May 2020, Hans Hagen wrote:


On 5/1/2020 11:38 PM, Aditya Mahajan wrote:

On Fri, 1 May 2020, Hans Hagen wrote:


On 5/1/2020 6:12 AM, Jairo A. del Rio wrote:
I've adapted the following code to make mazes in LuaLaTeX and ConTeXt: 
https://www.rosettacode.org/wiki/Maze_generation#Lua


I defined a modified version to make content visible to TeX and I saved 
in a file named maze.lua:


function make_maze_tex(w, h, m)
   w = w or 16
   h = h or 8

   local map = initialize_grid(w*2+1, h*2+1)

   function walk(x, y)
     map[y][x] = false

     local d = { 1, 2, 3, 4 }
     shuffle(d)
     for i, dirnum in ipairs(d) do
       local xx = x + dirs[dirnum].x
       local yy = y + dirs[dirnum].y
       if map[yy] and map[yy][xx] then
         map[avg(y, yy)][avg(x, xx)] = false
         walk(xx, yy)
       end
     end
   end

   walk(math.random(1, w)*2, math.random(1, h)*2)

...ext/tex/texmf-context/tex/context/base/mkiv/supp-ran.lua:30: C stack 
overflow Why does it happen? I guess it has something to do with 
math.randomseed, but I don't know how to avoid this error message.
no, it's just lua running out of stack space so it depends on the binary 
(and als the initial random value)


But why is it running out of stack? Isn't the walk function tail 
recursive, in which case it should not cause a stack overflow 
(https://www.lua.org/pil/6.3.html).
not really tail recursive: that is only true when it's the last action and 
return is used and it nests very deep


function foo(...)
 ...
 return foo(...)
end

versus

function foo(...)
 ...
 if something then
foo(...)
 end
end


Thanks for the clarification.

If you or anyone else is going to play around with generating mazes,
definitely take a look at http://www.mazesforprogrammers.com/

and the live demos here: 
https://weblog.jamisbuck.org/2011/2/7/maze-generation-algorithm-recap


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] supp-ran.lua makes code unable to work in ConTeXt

2020-05-01 Thread Aditya Mahajan

On Fri, 1 May 2020, Hans Hagen wrote:


On 5/1/2020 6:12 AM, Jairo A. del Rio wrote:
I've adapted the following code to make mazes in LuaLaTeX and ConTeXt: 
https://www.rosettacode.org/wiki/Maze_generation#Lua


I defined a modified version to make content visible to TeX and I saved in 
a file named maze.lua:


function make_maze_tex(w, h, m)
   w = w or 16
   h = h or 8

   local map = initialize_grid(w*2+1, h*2+1)

   function walk(x, y)
     map[y][x] = false

     local d = { 1, 2, 3, 4 }
     shuffle(d)
     for i, dirnum in ipairs(d) do
       local xx = x + dirs[dirnum].x
       local yy = y + dirs[dirnum].y
       if map[yy] and map[yy][xx] then
         map[avg(y, yy)][avg(x, xx)] = false
         walk(xx, yy)
       end
     end
   end

   walk(math.random(1, w)*2, math.random(1, h)*2)

...ext/tex/texmf-context/tex/context/base/mkiv/supp-ran.lua:30: C stack 
overflow 
Why does it happen? I guess it has something to do with math.randomseed, 
but I don't know how to avoid this error message.
no, it's just lua running out of stack space so it depends on the binary 
(and als the initial random value)


But why is it running out of stack? Isn't the walk function tail recursive, in 
which case it should not cause a stack overflow 
(https://www.lua.org/pil/6.3.html).

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] .so libraries not working with LMTX

2020-05-01 Thread Aditya Mahajan

On Fri, 1 May 2020, Jairo A. del Rio wrote:


I've tried using some C libraries for Lua in LuaTeX:
http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/

They work (both LuaLaTeX and ConTeXt), but when LMTX is used, the following
message appears (an example with MAPM):

token call, execute:
...xt/tex/texmf-context/tex/context/base/mkiv/l-package.lua:325: error
loading module 'mapm' from file './mapm.so':

./mapm.so: undefined symbol: lua_settop


I believe that the luametatex binary is stripped, so there any unused symbol
is removed.

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] animation using \startuseMPgraphic

2020-04-19 Thread Aditya Mahajan

On Sun, 19 Apr 2020, Jeong Dal wrote:


Dear all,

I am trying to make an animation using the animation module.
But it draws 10 figures instead of creating animation.
Is there anything I have to do more?
Or, is there a better way to do this?

Thank you for reading.

Best regards,

Dalyoung


\startuseMPgraphic{inversionPoint}{n}
vardef findPointD(expr C, Q, r) =
   numeric dist, ang;
   pair X, Y;
   dist := r**2/sqrt((xpart Q - xpart C)**2 + (ypart Q - ypart C)**2);
   ang := angle(Q - C);
   Y := C + dir(ang)*dist;
   Y
enddef;
numeric radius, now, move;
pair A,B,C,P,Q;
path p,q;

radius := 2cm;
C := origin;
p := fullcircle scaled (2*radius);
z[1] = point 6 of p;
z[2] = point .8 of p;

q := (1.5*z1 - .5*z2) -- (-.5z1 + 1.5*z2);
%q := fullcircle scaled radius shifted (2cm, 1cm);
draw p;
draw q;
%for i := 0 step 0.1 until 1:
   move := 0.1;
   now := move*\MPvar{n};
   P := point now along q;
   Q := findPointD(C, P, radius);
   drawdot P;
   drawdot Q withcolor .625red;
   dotlabel.lft(textext("P"),P);
   dotlabel.rt(textext("Q"),Q) withcolor .625red;
%endfor;
\stopuseMPgraphic

\usemodule[animation]
\setupinteraction[state=start]

\starttext
%\startplacefigure[]
   \startanimation[menu=yes]
   \dorecurse{10}{
   \useMPgraphic{inversionPoint}{n=\recurselevel}
   }
   \stopanimation
%\stopplacefigure
\stoptext


Also see my simple wrapper around this:

https://adityam.github.io/context-blog/post/metapost-animation/

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
___


  1   2   3   4   5   6   7   8   9   10   >