Re: [NTG-context] Number format with lua

2019-11-09 Thread Fabrice Couvreur
Hi Hans,
In fact, I was talking about functions that seemed to me "complicated" for
what I wanted to do.
Fabrice

Le sam. 9 nov. 2019 à 14:43, Hans Hagen  a écrit :

> On 11/9/2019 11:42 AM, Fabrice Couvreur wrote:
> > Hi,
> > Thank you for your suggestions, the problem is solved. I searched, but
> > the solutions seemed too complex. Is it specific to Context with Lua. If
> > so, which document should you read ?
>
> how do you mean complex ... anyway, if you refer to %g, one problem can
> be that the E notation kicks in
>
> Hans
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


[NTG-context] Formatting in the toc

2019-11-09 Thread Calum MacLeod
I have now found time to see if I could work out how to apply
\structurelistuservariable. In short, I  have to admit that I could not.

I am grateful to Hraban for his encouraging response, but though I could
see it was related, it seems to me not quite what I seek.

The more I thought about the answer, I realised I had not explained my
question in a precise manner.

I am retired, and produce a weekly A5 booklet from material with which my
wife (a church minister), supplies to me. I call it a pulpit manuscript. It
is the entire script for her service. Included are the numbers and first
line of five hymns, that are different each week.

Until I gain a better understanding of ConTeXt, I shall continue to use
LaTeX koma-script package for the weekly booklet. In order to make life
easier for myself, I have created commands of my own.

One of these commands enables me to have a template which has five
instances of \hymn{} {}. If I put with the first braces pair '387', and in
the second pair, 'The Lord's my shepherd' --- when LaTeX koma-script
outputs the PDF, 'Hymn 387' is in bold and 'The Lord's my shepherd' is
italicised. For the next hymn, it would be a different number, and
different first line, but it would auto-formatted the way I want.

That command is constructed in the preamble in the following way:

