Re: [NTG-context] Kerning between primes and left parenthesis (again)

2017-07-19 Thread Mikael P. Sundqvist
Den 12 juli 2017 10:17 fm skrev "Mikael P. Sundqvist" :

Dear Hans,

now, in luatex 1.05, that the primes are "constructed" in new manner,
I wonder if there is a way to specify in a goodie file the kerning
between characters, in particular primes and the left parenthesis?

I tried

kernpairs = {
   [0x2032] = {[0x0028] = -1000, }, -- prime and (
},

but that does not seem to have any effect.

The pre-1.05 modification

dimensions = {
default = {
[0x2044] = { xoffset = 275, width = 600 },
[0x2032] = { xoffset = 50, width = 290 }, -- prime
[0x2033] = { xoffset = 50, width = 690 }, -- double prime
[0x2034] = { xoffset = 50, width = 1090}, -- triple prime
[0x2057] = { xoffset = 50, width = 1490}, -- quadruple prime
},
},

(which is a non-optimal way of solving this issue since it has side
effects) does not change anything anymore.

So, is there now a way to do this cleanly now that the mechanism is changed?

/Mikael


Hi,

should I interpret the silence that this is currently not possible, or that
you, Hans, is completely fed up with this subject? :-)

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

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

Re: [NTG-context] t-vim module: math in "normal" code and background color

2017-07-19 Thread Aditya Mahajan

On Wed, 19 Jul 2017, Gerion Entrup wrote:


Am Mittwoch, 19. Juli 2017, 21:07:09 CEST schrieb Aditya Mahajan:

On Wed, 19 Jul 2017, Gerion Entrup wrote:

> Am Dienstag, 18. Juli 2017, 04:04:51 CEST schrieb Aditya Mahajan:
>> On Mon, 17 Jul 2017, Gerion Entrup wrote:
>>
>>> Hi,
>>>
>>> I have two questions with the vim module.
>>>
>>> 1. I want to use the math mode inside the code. I've seen the escape option,
>>> e.g. here [1], but this seems to work only with comments. Is there a
>>> possibility to use it directly in the code, too?
>>
>> Short answer. No.
>>
>> Long answer. t-vim relies on vim to syntax highlight the code. Since the
>> code is not valid python, the default python syntax highlighting will not
>> work. In principle, it is possible to write a vim syntax highlighting
>> script for a derivative of python where math terms are allowed, but that
>> requires a lot of work for each language. The whole point of t-vim module
>> was that I am lazy and don't want to write the parser for each language
>> :-)
>
> I've invested some time and rewrote parts of the vimscript file of t-vim.
> Now one or more escapechars can be defined, that helps vim to not interpret
> the text:

I'll look at this later

> Another point I saw is, that highlight together with TeX-code is not really 
usable:
> ```
> \usemodule[vim]
> \definevimtyping[python][syntax=python, escape=on]
>
> \starttext
> \startpython[highlight=1]
> # Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
> \stoppython
> \stoptext
> ```

By default, the highlighting is done using the bars mechanism. It works 
for simple cases but fails with math mode (the spaces are not covered). 
One option is to highlight using the textbackground mechanism:


\definetextbackground[texthighlight]
 [
   background=color,
   backgroundcolor=gray,
   frame=off,
 ]

\define[1]\texthighlight{\starttexthighlight#1\stoptexthighlight}

\usemodule[vim]
\definevimtyping[python][syntax=python, escape=on, 
highlightcommand=\texthighlight]

\starttext

\startpython[highlight=3]
for x in 1:n
   print(x)
# Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
for x in 1:n
   print(x)
\stoppython
\stoptext

Thank you, this works much better (critic on high level: the sum symbol is
higher than the highlight box, relevant on fractions).


Another option (slightly better visually, but increases the interline 
distance)


\defineframed[texthighlight]
[
  background=color,
  backgroundcolor=gray,
  frame=off,
  location=middle,
]

\usemodule[vim]
\definevimtyping[python][syntax=python, escape=on,
highlightcommand=\dontleavehmode\texthighlight]

\starttext

\startpython[highlight=3]
for x in 1:n
  print(x)
# Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
for x in 1:n
  print(x)
\stoppython
\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] t-vim module: math in "normal" code and background color

