Re: [NTG-context] date calculated with currentdate plus n days

2018-08-13 Thread Pablo Rodriguez
On 08/14/2018 01:46 AM, Henri Menke wrote:
> On top of that I recommend to use context.date to get the correct 
> formatting according to the current language options:
> 
> \def\duedate{\ctxlua{
>local t = os.date('*t', os.time()+ 10 * 24 * 3600)
>context.date{ d = t.day, m = t.month, y = t.year }
> }}

Many thanks for your reply, Henri.

Where are those context.* Lua commands documented?

I want to generate an xtable using Lua code, but I don’t know where to read.

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] Scite + ConTeXt

2018-08-13 Thread Ken Moffat
On Tue, Aug 14, 2018 at 01:54:06AM +0200, Fabrice Couvreur wrote:

> How to have evince as the default reader ?
> 
perhaps

 xdg-mime default evince.desktop application/pdf

ĸen
-- 
   Entropy not found, thump keyboard to continue

___
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] Scite + ConTeXt

2018-08-13 Thread Alan Braslau
On Tue, 14 Aug 2018 01:54:06 +0200
Fabrice Couvreur  wrote:

> Hello,
> As I am having some problems with Emacs, I will try to use Scite !
> 
> 1. How to insert an environment ?
> That is with AUCTEX + Emacs, I was doing C-c C-e but how do with Scite ?
> 
> 2. To compile, I do Alt + F12 (Run with jit) and it works but how to have
> the test.pdf output because F5 (go) gives me  > gv test.pdf then RET but
> nothing ...
> How to have evince as the default reader ?
> 
> 3. How to have highlighting of context code with Scite ?

Hans uses a (lua) lpeg library for syntax highlighting with Scite. As far as I 
know, this library has only been successfully compiled under Windows, at least 
our feeble attempts at porting it to other systems did not go very far. Perhaps 
the situation is now better?

Alan
___
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] Scite + ConTeXt

2018-08-13 Thread Fabrice Couvreur
Hello,
As I am having some problems with Emacs, I will try to use Scite !

1. How to insert an environment ?
That is with AUCTEX + Emacs, I was doing C-c C-e but how do with Scite ?

2. To compile, I do Alt + F12 (Run with jit) and it works but how to have
the test.pdf output because F5 (go) gives me  > gv test.pdf then RET but
nothing ...
How to have evince as the default reader ?

3. How to have highlighting of context code with Scite ?

Thanks
Fabrice
___
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] date calculated with currentdate plus n days

2018-08-13 Thread Henri Menke
On top of that I recommend to use context.date to get the correct 
formatting according to the current language options:


\starttext

\def\duedate{\ctxlua{
  local t = os.date('*t', os.time()+ 10 * 24 * 3600)
  context.date{ d = t.day, m = t.month, y = t.year }
}}

\duedate

\stoptext

On 14/08/18 05:37, Jan U. Hasecke wrote:

On 13.08.2018 17:57, Pablo Rodriguez wrote:


if you don’t mind using Lua, here you have it:

 \starttext
 \def\duedate{\cldcontext{os.date('\letterpercent d/\letterpercent
 m/\letterpercent Y', os.time()+ 10 * 24 * 3600)}}

 \duedate
 \stoptext

Just in case it helps,


Thanks!

I thought it should be possible with lua, but I found no entry point to
use lua in context by defining new commands.

juh



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

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


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

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

Re: [NTG-context] How can I remove a blank leading line from a buffer

2018-08-13 Thread Rik Kabel

On 8/13/2018 15:52, Wolfgang Schuster wrote:



Rik Kabel schrieb am 13.08.18 um 20:27:

On 8/13/2018 13:46, Wolfgang Schuster wrote:


\starttext

\BeforePar{\dontleavehmode\llap{? }}\GotoPar

\input knuth

\startnarrower

\BeforePar{\dontleavehmode\llap{? }}\GotoPar

\input knuth

\stopnarrower

\stoptext

Wolfgang


I am applying it incorrectly, or it does not work with the buffers 
created by \grabbufferdata:


\setupwhitespace[none]
\setupindenting[none]
\starttexdefinition unexpanded startBufTest
  \bgroup
  \dosingleempty\dostartBufTest
\stoptexdefinition
\starttexdefinition dostartBufTest [#SETUPS]
  \getrawparameters[BufTest][xx=yy,#SETUPS]
  \grabbufferdata[TestBuffer][startBufTest][stopBufTest]
\stoptexdefinition
\starttexdefinition stopBufTest
  \startnarrower[left,right]
  \startparagraph
    \BeforePar{\dontleavehmode\llap{? }}\GotoPar
    \inlinebuffer[TestBuffer]
  \stopparagraph
  \stopnarrower
  \egroup
\stoptexdefinition



\starttexdefinition stopBufTest
  \startnarrower[left,right]
  \startparagraph
    \dontleavehmode\llap{? }%
    \blank[overlay]
    \inlinebuffer[TestBuffer]
  \stopparagraph
  \stopnarrower
  \egroup
\stoptexdefinition


Wolfgang


Thank you, Wolfgang. That does it. Note that the % escaping the line end 
is not needed (    although it might be needed outside a 
\starttexdefinition environment) – the following works as well:



   \starttexdefinition stopBufTest

  \startnarrower[left,right]

  \startparagraph

    \dontleavehmode{\llap{? }}

    \blank[overlay]

    \inlinebuffer[TestBuffer]

  \stopparagraph

  \stopnarrower

  \egroup

   \stoptexdefinition


--
Rik

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

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

Re: [NTG-context] \definetextbackground does not fill tables within

2018-08-13 Thread Alan Braslau
Floating objects (\placetable, \placefigure, ... and footnotes, etc.) do not 
inherit the text background, for indeed, imagine that it floats to another 
location.

Here, you use location=force, so one might expect it to use the text 
background... In fact, side floats, location=left and location=right, do get 
the text background color, so there is a *kludge* possible there:

\startplacetable [location=right]
  ...
\stopplacetable

\flushsidefloats

...

(incomplete example)

Alan

P.S. Hans: maybe location=force ought to work similarly with respect to text 
backgrounds as location=left or location=right.


On Mon, 13 Aug 2018 21:37:45 +
dxpubl...@posteo.net wrote:

> Hi,
> 
> I have simple document which I define my \definetextbackground: 
> \startteoria and \stopteoria (see below). When I use it and put table 
> within, the table does not get filled with color. Any solution?
> 
> Thanks in advance,
> Xavier
> 
> \definecolor[teoriacolor][lightgray]
> 
> \definetextbackground[bteoria][
>  frame=off,
>  location=paragraph,
>  background=color,
>  backgroundcolor=teoriacolor, % fins aquí provat: 
> http://www.mail-archive.com/ntg-context%40ntg.nl/msg78014.html
>  %width=broad,
>  %corner=round,
>  %radius=5ex,
>  leftoffset=10pt,rightoffset=10pt,
>  topoffset=10pt,bottomoffset=10pt
>  %offset=-5pt
>  ]
> 
> \definestartstop[teoria][before={\begingroup\blank[big]\testpage[2]\starttextbackground[bteoria]},after={\stoptextbackground\blank[big]\endgroup}]
> 
> 
> \starttext
> 
> \startteoria
> \input tufte
> 
> \placetable[force,none][taula:teoria:1]{Recopilació de dades. Conceptes 
> fonamentals}{
> \starttable[|l|p(.6\textwidth)|]
> \NC Població: \NC Són {\em tots} els elements que són objecte d'estudi 
> \NC \FR
> \HL
> \NC Mostra: \NC La {\em part} de la població de la qual recopilem les 
> dades i estudiam.
> 
> Poques vegades coincideix amb la població. Una bona mostra necessita ser 
> suficientment heterogènia per a poder representar la població.
> 
> Es pot determinar el tamany mínim necessari per a què una mostra tengui 
> la representativitat necessària amb un marge d'error. \NC \MR
> \HL
> \NC Grandària: \NC {\em Nombre} d'elements de la població o de la 
> mostra. \NC \MR
> \HL
> \NC Variable estadística: \NC Cadascuna de les {\em propietats} o 
> característiques que volem estudiar d'un conjunt de dades. \NC \LR
> \stoptable}
> 
> Existeixen dues branques de l'estadística:
> 
> \startitemize
> \item L'{\em estadística descriptiva}, que simplement descriu i 
> interpreta les característiques del grup d'estudi, tal com és. Fa un 
> {\em retrat} de la població.
> \item L'{\em estadística inferencial} que intenta fer prediccions i 
> justificar que la mostra s'adeqüa a la població, de manera que les 
> característiques de la mostra siguin les mateixes que les 
> característiques de la població.
> \stopitemize
> 
> 
> \stopteoria
> 
> \stoptext
> 
> 
> 
> 
> Result (see pdf file)

___
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] \definetextbackground does not fill tables within

2018-08-13 Thread dxpublica

Hi,

I have simple document which I define my \definetextbackground: 
\startteoria and \stopteoria (see below). When I use it and put table 
within, the table does not get filled with color. Any solution?


Thanks in advance,
Xavier

\definecolor[teoriacolor][lightgray]

\definetextbackground[bteoria][
frame=off,
location=paragraph,
background=color,
backgroundcolor=teoriacolor, % fins aquí provat: 
http://www.mail-archive.com/ntg-context%40ntg.nl/msg78014.html

%width=broad,
%corner=round,
%radius=5ex,
leftoffset=10pt,rightoffset=10pt,
topoffset=10pt,bottomoffset=10pt
%offset=-5pt
]

\definestartstop[teoria][before={\begingroup\blank[big]\testpage[2]\starttextbackground[bteoria]},after={\stoptextbackground\blank[big]\endgroup}]


\starttext

\startteoria
\input tufte

\placetable[force,none][taula:teoria:1]{Recopilació de dades. Conceptes 
fonamentals}{

\starttable[|l|p(.6\textwidth)|]
\NC Població: \NC Són {\em tots} els elements que són objecte d'estudi 
\NC \FR

\HL
\NC Mostra: \NC La {\em part} de la població de la qual recopilem les 
dades i estudiam.


Poques vegades coincideix amb la població. Una bona mostra necessita ser 
suficientment heterogènia per a poder representar la població.


Es pot determinar el tamany mínim necessari per a què una mostra tengui 
la representativitat necessària amb un marge d'error. \NC \MR

\HL
\NC Grandària: \NC {\em Nombre} d'elements de la població o de la 
mostra. \NC \MR

\HL
\NC Variable estadística: \NC Cadascuna de les {\em propietats} o 
característiques que volem estudiar d'un conjunt de dades. \NC \LR

\stoptable}

Existeixen dues branques de l'estadística:

\startitemize
\item L'{\em estadística descriptiva}, que simplement descriu i 
interpreta les característiques del grup d'estudi, tal com és. Fa un 
{\em retrat} de la població.
\item L'{\em estadística inferencial} que intenta fer prediccions i 
justificar que la mostra s'adeqüa a la població, de manera que les 
característiques de la mostra siguin les mateixes que les 
característiques de la població.

\stopitemize


\stopteoria

\stoptext




Result (see pdf file)


prova.pdf
Description: Adobe PDF document
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

Re: [NTG-context] How can I remove a blank leading line from a buffer

2018-08-13 Thread Wolfgang Schuster



Rik Kabel schrieb am 13.08.18 um 20:27:

On 8/13/2018 13:46, Wolfgang Schuster wrote:


\starttext

\BeforePar{\dontleavehmode\llap{? }}\GotoPar

\input knuth

\startnarrower

\BeforePar{\dontleavehmode\llap{? }}\GotoPar

\input knuth

\stopnarrower

\stoptext

Wolfgang


I am applying it incorrectly, or it does not work with the buffers 
created by \grabbufferdata:


\setupwhitespace[none]
\setupindenting[none]
\starttexdefinition unexpanded startBufTest
  \bgroup
  \dosingleempty\dostartBufTest
\stoptexdefinition
\starttexdefinition dostartBufTest [#SETUPS]
  \getrawparameters[BufTest][xx=yy,#SETUPS]
  \grabbufferdata[TestBuffer][startBufTest][stopBufTest]
\stoptexdefinition
\starttexdefinition stopBufTest
  \startnarrower[left,right]
  \startparagraph
\BeforePar{\dontleavehmode\llap{? }}\GotoPar
\inlinebuffer[TestBuffer]
  \stopparagraph
  \stopnarrower
  \egroup
\stoptexdefinition



\starttexdefinition stopBufTest
  \startnarrower[left,right]
  \startparagraph
\dontleavehmode\llap{? }%
\blank[overlay]
\inlinebuffer[TestBuffer]
  \stopparagraph
  \stopnarrower
  \egroup
\stoptexdefinition


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

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

Re: [NTG-context] How can I remove a blank leading line from a buffer

2018-08-13 Thread Rik Kabel

On 8/13/2018 13:46, Wolfgang Schuster wrote:


\starttext

\BeforePar{\dontleavehmode\llap{? }}\GotoPar

\input knuth

\startnarrower

\BeforePar{\dontleavehmode\llap{? }}\GotoPar

\input knuth

\stopnarrower

\stoptext

Wolfgang


I am applying it incorrectly, or it does not work with the buffers 
created by \grabbufferdata:


   \setupwhitespace[none]
   \setupindenting[none]
   \starttexdefinition unexpanded startBufTest
  \bgroup
  \dosingleempty\dostartBufTest
   \stoptexdefinition
   \starttexdefinition dostartBufTest [#SETUPS]
  \getrawparameters[BufTest][xx=yy,#SETUPS]
  \grabbufferdata[TestBuffer][startBufTest][stopBufTest]
   \stoptexdefinition
   \starttexdefinition stopBufTest
  \startnarrower[left,right]
  \startparagraph
    \BeforePar{\dontleavehmode\llap{? }}\GotoPar
    \inlinebuffer[TestBuffer]
  \stopparagraph
  \stopnarrower
  \egroup
   \stoptexdefinition

   \starttext

   \startBufTest
  Buffer without blank lines.
   \stopBufTest

   \startBufTest

  Buffer with blank lines.

   \stopBufTest

   \startBufTest[key=value]

  Buffer with \type{[key=value]}.

   \stopBufTest

   \stoptext

--

Rik

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

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

Re: [NTG-context] How can I remove a blank leading line from a buffer

2018-08-13 Thread Rik Kabel

On 8/13/2018 10:28, Rik Kabel wrote:
That works for the over-simplified case here, but fails in practice. 
For a \startnarrower[left] paragraph, the mark is still in the main 
margin, not the 'margin' of the narrowed paragraph. Also, the 
placement of the text in the margin is wrong and not easily controlled 
as with \llap and \rlap. The code started out more like:




Correcting the record: I misspoke in part above; margintext does follow 
the narrowed paragraph shape.


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

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

Re: [NTG-context] How can I remove a blank leading line from a buffer

2018-08-13 Thread Wolfgang Schuster



Rik Kabel schrieb am 13.08.18 um 19:09:

On 8/13/2018 12:04, Wolfgang Schuster wrote:


Hi Rik,

what do you want to achieve and why do you need a buffer for it?

Wolfgang


Fair question.

I have a document with many (400+) block quotations. Each consists of 
a text extract, which may be prose or poetry, and additional optional 
components (alternate versions or transliterations, translations, 
attribution). The optional components are distinguished 
typographically – enlarged square brackets around alternate versions, 
enlarged parentheses around translations, leading en-dash and hanging 
indent for attributions. Each component is in a buffer. The structure 
looks like:


\startBlockQuotation[label=abc,authors={...},precis={short
extract},translators={...},tprecis={{short extract},{short
extract}}...]

\startExtract[language=agr,align=yes,font=abc,tolerance=...,...]

  text of extract

\stopExtract

\startTransliteration[language=en,align=yes,font=abc,...]

  text of transliteration

\stopTransliteration

\startTranslation[...]

  text of translation

\stopTranslation

\startAttribution[tolerance=,...]

  attribution of quotation

\stopAttribution

\stopBlockQuotation

and the code to handle it generates author index entries, a quotation 
precis index, and so on from the attributes of the envelope, and 
typesets each component based on the provided settings or defaults, 
placing the appropriate decorations around those components that call 
for them. The components are nestable, so one extract may contain 
another, and components can be used separately without the envelope 
(\startBlockQuotation or \startEpigraph) as well.


(I have written it this way to ease the move to an XML-based format 
for storing the quotations. I realize I am combining presentation 
elements, like label, tolerance, and precis, and content elements, 
like language, and some that may be either, like align and font, in 
the attributes, but will deal with that later.)


I prefer to leave blank lines around blocks of text and around macro 
commands, so:


\startparagraph

  some text

\stopparagraph

but when this is done with, for example, \startAttribution, and no 
optional arguments are provided, I run into the problem I have described.


Try to avoid blank lines at the begin/end of environments.

I realize that I can simply not include the blank line after 
\startAttribution. I would prefer, however, to see consistent parallel 
structures without having to distinguish them at the time it is 
written. Perhaps I am being too picky, but that is what I am attempting.


At this point, the \setupparagraphintro hack handles my needs, so I 
will proceed with that.


\starttext

\BeforePar{\dontleavehmode\llap{? }}\GotoPar

\input knuth

\startnarrower

\BeforePar{\dontleavehmode\llap{? }}\GotoPar

\input knuth

\stopnarrower

\stoptext

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

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

Re: [NTG-context] date calculated with currentdate plus n days

2018-08-13 Thread Jan U. Hasecke
On 13.08.2018 17:57, Pablo Rodriguez wrote:

> if you don’t mind using Lua, here you have it:
> 
> \starttext
> \def\duedate{\cldcontext{os.date('\letterpercent d/\letterpercent
> m/\letterpercent Y', os.time()+ 10 * 24 * 3600)}}
> 
> \duedate
> \stoptext
> 
> Just in case it helps,

Thanks!

I thought it should be possible with lua, but I found no entry point to
use lua in context by defining new commands.

juh



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

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

Re: [NTG-context] How can I remove a blank leading line from a buffer

2018-08-13 Thread Rik Kabel

On 8/13/2018 12:04, Wolfgang Schuster wrote:


Hi Rik,

what do you want to achieve and why do you need a buffer for it?

Wolfgang


Fair question.

I have a document with many (400+) block quotations. Each consists of a 
text extract, which may be prose or poetry, and additional optional 
components (alternate versions or transliterations, translations, 
attribution). The optional components are distinguished typographically 
– enlarged square brackets around alternate versions, enlarged 
parentheses around translations, leading en-dash and hanging indent for 
attributions. Each component is in a buffer. The structure looks like:


   \startBlockQuotation[label=abc,authors={...},precis={short
   extract},translators={...},tprecis={{short extract},{short extract}}...]

   \startExtract[language=agr,align=yes,font=abc,tolerance=...,...]

  text of extract

   \stopExtract

   \startTransliteration[language=en,align=yes,font=abc,...]

  text of transliteration

   \stopTransliteration

   \startTranslation[...]

  text of translation

   \stopTranslation

   \startAttribution[tolerance=,...]

  attribution of quotation

   \stopAttribution

   \stopBlockQuotation

and the code to handle it generates author index entries, a quotation 
precis index, and so on from the attributes of the envelope, and 
typesets each component based on the provided settings or defaults, 
placing the appropriate decorations around those components that call 
for them. The components are nestable, so one extract may contain 
another, and components can be used separately without the envelope 
(\startBlockQuotation or \startEpigraph) as well.


(I have written it this way to ease the move to an XML-based format for 
storing the quotations. I realize I am combining presentation elements, 
like label, tolerance, and precis, and content elements, like language, 
and some that may be either, like align and font, in the attributes, but 
will deal with that later.)


I prefer to leave blank lines around blocks of text and around macro 
commands, so:


   \startparagraph

  some text

   \stopparagraph

but when this is done with, for example, \startAttribution, and no 
optional arguments are provided, I run into the problem I have described.


I realize that I can simply not include the blank line after 
\startAttribution. I would prefer, however, to see consistent parallel 
structures without having to distinguish them at the time it is written. 
Perhaps I am being too picky, but that is what I am attempting.


At this point, the \setupparagraphintro hack handles my needs, so I will 
proceed with that.


--
Rik

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

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

Re: [NTG-context] How can I remove a blank leading line from a buffer

2018-08-13 Thread Rik Kabel

On 8/13/2018 10:28, Rik Kabel wrote:

On 8/13/2018 03:01, Hans Hagen wrote:

On 8/13/2018 5:18 AM, Rik Kabel wrote:

  \startparagraph

% \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer]
% \ (first: \First, arg: \Arg)

    \margintext{\Mark}

    \setupparagraphintro[first][(first: \First, arg: \Arg)]
   %\setupparagraphintro[next][(first: \First, arg: \Arg)]

    \getbuffer[TestBuffer]

  \stopparagraph 


Hans,

That works for the over-simplified case here, but fails in practice. 
For a \startnarrower[left] paragraph, the mark is still in the main 
margin, not the 'margin' of the narrowed paragraph. Also, the 
placement of the text in the margin is wrong and not easily controlled 
as with \llap and \rlap. The code started out more like:


\define\Mark{\color[middlegray]{\hskip.6cm\itb¿\ }}
\setwidthof{\Mark}\to\MarkWidth
...
\starttexdefinition stopBufTest
  \startluacode
buffers.prepend("TestBuffer","\\dontleavehmode\\llap{\\Mark}")
  \stopluacode
  \setupnarrower[left=\MarkWidth]
  \startnarrower[left,right]
  \startparagraph
    \inlinebuffer[TestBuffer]
  \stopparagraph
  \stopnarrower
  \egroup
\stoptexdefinition


So I am still looking for a way to do this. Meanwhile I am trying to 
understand Aditya's examples.


Turns out another answer was hidden in Hans's reply. The following seems 
to meet my needs, but it may complicate other use of 
\setupparagraphintro (which I don't recall seeing before), so it may not 
be a generic solution.


An empty string works fine instead of the llaped marking shown here.

This is a less dangerous hack than redefining \par, but still may fail 
in more complex documents when \setupparagraphintro is used elsewhere.


   \starttexdefinition stopBufTest
  \startnarrower[left,right]
  \startparagraph
    \setupparagraphintro[first][\llap{\Mark}]
    \inlinebuffer[TestBuffer] \ (first: \First, arg: \Arg)
  \stopparagraph
  \stopnarrower
  \egroup
   \stoptexdefinition


Thank you, Hans.

(For a non-hack generic solution that does not interfere with other use 
of \setupparagraphintro, surely there must be an easy way to apply 
string.strip to the buffer.)


--
Rik

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

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

Re: [NTG-context] How can I remove a blank leading line from a buffer

2018-08-13 Thread Wolfgang Schuster



Rik Kabel schrieb am 13.08.18 um 16:28:

Hans,

That works for the over-simplified case here, but fails in practice. 
For a \startnarrower[left] paragraph, the mark is still in the main 
margin, not the 'margin' of the narrowed paragraph. Also, the 
placement of the text in the margin is wrong and not easily controlled 
as with \llap and \rlap. The code started out more like:


\define\Mark{\color[middlegray]{\hskip.6cm\itb¿\ }}
\setwidthof{\Mark}\to\MarkWidth
...
\starttexdefinition stopBufTest
  \startluacode
buffers.prepend("TestBuffer","\\dontleavehmode\\llap{\\Mark}")
  \stopluacode
  \setupnarrower[left=\MarkWidth]
  \startnarrower[left,right]
  \startparagraph
\inlinebuffer[TestBuffer]
  \stopparagraph
  \stopnarrower
  \egroup
\stoptexdefinition



Hi Rik,

what do you want to achieve and why do you need a buffer for it?

Wolfgang

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

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

Re: [NTG-context] date calculated with currentdate plus n days

2018-08-13 Thread Pablo Rodriguez
On 08/13/2018 05:19 PM, Jan U. Hasecke wrote:
> Hi all,
> 
> I want to insert a due date for payments in my invoice and I would like
> to calculate it from \currentdate. Something like
> 
> define \duedate = \currentdate plus 10 days
> 
> Is this possible?

Hi Jan-Ulrich,

if you don’t mind using Lua, here you have it:

\starttext
\def\duedate{\cldcontext{os.date('\letterpercent d/\letterpercent
m/\letterpercent Y', os.time()+ 10 * 24 * 3600)}}

\duedate
\stoptext

Just in case it helps,

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

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

Re: [NTG-context] referencing a footnote (and getting the right number)

2018-08-13 Thread Pablo Rodriguez
On 08/12/2018 10:10 PM, Robert Zydenbos wrote:
> [...] 
> What does disturb me, however, is that I have this one chapter where
> the wrong note number is indicated (note 19 is referred to as note
> '18'), and I do not know why. Could it be that this is because earlier
> in the chapter I have also used

I wasn’t able to compile your source, but this works fine:

\starttext
\dorecurse{30}{a\footnote{Zapf.} }

\startlocalfootnotes[n=0,conversion=characters,location=none]
\bTABLE
\bTR \bTD 1 \footnote{\dorecurse{10}{abcd }} \eTD \bTD 2 \eTD \eTR
\bTR \bTD 3 4 5 6 7 8 9 \eTD \bTD 10 \eTD \eTR
\eTABLE
\placelocalfootnotes
\stoplocalfootnotes

\dorecurse{30}{e\footnote{Other.} }
\footnote[uvu-avu]{These two suffixes […]}
\dorecurse{30}{b\footnote{Knuth.} }
…
\footnote{See n.~\in[uvu-avu] on p.~\at[uvu-avu].}
\stoptext

> and that this somehow interferes with the referencing of other
> footnotes? That is the only difference I see between this chapter and
> the others.

Without the source, all I can say is that it shouldn’t interfere.

A simple way to check it would be to comment out the fragment with the
local footnotes, compile and see what happens with the referenced number.

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

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

[NTG-context] date calculated with currentdate plus n days

2018-08-13 Thread Jan U. Hasecke
Hi all,

I want to insert a due date for payments in my invoice and I would like
to calculate it from \currentdate. Something like

define \duedate = \currentdate plus 10 days

Is this possible?

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

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

Re: [NTG-context] Enumerations in an environment

2018-08-13 Thread Wolfgang Schuster



Fabrice Couvreur schrieb am 13.08.18 um 12:35:

Hello,
How to have :

Démonstration --- 1.one
2.two
3.three

Thanks
Fabrice

\defineenumeration
[proof]
  [text=Démonstration,
   alternative=serried,
number=no,
   headcommand=\groupedcommand{}{~---~},
headstyle=bolditalic,
   %headcommand=\groupedcommand{}{:\,},
width=broad,
   closesymbol={\symbol[square]}]

\starttext

\startproof
\startitemize[n]
   \item one
   \item two
   \item three
\stopitemize
 \stopproof


\startproof
  \startitemize[n,text][lefttext=,righttext=]
  \item one\par
  \item two\par
  \item three
  \stopitemize
\stopproof

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

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

Re: [NTG-context] How can I remove a blank leading line from a buffer

2018-08-13 Thread Rik Kabel

On 8/13/2018 03:01, Hans Hagen wrote:

On 8/13/2018 5:18 AM, Rik Kabel wrote:

%% How can one remove blank lines at the start of a buffer so that
%%   commands that grab a buffer can be used in the same way as, for
%%   example, \startparagraph...\stopparagraph, which allow blank
%%   lines around the content?
%%
%% The problem appears when an optional argument is allowed but none
%%   is provided. Adding \relax does not help; adding empty brackets
%%   does. I see no way to distinguish between a buffer without
%%   leading blank lines and a buffer that was created when brackets
%%   are provided.
%%
%% \inlinebuffer handles the leading blank lines when there is
%%   nothing prepended, but I need to prepend. (It also handles the
%%   unwanted trailing line, but that is not an issue here).
%%
%% How can I unpack the buffer, apply the equivalent functions of
%%   ignorespaspaces and removeunwantedspaces to it, and repack it?
%%   The buffer may contain internal blank lines and macros, and
%%   those should be retained. Or, is there already a function to
%%   strip a buffer in the manner that string.strip does a string?

\setupwhitespace[none]
\setupindenting[none]
\define\Mark{\color[middlegray]{\itb¿\ }}
\define\First{nothing yet}
\define\Arg{nothing yet}
\setuplanguage[en][spacing=packed]

\starttexdefinition unexpanded startBufTest
   \bgroup
   \dosingleempty\dostartBufTest
\stoptexdefinition

\starttexdefinition dostartBufTest [#SETUPS]
   \doifsomethingelse{#{SETUPS}}
 {\define\Arg{yes}}
 {\define\Arg{no}}
   \iffirstargument
 \define\First{yes}
   \else
 \define\First{no}
   \fi
   \relax
   \getrawparameters[BufTest][xx=yy,#SETUPS]
   \grabbufferdata[TestBuffer][startBufTest][stopBufTest]
\stoptexdefinition

\starttexdefinition stopBufTest

   \startparagraph

 \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer]
 \ (first: \First, arg: \Arg)

   \stopparagraph

   \egroup
\stoptexdefinition

\starttext

\startparagraph

   A starting paragraph.

\stopparagraph

\startBufTest
   Buffer without blank lines.
\stopBufTest

\startparagraph

   An intervening paragraph.

\stopparagraph

\startBufTest

   Buffer with blank lines.

\stopBufTest

\startparagraph

   An intervening paragraph.

\stopparagraph

\startBufTest\relax

   Buffer with \tex{relax}.

\stopBufTest

\startparagraph

   An intervening paragraph.

\stopparagraph

\startBufTest[]

   Buffer with \type{[]}.

\stopBufTest

\startparagraph

   An intervening paragraph.

\stopparagraph

\startBufTest[key=value]

   Buffer with \type{[key=value]}.

\stopBufTest

\startparagraph

   A closing paragraph.

\stopparagraph

\stoptext


  \startparagraph

% \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer]
% \ (first: \First, arg: \Arg)

    \margintext{\Mark}

    \setupparagraphintro[first][(first: \First, arg: \Arg)]
   %\setupparagraphintro[next][(first: \First, arg: \Arg)]

    \getbuffer[TestBuffer]

  \stopparagraph 


Hans,

That works for the over-simplified case here, but fails in practice. For 
a \startnarrower[left] paragraph, the mark is still in the main margin, 
not the 'margin' of the narrowed paragraph. Also, the placement of the 
text in the margin is wrong and not easily controlled as with \llap and 
\rlap. The code started out more like:


   \define\Mark{\color[middlegray]{\hskip.6cm\itb¿\ }}
   \setwidthof{\Mark}\to\MarkWidth
   ...
   \starttexdefinition stopBufTest
  \startluacode
   buffers.prepend("TestBuffer","\\dontleavehmode\\llap{\\Mark}")
  \stopluacode
  \setupnarrower[left=\MarkWidth]
  \startnarrower[left,right]
  \startparagraph
    \inlinebuffer[TestBuffer]
  \stopparagraph
  \stopnarrower
  \egroup
   \stoptexdefinition


So I am still looking for a way to do this. Meanwhile I am trying to 
understand Aditya's examples.


--
Rik

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

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

[NTG-context] Enumerations in an environment

2018-08-13 Thread Fabrice Couvreur
Hello,
How to have :

Démonstration --- 1.one
2.two
3.three

Thanks
Fabrice

\defineenumeration
  [proof]
  [text=Démonstration,
   alternative=serried,
   number=no,
   headcommand=\groupedcommand{}{~---~},
   headstyle=bolditalic,
   %headcommand=\groupedcommand{}{:\,},
   width=broad,
   closesymbol={\symbol[square]}]

\starttext

\startproof
   \startitemize[n]
   \item one
   \item two
   \item three
   \stopitemize
 \stopproof

\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] How can I remove a blank leading line from a buffer

2018-08-13 Thread Hans Hagen

On 8/13/2018 5:46 AM, Henri Menke wrote:


% Ignore first \par
\def\par{\let\par\normalpar}
Sort of dangerous ... redefining such core commands or primitives can 
have side effects as one never knows what explicit \par's are issued.


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] How can I remove a blank leading line from a buffer

2018-08-13 Thread Hans Hagen

On 8/13/2018 5:18 AM, Rik Kabel wrote:

%% How can one remove blank lines at the start of a buffer so that
%%   commands that grab a buffer can be used in the same way as, for
%%   example, \startparagraph...\stopparagraph, which allow blank
%%   lines around the content?
%%
%% The problem appears when an optional argument is allowed but none
%%   is provided. Adding \relax does not help; adding empty brackets
%%   does. I see no way to distinguish between a buffer without
%%   leading blank lines and a buffer that was created when brackets
%%   are provided.
%%
%% \inlinebuffer handles the leading blank lines when there is
%%   nothing prepended, but I need to prepend. (It also handles the
%%   unwanted trailing line, but that is not an issue here).
%%
%% How can I unpack the buffer, apply the equivalent functions of
%%   ignorespaspaces and removeunwantedspaces to it, and repack it?
%%   The buffer may contain internal blank lines and macros, and
%%   those should be retained. Or, is there already a function to
%%   strip a buffer in the manner that string.strip does a string?

\setupwhitespace[none]
\setupindenting[none]
\define\Mark{\color[middlegray]{\itb¿\ }}
\define\First{nothing yet}
\define\Arg{nothing yet}
\setuplanguage[en][spacing=packed]

\starttexdefinition unexpanded startBufTest
   \bgroup
   \dosingleempty\dostartBufTest
\stoptexdefinition

\starttexdefinition dostartBufTest [#SETUPS]
   \doifsomethingelse{#{SETUPS}}
     {\define\Arg{yes}}
     {\define\Arg{no}}
   \iffirstargument
     \define\First{yes}
   \else
     \define\First{no}
   \fi
   \relax
   \getrawparameters[BufTest][xx=yy,#SETUPS]
   \grabbufferdata[TestBuffer][startBufTest][stopBufTest]
\stoptexdefinition

\starttexdefinition stopBufTest

   \startparagraph

     \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer]
     \ (first: \First, arg: \Arg)

   \stopparagraph

   \egroup
\stoptexdefinition

\starttext

\startparagraph

   A starting paragraph.

\stopparagraph

\startBufTest
   Buffer without blank lines.
\stopBufTest

\startparagraph

   An intervening paragraph.

\stopparagraph

\startBufTest

   Buffer with blank lines.

\stopBufTest

\startparagraph

   An intervening paragraph.

\stopparagraph

\startBufTest\relax

   Buffer with \tex{relax}.

\stopBufTest

\startparagraph

   An intervening paragraph.

\stopparagraph

\startBufTest[]

   Buffer with \type{[]}.

\stopBufTest

\startparagraph

   An intervening paragraph.

\stopparagraph

\startBufTest[key=value]

   Buffer with \type{[key=value]}.

\stopBufTest

\startparagraph

   A closing paragraph.

\stopparagraph

\stoptext


  \startparagraph

% \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer]
% \ (first: \First, arg: \Arg)

\margintext{\Mark}

\setupparagraphintro[first][(first: \First, arg: \Arg)]
   %\setupparagraphintro[next][(first: \First, arg: \Arg)]

\getbuffer[TestBuffer]

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