\newcommand{\hymn}[3][Hymn]{\addsec{\rlap{\textbf{#1
#2}}\hspace}{7em}{\normalfont\small\textit{#3} }}}

This places a specific gap between the hymn number and the first line as
well. Not only does it format the section heading (\addsec) to have bold
and italics (without bold), it formats the corresponding entry in the toc
in exactly the same way.

How can I make a similar command for ConTeXt, please?
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Issue with text running into footnotes

2019-11-09 Thread Pablo Rodriguez
On 11/9/19 6:22 PM, Otared Kavian wrote:
> Hi Pablo,
>
> By setting
>
> \setupwhitespace[big]
>
> the specific issue could be solved, but then the number of pages became too 
> big as a consequence.
> However, cutting the text into one more paragraph, without changing the 
> whitespace, solved the issue of the text running into the footnote.

Hi Otared,

I’m afraid that I have to add two more paragraphs to get rid of text
running into the footnote space.

But notes are my most problematic field in ConTeXt (I hate to admit).

Many thanks for your reply,

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

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


Re: [NTG-context] Issue with text running into footnotes

2019-11-09 Thread Otared Kavian
Hi Pablo,

By setting 

\setupwhitespace[big]

the specific issue could be solved, but then the number of pages became too big 
as a consequence. 
However, cutting the text into one more paragraph, without changing the 
whitespace, solved the issue of the text running into the footnote.

I don't know how to setup a different penalty, nor what would be its influence 
in some other parts of my text. 

Best regards: OK

> On 9 Nov 2019, at 11:04, Pablo Rodriguez  wrote:
> 
> On 11/4/19 9:49 PM, Wolfgang Schuster wrote:
>> Otared Kavian schrieb am 04.11.2019 um 20:30:
>>> Hi all,
>>> 
>>> I have a lecture note in which a few footnotes are given, but in some
>>> cases the text runs into the footnote, and it has been impossible for
>>> me to exhibit a minimal example where the issue appears. In the link
>>> https://www.dropbox.com/s/o9h0j6i21emyw2v/footnote-issue.pdf?dl=0
>>> the issue is shown in the real case.
>>> [...]
>> 
>> You can increase the vertical tolerance, e.g.
>> 
>> \setuptolerance[vertical,verytolerant]
> 
> Hi Wolfgang,
> 
> I have a much worse sample (text runs totally into foonote space as
> there were no footnotes).
> 
> Setting tolerance makes no difference, setting a higher spacebefore or
> before makes no difference.
> 
> Hi Otared,
> 
> I wonder whether you could fix your problem.
> 
>> change the penalty settings or use a bigger whitespace between the
>> paragraphs.
> 
> Which would be those penalty settings?
> 
> Sorry, but I don’t understand why ConTeXt has this kind of problems with
> notes. Why is so difficult to keep the space before notes?
> 
> Many thanks for your help,
> 
> Pablo
> --
> http://www.ousia.tk
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
If your question is of 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] Number format with lua

2019-11-09 Thread Hans Hagen

On 11/9/2019 11:42 AM, Fabrice Couvreur wrote:

Hi,
Thank you for your suggestions, the problem is solved. I searched, but 
the solutions seemed too complex. Is it specific to Context with Lua. If 
so, which document should you read ?


how do you mean complex ... anyway, if you refer to %g, one problem can 
be that the E notation kicks in


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Number format with lua

2019-11-09 Thread Fabrice Couvreur
Hi,
Thank you for your suggestions, the problem is solved. I searched, but the
solutions seemed too complex. Is it specific to Context with Lua. If so,
which document should you read ?
Fabrice

Le sam. 9 nov. 2019 à 11:20, Hans Hagen  a écrit :

> On 11/9/2019 11:03 AM, Pablo Rodriguez wrote:
> > On 11/9/19 10:38 AM, Fabrice Couvreur wrote:
> >> Hi,
> >> In the table below, how to have numbers with only three decimals?
> >
> > Hi Fabrice,
> >
> > at least in your sample "0.4g" seems the way to go, such as in:
> >
> >context.startxcell() context("%0.4g",1.031^i) context.stopxcell()
> >
> > Just in case it might help,
> better use %0.3f as %g is somewhat unpredictable; using %0.3N will omit
> redundant zeros (slower but not relevant here)
>
> Hans
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
If your question is of 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] Number format with lua

2019-11-09 Thread Hans Hagen

On 11/9/2019 11:03 AM, Pablo Rodriguez wrote:

On 11/9/19 10:38 AM, Fabrice Couvreur wrote:

Hi,
In the table below, how to have numbers with only three decimals?


Hi Fabrice,

at least in your sample "0.4g" seems the way to go, such as in:

   context.startxcell() context("%0.4g",1.031^i) context.stopxcell()

Just in case it might help,
better use %0.3f as %g is somewhat unpredictable; using %0.3N will omit 
redundant zeros (slower but not relevant here)


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Issue with text running into footnotes

2019-11-09 Thread Pablo Rodriguez
On 11/4/19 9:49 PM, Wolfgang Schuster wrote:
> Otared Kavian schrieb am 04.11.2019 um 20:30:
>> Hi all,
>>
>> I have a lecture note in which a few footnotes are given, but in some
>> cases the text runs into the footnote, and it has been impossible for
>> me to exhibit a minimal example where the issue appears. In the link
>> https://www.dropbox.com/s/o9h0j6i21emyw2v/footnote-issue.pdf?dl=0
>> the issue is shown in the real case.
>> [...]
>
> You can increase the vertical tolerance, e.g.
>
>     \setuptolerance[vertical,verytolerant]

Hi Wolfgang,

I have a much worse sample (text runs totally into foonote space as
there were no footnotes).

Setting tolerance makes no difference, setting a higher spacebefore or
before makes no difference.

Hi Otared,

I wonder whether you could fix your problem.

> change the penalty settings or use a bigger whitespace between the
> paragraphs.

Which would be those penalty settings?

Sorry, but I don’t understand why ConTeXt has this kind of problems with
notes. Why is so difficult to keep the space before notes?

Many thanks for your help,

Pablo
--
http://www.ousia.tk

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

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


Re: [NTG-context] Number format with lua

2019-11-09 Thread Pablo Rodriguez
On 11/9/19 10:38 AM, Fabrice Couvreur wrote:
> Hi,
> In the table below, how to have numbers with only three decimals?

Hi Fabrice,

at least in your sample "0.4g" seems the way to go, such as in:

  context.startxcell() context("%0.4g",1.031^i) context.stopxcell()

Just in case it might help,

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

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


Re: [NTG-context] Number format with lua

2019-11-09 Thread Henri Menke
On 11/9/19 10:38 PM, Fabrice Couvreur wrote:
> Hi,
> In the table below, how to have numbers with only three decimals ?
> Thank you.
> Fabrice
> 
> \starttext
> \startluacode
> local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }
> local letters_2 = { "1", "Année", "1998", "1999", "2000", "2001", "2002",
> "2003", "2004", "2005","2006" }
> context.startxtable({"align={middle,lohi},
> width=1.2cm,offset=0.8ex,bodyfont=9pt"})
> 
> context.startxrow({"background=color,backgroundcolor=green"})
> context.startxcell({"background=color,backgroundcolor=white,frame=off"})
> context("")
> context.stopxcell()
> for _, letter in ipairs(letters_1) do
> context.startxcell()
> context(letter) context.stopxcell()
> end
> context.stopxrow()
> 
> context.startxrow()
> for _, letter in ipairs(letters_2) do
> context.startxcell() context(letter) context.stopxcell()
> end
> context.stopxrow()
> 
> context.startxrow()
> context.startxcell() context("2") context.stopxcell()
> context.startxcell({"width=2cm"}) context("Prix (kg)") context.stopxcell()
> for i=0,8 do
> context.startxcell() context("%0.5g",1.031^i) context.stopxcell()

Have you tried

context.startxcell() context("%0.3g",1.031^i) context.stopxcell()

?
Cheers, Henri

> end
> context.stopxrow()
> 
> context.stopxtable()
> \stopluacode
> \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
> ___
> 

___
If your question is of 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] Number format with lua

2019-11-09 Thread Fabrice Couvreur
Hi,
In the table below, how to have numbers with only three decimals ?
Thank you.
Fabrice

\starttext
\startluacode
local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }
local letters_2 = { "1", "Année", "1998", "1999", "2000", "2001", "2002",
"2003", "2004", "2005","2006" }
context.startxtable({"align={middle,lohi},
width=1.2cm,offset=0.8ex,bodyfont=9pt"})

context.startxrow({"background=color,backgroundcolor=green"})
context.startxcell({"background=color,backgroundcolor=white,frame=off"})
context("")
context.stopxcell()
for _, letter in ipairs(letters_1) do
context.startxcell()
context(letter) context.stopxcell()
end
context.stopxrow()

context.startxrow()
for _, letter in ipairs(letters_2) do
context.startxcell() context(letter) context.stopxcell()
end
context.stopxrow()

context.startxrow()
context.startxcell() context("2") context.stopxcell()
context.startxcell({"width=2cm"}) context("Prix (kg)") context.stopxcell()
for i=0,8 do
context.startxcell() context("%0.5g",1.031^i) context.stopxcell()
end
context.stopxrow()

context.stopxtable()
\stopluacode
\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
___