2017-07-19 Thread Aditya Mahajan

On Thu, 20 Jul 2017, Henri Menke wrote:


On Wed, 2017-07-19 at 15:07 -0400, Aditya Mahajan wrote:

On Wed, 19 Jul 2017, Gerion Entrup wrote:

> 
> Am Dienstag, 18. Juli 2017, 04:04:51 CEST schrieb Aditya Mahajan:
> > 
> > On Mon, 17 Jul 2017, Gerion Entrup wrote:
> > 
> > > 
> > > Hi,
> > > 
> > > I have two questions with the vim module.
> > > 
> > > 1. I want to use the math mode inside the code. I've seen the escape option,

> > > e.g. here [1], but this seems to work only with comments. Is there a
> > > possibility to use it directly in the code, too?
> > Short answer. No.
> > 
> > Long answer. t-vim relies on vim to syntax highlight the code. Since the

> > code is not valid python, the default python syntax highlighting will not
> > work. In principle, it is possible to write a vim syntax highlighting
> > script for a derivative of python where math terms are allowed, but that
> > requires a lot of work for each language. The whole point of t-vim module
> > was that I am lazy and don't want to write the parser for each language
> > :-)
> I've invested some time and rewrote parts of the vimscript file of t-vim.
> Now one or more escapechars can be defined, that helps vim to not interpret
> the text:
I'll look at this later

> 
> Another point I saw is, that highlight together with TeX-code is not really usable:

> ```
> \usemodule[vim]
> \definevimtyping[python][syntax=python, escape=on]
> 
> \starttext

> \startpython[highlight=1]
> # Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
> \stoppython
> \stoptext
> ```
By default, the highlighting is done using the bars mechanism. It works 
for simple cases but fails with math mode (the spaces are not covered). 
One option is to highlight using the textbackground mechanism:

\definetextbackground[texthighlight]
 [
   background=color,
   backgroundcolor=gray,
   frame=off,
 ]

\define[1]\texthighlight{\starttexthighlight#1\stoptexthighlight}

\usemodule[vim]
\definevimtyping[python][syntax=python, escape=on, 
highlightcommand=\texthighlight]

\starttext

\startpython[highlight=3]
for x in 1:n
   print(x)
# Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
for x in 1:n
   print(x)
\stoppython
\stoptext

The spacing in math mode is bad. What is happening is the following. To 
make sure that spaces are obeyed in the code listing, I set (a modified 
version of) \activatespacehandler{on}, so the output that you get is the 
following:

{\obeyspaces
  \def\obeyedspace{\hskip\interwordspace\relax}
\m{\sum_{i=1}^{n}i \in F \int_i f}}

The simplest way to fix this is to define a new command:

\define[1]\MATH{\bgroup\activatespacehandler{off}\m{\rescan{#1}}\egroup}


Why not just this?

\def\obeyedspace{\ifmmode\else\hskip\interwordspace\relax\fi}


That's a good suggestion and will be easier to incorporate in t-vim.

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] t-vim module: math in "normal" code and background color

2017-07-19 Thread Henri Menke
On Wed, 2017-07-19 at 15:07 -0400, Aditya Mahajan wrote:
> On Wed, 19 Jul 2017, Gerion Entrup wrote:
> 
> > 
> > Am Dienstag, 18. Juli 2017, 04:04:51 CEST schrieb Aditya Mahajan:
> > > 
> > > On Mon, 17 Jul 2017, Gerion Entrup wrote:
> > > 
> > > > 
> > > > Hi,
> > > > 
> > > > I have two questions with the vim module.
> > > > 
> > > > 1. I want to use the math mode inside the code. I've seen the escape 
> > > > option,
> > > > e.g. here [1], but this seems to work only with comments. Is there a
> > > > possibility to use it directly in the code, too?
> > > Short answer. No.
> > > 
> > > Long answer. t-vim relies on vim to syntax highlight the code. Since the
> > > code is not valid python, the default python syntax highlighting will not
> > > work. In principle, it is possible to write a vim syntax highlighting
> > > script for a derivative of python where math terms are allowed, but that
> > > requires a lot of work for each language. The whole point of t-vim module
> > > was that I am lazy and don't want to write the parser for each language
> > > :-)
> > I've invested some time and rewrote parts of the vimscript file of t-vim.
> > Now one or more escapechars can be defined, that helps vim to not interpret
> > the text:
> I'll look at this later
> 
> > 
> > Another point I saw is, that highlight together with TeX-code is not really 
> > usable:
> > ```
> > \usemodule[vim]
> > \definevimtyping[python][syntax=python, escape=on]
> > 
> > \starttext
> > \startpython[highlight=1]
> > # Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
> > \stoppython
> > \stoptext
> > ```
> By default, the highlighting is done using the bars mechanism. It works 
> for simple cases but fails with math mode (the spaces are not covered). 
> One option is to highlight using the textbackground mechanism:
> 
> \definetextbackground[texthighlight]
>  [
>    background=color,
>    backgroundcolor=gray,
>    frame=off,
>  ]
> 
> \define[1]\texthighlight{\starttexthighlight#1\stoptexthighlight}
> 
> \usemodule[vim]
> \definevimtyping[python][syntax=python, escape=on, 
> highlightcommand=\texthighlight]
> 
> \starttext
> 
> \startpython[highlight=3]
> for x in 1:n
>    print(x)
> # Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
> for x in 1:n
>    print(x)
> \stoppython
> \stoptext
> 
> The spacing in math mode is bad. What is happening is the following. To 
> make sure that spaces are obeyed in the code listing, I set (a modified 
> version of) \activatespacehandler{on}, so the output that you get is the 
> following:
> 
> {\obeyspaces
>   \def\obeyedspace{\hskip\interwordspace\relax}
> \m{\sum_{i=1}^{n}i \in F \int_i f}}
> 
> The simplest way to fix this is to define a new command:
> 
> \define[1]\MATH{\bgroup\activatespacehandler{off}\m{\rescan{#1}}\egroup}

Why not just this?

\def\obeyedspace{\ifmmode\else\hskip\interwordspace\relax\fi}

> 
> and use \MATH{} instead of \m{}.
> 
> I'll test this is a bit, and if the solution is robust, then I will map 
> \m{...} to something equivalent to the above in the t-vim environments.
> 
> 
> Aditya
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

Re: [NTG-context] t-vim module: math in "normal" code and background color

2017-07-19 Thread Gerion Entrup
Am Mittwoch, 19. Juli 2017, 21:07:09 CEST schrieb Aditya Mahajan:
> On Wed, 19 Jul 2017, Gerion Entrup wrote:
> 
> > Am Dienstag, 18. Juli 2017, 04:04:51 CEST schrieb Aditya Mahajan:
> >> On Mon, 17 Jul 2017, Gerion Entrup wrote:
> >>
> >>> Hi,
> >>>
> >>> I have two questions with the vim module.
> >>>
> >>> 1. I want to use the math mode inside the code. I've seen the escape 
> >>> option,
> >>> e.g. here [1], but this seems to work only with comments. Is there a
> >>> possibility to use it directly in the code, too?
> >>
> >> Short answer. No.
> >>
> >> Long answer. t-vim relies on vim to syntax highlight the code. Since the
> >> code is not valid python, the default python syntax highlighting will not
> >> work. In principle, it is possible to write a vim syntax highlighting
> >> script for a derivative of python where math terms are allowed, but that
> >> requires a lot of work for each language. The whole point of t-vim module
> >> was that I am lazy and don't want to write the parser for each language
> >> :-)
> >
> > I've invested some time and rewrote parts of the vimscript file of t-vim.
> > Now one or more escapechars can be defined, that helps vim to not interpret
> > the text:
> 
> I'll look at this later
> 
> > Another point I saw is, that highlight together with TeX-code is not really 
> > usable:
> > ```
> > \usemodule[vim]
> > \definevimtyping[python][syntax=python, escape=on]
> >
> > \starttext
> > \startpython[highlight=1]
> > # Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
> > \stoppython
> > \stoptext
> > ```
> 
> By default, the highlighting is done using the bars mechanism. It works 
> for simple cases but fails with math mode (the spaces are not covered). 
> One option is to highlight using the textbackground mechanism:
> 
> \definetextbackground[texthighlight]
>  [
>background=color,
>backgroundcolor=gray,
>frame=off,
>  ]
> 
> \define[1]\texthighlight{\starttexthighlight#1\stoptexthighlight}
> 
> \usemodule[vim]
> \definevimtyping[python][syntax=python, escape=on, 
> highlightcommand=\texthighlight]
> 
> \starttext
> 
> \startpython[highlight=3]
> for x in 1:n
>print(x)
> # Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
> for x in 1:n
>print(x)
> \stoppython
> \stoptext
Thank you, this works much better (critic on high level: the sum symbol is
higher than the highlight box, relevant on fractions).

 
> The spacing in math mode is bad. What is happening is the following. To 
> make sure that spaces are obeyed in the code listing, I set (a modified 
> version of) \activatespacehandler{on}, so the output that you get is the 
> following:
> 
> {\obeyspaces
>   \def\obeyedspace{\hskip\interwordspace\relax}
> \m{\sum_{i=1}^{n}i \in F \int_i f}}
> 
> The simplest way to fix this is to define a new command:
> 
> \define[1]\MATH{\bgroup\activatespacehandler{off}\m{\rescan{#1}}\egroup}
> 
> and use \MATH{} instead of \m{}.
> 
> I'll test this is a bit, and if the solution is robust, then I will map 
> \m{...} to something equivalent to the above in the t-vim environments.
I saw the strange spacing. Thank you very much to provide a solution.

Gerion

___
If your question is of interest to 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] t-vim module: math in "normal" code and background color

2017-07-19 Thread Aditya Mahajan

On Wed, 19 Jul 2017, Gerion Entrup wrote:


Am Dienstag, 18. Juli 2017, 04:04:51 CEST schrieb Aditya Mahajan:

On Mon, 17 Jul 2017, Gerion Entrup wrote:


Hi,

I have two questions with the vim module.

1. I want to use the math mode inside the code. I've seen the escape option,
e.g. here [1], but this seems to work only with comments. Is there a
possibility to use it directly in the code, too?


Short answer. No.

Long answer. t-vim relies on vim to syntax highlight the code. Since the
code is not valid python, the default python syntax highlighting will not
work. In principle, it is possible to write a vim syntax highlighting
script for a derivative of python where math terms are allowed, but that
requires a lot of work for each language. The whole point of t-vim module
was that I am lazy and don't want to write the parser for each language
:-)


I've invested some time and rewrote parts of the vimscript file of t-vim.
Now one or more escapechars can be defined, that helps vim to not interpret
the text:


I'll look at this later


Another point I saw is, that highlight together with TeX-code is not really 
usable:
```
\usemodule[vim]
\definevimtyping[python][syntax=python, escape=on]

\starttext
\startpython[highlight=1]
# Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
\stoppython
\stoptext
```


By default, the highlighting is done using the bars mechanism. It works 
for simple cases but fails with math mode (the spaces are not covered). 
One option is to highlight using the textbackground mechanism:


\definetextbackground[texthighlight]
[
  background=color,
  backgroundcolor=gray,
  frame=off,
]

\define[1]\texthighlight{\starttexthighlight#1\stoptexthighlight}

\usemodule[vim]
\definevimtyping[python][syntax=python, escape=on, 
highlightcommand=\texthighlight]

\starttext

\startpython[highlight=3]
for x in 1:n
  print(x)
# Returns \m{\sum_{i=1}^{n}i \in F \int_i f}
for x in 1:n
  print(x)
\stoppython
\stoptext

The spacing in math mode is bad. What is happening is the following. To 
make sure that spaces are obeyed in the code listing, I set (a modified 
version of) \activatespacehandler{on}, so the output that you get is the 
following:


{\obeyspaces
 \def\obeyedspace{\hskip\interwordspace\relax}
\m{\sum_{i=1}^{n}i \in F \int_i f}}

The simplest way to fix this is to define a new command:

\define[1]\MATH{\bgroup\activatespacehandler{off}\m{\rescan{#1}}\egroup}

and use \MATH{} instead of \m{}.

I'll test this is a bit, and if the solution is robust, then I will map 
\m{...} to something equivalent to the above in the t-vim environments.



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

2017-07-19 Thread Thomas Floeren

> On 11. Jul 2017, at 23:06, Thomas Floeren  wrote:
> 
>> 
>> On 11. Jul 2017, at 17:09, Hans Hagen > 
>> wrote:
>> 
>> On 7/11/2017 4:36 PM, Thomas Floeren wrote:
 On 4. Jun 2017, at 18:55, Hans Hagen > wrote:
 
 Hi,
 
 For those using synctex, an alternative method is:
 
 \setupsynctex[state=start]
 
 It is tuned for use in a more complex setup where one wants access to 
 source files (with content) and not to e.g. styles in a tex tree. It also 
 works reasonable well with (also included) xml files. Personally I never 
 use synctex but for some projects it came in handy for authors (think of 
 proofing xml files with hundreds of nested inclusions and files in a 
 rather branched tree.) Of course you can expect a similar performance hit 
 as normal synctex but commenting the above line in production results in 
 zero overhead. Using the syntex flag on the command line 
 (--synctex=context will work) can be messy.
 
 This currently only works with the windows binaries version on the garden 
 (as we need luatex 1.0.5).
>>> Hans, thanks for that info.
>>> \setupsynctex[state=start] seems to work fine with Beta 2017.07.05 23:01 - 
>>> LuaTeX 1.05.0 on the Mac.
>>> Whereas I noticed that -the switches -synctex=context or --synctex=zipped 
>>> have completely stopped working with that Beta (or that luatex version).
>> 
>> i'll have to upload a new beta ... last week i optimized the code a bit so 
>> performance is now a bit better too; there are some options you can play 
>> with to see what happens deep down
>> 
>> % \setupsynctex[state=start,method=min]
>> % \setupsynctex[state=start,method=max]
>> % \enabletrackers[system.synctex.visualize]
>> % \enabletrackers[system.synctex.visualize=real]
>> 
>> indeed, we now have a context specific variant only (you can still force the 
>> original synctex by setting \normalsynctex but it can interfere with the 
>> context variant when set)
> 
> 
> I think I have found a problem with the new synctex:
> 
> Synctex works perfectly fine – until the first occurence of a \readfile. From 
> that point on it always takes me to the imported file, no matter whether the 
> text actually is in the imported file or in the main file.
> 
> Here is a MWE:
> 
> \setupsynctex[state=start,method=max]
> \starttext
> This line is found by the new synctex.\crlf
> This line is found by the new synctex.\crlf
> This line is found by the new synctex.\crlf
> This line is found by the new synctex.\crlf
> \readfile{myInputfile}{}{}
> This line is {\em not} found by the new synctex.\crlf
> Instead, synctex takes me to myInputfile.tex.\crlf
> This line is {\em not} found by the new synctex.\crlf
> Instead, synctex takes me to myInputfile.tex.\crlf
> \stoptext
> 
> ['myInputfile.tex' can contain any text, it doesn't matter.]
> 
> If I click one of the first four lines in the PDF synctex works fine. The 
> lines after the \readfile don't work: Synctex takes me to the end of 
> myInputfile.tex. (You can also import 'ward' or 'knuth', in that case synctex 
> takes me to the last line _before_ the \readfile.)

With 2017.07.17 00:20 the issue seems to persist.

Tom


> 
> I tested the sample with an older Ctx and with --synctex=zipped, and it 
> doesn't show the problem.
> 
> -- 
> Tom
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl  / 
> http://www.ntg.nl/mailman/listinfo/ntg-context 
> 
> webpage  : http://www.pragma-ade.nl  / 
> http://context.aanhet.net 
> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
> 
> wiki : http://contextgarden.net 
> ___

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

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