[NTG-context] Is the Society of Biblical Literature (SBL) style files for ConTeXt incompatible with \setupinteraction[state=start]?

2023-01-15 Thread Joel via ntg-context
When I am using the SBL ConTeXt files for citations, if I add a line 
`\setupinteraction[state=start` my code starts complaining:
Undefined control sequence \currentbtxloctext 

 \16>:btx:sbl:cite:inline 
    #1->\fastsetup {\s!btx :\s!cite :concat}\fastsetup 
{btx:sbl:cite:lefttext}\begingroup \letbtxparameter {punct}\empty \def 
\currentbtxcitealternative {inline}\def \currentbtxcategory {\btxfield 
{category}}\def \currentbtxloctext 
    {\btxparameter {loctex
 \normalexpanded 
    \Word {\fastsetup {btx:sbl:cite:inline}
    }\doif {\btxparameter {righttext}}{\empty } {\btxperiod }
 \strc_constructions_register_yes 

...
Is this package incompatible with interaction?
--Joel
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] \jobname and \doifelse

2022-11-06 Thread Pablo Rodriguez via ntg-context
On 11/5/22 16:55, Wolfgang Schuster via ntg-context wrote:
> Pablo Rodriguez via ntg-context schrieb am 05.11.2022 um 16:30:
>>
>>\doifelse{\jobname}{a}
>>  {yes}{no}
>>
>> I get "no" as in TeX and "yes" with Lua, being "a.tex" the source file.
>>
>> The TeX conditional used to work before.
>>
> Are you sure the check worked in the past?

Many thanks for your reply, Wolfgang.

I thought this used to work before.

Now I realize I have to check the use of \doif{\jobname} and
\doifelse{\jobname} in all my documents.

> The content of \jobname has catcode 12 while you "a" you check against 
> has catcode 11, and even when \jobname result in "a" they are different 
> because the catcodes differ.

I see now. Not that I fully understand what catcodes are, but
\doifsamestringelse should be what I have used here (as suggested in
https://wiki.contextgarden.net/System_Macros/Branches_and_Decisions#.5Cdoifsamestringelse.2C.5Cdoifsamestring.2C.5Cdoifnotsamestring).

Just a final question: \doif compares both strings and catcodes and
\doifsamestring compares only strings. Or am I missing something here too.

Many thanks for your help,

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

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


Re: [NTG-context] error with sbl bibliography on latest LMTX

2022-07-09 Thread Joey McCollum via ntg-context
Sorry, these are definitely errors on my part. The first one ("invalid
parent sbl:list:title:unpublished for sbl:list:title:thesis,
sbl:list:title:unpublished defined too") was thankfully an easy fix; I just
had to move \definebtx[sbl:\s!list:title:unpublished] before
\definebtx[sbl:\s!list:title:thesis]. I've now pushed this change to the
repo at https://github.com/jjmccollum/context-sbl.

The second error ("Undefined control sequence \currentbtxloctext") is
unfortunately more puzzling. In an effort to preserve backward
compatibility with biblatex usage, I focused on implementing citations in
the SBL style using \autocite, \inlinecite, \parencite, and \footcite
commands, and I neglected to see if the ConTeXt \cite command would work as
expected.

The \currentbtxloctext macro is used for handling more complicated
situations regarding volume, part, page number, etc. citations; for the
purposes of your MWE (and for most citations) a righttext with the page
number citation should also work just fine, so the lack of a loctext
parameter in the \cite command shouldn't be a problem. The
\currentbtxloctext macro is defined in most of the btx:sbl:cite setups in
publ-imp-sbl.mkvi, always via the command

```
\def\currentbtxloctext{\btxparameter{loctext}}
```

The default value of this parameter and similar ones should be \empty, per
the \definebtx[sbl] command in publ-imp-sbl.mkvi:

```
\definebtx
  [sbl]
  [
  ...
  lefttext=\empty, % empty by default
  altloctext=\empty, %empty by default
  loctext=\empty, %empty by default
  righttext=\empty, % empty by default
  punct=\empty, % trailing punctuation (empty by default)
  ...
  ]
```

If I've coded this correctly, then the loctext parameter should default to
\empty when you do not specify it for your \cite command. This seems to be
the case when you first invoke the \cite command (i.e., in the
btx:sbl:cite:footnote setup).

Here is the problem: if you invoke the btx:sbl:cite:inline setup from
inside the btx:sbl:cite:footnote setup, it seems that the loctext parameter
is no longer accessible, and thus, it does not get defined. If I patch the
btx:sbl:cite:footnote setup as follows, then I no longer get the "Undefined
control sequence \currentbtxloctext" error:

```
% Inline footnote citation setup (with intelligent trailing punctuation
replacement)
\startsetups btx:sbl:cite:footnote
  \removeunwantedspaces

\doifinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
  \begingroup
  \letbtxparameter{punct}\empty % don't pass the trailing punctuation down
to the inline setup
  \let\doifendswithpunctelse\btx_sbl_doifendswithpunctelse % why is this
necessary? For some reason, \btx_sbl_doifendswithpunctelse is not
recognized within the footnote environment...
  \def\currentbtxcitealternative{footnote}
  \def\currentbtxcategory{\btxfield{category}}
  \def\currentbtxloctext{\btxparameter{loctext}}
  \def\currentbtxaltloctext{\btxparameter{altloctext}}
  \startfootnote
\Word{\fastsetup{btx:sbl:cite:inline}}% capitalize the first word in
the footnote (needed to render "Ibid." and "Idem" correctly)
% Add a closing period if there is no righttext
\doif{\btxparameter{righttext}}{\empty} {
  \btxperiod
}
  \stopfootnote
  \endgroup

\doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
\stopsetups
```

But I still get errors involving other macros that now appear to be
undefined—specifically, the \btxsblshorthandbeforeloctext macro (and,
likely, the \btxsblvolumebeforeloctext macro, as well). These are initially
defined as "no" in the SBL style module outside of the various citation
alternative setups, but they are conditionally redefined as "yes" in these
setups based on specific information in the bibliographic entry.

This pattern suggests a bigger problem. Do these variables and the \cite
parameters fall out of scope when we enter a footnote environment inside a
setup? In my code, I noticed that a macro defined outside of the
btx:sbl:cite:footnote setup was unrecognized within the footnote
environment unless I freshly redefined it:

```
\let\doifendswithpunctelse\btx_sbl_doifendswithpunctelse % why is this
necessary? For some reason, \btx_sbl_doifendswithpunctelse is not
recognized within the footnote environment...
```

Meanwhile, if I change the default citation alternative to "inline" or
"paren", then everything works:

```

\usebtxdataset[default][references.bib]

\setupbtx[dataset=default]

\usebtxdefinitions[sbl]

\setupbtx[sbl:cite][alternative=paren] % or alternative=inline

\setupinteraction[state=start]


\starttext


superior typographic output \cite[lefttext={e.g.}][taraborelli:beauty].


Therefore, the {\TEX}book mentions that the word

\quotation{shel\noligature{ff}ul} should indeed be rendered without the

ff-ligature \cite[righttext={p.~19}][knuth:texbook].


\placelistofpublica

[NTG-context] error with sbl bibliography on latest LMTX

2022-07-08 Thread Henning Hraban Ramm via ntg-context

Hi Joel (et al.),

I tried the SBL bibliography setup with the latest LMTX; the example and 
bib database are from Dennis’ article on ligatures in the upcoming CG 
journal:


"""
\usebtxdataset[default][references.bib]
\setupbtx[dataset=default]
\usebtxdefinitions[sbl]
\setupinteraction[state=start]

\starttext

superior typographic output \cite[lefttext={e.g.}][taraborelli:beauty].

Therefore, the {\TEX}book mentions that the word 
\quotation{shel\noligature{ff}ul} should indeed be rendered without the 
ff-ligature  \cite[righttext={p.~19}][knuth:texbook].


\placelistofpublications%[numbering=yes]

\stoptext
"""

Unfortunately, I get some errors, while it works with APS and APA:

-- invalid parent sbl:list:title:unpublished for sbl:list:title:thesis, 
sbl:list:title:unpublished defined too (best check it)

-- Undefined control sequence \currentbtxloctext

I installed your files in TEXMFHOME, and apparently, ConTeXt can find 
them. Here’s the shortened log:


system  > ConTeXt  ver: 2022.05.11 11:36 LMTX  fmt: 2022.7.4 
int: english/english

...
open source > level 1, order 2, name './bibtest.tex'
publications> adding bib data to set 'default' from source 
'references.bib'
open source > level 2, order 3, name 
'/Users/hraban/texmf/context/context-sbl/tex/publ-imp-sbl.mkvi'
system  > error: invalid parent sbl:list:title:unpublished for 
sbl:list:title:thesis, sbl:list:title:unpublished defined too (best 
check it)
close source> level 2, order 3, name 
'/Users/hraban/texmf/context/context-sbl/tex/publ-imp-sbl.mkvi'

...
publications> analyzing previous publication run for 'default'
tex error   > tex error on line 34 in file ./bibtest.tex: Undefined 
control sequence \currentbtxloctext


 \22>:btx:sbl:cite:inline
#1->\fastsetup {\s!btx :\s!cite :concat}\fastsetup 
{btx:sbl:cite:lefttext}\begingroup \letbtxparameter {punct}\empty \def 
\currentbtxcitealternative {inline}\def \currentbtxcategory {\btxfield 
{category}}\def \currentbtxloctext

{\btxparameter {loctex
 \normalexpanded
\Word {\fastsetup {btx:sbl:cite:inline}
}\doif {\btxparameter {righttext}}{\empty } {\btxperiod }
 \strc_constructions_register_yes
...constructionparameter \c!referencetext }\iflocation \ifempty 
\currentconstructionbookmark \begingroup \simplifycommands \xdef 
\currentconstructionbookmark {\detokenize \expandafter {\normalexpanded 
{\constructionparameter \c!title

}}}\endgroup  ...
 \strc_notations_start_reference_indeed
[#1]#*#2->\strc_constructions_register [][\c!label 
={\descriptionparameter \c!text },\c!reference ={#1},\c!title 
={#2},\c!bookmark =,\c!list =,\c!referencetext =]

\strc_notations_wrapup
 \22>:btx:sbl:cite:footnote
...ct}}\begingroup \letbtxparameter {punct}\empty \let 
\doifendswithpunctelse \btx_sbl_doifendswithpunctelse \startfootnote 
\Word {\fastsetup {btx:sbl:cite:inline}}\doif {\btxparameter 
{righttext}}{\empty } {\btxperiod }\stopfootnote

\endgroup \do ...

 ...


superior typographic output \cite[lefttext={e.g.}][taraborelli:beauty]
.

The control sequence at the end of the top line of your error message 
was never

\def'ed. You can just continue as I'll forget about whatever was undefined.
mtx-context | fatal error: return code: 1


Did I do something wrong, is the database not suitable for SBL, or is it 
a bug?



Hraban


references.bib
Description: application/bibtex
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] XML Namespaces and XML Setups

2022-05-24 Thread Bruce Horrocks via ntg-context
I haven't seen it explicitly documented - my cue to add it to the Wiki I guess!

I work with XML a fair bit and, IMHO, the WWW consortium docs do a very poor 
job of explaining namespaces because they make them seem much more complicated 
than they are. Essentially, a tag with a namespace identifier is just another 
tag i.e. treat all the characters, including the colon, as the tag name. Armed 
with that knowledge I just created a second tag definition in the sample code 
you posted.

> On 24 May 2022, at 09:50, Duncan Hothersall  wrote:
> 
> Yes, it does! Thanks Bruce. Is this documented somewhere already and I missed 
> it?
> 
> Cheers.
> 
> Duncan
> 
> On Mon, 23 May 2022 at 21:14, Bruce Horrocks  wrote:
> Does this help?
> 
> \startxmlsetups xml:demo:base
>   \xmlsetsetup{#1}{tag}{xml:demo:tag}
>   \xmlsetsetup{#1}{o:tag}{xml:demo:otag} %% <---
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
>   \xmlflush{#1}
> \stopxmlsetups
> \startxmlsetups xml:demo:otag   %% <---
>   {\bf \xmlflush{#1}}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> 
>xmlns:o="NameSpaceO">
>   text text
> 
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
> 
> > On 23 May 2022, at 09:07, Duncan Hothersall via ntg-context 
> >  wrote:
> > 
> > I found this unanswered question on the list from November 2020 and find 
> > today that I have the same question. How can one handle elements with the 
> > same name but in different namespaces? How should the different 
> > \startxmlsetups commands be written?
> > 
> > Thanks.
> > 
> > Duncan
> > 
> > On Mon, 16 Nov 2020 at 13:37, Christoph Reller  
> > wrote:
> > Dear List,
> > 
> > Consider the following MWE:
> > 
> > \startxmlsetups xml:demo:base
> >   \xmlsetsetup{#1}{tag}{xml:demo:tag}
> > \stopxmlsetups
> > \xmlregisterdocumentsetup{demo}{xml:demo:base}
> > \startxmlsetups xml:demo:tag
> >   %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
> >   \xmlflush{#1}
> > \stopxmlsetups
> > \starttext
> > \startbuffer[test]
> > 
> >  >   xmlns:o="NameSpaceO">
> >   text text
> > 
> > \stopbuffer
> > \xmlprocessbuffer{demo}{test}{}
> > \stoptext
> > 
> > My questions:
> > - Is there a good way to have a separate XML setup for each XML namespace?
> > - Alternatively, one has to do the distinction within the same XML setup. 
> > In this case, how do we get the complete namespace? (In this example: 
> > "NameSpaceA" and "NameSpaceO")
> > 
> > Thanks in advance for your help!
> > 
> > Cheers, Christoph

—
Bruce Horrocks
Hampshire, UK

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

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


Re: [NTG-context] XML Namespaces and XML Setups

2022-05-24 Thread Duncan Hothersall via ntg-context
Yes, it does! Thanks Bruce. Is this documented somewhere already and I
missed it?

Cheers.

Duncan

On Mon, 23 May 2022 at 21:14, Bruce Horrocks  wrote:

> Does this help?
>
> \startxmlsetups xml:demo:base
>   \xmlsetsetup{#1}{tag}{xml:demo:tag}
>   \xmlsetsetup{#1}{o:tag}{xml:demo:otag} %% <---
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
>   \xmlflush{#1}
> \stopxmlsetups
> \startxmlsetups xml:demo:otag   %% <---
>   {\bf \xmlflush{#1}}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> 
>xmlns:o="NameSpaceO">
>   text text
> 
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
>
> > On 23 May 2022, at 09:07, Duncan Hothersall via ntg-context <
> ntg-context@ntg.nl> wrote:
> >
> > I found this unanswered question on the list from November 2020 and find
> today that I have the same question. How can one handle elements with the
> same name but in different namespaces? How should the different
> \startxmlsetups commands be written?
> >
> > Thanks.
> >
> > Duncan
> >
> > On Mon, 16 Nov 2020 at 13:37, Christoph Reller <
> christoph.rel...@gmail.com> wrote:
> > Dear List,
> >
> > Consider the following MWE:
> >
> > \startxmlsetups xml:demo:base
> >   \xmlsetsetup{#1}{tag}{xml:demo:tag}
> > \stopxmlsetups
> > \xmlregisterdocumentsetup{demo}{xml:demo:base}
> > \startxmlsetups xml:demo:tag
> >   %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
> >   \xmlflush{#1}
> > \stopxmlsetups
> > \starttext
> > \startbuffer[test]
> > 
> >  >   xmlns:o="NameSpaceO">
> >   text text
> > 
> > \stopbuffer
> > \xmlprocessbuffer{demo}{test}{}
> > \stoptext
> >
> > My questions:
> > - Is there a good way to have a separate XML setup for each XML
> namespace?
> > - Alternatively, one has to do the distinction within the same XML
> setup. In this case, how do we get the complete namespace? (In this
> example: "NameSpaceA" and "NameSpaceO")
> >
> > Thanks in advance for your help!
> >
> > Cheers, Christoph
> >
> ___
> > If your question is of interest to others as well, please add an entry
> to the Wiki!
> >
> > maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/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
> >
> ___
>
> —
> Bruce Horrocks
> Hampshire, UK
>
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] XML Namespaces and XML Setups

2022-05-23 Thread Bruce Horrocks via ntg-context
Does this help?

\startxmlsetups xml:demo:base
  \xmlsetsetup{#1}{tag}{xml:demo:tag}
  \xmlsetsetup{#1}{o:tag}{xml:demo:otag} %% <---
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{xml:demo:base}
\startxmlsetups xml:demo:tag
  \xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:demo:otag   %% <---
  {\bf \xmlflush{#1}}
\stopxmlsetups
\starttext
\startbuffer[test]


  text text

\stopbuffer
\xmlprocessbuffer{demo}{test}{}
\stoptext

> On 23 May 2022, at 09:07, Duncan Hothersall via ntg-context 
>  wrote:
> 
> I found this unanswered question on the list from November 2020 and find 
> today that I have the same question. How can one handle elements with the 
> same name but in different namespaces? How should the different 
> \startxmlsetups commands be written?
> 
> Thanks.
> 
> Duncan
> 
> On Mon, 16 Nov 2020 at 13:37, Christoph Reller  
> wrote:
> Dear List,
> 
> Consider the following MWE:
> 
> \startxmlsetups xml:demo:base
>   \xmlsetsetup{#1}{tag}{xml:demo:tag}
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
>   %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
>   \xmlflush{#1}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> 
>xmlns:o="NameSpaceO">
>   text text
> 
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
> 
> My questions:
> - Is there a good way to have a separate XML setup for each XML namespace?
> - Alternatively, one has to do the distinction within the same XML setup. In 
> this case, how do we get the complete namespace? (In this example: 
> "NameSpaceA" and "NameSpaceO")
> 
> Thanks in advance for your help!
> 
> Cheers, Christoph
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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
> ___

—
Bruce Horrocks
Hampshire, UK

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

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


Re: [NTG-context] XML Namespaces and XML Setups

2022-05-23 Thread Duncan Hothersall via ntg-context
I found this unanswered question on the list from November 2020 and find
today that I have the same question. How can one handle elements with the
same name but in different namespaces? How should the different
\startxmlsetups commands be written?

Thanks.

Duncan

On Mon, 16 Nov 2020 at 13:37, Christoph Reller 
wrote:

> Dear List,
>
> Consider the following MWE:
>
> \startxmlsetups xml:demo:base
>   \xmlsetsetup{#1}{tag}{xml:demo:tag}
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
> \startxmlsetups xml:demo:tag
>   %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
>   \xmlflush{#1}
> \stopxmlsetups
> \starttext
> \startbuffer[test]
> 
>xmlns:o="NameSpaceO">
>   text text
> 
> \stopbuffer
> \xmlprocessbuffer{demo}{test}{}
> \stoptext
>
> My questions:
> - Is there a good way to have a separate XML setup for each XML namespace?
> - Alternatively, one has to do the distinction within the same XML setup.
> In this case, how do we get the complete namespace? (In this example:
> "NameSpaceA" and "NameSpaceO")
>
> Thanks in advance for your help!
>
> Cheers, Christoph
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/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] Simple question

2022-05-10 Thread Henning Hraban Ramm via ntg-context

Am 10.05.22 um 00:15 schrieb Gerben Wierda via ntg-context:
What is the easiest way to have a ‘database’ of translations for strings 
and maybe links?


I now have 4 languages and 2 versions so 8 documents, but I’d like to 
have all translatable strings together so I can maintain these in a 
single file. Ideally I can do a file where the key of the translation is 
one language (say English) and the translations are part of that.


Something I can call like this

\translatephrase[English phrase][nl]
\translatelocation[../LMTX-Output/without-ids/en/file.pdf][nl][simple]

and where I can maintain all the translations a bit like this:

\translationentry[English phrase]{
\definetranslatephrase[nl]Nederlandse frase]
\definetranslatephrase[fr][Phrase français]
}
}

\translatelocation[../LMTX-Output/without-ids/en/file.pdf][simple][nl][../LMTX-Output/without-ids/nl/file-simple.pdf]]
\translatelocation[../LMTX-Output/without-ids/en/file.pdf][none][nl][../LMTX-Output/without-ids/nl/file.pdf]]


Where the \translatelocation command can be used inside an 
\externalfigure command and \translatephrase can be used as as text.


In the end I’d like to compile with

context language=fr mode=simple mainfile.tex

Doable?

Gerben Wierda (LinkedIn <https://www.linkedin.com/in/gerbenwierda>)
R IT Strategy <https://ea.rna.nl/> (main site)
Book: Chess and the Art of Enterprise Architecture 
<https://ea.rna.nl/the-book/>

Book: Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>



Hi Gerben,

a lot is doable, it depends on by whom ;)
But this looks like a quite easy case.

Of course the answer is always “Lua tables”, but I guess the 
translations would be most easy to maintain in a CSV file (you can edit 
it in LibreOffice or Excel, while the latter often botches the encoding).


It could look like:

key;en;de;nl
yes;yes;ja;ja
LANG;English;Deutsch;Nederlands

i.e. the first column is the keyword and the other columns contain the 
translated term (so you can also change the “original” version).


(We’re using the same in a LaTeX3 project made by Marei.)

Without researching I assume there are already Lua functions to read a 
CSV file into a Lua table, and the lookup is easy – since I’m not fluent 
in Lua, I won’t provide the function(s) for you.


BTW there is already \translate 
(https://wiki.contextgarden.net/Command/translate) that changes text 
depending on the current language.


And there is the translate module that changes terms within the whole 
text: 
https://source.contextgarden.net/tex/context/modules/mkiv/m-translate.mkiv


Other options like .po files might be more versatile but also much more 
involved.


This covers \translatephrase; for your figures I’d just just a language 
variable in the path, like \externalfigure[images/\LANG/cow.pdf]

If this is always the current language, use \currentlanguage.
You can also setup the language dependent directory in 
\setupexternalfigures.


Regarding modes, the current language is set as a system mode (*en, 
*nl), and of course you can query modes with one of the many \doif 
macros. (https://wiki.contextgarden.net/Modes)
Since it doesn’t make sense to try 
\externalfigure[path/\currentmode/cow] (you never know how many modes 
are active), you can set a macro or variable depending on a mode:


\doifmode{simple}{\setvariable{gerben}{level}{simple}}
and then
\externalfigure[images/\getvariable{gerben}{level}/\currentlanguage/cow]

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

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


Re: [NTG-context] XML processing instructions

2022-05-03 Thread Duncan Hothersall via ntg-context
Just following up on my own question in case anybody else is interested, I
realised that the logic of my preprocessor code wasn't the problem, it was
just my ignorance of lua and character escaping. Both ? and * are special
characters in string.gsub expressions, so they need to be escaped with the
lua escape character which is % (which sends my editor haywire because it
thinks I am putting in a TeX comment, but never mind!).

So my now working code to translate historic processing instructions into
directives without a separate pass is:

\startluacode
function lxml.preprocessor(data)
 data = string.gsub(data, '<%?capdm %*force_line_stop%?>',
'')
 return data
end
\stopluacode

\startsetups xml:directive:injector:newline
 \crlf
\stopsetups

Duncan

On Mon, 2 May 2022 at 09:24, Duncan Hothersall  wrote:

> Many thanks Denis. Very useful tip on the injectors and generalised
> command usage. That will definitely come in useful.
>
> My problem is that I already have a lot of XML data with the existing
> processing instructions in it. I know I could use an external preprocess in
> something like Python to change them into injectors before they are fed
> into ConTeXt, but I was hoping there was a way to handle them directly as
> part of the ConTeXt / lua process.
>
> Thanks again though.
>
> Duncan
>
>
>
>
> On Mon, 2 May 2022, 08:48 ,  wrote:
>
>> That was too quick, sorry.
>>
>>
>>
>> Hi Duncan,
>>
>>
>>
>> I have used context’s own injectors for this :
>>
>>
>>
>> 
>>
>>
>>
>> \startsetups xml:directive:injector:addlinetopage
>>
>>   \adaptlayout[lines=+1]
>>
>> \stopsetups
>>
>>
>>
>> Or, for your line break example :
>>
>>
>>
>> 
>>
>>
>>
>> \startsetups xml:directive:injector:newline
>>
>>   \crlf
>>
>> \stopsetups
>>
>>
>>
>> Also, I have learned that you can just use arbitrary context code in xml:
>>
>>
>>
>> \def\xmltexdirective#1#2{\doif{#1}{command}{#2}}
>>
>>
>>
>> \xmlinstalldirective{tex}{xmltexdirective}
>>
>>
>>
>>  
>>
>>  
>>
>>  
>>
>>
>>
>> Best,
>>
>> Denis
>>
>>
>>
>> *Von:* Maier, Denis Christian (UB)
>> *Gesendet:* Montag, 2. Mai 2022 09:45
>> *An:* 'mailing list for ConTeXt users' 
>> *Cc:* Duncan Hothersall 
>> *Betreff:* AW: [NTG-context] XML processing instructions
>>
>>
>>
>>
>>
>> *Von:* ntg-context  *Im Auftrag von *Duncan
>> Hothersall via ntg-context
>> *Gesendet:* Montag, 2. Mai 2022 09:20
>> *An:* mailing list for ConTeXt users 
>> *Cc:* Duncan Hothersall 
>> *Betreff:* [NTG-context] XML processing instructions
>>
>>
>>
>> I have a big set of existing XML books (held in a derivative of DocBook)
>> which I'm looking to start processing directly with ConTeXt. (Up to now I
>> have a system which converts the XML into ConTeXt code which is then
>> processed, but this is inefficient and lots of the code is now unsupported.)
>>
>>
>>
>> I've had some success producing output, but my first real sticking point
>> has come with processing instructions. The existing XML contains lots of
>> processing instructions of the form
>>
>> , some of which can be conditional and introduce new
>> data etc. But I'd be happy at this stage if I could just process the most
>> basic one of them, which is used to introduce a line stop in a running
>> paragraph of text.
>>
>>
>>
>> My best guess at how to do this was to use the lxml.preprocessor function
>> to convert the processing instruction into an element, and then process the
>> element as normal. But (a) my attempt didn't work, and (b) there may
>> well be a better way.
>>
>>
>>
>> Minimal working example below, except that obviously the processing
>> instruction bit doesn't work!
>>
>>
>>
>> Thanks for any help or insights.
>>
>>
>>
>> Duncan
>>
>>
>>
>>
>>
>> MWE:
>>
>> --
>>
>>
>>
>> \startbuffer[demo]
>> 
>>   A paragraph witha processing
>> instruction.
>> 
>> \stopbuffer
>>
>> \startxmlsetups xml:demo:base
>>  \xmlsetsetup{#1}{*}{xml:demo:*}
>> \stopxmlsetups
>> \xmlregisterdocumentsetup{demo}{xml:demo:base}
>>
>> \startxmlsetups xml:demo:book
>>  \xmlflush{#1}
>

Re: [NTG-context] XML processing instructions

2022-05-02 Thread Duncan Hothersall via ntg-context
Many thanks Denis. Very useful tip on the injectors and generalised command
usage. That will definitely come in useful.

My problem is that I already have a lot of XML data with the existing
processing instructions in it. I know I could use an external preprocess in
something like Python to change them into injectors before they are fed
into ConTeXt, but I was hoping there was a way to handle them directly as
part of the ConTeXt / lua process.

Thanks again though.

Duncan




On Mon, 2 May 2022, 08:48 ,  wrote:

> That was too quick, sorry.
>
>
>
> Hi Duncan,
>
>
>
> I have used context’s own injectors for this :
>
>
>
> 
>
>
>
> \startsetups xml:directive:injector:addlinetopage
>
>   \adaptlayout[lines=+1]
>
> \stopsetups
>
>
>
> Or, for your line break example :
>
>
>
> 
>
>
>
> \startsetups xml:directive:injector:newline
>
>   \crlf
>
> \stopsetups
>
>
>
> Also, I have learned that you can just use arbitrary context code in xml:
>
>
>
> \def\xmltexdirective#1#2{\doif{#1}{command}{#2}}
>
>
>
> \xmlinstalldirective{tex}{xmltexdirective}
>
>
>
>  
>
>  
>
>  
>
>
>
> Best,
>
> Denis
>
>
>
> *Von:* Maier, Denis Christian (UB)
> *Gesendet:* Montag, 2. Mai 2022 09:45
> *An:* 'mailing list for ConTeXt users' 
> *Cc:* Duncan Hothersall 
> *Betreff:* AW: [NTG-context] XML processing instructions
>
>
>
>
>
> *Von:* ntg-context  *Im Auftrag von *Duncan
> Hothersall via ntg-context
> *Gesendet:* Montag, 2. Mai 2022 09:20
> *An:* mailing list for ConTeXt users 
> *Cc:* Duncan Hothersall 
> *Betreff:* [NTG-context] XML processing instructions
>
>
>
> I have a big set of existing XML books (held in a derivative of DocBook)
> which I'm looking to start processing directly with ConTeXt. (Up to now I
> have a system which converts the XML into ConTeXt code which is then
> processed, but this is inefficient and lots of the code is now unsupported.)
>
>
>
> I've had some success producing output, but my first real sticking point
> has come with processing instructions. The existing XML contains lots of
> processing instructions of the form
>
> , some of which can be conditional and introduce new
> data etc. But I'd be happy at this stage if I could just process the most
> basic one of them, which is used to introduce a line stop in a running
> paragraph of text.
>
>
>
> My best guess at how to do this was to use the lxml.preprocessor function
> to convert the processing instruction into an element, and then process the
> element as normal. But (a) my attempt didn't work, and (b) there may well
> be a better way.
>
>
>
> Minimal working example below, except that obviously the processing
> instruction bit doesn't work!
>
>
>
> Thanks for any help or insights.
>
>
>
> Duncan
>
>
>
>
>
> MWE:
>
> --
>
>
>
> \startbuffer[demo]
> 
>   A paragraph witha processing
> instruction.
> 
> \stopbuffer
>
> \startxmlsetups xml:demo:base
>  \xmlsetsetup{#1}{*}{xml:demo:*}
> \stopxmlsetups
> \xmlregisterdocumentsetup{demo}{xml:demo:base}
>
> \startxmlsetups xml:demo:book
>  \xmlflush{#1}
> \stopxmlsetups
>
> \startxmlsetups xml:demo:para
>  \xmlflush{#1}\endgraf
> \stopxmlsetups
>
> \startluacode
>  function lxml.preprocessor(data,settings)
>   return string.find(data,"")
>and string.gsub(data," *force_line_stop?>","")
>or data
>  end
> \stopluacode
>
> \startxmlsetups xml:demo:capdmlinestop
>  \crlf
>  \xmlflush{#1}
> \stopxmlsetups
>
> \setupbodyfont[modern]
> \starttext
> \xmlprocessbuffer{demo}{demo}{}
> \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] XML processing instructions

2022-05-02 Thread Denis Maier via ntg-context
That was too quick, sorry.

Hi Duncan,

I have used context’s own injectors for this :



\startsetups xml:directive:injector:addlinetopage
  \adaptlayout[lines=+1]
\stopsetups

Or, for your line break example :



\startsetups xml:directive:injector:newline
  \crlf
\stopsetups

Also, I have learned that you can just use arbitrary context code in xml:

\def\xmltexdirective#1#2{\doif{#1}{command}{#2}}

\xmlinstalldirective{tex}{xmltexdirective}

 
 
 

Best,
Denis

Von: Maier, Denis Christian (UB)
Gesendet: Montag, 2. Mai 2022 09:45
An: 'mailing list for ConTeXt users' 
Cc: Duncan Hothersall 
Betreff: AW: [NTG-context] XML processing instructions


Von: ntg-context 
mailto:ntg-context-boun...@ntg.nl>> Im Auftrag von 
Duncan Hothersall via ntg-context
Gesendet: Montag, 2. Mai 2022 09:20
An: mailing list for ConTeXt users 
mailto:ntg-context@ntg.nl>>
Cc: Duncan Hothersall mailto:d...@capdm.com>>
Betreff: [NTG-context] XML processing instructions

I have a big set of existing XML books (held in a derivative of DocBook) which 
I'm looking to start processing directly with ConTeXt. (Up to now I have a 
system which converts the XML into ConTeXt code which is then processed, but 
this is inefficient and lots of the code is now unsupported.)

I've had some success producing output, but my first real sticking point has 
come with processing instructions. The existing XML contains lots of processing 
instructions of the form
, some of which can be conditional and introduce new data 
etc. But I'd be happy at this stage if I could just process the most basic one 
of them, which is used to introduce a line stop in a running paragraph of text.

My best guess at how to do this was to use the lxml.preprocessor function to 
convert the processing instruction into an element, and then process the 
element as normal. But (a) my attempt didn't work, and (b) there may well be a 
better way.

Minimal working example below, except that obviously the processing instruction 
bit doesn't work!

Thanks for any help or insights.

Duncan


MWE:
--

\startbuffer[demo]

  A paragraph witha processing 
instruction.

\stopbuffer

\startxmlsetups xml:demo:base
 \xmlsetsetup{#1}{*}{xml:demo:*}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{xml:demo:base}

\startxmlsetups xml:demo:book
 \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:demo:para
 \xmlflush{#1}\endgraf
\stopxmlsetups

\startluacode
 function lxml.preprocessor(data,settings)
  return string.find(data,"")
   and string.gsub(data,"","")
   or data
 end
\stopluacode

\startxmlsetups xml:demo:capdmlinestop
 \crlf
 \xmlflush{#1}
\stopxmlsetups

\setupbodyfont[modern]
\starttext
\xmlprocessbuffer{demo}{demo}{}
\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] Why are endnotes not working with ConTeXt-SBL?

2021-12-26 Thread Joey McCollum via ntg-context
This actually seems to be rooted in a more general problem with the
publications support module. Why does invoking the fastsetup for citations
work within the default footnote setup, but not within endnotes flushed via
\placenotes[footnote]? If I modify the original MWE to use ConTeXt's
default btx rendering, I get the same error:

```
\startbuffer [bib]

@Book{clark1989,
author = {Clark, William},
title = {Railroads \word{and} railroad towns \word{in} New Mexico},
publisher = {New Mexico Magazine},
year = {1989},
address = {Albuquerque, New Mexico},
isbn = {9780937206126}
}

\stopbuffer

\usebtxdataset[bib.buffer]

\setupbtx[dataset=default]

\setupnote[footnote][location=none] % commenting out this line will produce
footnotes that expand the citation correctly

\starttext

   \input knuth
\cite[alternative=footnote][clark1989]
\page
\placenotes[footnote]

\startchapter[title=Bibliography]
\placelistofpublications
\stopchapter

\stoptext
```

If it helps, the relevant code in publications support is the following
block in publ-imp-cite.mkvi:

```
\startsetups \s!btx:\s!cite:footnote
\startfootnote
\fastsetup{btx:cite:entry}
\stopfootnote
\stopsetups
```

The \fastsetup{btx:cite:entry} doesn't expand to anything if the footnote
is flushed as an endnote via \placenotes[footnote]. Does anyone have any
idea why this happens and how to fix it?

Joey

On Sat, Dec 25, 2021 at 3:34 PM Joey McCollum 
wrote:

> A reasonable solution for the time being would be to check if the
> righttext argument is empty, and add a final period in the footnote only if
> it is not (with the assumption being that the user would provide
> punctuation in any righttext for footnote/endnote citations). I've pushed
> the following change to the GitHub repo, if you'd like to pull and use it:
>
> ```
> % Inline footnote citation setup (with intelligent trailing punctuation
> replacement)
> \startsetups btx:sbl:cite:footnote
>   \removeunwantedspaces
>
> \doifinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
>   \begingroup
>   \letbtxparameter{punct}\empty % don't pass the trailing punctuation down
> to the inline setup
>   \startfootnote
> \Word{\fastsetup{btx:sbl:cite:inline}}% capitalize the first word in
> the footnote (needed to render "Ibid." and "Idem" correctly)
> % Add a closing period if there is no righttext
> \doif{\btxparameter{righttext}}{\empty} {
>   \btxperiod
> }
>   \stopfootnote
>   \endgroup
>
> \doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
> \stopsetups
> ```
>
> This should allow your script to compile, but unfortunately, it doesn't
> seem to make endnotes work, at least not when I try it. For some reason,
> the macro \Word{\fastsetup{btx:sbl:cite:inline}} is expanding to nothing
> inside the \startfootnote ... \stopfootnote environment. I have no idea why
> this is happening, so any ideas are appreciated.
>
> Joey
>
> On Sat, Dec 25, 2021 at 1:11 PM Joey McCollum 
> wrote:
>
>> Joel,
>>
>> You may not have done anything wrong; this may be an issue with
>> ConTeXt-SBL. In my code for the btx:sbl:cite:footnote setup in
>> publ-imp-sbl.mkvi, I added a comment to this effect:
>>
>> ```
>> \startsetups btx:sbl:cite:footnote
>>   \removeunwantedspaces
>>
>> \doifinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
>>   \begingroup
>>   \letbtxparameter{punct}\empty % don't pass the trailing punctuation
>> down to the inline setup
>>   \let\doifendswithpunctelse\btx_sbl_doifendswithpunctelse % why is this
>> necessary? For some reason, \btx_sbl_doifendswithpunctelse is not
>> recognized within the footnote environment...
>>   \startfootnote
>> \Word{\fastsetup{btx:sbl:cite:inline}}% capitalize the first word in
>> the footnote (needed to render "Ibid." and "Idem" correctly)
>> % Add a closing period, unless the righttext ends with punctuation
>> \doifendswithpunctelse{\btxparameter{righttext}} {
>>   \removeunwantedspaces
>> } {
>>   \removeunwantedspaces
>>   \btxperiod
>> }
>>   \stopfootnote
>>   \endgroup
>>
>> \doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
>> \stopsetups
>> ```
>>
>> I define the \btx_sbl_doifendswithpunctelse macro earlier in the module.
>> Initially, when I tried to invoke this macro within the \startfootnote ...
>> \stopfootnote environment (to conditionally add a period at the end of a
>> footnote citation if it does not have a righttext ending with p

Re: [NTG-context] Why are endnotes not working with ConTeXt-SBL?

2021-12-25 Thread Joey McCollum via ntg-context
A reasonable solution for the time being would be to check if the
righttext argument is empty, and add a final period in the footnote only if
it is not (with the assumption being that the user would provide
punctuation in any righttext for footnote/endnote citations). I've pushed
the following change to the GitHub repo, if you'd like to pull and use it:

```
% Inline footnote citation setup (with intelligent trailing punctuation
replacement)
\startsetups btx:sbl:cite:footnote
  \removeunwantedspaces

\doifinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
  \begingroup
  \letbtxparameter{punct}\empty % don't pass the trailing punctuation down
to the inline setup
  \startfootnote
\Word{\fastsetup{btx:sbl:cite:inline}}% capitalize the first word in
the footnote (needed to render "Ibid." and "Idem" correctly)
% Add a closing period if there is no righttext
\doif{\btxparameter{righttext}}{\empty} {
  \btxperiod
}
  \stopfootnote
  \endgroup

\doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
\stopsetups
```

This should allow your script to compile, but unfortunately, it doesn't
seem to make endnotes work, at least not when I try it. For some reason,
the macro \Word{\fastsetup{btx:sbl:cite:inline}} is expanding to nothing
inside the \startfootnote ... \stopfootnote environment. I have no idea why
this is happening, so any ideas are appreciated.

Joey

On Sat, Dec 25, 2021 at 1:11 PM Joey McCollum 
wrote:

> Joel,
>
> You may not have done anything wrong; this may be an issue with
> ConTeXt-SBL. In my code for the btx:sbl:cite:footnote setup in
> publ-imp-sbl.mkvi, I added a comment to this effect:
>
> ```
> \startsetups btx:sbl:cite:footnote
>   \removeunwantedspaces
>
> \doifinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
>   \begingroup
>   \letbtxparameter{punct}\empty % don't pass the trailing punctuation down
> to the inline setup
>   \let\doifendswithpunctelse\btx_sbl_doifendswithpunctelse % why is this
> necessary? For some reason, \btx_sbl_doifendswithpunctelse is not
> recognized within the footnote environment...
>   \startfootnote
> \Word{\fastsetup{btx:sbl:cite:inline}}% capitalize the first word in
> the footnote (needed to render "Ibid." and "Idem" correctly)
> % Add a closing period, unless the righttext ends with punctuation
> \doifendswithpunctelse{\btxparameter{righttext}} {
>   \removeunwantedspaces
> } {
>   \removeunwantedspaces
>   \btxperiod
> }
>   \stopfootnote
>   \endgroup
>
> \doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
> \stopsetups
> ```
>
> I define the \btx_sbl_doifendswithpunctelse macro earlier in the module.
> Initially, when I tried to invoke this macro within the \startfootnote ...
> \stopfootnote environment (to conditionally add a period at the end of a
> footnote citation if it does not have a righttext ending with punctuation),
> I got the same error you got, but for \btx_sbl_doifendswithpunctelse. I
> wasn't sure why this was happening, so I tried defining a new
> \doifendswithpunctelse macro. Unfortunately, based on your e-mail, it looks
> like this doesn't actually fix the problem.
>
> Any help from other developers would be appreciated here! Unfortunately, I
> don't have a MWE replicating the problem on hand at the moment.
>
> Joey
>
> On Sat, Dec 25, 2021 at 1:04 PM Joel via ntg-context 
> wrote:
>
>> I am using the ConTeXt-SBL package for citations. I need to move my
>> footnotes to the end of each article.
>>
>> According to the manual, I can suppress the placement of footnotes using
>> two lines of code. I've added these to my minimal working code, placing 
>> \setupnote[footnote][location=none]
>> in the header and \placenotes[footnote] where I want the endnotes to
>> appear. It complains this error:
>>
>> "Undefined control sequence \doifendswithpunctelse"
>>
>> What did I do wrong?
>>
>> --Joel
>>
>> Code follows:
>>
>> \usemodule[publ-imp-sbl]
>> \startbuffer [bib]
>>
>> @Article{na2006,
>> title={Volcanoes \word{of} New Mexico},
>> year={2006},
>> journal={New Mexico Earth Matters},
>> publisher={New Mexico Bureau \word{of} Geology \word{and} Mineral
>> Resources},
>> volume={6},
>> number={1},
>> location={Socorro, New Mexico}
>> }
>>
>> @Book{clark1989,
>> author = {Clark, William},
>> title = {Railroads \word{and} railroad towns \word{in} New Mexico},
>> publisher = {New Mexico Magazine},
>> year = {1989},
>> address = {

Re: [NTG-context] Test for displaying a header

2021-08-28 Thread Wolfgang Schuster via ntg-context

Fabrice,

there is difference between putting something on the first page 
regardless of the number of pages in your document or do something when 
your document contains only a single or more pages.



When you have a header or title which is always placed on the first page 
(but not on the following pages) you have to options.


    1. Check the current page when to header is placed which can be 
done with \doif{\pagenumber}{1}{...}


    2. Disable the header on the first page (\setupheader[state=high]) 
and place your own title as a regular element in the running text.



A case where you have to number the number of total pages is when you 
try to show the page counter in the form "Page x of y" for 2 or more 
pages. In this case you have to check against the value for the total 
number of pages which can be done with 
\doifnot{\totalnumberofpages}{1}{...}.



Below are two examples which show how the header/title placement works.

 start example 1
\startsetups [header]
    \startframed [width=max,height=max]
    First page header
    \stopframed
\stopsetups

\startsetups [footer]
    Page \userpagenumber\ of \lastuserpagenumber
\stopsetups

\setupheadertexts
  [\doif{\pagenumber}{1}{\directsetup{header}}]

\setupfootertexts
  [\doifnot{\totalnumberofpages}{1}{\directsetup{footer}}]

\starttext
\dorecurse{12}{\samplefile{lorem}\par}
\stoptext
 stop example 1

 start example 2
\startsetups [header]
    \setupheader[state=high]
    \startframed [width=max,height=3cm]
    First page header
    \stopframed
    \blank
\stopsetups

\startsetups [footer]
    Page \userpagenumber\ of \lastuserpagenumber
\stopsetups

\setuppagenumbering
  [location=none]

\setupfootertexts
  [\doifnot{\totalnumberofpages}{1}{\directsetup{footer}}]

\starttext

\setup[header]

\dorecurse{12}{\samplefile{lorem}\par}

\stoptext
 stop example 2

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] columnsets messed up

2021-07-04 Thread Henning Hraban Ramm

> Am 02.07.2021 um 14:49 schrieb Henning Hraban Ramm :
> In several articles I get a problem, and I can’t (yet) reproduce it in a MWE:
> 
> The text in a two-column columnset suddenly breaks at the end of a left 
> column, the end is missing.
> 
> Here’s an example PDF:
> https://sedna.fiee.net/f/24d54a952b0243a98775/?dl=1
> 
> What could case that?

Even curioser:

If there isn’t a \page after \stopcolumnset, the second-to-last section 
(subject) disappears and the last one is typeset completely.

(Later:)
Ok, found it:

\def\stopArticle{%
  \par\signArticle
  \doif{\getvariable{CG-Journal}{NOFColumns}}{>1}
  {\stopcolumnset}
  \page
}

--> \stopcolumnset is never executed, since \doif can’t handle ">1". – Did it 
ever or is this a regression?


Hraban

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

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


Re: [NTG-context] Rolling out a pandoc-context publication workflow in an organization

2021-07-02 Thread Hans Hagen

On 7/2/2021 9:38 AM, Jan U. Hasecke wrote:


Am 02.07.21 um 01:07 schrieb Bruce Horrocks:
One option you might try, if your cooperative has a web-server 
available to editors, is to store your own ConTeXt repository. That 
way you can update the LMTX version when you are ready to.


This works because "install.sh" can have a "--server" parameter 
supplied. By default it goes to lmtx.pragma-ade.com/install-lmtx but 
if you were to copy the install-lmtx directory and host the copy on 
your own server at the same path, then you could 'freeze' your LMTX 
version until you were ready to change.



Thanks for this hint.

This might solve one more problem. We would like to pin the installation 
to a version that is known too work.


BTW: Are there plans to use a GitHub repository or an alternative to it? 
As that would ease pinning a bit.

All uploads end up here too alsk kind of an archive:

official: https://bitbucket.org/phg/context-mirror/src/beta/
experimental : https://github.com/mojca/context2

The official oen can be checked out, the experimental one is a 
playground because for quite a while Mojca and I have some ideas for a 
more extensive install on github which would then involve:


-- core context code (with luametatex in source tree too: 
tex/texmf-context in the distribution


-- the minimal set of resources: tex/texmf in the distribution

-- binaries (which is the more complex part)

-- modules: texmf/modules

So, basically several repositories alongside (totaling to the amoutn we 
now have in the zips). We then have doif-it-yourself-zips, the garden 
installer, the lmtx self updater and install-from-github as 
alternatives. I have a sort of proof of concept for it. We looked into 
the binary bit and things have changed a bit over the years so maybe 
it's more doable now.


One of the complications is always that it depends on helper programs:

- zips are easy as all systems have it (ok, some linux distributions 
don't install unzip but one can easily add it)


- the garden install needs a matching rsync (we need to ship on for 
windows and sometimes a mismatch will require an update on other 
platforms); it reminds me that we have to swap the cygwin bins by mingw 
bins; anyway. one problem is that organizations block the port


- the lmtx installer needs a (luametatex) binary which is no big deal; 
it uses http and there might be organizations that demand https and ssl 
keeps evolving so in the long run it can fail to update older 
installations (it anyway means that we need to also ship e.g. curl or 
libcurl (the later works ok for us); no big deal but more work)


- a github install demands that git is installed; that itself is a big 
piece of software (a small git binary for windows is already 200 MB due 
to all the dependencies while actually we only need a stupid fetch); the 
gh binary is still 25M but might be a solution, apart from the fact that 
we then expect users to have a recent bin ... will a 5 year old 
installation update?); of course users can also decide to completely do 
it themselves (check out etc) but for a local project-specific run one 
doesn't want all those gigs


So, each approach has pros and cons, and we need to prevent lock into 
some specific technology.


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] arbitrary context commands in xml file

2021-03-08 Thread denis.maier
Indeed. That's very useful. Thanks!

Von: ntg-context  Im Auftrag von Duncan Hothersall
Gesendet: Montag, 8. März 2021 14:06
An: Hans Hagen 
Cc: mailing list for ConTeXt users 
Betreff: Re: [NTG-context] arbitrary context commands in xml file



On Mon, 8 Mar 2021 at 12:46, Hans Hagen 
mailto:j.ha...@xs4all.nl>> wrote:
> I'd like to second Denis' request for support for XML processing
> instructions to execute ConTeXt code, rather than elements which can
> cause big problems if one is working to a fixed schema. It would be a
> boon to be able to drop in  in an XML source.
one of the things that can already be done ...

\def\xmltexdirective#1#2{\doif{#1}{command}{#2}}

\xmlinstalldirective{tex}{xmltexdirective}

 
 

(the #2 is something without spaces btu one can work around that)

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] arbitrary context commands in xml file

2021-03-08 Thread Duncan Hothersall
On Mon, 8 Mar 2021 at 12:46, Hans Hagen  wrote:

> > I'd like to second Denis' request for support for XML processing
> > instructions to execute ConTeXt code, rather than elements which can
> > cause big problems if one is working to a fixed schema. It would be a
> > boon to be able to drop in  in an XML source.
> one of the things that can already be done ...
>
> \def\xmltexdirective#1#2{\doif{#1}{command}{#2}}
>
> \xmlinstalldirective{tex}{xmltexdirective}
>
>  
>  
>
> (the #2 is something without spaces btu one can work around that)
>

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] arbitrary context commands in xml file

2021-03-08 Thread Hans Hagen

On 3/8/2021 12:48 PM, Duncan Hothersall wrote:



On Mon, 8 Mar 2021 at 10:21, <mailto:denis.ma...@ub.unibe.ch>> wrote:


 > -Ursprüngliche Nachricht-
 > Von: Hans Hagen mailto:j.ha...@xs4all.nl>>
 > Gesendet: Freitag, 5. März 2021 23:17
 > An: mailing list for ConTeXt users mailto:ntg-context@ntg.nl>>; Maier, Denis
 > Christian (UB) mailto:denis.ma...@ub.unibe.ch>>;
 > wolfgang.schuster.li...@gmail.com
<mailto:wolfgang.schuster.li...@gmail.com>
 > Betreff: Re: [NTG-context] arbitrary context commands in xml file


[...]

 > >
 > > Here, I was thinking if something like this could be easier:
 > >
 > > 
 > you can also do this:
 >
 > 
 >
 > \startxmlsetups xml:testpage
 >    \testpage[\xmlatt{#1}{n}]
 > \stopxmlsetup
 >
 > and register that one (as in previous examples)

Thanks,. That's a good idea, but it will also make the XML invalid.

Denis

I'd like to second Denis' request for support for XML processing 
instructions to execute ConTeXt code, rather than elements which can 
cause big problems if one is working to a fixed schema. It would be a 
boon to be able to drop in  in an XML source.

one of the things that can already be done ...

\def\xmltexdirective#1#2{\doif{#1}{command}{#2}}

\xmlinstalldirective{tex}{xmltexdirective}




(the #2 is something without spaces btu one can work around that)


-
  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] verify if you are already postponing notes

2021-02-15 Thread Hans Hagen

On 2/15/2021 7:14 PM, mf wrote:

Dear list,
I'm typesetting XHTML and there is a couple of cases (tables and math), 
where I use \postponenotes ... \flushnotes in both their XML setups.


The problem arises when I have math inside the cell of a table, so I get 
those commands nested:


\postponenotes %  element

\postponenotes %  element inside a cell

\flushnotes %  closing math

\flushnotes %  closing table

With CSS selectors or XML machinery I can find those corner cases, but 
something like this would be better because more general:


\doifnotpostponingnotes{\postponenotes}

\dofipostponingnotes{\flushnotes}

Is there a way to define those \doif... macros?

mkiv:

\ifconditional\postponingnotes
\else
\fi

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

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


[NTG-context] verify if you are already postponing notes

2021-02-15 Thread mf

Dear list,
I'm typesetting XHTML and there is a couple of cases (tables and math), 
where I use \postponenotes ... \flushnotes in both their XML setups.


The problem arises when I have math inside the cell of a table, so I get 
those commands nested:


\postponenotes %  element

\postponenotes %  element inside a cell

\flushnotes %  closing math

\flushnotes %  closing table

With CSS selectors or XML machinery I can find those corner cases, but 
something like this would be better because more general:


\doifnotpostponingnotes{\postponenotes}

\dofipostponingnotes{\flushnotes}

Is there a way to define those \doif... macros?

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] XML Namespaces and XML Setups

2020-11-16 Thread Christoph Reller
Dear List,

Consider the following MWE:

\startxmlsetups xml:demo:base
  \xmlsetsetup{#1}{tag}{xml:demo:tag}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{xml:demo:base}
\startxmlsetups xml:demo:tag
  %\doif{\xmlnamespace{#1}}{o}{NameSpaceO:}
  \xmlflush{#1}
\stopxmlsetups
\starttext
\startbuffer[test]


  text text

\stopbuffer
\xmlprocessbuffer{demo}{test}{}
\stoptext

My questions:
- Is there a good way to have a separate XML setup for each XML namespace?
- Alternatively, one has to do the distinction within the same XML setup.
In this case, how do we get the complete namespace? (In this example:
"NameSpaceA" and "NameSpaceO")

Thanks in advance for your help!

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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
___


[NTG-context] need help comparing strings

2020-10-13 Thread Pablo Rodriguez
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?

Many thanks,

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] problem since previous versions

2020-06-07 Thread Hans van der Meer
Wolfgang,

I did define the various variants in order to parametrize vtop, vbox and 
vcenter through parameters top, bottom, center.
 
Happily there proved to be a remedy: place everything inside an \hbox and the 
error goes away. Without problematic whitespace or other nasty side effects, it 
seems.  But, although the panic is over now :-), I am still curious to know why 
it worked before and raises an error now.

as for the definition of \placexlocation, it comes from:
\def\setupplacex{\getparameters[placex]}
\setupplacex[%  default parameters
...
location=center,%
...
]%
and I checked that it had the value: center.

But if you are interested, I can send you the module code.

dr. Hans van der Meer


> On 7 Jun 2020, at 12:20, Wolfgang Schuster 
>  wrote:
> 
> Hans van der Meer schrieb am 07.06.2020 um 12:07:
>> A problem has arisen up since previous versions, where code without a 
>> problem now raises an error.
>> This is the afflicted code:
>> % Assign values to \locationbox.
>> \doif{top}{\placexlocation}%
>> {\def\startlocationbox{\vtop\bgroup\vss}}%
>> \doif{center}{\placexlocation}%
>> {\def\startlocationbox{\vcenter\bgroup}}%
>> \doif{bottom}{\placexlocation}%
>> {\def\startlocationbox{\vbox\bgroup}}%
>> And it is used here:
>> \setbox\placexbox=\startlocationbox
>> \ignorespaces
>> Previously this worked without a hitch, now the error is:
>> tex error   > tex error on line 9 in file ./familie-events.tex: ! A 
>>  was supposed to be here
>> 
>> \vcenter
>> \startlocationbox ->\vcenter
>>  \bgroup
>> \dostartcontentplacexinline ...ables \par \setbox \placexbox 
>> =\startlocationbox
>>  
>> \ignorespaces
>>  \syst_helpers_single_empty_one_nop
>>\xmlflush
>> \21>:xmlplc:placexcontent ...le=\xmlatt {#1}{alttitle}]}\startcontent 
>> \xmlflush
>>  
>> {#1}\stopcontent
>> l.9 }
>> I can try to make a minimal example, but not without the afflicted module of 
>> some 800 lines. So perhaps the problem will be located by the experts at 
>> first sight. It is of course the \vcenter playing havoc, because replacing 
>> it by \vtop or \vbox makes the error disappear.
>> Thanks for looking into it, because my work more or less depends on this 
>> code working in good order.
> 
> How so you define \placexlocation?
> 
> 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
> ___

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

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


Re: [NTG-context] problem since previous versions

2020-06-07 Thread Wolfgang Schuster

Hans van der Meer schrieb am 07.06.2020 um 12:07:
A problem has arisen up since previous versions, where code without a 
problem now raises an error.


This is the afflicted code:
% Assign values to \locationbox.
\doif{top}{\placexlocation}%
{\def\startlocationbox{\vtop\bgroup\vss}}%
\doif{center}{\placexlocation}%
{\def\startlocationbox{\vcenter\bgroup}}%
\doif{bottom}{\placexlocation}%
{\def\startlocationbox{\vbox\bgroup}}%

And it is used here:
\setbox\placexbox=\startlocationbox
\ignorespaces

Previously this worked without a hitch, now the error is:
tex error       > tex error on line 9 in file ./familie-events.tex: ! A 
 was supposed to be here


\vcenter
\startlocationbox ->\vcenter
                              \bgroup
\dostartcontentplacexinline ...ables \par \setbox \placexbox 
=\startlocationbox
 
         \ignorespaces

 \syst_helpers_single_empty_one_nop
                                    \xmlflush
\21>:xmlplc:placexcontent ...le=\xmlatt {#1}{alttitle}]}\startcontent 
\xmlflush
 
         {#1}\stopcontent

l.9 }

I can try to make a minimal example, but not without the afflicted 
module of some 800 lines. So perhaps the problem will be located by the 
experts at first sight. It is of course the \vcenter playing havoc, 
because replacing it by \vtop or \vbox makes the error disappear.


Thanks for looking into it, because my work more or less depends on this 
code working in good order.


How so you define \placexlocation?

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

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


[NTG-context] problem since previous versions

2020-06-07 Thread Hans van der Meer
A problem has arisen up since previous versions, where code without a problem 
now raises an error.

This is the afflicted code:
% Assign values to \locationbox.
\doif{top}{\placexlocation}%
{\def\startlocationbox{\vtop\bgroup\vss}}%
\doif{center}{\placexlocation}%
{\def\startlocationbox{\vcenter\bgroup}}%
\doif{bottom}{\placexlocation}%
{\def\startlocationbox{\vbox\bgroup}}%

And it is used here:
\setbox\placexbox=\startlocationbox
\ignorespaces

Previously this worked without a hitch, now the error is:
tex error   > tex error on line 9 in file ./familie-events.tex: ! A  
was supposed to be here
 
\vcenter 
\startlocationbox ->\vcenter 
 \bgroup 
\dostartcontentplacexinline ...ables \par \setbox \placexbox =\startlocationbox 

\ignorespaces 
 \syst_helpers_single_empty_one_nop 
   \xmlflush 
\21>:xmlplc:placexcontent ...le=\xmlatt {#1}{alttitle}]}\startcontent \xmlflush 

{#1}\stopcontent 
l.9 }

I can try to make a minimal example, but not without the afflicted module of 
some 800 lines. So perhaps the problem will be located by the experts at first 
sight. It is of course the \vcenter playing havoc, because replacing it by 
\vtop or \vbox makes the error disappear.

Thanks for looking into it, because my work more or less depends on this code 
working in good order.

dr. Hans van der Meer


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] mtxrun exit code

2020-05-29 Thread Hans van der Meer
I am producing a series of files in a shell script with mtxrun --autogenerate 
--script context input
Doing exit mtxrun... shows there is no exit number to test in the shell, or to 
ste a shell variable to that value.

I can set a global macro \ExitStatus to an exit value depending on success or 
failure, pass that on to mtxrun as exit statusd and test that in the script.

For example:
\starttext
  \xmlprocessbuffer{notes}{notes}{}
  \doif{\ExitStatus}{notok}{"let mtxrun return value 1 as error in UNIX"}
\stoptext

After that it would be possible in the shell script to delete the pdf produced, 
what is my intention in this case.

Is this an option or is there presently another (standard) procedure to 
communicate from ConTeXt to the shell.

dr. Hans van der Meer


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] conditional not working in \setuphead

2020-04-20 Thread Wolfgang Schuster

Pablo Rodriguez schrieb am 20.04.2020 um 18:55:

Dear list,

I have the following sample:

   \startbuffer[demo]
   
 
   first
 
 
   second
 

   
   \stopbuffer

   \startxmlsetups xml:initialize
  \xmlsetsetup{#1}{doc|section}{xml:*}
   \stopxmlsetups

   \xmlregistersetup{xml:initialize}

   \startxmlsetups xml:doc
  \xmlflush{#1}
   \stopxmlsetups

   \startxmlsetups xml:section
  \startsection[title={\xmlatt{#1}{id}},
 beforesection={\doif{\xmlatt{#1}{id}}{\selectedtopic}
 {conditional}}]
 \xmlflush{#1}
 \doif{\xmlatt{#1}{id}}{\selectedtopic}{conditional}
  \stopsection
   \stopxmlsetups

   \def\selectedtopic{section-i1}

   \starttext
  \xmlprocessbuffer{main}{demo}{}
   \stoptext

How can I make the conditional in the beforesection option work?


The argument of the beforesection-key is placed before ConTeXt stores 
the values of \startsection which means you can do it this way.


What you can do here is to put whatever something in a macro before you 
call \startsection and access the value of this macro with the 
beforesection-key. You should ensure the content if this temporary macro 
is cleared when your conditional is false.


\setuphead
  [section]
  [beforesection=\getvariable{xml}{beforesection}]

\startxmlsetups xml:section

\doifelse{\xmlatt{#1}{id}}{\selectedtopic}
{\setvariable{xml}{beforesection}{conditional}}
{\setvariable{xml}{beforesection}{}}

\startsection[title={\xmlatt{#1}{id}}]
\xmlflush{#1}
\stopsection

\stopxmlsetups

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

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


[NTG-context] conditional not working in \setuphead

2020-04-20 Thread Pablo Rodriguez
Dear list,

I have the following sample:

  \startbuffer[demo]
  

  first


  second


  
  \stopbuffer

  \startxmlsetups xml:initialize
 \xmlsetsetup{#1}{doc|section}{xml:*}
  \stopxmlsetups

  \xmlregistersetup{xml:initialize}

  \startxmlsetups xml:doc
 \xmlflush{#1}
  \stopxmlsetups

  \startxmlsetups xml:section
 \startsection[title={\xmlatt{#1}{id}},
beforesection={\doif{\xmlatt{#1}{id}}{\selectedtopic}
{conditional}}]
\xmlflush{#1}
\doif{\xmlatt{#1}{id}}{\selectedtopic}{conditional}
 \stopsection
  \stopxmlsetups

  \def\selectedtopic{section-i1}

  \starttext
 \xmlprocessbuffer{main}{demo}{}
  \stoptext

How can I make the conditional in the beforesection option work?

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] fancy chapter setup

2020-01-11 Thread Rik Kabel

On 1/11/2020 10:04, Henning Hraban Ramm wrote:

Hi all,
I’m trying to setup a book layout where each chapter begins with a quote and an 
image on the left page, followed by title and text start on the right page.

While the quote & image thing works, I can’t get the title on the right page, 
ConTeXt always puts it right of the image, even if that’s as wide as the text 
width. \page[right] doesn’t do anything.
Where’s my mistake?

There are also chapters without that intro, therefore I use 
\doifnot{\structureuservariable{subtitle}}, but those should also start on a 
right page. I could also use a different section name. But I don’t think that’s 
the problem.

(The page number should appear on the right page; it wouldn’t hurt on the left 
page, but the chapter title should only appear on following pages.)

Best, Hraban

%%
\define[2]\FancyChapter{%
\doifnot{\structureuservariable{subtitle}}{}{%
\startstandardmakeup
   \framed[
 width=\textwidth,height=fit,
 offset=overlay,
 align=flushleft,
   ]{%
 \definedfont[SerifItalic at 16pt]
 \structureuservariable{subtitle}%
   }
   \framed[width=\textwidth]{%
 \externalfigure[dummy][width=\textwidth]%
   }
   %\hfill\vfill\strut % doesn’t help
\stopstandardmakeup
}
\page[right]
%
\framed[
   width=\textwidth,
   offset=overlay,
   align=flushleft,
]{%
   \definedfont[Sans at 32pt]%#2
   \structurevariable{title}%
}%
}

\setupheadertexts[][pagenumber][pagenumber][chapter]
\setuphead[chapter][
   page=left,
   number=no,
   header=high,
   command=\FancyChapter,
]

\starttext

\startchapter[title={My Normal Text}]

\input knuth

\stopchapter

\startchapter[title={My Fancy Story}]
[subtitle={\quotation{I thought that was real.}}]

\input tufte

\stopchapter

\stoptext
%%


For what it is worth, here is how I address this. This lets me place 
epigraphs on the facing verso of a chapter, or under the section title, 
and set lettrines and first line treatment for chapters. I set page 
numbers in a separate overlay to better control the positioning. Perhaps 
a bit overthought, but it works for me ...


   \setupheadertexts [][{\it\getmarking[section]}]
  [{\it\getmarking[chapter]}][]

   \startsetups section:epigraph
  \doifelsebuffer{SectionEpigraph}
    {\getbuffer  [SectionEpigraph]
 \resetbuffer[SectionEpigraph]}
    {\donothing}
   \stopsetups

   \startsetups chapter:epigraph
  \setupheadertexts [][][][]
  \doifelsebuffer{ChapterEpigraph}
    {\doifoddpageelse
  {\page[left]}
  {\donothing}
 \centerbox{\getbuffer[ChapterEpigraph]}
 \resetbuffer[ChapterEpigraph]
    }
    {\donothing}
  \page[right]
  \setupheadertexts [][{\it\getmarking[section]}]
    [{\it\getmarking[chapter]}][]
   \stopsetups

   \startsectionblockenvironment[bodypart]
   \setuphead  [chapter][
  style=\tfc\HeadFont,
  page=yes,
  separator=,
  numbercolor=darkgray,
  alternative=inmargin,
   before=\directsetup{chapter:epigraph},
   after={\resetshownsynonyms[dictionary]
   \setupsynonyms[dictionary][alternative=first]
   \doifsomething{\structureuservariable{setFirst}}
   {\setfirstline[\structureuservariable{setFirst}]}
   \doif{\structureuservariable{Lettrine}}
 {yes}{\setinitial}},
 ]
   \setuphead  [section][
  style=\tfb\HeadFont,
   insidesection=\setups{section:epigraph},
  before={\blank[big]},
  sectionseparatorset=reddot,
  numbercolor=darkgray,
  alternative=inmargin,
 ]
   \setuphead  [subsection]
 [
  style=\tfa\HeadFont,
  number=no,
  distance=0pt,
   insidesection=\setups{section:epigraph},
  before={\blank[big]},
  alternative=normal,
  after={\blank[halfline]},
  numbercolor=,
  sectionseparatorset=,
 ]
   \stopsectionblockenvironment

   \definefirstline [5W][alternative=word, n=5,style=smallcaps]% and so
   on as you like
   \definefirstline [1L][alternative=line, style=smallcaps]

   ...

   \starttext

   ...

   \startbuffer[ChapterEpigraph]

   \startEpigraph% brings in its own formatting

   The stuff of the epigraph

   \stopEpigraph

   \stopbuffer

   \startchapter[reference={cha:blah},
  list={blah}, % toc
  marking={blah},  % page heading
  bookmark={blah}, % pdf bookmark
  title={blah}]    % cha

Re: [NTG-context] changing alignment inside a paragraph

2019-12-12 Thread mf

Il 11/12/19 21:25, Wolfgang Schuster ha scritto:

\starttext

\startbuffer
This is the text of an index term, that is normally justified,
but I'd like the page numbers to be flushed to the right from
their second line\par
\startalignment[flushright]
\ifdim\dimexpr\hsize-\lastlinewidth\relax>2\emwidth
     \blank[overlay]
%   simple solution but doesn't indent the numbers on the following lines
%   \hskip\dimexpr\lastlinewidth+\emwidth\relax
     \parshape 2
     \dimexpr\lastlinewidth+\emwidth\relax 
\dimexpr\hsize-\lastlinewidth-\emwidth\relax

     \emwidth \dimexpr\hsize-\emwidth\relax
\else
     \parshape 1 \emwidth \dimexpr\hsize-\emwidth\relax
\fi
34, 57, 101-104, 276, 345, 401, 403, 512.
\stopalignment
\stopbuffer

\dorecurse
   {10}
   {\hsize\dimexpr.75\textwidth-#1\emwidth\relax
    \getbuffer
    \page}

\stoptext



Thanks Wolfgang.

I wrote a better version. I still have a couple of questions.
In the lines:

\iffirstargument
  \getparameters[PIT!][test=off,margin=1em,distance=1em,minwidth=1em,#1]
\else
  \getparameters[PIT!][test=off,margin=1em,distance=1em,minwidth=1em,]
\fi

i would avoid writing the default values twice; i tried something like:

\getparameters[PIT!][test=off,margin=1em,distance=1em,minwidth=1em,\iffirstargument#1\fi]

but it doesn't work.

For the second question, see the first item of page 3: i think the 
\lastlinewidth fails because there's a page break. From supp-box.lua:


implement {
name= "lastlinewidth",
actions = function()
local head = tex.lists.page_head
-- list dimensions returns 3 value but we take the first
context(head and 
getdimensions(getlist(find_tail(tonut(tex.lists.page_head or 0)

end
}

I think that's because page_head is reset in the page break.
Is there a way to prevent that?

Massi

--
\unprotect
\def\PlaceIndexTerm{\dosingleempty\doPlaceIndexTerm}
\def\doPlaceIndexTerm[#1]#2#3{%
\iffirstargument
  \getparameters[PIT!][test=off,margin=1em,distance=1em,minwidth=1em,#1]
\else
  \getparameters[PIT!][test=off,margin=1em,distance=1em,minwidth=1em,]
\fi
#2\par
\startalignment[flushright,stretch]
\ifdim\dimexpr\hsize-\lastlinewidth\relax > 
\dimexpr\PIT!distance+\PIT!minwidth\relax

  \blank[overlay]
  \parshape 2
  \dimexpr\lastlinewidth+\PIT!distance\relax 
\dimexpr\hsize-\lastlinewidth-\PIT!distance\relax

  \PIT!margin \dimexpr\hsize-\PIT!margin\relax \doif{\PIT!test}{on}{\red}
\else
  \page[no]
  \parshape 1 \PIT!margin \dimexpr\hsize-\PIT!margin\relax 
\doif{\PIT!test}{on}{\darkgreen}

\fi
#3\par
\stopalignment}
\protect

\setupalign[stretch]

\starttext

\def\Text{This is the text of an index term, that is normally justified,
but I'd like the page numbers to be flushed to the right from
their second line}

\def\Pages{34, 57, 101-104, 276, 345, 401, 403, 512.}

\type{\PlaceIndexTerm[margin=1em,distance=1em,minwidth=1em]{text}{pages}}
\startitemize
\item margin:
  the left margin of the lines made only of page numbers
\item distance:
  the distance of the first page number from the last word of the text
\item minwidth:
  the shortest acceptable space at the end of the text to try to 
start page numbers there

\stopitemize

\page

\dorecurse
  {23}
  {\hsize=\dimexpr5cm+#1\emwidth\relax
   #1: \the\hsize\par
   \PlaceIndexTerm[test=on]{\Text}{\Pages}}

\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] expansion problem: random location

2019-09-13 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 13.09.2019 um 18:51:

Hi, in an example document I’m trying to get pictures of random size and 
placement.
Unfortunately the expansion is over my head:

%
\useMPlibrary[dum]
\usemodule[visual]

\startluacode

local locations = {
   'top',
   'bottom',
   'left',
   'right',
}

function RandomLocation()
   context(locations[math.random(1,#locations)])
end

\stopluacode

\newdimen\PicWidth
\PicWidth=\textwidth

\define[1]\Blindbild{
\getrandomnumber\imgH{1}{9}
\PicWidth=\textwidth
\doif{#1}{left}{\PicWidth=.4\textwidth}
\doif{#1}{right}{\PicWidth=.4\textwidth}
\startplacefigure[location={#1},title={#1 \fakewords{3}{20}}]
\externalfigure[place #1][width=\PicWidth,height=\dimexpr\textheight * \imgH / 
10 \relax]
\stopplacefigure
}

Put the value of the random location in a macro.

\define[1]\Blindbild
  {\edef\PicLocation{#1}%
   \getrandomnumber\imgH{1}{9}%
   \PicWidth=\textwidth
   \doifinset{\PicLocation}{left,right}{\PicWidth=.4\textwidth}%
\startplacefigure[location={\PicLocation},title={\PicLocation\space\fakewords{3}{20}}]
   \externalfigure
 [place \PicLocation]
 [width=\PicWidth,
  height=\dimexpr\textheight * \imgH / 10 \relax]
   \stopplacefigure}

Wolfgang

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

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


[NTG-context] expansion problem: random location

2019-09-13 Thread Henning Hraban Ramm
Hi, in an example document I’m trying to get pictures of random size and 
placement.
Unfortunately the expansion is over my head:

%
\useMPlibrary[dum]
\usemodule[visual]

\startluacode

local locations = {
  'top',
  'bottom',
  'left',
  'right',
}

function RandomLocation()
  context(locations[math.random(1,#locations)])
end

\stopluacode

\newdimen\PicWidth
\PicWidth=\textwidth

\define[1]\Blindbild{
\getrandomnumber\imgH{1}{9}
\PicWidth=\textwidth
\doif{#1}{left}{\PicWidth=.4\textwidth}
\doif{#1}{right}{\PicWidth=.4\textwidth}
\startplacefigure[location={#1},title={#1 \fakewords{3}{20}}]
\externalfigure[place #1][width=\PicWidth,height=\dimexpr\textheight * \imgH / 
10 \relax]
\stopplacefigure
}

\starttext
   \dorecurse{3}
 {\chapter{\fakewords{5}{10}}
   \dorecurse{3}
 {\dorecurse{3}{\fakewords{50}{100}\endgraf}
\Blindbild{\ctxlua{RandomLocation()}} % expansion!?
\dorecurse{2}{\fakewords{50}{100}\endgraf}}}
\stoptext
%%

So the parameter of \Blindbild should get generated at the time of calling the 
macro, so that #1 stays the same within the macro.
In this state the Lua function gets called at every use of #1.


Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

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

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


[NTG-context] Using \currentreferencenumber triggers “has a hidden number” in log file

2019-07-18 Thread Marco Patzer
Hi,

I use

  \enabletrackers
[structures.referencing.empty]

to catch references by number to sections without a number. The log
file contains “has a hidden number…” in that case. I have a command
that uses \currentreferencenumber which triggers the “has a hidden
number…” warning in the log file. But that command takes care not to
output the contents of that variable. But merely using it in an
\doif\currentreferencenumber is sufficient to trigger the log
message. Example:

\enabletrackers
  [structures.referencing.empty]

\def\foo[#1]{%%
  \doifreferencefoundelse{#1}{%%
\doifelse\currentreferencenumber\emptyreference
{Foo}{Bar}}%%
}

\setuphead
  [section] [number=no]

\starttext
  \startsection [title=Foo, reference=sec:foo]
\samplefile{knuth}
  \stopsection
  \foo[sec:foo]
\stoptext

Then check the log file for “has a hidden number”.

1) How to not trigger the log message when checking
   \currentreferencenumber? Or alternatively

2) Is there a better way to find invisible references?

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

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


[NTG-context] registers: setting pageleft parameter by index term

2019-04-29 Thread mf

Hello list, please consider this MWE:

\definenumber[p]
\setnumber[p][1]
\def\PageLeft{ p.~}
\def\TextCommand#1{\getnumber[p] 
#1\doif{\rawcountervalue[p]}{2}{\def\PageLeft{ P.~}}\incrementnumber[p]}

\setupindex[n=1,pageleft=\PageLeft,pageright=,textcommand=\TextCommand]
\starttext
Foo\index{foo}.
\page
Bar\index{bar}.
\page
Baz\index{baz}.
\page
\placeindex
\stoptext

The pageleft parameter of \setupindex (\setupregister) is normally set 
to " p.~", but it gets redefined to " P.~" for the second term in the 
index ("baz").


Here i'm using a counter and i check when it is 2, but i'd like to check 
if the term is "baz" (and i don't know how to do that test).


If you use deeptextcommand instead of textcommand, the pageleft 
parameter can't be redefined.


The following variation compiles, but it does not work, because pageleft 
is always " p.~":


\definenumber[p]
\setnumber[p][1]
\def\PageLeft{ p.~}
\def\TextCommand#1{\getnumber[p] 
#1\doif{\rawcountervalue[p]}{2}{\def\PageLeft{ P.~}}\incrementnumber[p]}

\setupindex[n=1,pageleft=\PageLeft,pageright=,deeptextcommand=\TextCommand]
\starttext
Foo\index{foo}.
\page
Bar\index{bar}.
\page
Baz\index{baz}.
\page
\placeindex
\stoptext

In my setup i must use deeptextcommand, and i want to set the pageleft 
and pageright parameters to a different value for some particular terms 
of the index.


Since the argument passed to deeptextcommand is not the text of the term 
(it's actually an id used to retrieve a much longer text), i can 
discriminate the terms by their id, but i can't setup pageleft and 
pageright accordingly from the command specified by deeptextcommand.


On the other hand, textcommand would let me set pageleft and pageright, 
but its argument is not pure text, and i don't know how to get the id 
from it.


How can i solve this problem?

Thanks,

Massimiliano

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] util-sha.lua misbehaving?

2019-02-28 Thread Pablo Rodriguez
Dear list,

I have the following sample:

\startluacode
function document.capture(cmd, raw)
local f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*a'))
f:close()
if raw then return s end
s = string.gsub(s, '^%s+', '')
s = string.gsub(s, '%s+$', '')
s = string.gsub(s, '[\n\r]+', ' ')
return s
end

function document.sha512(file)
command_output= document.capture("sha512sum -b " .. file)
context(command_output:sub(0,8))
end
\stopluacode

\def\shafive#1{\ctxlua{document.sha512("#1")}}

\doif{\luaversion}{5.3}{\ctxlua{require("util-sha")}}

\def\hashfive#1{%
\ctxlua{context(
utilities.sha2.hash512("#1"):sub(0,8))}}

\def\hashfivefile#1{%
\ctxlua{context(
utilities.sha2.hash512(io.loaddata("#1")):sub(0,8))}}

\def\cB{i-context.pdf}

\starttext
\startTEXpage[offset=2em]
\tt i-context.pdf\ss:
\doifelse{\luaversion}{5.3}
{\hashfivefile{\cB}\\
 {\rm text: }\hashfive{\cB}}
{\shafive{\cB}}
\stopTEXpage
\stoptext

Just accidentally, I discovered today (using latest beta from 2019.02.26
20:04) that file hashing may be wrong in ConTeXt. For the sake of
brevity, I only use the 8 first chars.

"sha512sum i-context.pdf" gives c4cc3840. Using luajittex, I get that
result. But using Lua 5.3 (and util-sha.lua), I get 44241e9d.

I don’t know whether my invocation of io.loaddata is wrong, since the
SHA512 for the text "i-context.pdf" is 2ac2778b, which is the same
result as https://duckduckgo.com/?q=sha512+i-context.pdf.

After discovering that io.loaddata is from l-io.lua, I don’t know what I
may be doing wrong.

This is an essential feature for me in ConTeXt, since it is the way of
showing the integrity of the attached files to a PDF document (mainly
digitally signed documents).

Could anyone tell me what I am missing here?

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] linking to an external PDF file

2018-10-08 Thread Pablo Rodriguez
On 10/8/18 10:09 AM, Hans van der Meer wrote:
> I am embedding links to an URL in my documents. Although it is used in
> XML-documents, you might be able to use the gist of this code that
> generates a clickable link. Perhaps you find it useful. 

Many thanks for your reply, dr. Hans van der Meer.

Sorry, but I’m afraid I don’t see the way of generating an URL to a
non-external document in your code.

After all, the document is embedded in the PDF document itself.

Pablo

> % Return the code when clicking the link.
> \def\URIReturnCode#1{\ctxlua{tex.print(hvdm.urireturncode("#1"))}}
> 
> — Some Lua code needed:
> -- Check URI
> 
> socket.http.TIMEOUT = 5-- set URI timeout in seconds
> hvdm.urireturncode = function (theuri)
> -- Differentiate between file and http protocols.
> local first,last = string.find(theuri, "file://")
> if first == nil then
> -- We have http to search for.
> local content, status, authinfo = socket.http.request{
> method = "HEAD",
> url = theuri,
> }
> return type(status) == "number" and status or "failure"
> else
> -- We must ascertain the existence of the file.
> local thefile = io.open(string.sub(theuri, last+1, -1), "r")
> if thefile then
> io.close(thefile)
> return "200"
> else
> return "404"
> end
> end
> end
> 
> % . Place an url link
> .
> 
> % BEWARE: spaces in file names must be %20 in the link !!!
> 
> % This global definition of the URLbase cannot be missed.
> \def\THEURLBASE{http://}
> 
> % Signal the occurence of timeout on URI search.
> \newif\ifURItimeout
> 
> \startxmlsetups xmlcommon:urlbase
> \edef\THEURLBASE{\xmlstrippednolines{#1}{.}}
> 
> % Reset the URI timeout for new URLbase.
> \global\URItimeoutfalse
> \stopxmlsetups
> 
> \startxmlsetups xmlcommon:url
> 
> % Define the full uri.
> \edef\theurl{\THEURLBASE\xmlatt{#1}{link}}
> 
> % File suffix should be one of the list.
> \doifelse{\FileSuffixList{\xmlatt{#1}{link}}
> {pdf,jpg,jpeg,html,png,tif,tiff}}{\empty}
> {\def\suffix{.impossible}}% no suffix from the list here
> {\def\suffix{\empty}}% one of the list is present
> 
> % First try link as given, beware of unreachable site.
> \ifURItimeout
> % For previously timeout on this site.
> \else
> \edef\returncode{\URIReturnCode{\theurl}}
> \doif{\returncode}{failure}
> {
> \global\URItimeouttrue
> \errorcall{#1}{url access fails for \THEURLBASE\xmlatt{#1}{link}}
> }
> \fi
> 
> % On URI timeout there is no hope to find the file.
> \ifURItimeout
> \else
> % When there is no suffix from the list, try several.
> \doifnot{\suffix}{\empty}
> {
> \scratchcounter=200\relax
> \ifnum\returncode=\scratchcounter\else
> \def\suffix{.pdf}
> \edef\returncode{\URIReturnCode{\theurl\suffix}}
> \fi
> \ifnum\returncode=\scratchcounter\else
> \def\suffix{.jpg}
> \edef\returncode{\URIReturnCode{\theurl\suffix}}
> \fi
> \ifnum\returncode=\scratchcounter\else
> \def\suffix{.jpeg}
> \edef\returncode{\URIReturnCode{\theurl\suffix}}
> \fi
> \ifnum\returncode=\scratchcounter\else
> \def\suffix{.html}
> \edef\returncode{\URIReturnCode{\theurl\suffix}}
> \fi
> \ifnum\returncode=\scratchcounter\else
> \def\suffix{.png}
> \edef\returncode{\URIReturnCode{\theurl\suffix}}
> \fi
> \ifnum\returncode=\scratchcounter\else
> \def\suffix{.tiff}
> \edef\returncode{\URIReturnCode{\theurl\suffix}}
> \fi
> \ifnum\returncode=\scratchcounter\else
> \def\suffix{.tif}
> \edef\returncode{\URIReturnCode{\theurl\suffix}}
> \fi
> }
> 
> % Give up if returncode other then 200.
> \ifnum\returncode=200\relax
> % Page number might be added.
> \doifelse{\xmlatt{#1}{page}}{\empty}
> {\let\thep\empty}
> {\edef\thep{\letterhash page=\xmlatt{#1}{page}}}
> 
> % Place the link, ref-attribute prevales in the presentation.
> \doifelse{\xmlatt{#1}{ref}}{\empty}
> {\edef\temp{\xmlatt{#1}{link}}}
> {\edef\temp{\xmlatt{#1}{ref}}}
> \goto
> {\FirstLastCharacters{\temp}{\xmlatt{#1}{maxsize}}}
> [url(\theurl\suffix\thep)]
> \else
> \errorcall{#1}
> {\THEURLBASE\xmlatt{#1}{link} not found (\returncode)}
> \fi
> 
> \fi% end of URItimeout
> \stopxmlsetups
> 
> 
>> On 8 Oct 2018, at 00:39, Hans Hagen > <mailto:j.ha...@xs4all.nl>> wrote:
>>
>> On 10/7/2018 8:41 PM, Pablo Rodriguez wrote:
>>> On 10/7/18 8:33 PM, Hans Hagen wrote:
>>>> On 10/7/2018 8:19 PM, Pablo Rodriguez wrote:
>>>>> [...]
>>>>> Is there a way to hyperlink to an attached document? I mean, no matter
>>>>> whether it has been generated by C

Re: [NTG-context] linking to an external PDF file

2018-10-08 Thread Hans van der Meer
I am embedding links to an UR in my documents. Although it is used in 
XML-documents, you might be able to use the gist of this code that generates a 
clickable link. Perhaps you find it useful. 

dr. Hans van der Meer

% Return the code when clicking the link.
\def\URIReturnCode#1{\ctxlua{tex.print(hvdm.urireturncode("#1"))}}

— Some Lua code needed:
-- Check URI

socket.http.TIMEOUT = 5 -- set URI 
timeout in seconds
hvdm.urireturncode = function (theuri)
-- Differentiate between file and http protocols.
local first,last = string.find(theuri, "file://")
if first == nil then
-- We have http to search for.
local content, status, authinfo = socket.http.request{
method = "HEAD",
url = theuri,
}
return type(status) == "number" and status or "failure"
else
-- We must ascertain the existence of the file.
local thefile = io.open(string.sub(theuri, last+1, -1), 
"r")
if thefile then
io.close(thefile)
return "200"
else
return "404"
end
end
end

% . Place an url link .

% BEWARE: spaces in file names must be %20 in the link !!!

% This global definition of the URLbase cannot be missed.
\def\THEURLBASE{http://}

% Signal the occurence of timeout on URI search.
\newif\ifURItimeout

\startxmlsetups xmlcommon:urlbase
\edef\THEURLBASE{\xmlstrippednolines{#1}{.}}

% Reset the URI timeout for new URLbase.
\global\URItimeoutfalse
\stopxmlsetups

\startxmlsetups xmlcommon:url

% Define the full uri.
\edef\theurl{\THEURLBASE\xmlatt{#1}{link}}

 % File suffix should be one of the list.
\doifelse{\FileSuffixList{\xmlatt{#1}{link}}
{pdf,jpg,jpeg,html,png,tif,tiff}}{\empty}
{\def\suffix{.impossible}}% no suffix from the list here
{\def\suffix{\empty}}% one of the list is present

% First try link as given, beware of unreachable site.
\ifURItimeout
% For previously timeout on this site.
\else
\edef\returncode{\URIReturnCode{\theurl}}
\doif{\returncode}{failure}
{
\global\URItimeouttrue
\errorcall{#1}{url access fails for 
\THEURLBASE\xmlatt{#1}{link}}
}
\fi

% On URI timeout there is no hope to find the file.
\ifURItimeout
\else
% When there is no suffix from the list, try several.
\doifnot{\suffix}{\empty}
{
\scratchcounter=200\relax
\ifnum\returncode=\scratchcounter\else
\def\suffix{.pdf}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
\ifnum\returncode=\scratchcounter\else
\def\suffix{.jpg}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
\ifnum\returncode=\scratchcounter\else
\def\suffix{.jpeg}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
\ifnum\returncode=\scratchcounter\else
\def\suffix{.html}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
\ifnum\returncode=\scratchcounter\else
\def\suffix{.png}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
\ifnum\returncode=\scratchcounter\else
\def\suffix{.tiff}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
\ifnum\returncode=\scratchcounter\else
\def\suffix{.tif}
\edef\returncode{\URIReturnCode{\theurl\suffix}}
\fi
}

% Give up if returncode other then 200.
\ifnum\returncode=200\relax
% Page number might be added.
\doifelse{\xmlatt{#1}{page}}{\empty}
  

Re: [NTG-context] conditional format in xtables

2018-04-11 Thread Pablo Rodriguez
On 04/10/2018 11:07 PM, Wolfgang Schuster wrote:
> The normal \doif... commands don’t work because they aren’t expandable
> but you can use the \expdoif... commands (look into setup-en.pdf for all
> of them).

Many thanks for your reply, Wolfgang.

TeX conditionals are fine for me and I need \ifcase and \ifodd.

I must admit that now I don’t understand what expansion actually is.

Many thanks for your help,

Pablo


>> Pablo Rodriguez 10. April 2018 um 19:18
>> Dear list,
>>
>> thanks to Wolfgang, I learnt to set conditional format in xtables, such
>> as in:
>>
>> \setupxtable
>> [foregroundcolor={\ifnum\currentxtablecolumn=2 red\else green\fi}]
>> \starttext
>> \startxtable
>> \startxrow
>> \startxcell one \stopxcell
>> \startxcell two \stopxcell
>> \startxcell tree \stopxcell
>> \startxcell four \stopxcell
>> \stopxrow
>> \stopxtable
>> \stoptext
>>
>> My question is whether I can use ConTeXt conditionals instead of the
>> ones from TeX. {\doifelse{\currentxtablecolumn}{2}{red}{green}} doesn’t
>> work here.
>>
>> Many thanks for your help,
>>
>> Pablo
> 
> 
> 
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___
> 


-- 
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] conditional format in xtables

2018-04-10 Thread Wolfgang Schuster

The normal \doif... commands don’t work because they aren’t expandable
but you can use the \expdoif... commands (look into setup-en.pdf for all 
of them).


Wolfgang

Pablo Rodriguez <mailto:oi...@gmx.es>
10. April 2018 um 19:18
Dear list,

thanks to Wolfgang, I learnt to set conditional format in xtables, such
as in:

\setupxtable
[foregroundcolor={\ifnum\currentxtablecolumn=2 red\else green\fi}]
\starttext
\startxtable
\startxrow
\startxcell one \stopxcell
\startxcell two \stopxcell
\startxcell tree \stopxcell
\startxcell four \stopxcell
\stopxrow
\stopxtable
\stoptext

My question is whether I can use ConTeXt conditionals instead of the
ones from TeX. {\doifelse{\currentxtablecolumn}{2}{red}{green}} doesn’t
work here.

Many thanks for your help,

Pablo


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] Compare contents of macros via \doif etc. alternatives

2017-07-23 Thread Hans Hagen

On 7/23/2017 8:46 AM, Henri Menke wrote:

On 07/23/2017 05:55 PM, Jaroslav Hajtmar wrote:


Thanx Hans for reply.



also, it depends on what you want to achieve ... maybe comparing macros is not 
needed at all


You have right, that anytime compares are not needed, but for my very needed 
compares is not working in next eight examples. Problem is in expansions macros 
with optional argument. For “normal” macros are compares without problem as you 
see in last four examples….


Did you read my first reply?  Scanning for optional arguments is _inherently_ 
unexpandable.  Peeking ahead _always_ involves \futurelet which performs an 
assignment.  This can _never_ be edef-expanded.
indeed. fwiw, one can do some trickery with lua (read and push back) but 
even then you run into the fact that when reading a token expansion 
happens (so the expanded stuff is then in front)


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] Compare contents of macros via \doif etc. alternatives

2017-07-23 Thread Henri Menke
On 07/23/2017 05:55 PM, Jaroslav Hajtmar wrote:
> 
> Thanx Hans for reply.
> 
>>
>> also, it depends on what you want to achieve ... maybe comparing macros is 
>> not needed at all
> 
> You have right, that anytime compares are not needed, but for my very needed 
> compares is not working in next eight examples. Problem is in expansions 
> macros with optional argument. For “normal” macros are compares without 
> problem as you see in last four examples….

Did you read my first reply?  Scanning for optional arguments is _inherently_ 
unexpandable.  Peeking ahead _always_ involves \futurelet which performs an 
assignment.  This can _never_ be edef-expanded.

> 
> 
> mymacro
> 
> \doifelse{\mymacro}{123}{equal content}{not equal content}
> 
> \doifsamestringelse{\mymacro}{123}{equal content}{not equal content}
> 
> \doifinstringelse{\mymacro}{123}{equal content}{not equal content}
> 
> \doifincsnameelse{\mymacro}{123}{equal content}{not equal content}
> 
> 
> \hairline
> 
> mymacro[123]
> 
> \doifelse{\mymacro[123]}{123}{equal content}{not equal content}
> 
> \doifsamestringelse{\mymacro[123]}{123}{equal content}{not equal content}
> 
> \doifinstringelse{\mymacro[123]}{123}{equal content}{not equal content}
> 
> \doifincsnameelse{\mymacro[123]}{123}{equal content}{not equal content}
> 
> 
> 
> \hairline
> 
> 
> myothermacro
> 
> \doifelse{\myothermacro}{123}{equal content}{not equal content}
> 
> \doifsamestringelse{\myothermacro}{123}{equal content}{not equal content}
> 
> \doifinstringelse{\myothermacro}{123}{equal content}{not equal content}
> 
> \doifincsnameelse{\myothermacro}{123}{equal content}{not equal content}
> 
> 
>>
>> there is not that much benefit defining these at the lua end if you directly 
>> feed back into tex anyway
> 
> sure, but I need define some macros automatically from luacode (is part of 
> custom lua library)
> 
> Thanx
> Jaroslav Hajtmar
> 
> 
> 
> 
>> 22. 7. 2017 v 13:23, Hans Hagen <pra...@wxs.nl <mailto:pra...@wxs.nl>>:
>>
>> On 7/22/2017 3:58 AM, Henri wrote:
>>> On Fri, 2017-07-21 at 11:25 +, Jaroslav Hajtmar wrote:
>>>> Hello ConTeXist.
>>>> Is there any way to evaluate of contents of two macros as I am showing in 
>>>> my minimal example?
>>>> I know, that problem is in expansion, but I dont know to resolve it.
>>>> My minimal example consist of piece lua code, because I am solving my 
>>>> problem in mixed codes (TeX
>>>> & Lua)
>>> Something similar has been asked before and it is not possible.  The 
>>> interfaces.definecommand
>>> function defines a new macro using \protected\def.  To compare as equal in 
>>> a \doif context, both
>>> operands have to _expand_ to the same thing (here 123).  Here \mymacro is 
>>> not expandable and thus
>>> only \doifelse{\mymacro}{\mymacro} will ever compare true.
>>> Furthermore, scanning for optional arguments (i.e. [...]) is inherently 
>>> non-expandable.  To get
>>> something expandable you must at least switch to mandatory arguments (i.e. 
>>> {...}).  Still, using
>>> interfaces.definecommand will still not be possible.  I believe that 
>>> scanning arguments is better
>>> done on the macro level than in Lua, but that's just my opinion.
>>
>> also, it depends on what you want to achieve ... maybe comparing macros is 
>> not needed at all
>>
>>>> Thanx for help.
>>>> Jaroslav Hajtmar
>>>>\starttext
>>>>  \startluacode
>>>> interfaces.definecommand ("domymacro", {
>>>> arguments = { { "option", "string" }  },
>>>> macro = function (opt_1)
>>>>if #opt_1>0 then
>>>>context(opt_1)
>>>>else
>>>>context("123")
>>>>end
>>>> end
>>>>})
>>>> interfaces.definecommand("mymacro", {
>>>> macro = function ()
>>>>   context.dosingleempty()
>>>>   context["domymacro"]()
>>>> end
>>>>})
>>>> \stopluacode
>>
>> there is not that much 

Re: [NTG-context] Compare contents of macros via \doif etc. alternatives

2017-07-22 Thread Jaroslav Hajtmar

Thanx Hans for reply.


also, it depends on what you want to achieve ... maybe comparing macros is not 
needed at all

You have right, that anytime compares are not needed, but for my very needed 
compares is not working in next eight examples. Problem is in expansions macros 
with optional argument. For “normal” macros are compares without problem as you 
see in last four examples….


mymacro

\doifelse{\mymacro}{123}{equal content}{not equal content}

\doifsamestringelse{\mymacro}{123}{equal content}{not equal content}

\doifinstringelse{\mymacro}{123}{equal content}{not equal content}

\doifincsnameelse{\mymacro}{123}{equal content}{not equal content}


\hairline

mymacro[123]

\doifelse{\mymacro[123]}{123}{equal content}{not equal content}

\doifsamestringelse{\mymacro[123]}{123}{equal content}{not equal content}

\doifinstringelse{\mymacro[123]}{123}{equal content}{not equal content}

\doifincsnameelse{\mymacro[123]}{123}{equal content}{not equal content}



\hairline


myothermacro

\doifelse{\myothermacro}{123}{equal content}{not equal content}

\doifsamestringelse{\myothermacro}{123}{equal content}{not equal content}

\doifinstringelse{\myothermacro}{123}{equal content}{not equal content}

\doifincsnameelse{\myothermacro}{123}{equal content}{not equal content}



there is not that much benefit defining these at the lua end if you directly 
feed back into tex anyway

sure, but I need define some macros automatically from luacode (is part of 
custom lua library)

Thanx
Jaroslav Hajtmar




22. 7. 2017 v 13:23, Hans Hagen <pra...@wxs.nl<mailto:pra...@wxs.nl>>:

On 7/22/2017 3:58 AM, Henri wrote:
On Fri, 2017-07-21 at 11:25 +, Jaroslav Hajtmar wrote:
Hello ConTeXist.
Is there any way to evaluate of contents of two macros as I am showing in my 
minimal example?
I know, that problem is in expansion, but I dont know to resolve it.
My minimal example consist of piece lua code, because I am solving my problem 
in mixed codes (TeX
& Lua)
Something similar has been asked before and it is not possible.  The 
interfaces.definecommand
function defines a new macro using \protected\def.  To compare as equal in a 
\doif context, both
operands have to _expand_ to the same thing (here 123).  Here \mymacro is not 
expandable and thus
only \doifelse{\mymacro}{\mymacro} will ever compare true.
Furthermore, scanning for optional arguments (i.e. [...]) is inherently 
non-expandable.  To get
something expandable you must at least switch to mandatory arguments (i.e. 
{...}).  Still, using
interfaces.definecommand will still not be possible.  I believe that scanning 
arguments is better
done on the macro level than in Lua, but that's just my opinion.

also, it depends on what you want to achieve ... maybe comparing macros is not 
needed at all

Thanx for help.
Jaroslav Hajtmar
   \starttext
 \startluacode
interfaces.definecommand ("domymacro", {
arguments = { { "option", "string" }  },
macro = function (opt_1)
   if #opt_1>0 then
   context(opt_1)
   else
   context("123")
   end
end
   })
interfaces.definecommand("mymacro", {
macro = function ()
  context.dosingleempty()
  context["domymacro"]()
end
   })
\stopluacode

there is not that much benefit defining these at the lua end if you directly 
feed back into tex anyway

\def\myothermacro{123}
 \hairline
 \mymacro[123]
 \mymacro
 \myothermacro
 \hairline
 \doifelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
 \doifsamestringelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
 \doifinstringelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
 \doifincsnameelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
   \hairline
 \doifelse{\mymacro}{\myothermacro}{equal content}{not equal content}
 \doifsamestringelse{\mymacro}{\myothermacro}{equal content}{not equal content}
 \doifinstringelse{\mymacro}{\myothermacro}{equal content}{not equal content}
 \doifincsnameelse{\mymacro}{\myothermacro}{equal content}{not equal content}
 \stoptext
 
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl<mailto:ntg-context@ntg.nl> / 
http://www.ntg.nl/mailman/listinfo/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] Compare contents of macros via \doif etc. alternatives

2017-07-22 Thread Jaroslav Hajtmar
Hello ConTeXist.

Is there any way to evaluate of contents of two macros as I am showing in my 
minimal example? 

I know, that problem is in expansion, but I dont know to resolve it.

My minimal example consist of piece lua code, because I am solving my problem 
in mixed codes (TeX & Lua)

 

Thanx for help.

Jaroslav Hajtmar

 

 

\starttext

 

\startluacode

    interfaces.definecommand ("domymacro", {

        arguments = { { "option", "string" }  },

        macro = function (opt_1)

       if #opt_1>0 then

   context(opt_1)

   else

   context("123")

   end

        end

   })

    interfaces.definecommand("mymacro", {

        macro = function ()

      context.dosingleempty()

      context["domymacro"]()

        end

   })

\stopluacode

 

\def\myothermacro{123}

 

\hairline

 

\mymacro[123]

 

\mymacro

 

\myothermacro

 

\hairline

 

\doifelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}

 

\doifsamestringelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}

 

\doifinstringelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}

 

\doifincsnameelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}

 

 

\hairline

 

\doifelse{\mymacro}{\myothermacro}{equal content}{not equal content}

 

\doifsamestringelse{\mymacro}{\myothermacro}{equal content}{not equal content}

 

\doifinstringelse{\mymacro}{\myothermacro}{equal content}{not equal content}

 

\doifincsnameelse{\mymacro}{\myothermacro}{equal content}{not equal content}

 

 

 

\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] Compare contents of macros via \doif etc. alternatives

2017-07-22 Thread Hans Hagen

On 7/22/2017 3:58 AM, Henri wrote:

On Fri, 2017-07-21 at 11:25 +, Jaroslav Hajtmar wrote:

Hello ConTeXist.
Is there any way to evaluate of contents of two macros as I am showing in my 
minimal example?
I know, that problem is in expansion, but I dont know to resolve it.
My minimal example consist of piece lua code, because I am solving my problem 
in mixed codes (TeX
& Lua)


Something similar has been asked before and it is not possible.  The 
interfaces.definecommand
function defines a new macro using \protected\def.  To compare as equal in a 
\doif context, both
operands have to _expand_ to the same thing (here 123).  Here \mymacro is not 
expandable and thus
only \doifelse{\mymacro}{\mymacro} will ever compare true.

Furthermore, scanning for optional arguments (i.e. [...]) is inherently 
non-expandable.  To get
something expandable you must at least switch to mandatory arguments (i.e. 
{...}).  Still, using
interfaces.definecommand will still not be possible.  I believe that scanning 
arguments is better
done on the macro level than in Lua, but that's just my opinion.


also, it depends on what you want to achieve ... maybe comparing macros 
is not needed at all



Thanx for help.
Jaroslav Hajtmar
  
  
\starttext
  
\startluacode

 interfaces.definecommand ("domymacro", {
 arguments = { { "option", "string" }  },
 macro = function (opt_1)
if #opt_1>0 then
context(opt_1)
else
context("123")
end
 end
})
 interfaces.definecommand("mymacro", {
 macro = function ()
   context.dosingleempty()
   context["domymacro"]()
 end
})
\stopluacode


there is not that much benefit defining these at the lua end if you 
directly feed back into tex anyway



\def\myothermacro{123}
  
\hairline
  
\mymacro[123]
  
\mymacro
  
\myothermacro
  
\hairline
  
\doifelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
  
\doifsamestringelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
  
\doifinstringelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
  
\doifincsnameelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
  
  
\hairline
  
\doifelse{\mymacro}{\myothermacro}{equal content}{not equal content}
  
\doifsamestringelse{\mymacro}{\myothermacro}{equal content}{not equal content}
  
\doifinstringelse{\mymacro}{\myothermacro}{equal content}{not equal content}
  
\doifincsnameelse{\mymacro}{\myothermacro}{equal content}{not equal content}
  
  
  
\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
___




--

-
  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] Compare contents of macros via \doif etc. alternatives

2017-07-21 Thread Jaroslav Hajtmar
Thanks to Henri for the answer. To I admit, I thought it a bit technically that 
it would not be technically possible. At least I know why I was tearing my 
teeth while trying to test ... 
One more thanx.
Jaroslav Hajtmar


Dne 22.07.17 3:58, ntg-context za uživatele Henri <ntg-context-boun...@ntg.nl 
za uživatele henrime...@gmail.com> napsal(a):

On Fri, 2017-07-21 at 11:25 +, Jaroslav Hajtmar wrote:
> Hello ConTeXist.
> Is there any way to evaluate of contents of two macros as I am showing in 
my minimal example? 
> I know, that problem is in expansion, but I dont know to resolve it.
> My minimal example consist of piece lua code, because I am solving my 
problem in mixed codes (TeX
> & Lua)

Something similar has been asked before and it is not possible.  The 
interfaces.definecommand
function defines a new macro using \protected\def.  To compare as equal in 
a \doif context, both
operands have to _expand_ to the same thing (here 123).  Here \mymacro is 
not expandable and thus
only \doifelse{\mymacro}{\mymacro} will ever compare true.

Furthermore, scanning for optional arguments (i.e. [...]) is inherently 
non-expandable.  To get
something expandable you must at least switch to mandatory arguments (i.e. 
{...}).  Still, using
interfaces.definecommand will still not be possible.  I believe that 
scanning arguments is better
done on the macro level than in Lua, but that's just my opinion.

> Thanx for help.
> Jaroslav Hajtmar
>  
>  
> \starttext
>  
> \startluacode
> interfaces.definecommand ("domymacro", {
> arguments = { { "option", "string" }  },
> macro = function (opt_1)
>if #opt_1>0 then
>context(opt_1)
>else
>context("123")
>end
> end
>})
> interfaces.definecommand("mymacro", {
> macro = function ()
>   context.dosingleempty()
>   context["domymacro"]()
> end
>})
> \stopluacode
>  
> \def\myothermacro{123}
>  
> \hairline
>  
> \mymacro[123]
>  
> \mymacro
>  
> \myothermacro
>  
> \hairline
>  
> \doifelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
>  
> \doifsamestringelse{\mymacro}{\mymacro[123]}{equal content}{not equal 
content}
>  
> \doifinstringelse{\mymacro}{\mymacro[123]}{equal content}{not equal 
content}
>  
> \doifincsnameelse{\mymacro}{\mymacro[123]}{equal content}{not equal 
content}
>  
>  
> \hairline
>  
> \doifelse{\mymacro}{\myothermacro}{equal content}{not equal content}
>  
> \doifsamestringelse{\mymacro}{\myothermacro}{equal content}{not equal 
content}
>  
> \doifinstringelse{\mymacro}{\myothermacro}{equal content}{not equal 
content}
>  
> \doifincsnameelse{\mymacro}{\myothermacro}{equal content}{not equal 
content}
>  
>  
>  
> \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

___

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] Compare contents of macros via \doif etc. alternatives

2017-07-21 Thread Henri
On Fri, 2017-07-21 at 11:25 +, Jaroslav Hajtmar wrote:
> Hello ConTeXist.
> Is there any way to evaluate of contents of two macros as I am showing in my 
> minimal example? 
> I know, that problem is in expansion, but I dont know to resolve it.
> My minimal example consist of piece lua code, because I am solving my problem 
> in mixed codes (TeX
> & Lua)

Something similar has been asked before and it is not possible.  The 
interfaces.definecommand
function defines a new macro using \protected\def.  To compare as equal in a 
\doif context, both
operands have to _expand_ to the same thing (here 123).  Here \mymacro is not 
expandable and thus
only \doifelse{\mymacro}{\mymacro} will ever compare true.

Furthermore, scanning for optional arguments (i.e. [...]) is inherently 
non-expandable.  To get
something expandable you must at least switch to mandatory arguments (i.e. 
{...}).  Still, using
interfaces.definecommand will still not be possible.  I believe that scanning 
arguments is better
done on the macro level than in Lua, but that's just my opinion.

> Thanx for help.
> Jaroslav Hajtmar
>  
>  
> \starttext
>  
> \startluacode
>     interfaces.definecommand ("domymacro", {
>         arguments = { { "option", "string" }  },
>         macro = function (opt_1)
>        if #opt_1>0 then
>    context(opt_1)
>    else
>    context("123")
>    end
>         end
>    })
>     interfaces.definecommand("mymacro", {
>         macro = function ()
>       context.dosingleempty()
>       context["domymacro"]()
>         end
>    })
> \stopluacode
>  
> \def\myothermacro{123}
>  
> \hairline
>  
> \mymacro[123]
>  
> \mymacro
>  
> \myothermacro
>  
> \hairline
>  
> \doifelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
>  
> \doifsamestringelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
>  
> \doifinstringelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
>  
> \doifincsnameelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}
>  
>  
> \hairline
>  
> \doifelse{\mymacro}{\myothermacro}{equal content}{not equal content}
>  
> \doifsamestringelse{\mymacro}{\myothermacro}{equal content}{not equal content}
>  
> \doifinstringelse{\mymacro}{\myothermacro}{equal content}{not equal content}
>  
> \doifincsnameelse{\mymacro}{\myothermacro}{equal content}{not equal content}
>  
>  
>  
> \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] Compare contents of macros via \doif etc. alternatives

2017-07-21 Thread Jaroslav Hajtmar
Hello ConTeXist.
Is there any way to evaluate of contents of two macros as I am showing in my 
minimal example?
I know, that problem is in expansion, but I dont know to resolve it.
My minimal example consist of piece lua code, because I am solving my problem 
in mixed codes (TeX & Lua)

Thanx for help.
Jaroslav Hajtmar


\starttext

\startluacode
interfaces.definecommand ("domymacro", {
arguments = { { "option", "string" }  },
macro = function (opt_1)
   if #opt_1>0 then
   context(opt_1)
   else
   context("123")
   end
end
   })
interfaces.definecommand("mymacro", {
macro = function ()
  context.dosingleempty()
  context["domymacro"]()
end
   })
\stopluacode

\def\myothermacro{123}

\hairline

\mymacro[123]

\mymacro

\myothermacro

\hairline

\doifelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}

\doifsamestringelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}

\doifinstringelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}

\doifincsnameelse{\mymacro}{\mymacro[123]}{equal content}{not equal content}


\hairline

\doifelse{\mymacro}{\myothermacro}{equal content}{not equal content}

\doifsamestringelse{\mymacro}{\myothermacro}{equal content}{not equal content}

\doifinstringelse{\mymacro}{\myothermacro}{equal content}{not equal content}

\doifincsnameelse{\mymacro}{\myothermacro}{equal content}{not equal content}



\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] Nested modes and itemizations

2016-11-17 Thread Christoph Reller
On Thu, Nov 17, 2016 at 13:14:49 +0100 Hans Hagen <pra...@wxs.nl> wrote:

>
> On 11/17/2016 11:21 AM, Christoph Reller wrote:
> > Hi,
> >
> > I have the following minimal not-working example:
> >
> > \starttext
> > \startitemize
> > \item One
> >   \startmode[modeA]
> >   \item Two
> > \startitemize
> >   \startmode[modeB] % <- this
> >   \item Two A   % <- does
> >   \stopmode % <- not work
> >   % \doifmode{modeB}{\item Two A} % <- this works
> > \item Two B
> > \stopitemize
> >   \stopmode
> > \stopitemize
> > \stoptext
> >
> > Note that both modeA and modeB are not defined and hence not enabled.
> > When compiled with the latest version of ConTeXt MkIV, I get: Missing
> > number, treated as zero.
> > However, If I use the inline version \doifmode instead of the
> > environment version \startmode \stopmode, then the example compiles
> > without problem.
> >
> > I am afraid but this may be a bug.
>
> No, just the way tex parses, \stopmode is a delimiter so the inner
> \stopmode ends the outer \startmode.
>
> Using the \doif variable doesn't have that problem.
>
>
Oh, of course! Thank you and sorry for the noise.
Christoph
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/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] Nested modes and itemizations

2016-11-17 Thread Hans Hagen

On 11/17/2016 11:21 AM, Christoph Reller wrote:

Hi,

I have the following minimal not-working example:

\starttext
\startitemize
\item One
  \startmode[modeA]
  \item Two
\startitemize
  \startmode[modeB] % <- this
  \item Two A   % <- does
  \stopmode % <- not work
  % \doifmode{modeB}{\item Two A} % <- this works
\item Two B
\stopitemize
  \stopmode
\stopitemize
\stoptext

Note that both modeA and modeB are not defined and hence not enabled.
When compiled with the latest version of ConTeXt MkIV, I get: Missing
number, treated as zero.
However, If I use the inline version \doifmode instead of the
environment version \startmode \stopmode, then the example compiles
without problem.

I am afraid but this may be a bug.


No, just the way tex parses, \stopmode is a delimiter so the inner 
\stopmode ends the outer \startmode.


Using the \doif variable doesn't have that problem.

-
  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] use of preceding-sibling in xmlsetsetup

2015-10-20 Thread massifr
Here's the (complete) code:

\startbuffer[test]

  Dear list,
  this paragraph should not be indented, because it 
follows the “incipit”
  of the letter.
  This one and the following ones should be indented.
  You may question whether “Dear list,” should be a paragraph of his own,
  but my text is already formatted like that and I can’t do anything 
  about it.

\stopbuffer
 
\startxmlsetups xml:somesetups
  \xmlsetsetup{#1}{text}{xml:text}
  \xmlsetsetup{#1}{p}{xml:p}
  \xmlsetsetup{#1}{p[@class='incipit']}{xml:p:noindent}
  % the following lpath expression does not work
  % \xmlsetsetup{#1}{p[reverse-sibling::p[1]/attribute('class') == 
'incipit']}{xml:p:noindent}
\stopxmlsetups

\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
  \indenting[{yes,first,12pt}]
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
  \doif{\xmlattribute{#1}{reverse-sibling::p[1]}{class}}{incipit}{\noindent}
  \xmlflush{#1}\par
\stopxmlsetups
 
\startxmlsetups xml:p:noindent
  \noindent\xmlflush{#1}\par
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{test}{}
\stoptext
 
It's the example of the original message of this thread, with the 
modifications posted in the second message.

In the \startxmlsetups section I tried to put that condition in a
\xmlsetsetup, but I commented it out because it did not work.
 
Here's where I found an example with reverse-sibling:
https://www.mail-archive.com/ntg-context%40ntg.nl/msg77364.html
I was searching for "sibling" in the mailing list archive to see whether
"sibling expressions" had been implemented.

Greetings,
Massi

> > On 10/17/2015 11:19 AM, mf wrote:
> > > "reverse-sibling" is ConTeXt specific and very useful: it's a "reversed
> > > preceding-sibling", so that you find the nearest sibling at index [1].
> > > I've used it successfully in a \doif statement, but I failed in
> > > translating it in a \xmlsetsetup statement, to tell ConTeXt: "this
> > > setup is for an element p whose nearest preceding sibling p has class
> > > 'incipit'".
> > 
> > In that case, why don't you show the code where you've used it 
> > successfully and maybe we can take it from there.
> > 
> > Thomas
> > 

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] use of preceding-sibling in xmlsetsetup

2015-10-20 Thread Hans Hagen

On 10/20/2015 11:48 AM, mass...@fastwebnet.it wrote:

Here's the (complete) code:

\startbuffer[test]

   Dear list,
   this paragraph should not be indented, because it 
follows the “incipit”
   of the letter.
   This one and the following ones should be indented.
   You may question whether “Dear list,” should be a paragraph of his own,
   but my text is already formatted like that and I can’t do anything
   about it.

\stopbuffer

\startxmlsetups xml:somesetups
   \xmlsetsetup{#1}{text}{xml:text}
   \xmlsetsetup{#1}{p}{xml:p}
   \xmlsetsetup{#1}{p[@class='incipit']}{xml:p:noindent}
   % the following lpath expression does not work
   % \xmlsetsetup{#1}{p[reverse-sibling::p[1]/attribute('class') == 
'incipit']}{xml:p:noindent}
\stopxmlsetups


\xmlsetsetup{#1}{p/reverse-sibling::p[1][@class=='incipit']/following-sibling::p[1]}{xml:p:noindent}

or

\xmlsetsetup{#1}{p/reverse-sibling::p[position()==1 and 
@class=='incipit']/following-sibling::p[1]}{xml:p:noindent}



\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
   \indenting[{yes,first,12pt}]
   \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
   \doif{\xmlattribute{#1}{reverse-sibling::p[1]}{class}}{incipit}{\noindent}
   \xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:p:noindent
   \noindent\xmlflush{#1}\par
\stopxmlsetups

\starttext
   \xmlprocessbuffer{main}{test}{}
\stoptext

It's the example of the original message of this thread, with the
modifications posted in the second message.

In the \startxmlsetups section I tried to put that condition in a
\xmlsetsetup, but I commented it out because it did not work.

Here's where I found an example with reverse-sibling:
https://www.mail-archive.com/ntg-context%40ntg.nl/msg77364.html
I was searching for "sibling" in the mailing list archive to see whether
"sibling expressions" had been implemented.

Greetings,
Massi


On 10/17/2015 11:19 AM, mf wrote:

"reverse-sibling" is ConTeXt specific and very useful: it's a "reversed
preceding-sibling", so that you find the nearest sibling at index [1].
I've used it successfully in a \doif statement, but I failed in
translating it in a \xmlsetsetup statement, to tell ConTeXt: "this
setup is for an element p whose nearest preceding sibling p has class
'incipit'".


In that case, why don't you show the code where you've used it
successfully and maybe we can take it from there.

Thomas



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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___




--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] use of preceding-sibling in xmlsetsetup

2015-10-19 Thread Thomas A. Schmitz

On 10/17/2015 11:19 AM, mf wrote:

"reverse-sibling" is ConTeXt specific and very useful: it's a "reversed
preceding-sibling", so that you find the nearest sibling at index [1].
I've used it successfully in a \doif statement, but I failed in
translating it in a \xmlsetsetup statement, to tell ConTeXt: "this
setup is for an element p whose nearest preceding sibling p has class
'incipit'".


In that case, why don't you show the code where you've used it 
successfully and maybe we can take it from there.


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] ntg-context Digest, Vol 136, Issue 30

2015-10-19 Thread massifr
Here's the (complete) code:

\startbuffer[test]

  Dear list,
  this paragraph should not be indented, because it 
follows the “incipit”
  of the letter.
  This one and the following ones should be indented.
  You may question whether “Dear list,” should be a paragraph of his own,
  but my text is already formatted like that and I can’t do anything 
  about it.

\stopbuffer

\startxmlsetups xml:somesetups
  \xmlsetsetup{#1}{text}{xml:text}
  \xmlsetsetup{#1}{p}{xml:p}
  \xmlsetsetup{#1}{p[@class='incipit']}{xml:p:noindent}
  % the following lpath expression does not work
  % \xmlsetsetup{#1}{p[reverse-sibling::p[1]/attribute('class') == 
'incipit']}{xml:p:noindent}
\stopxmlsetups

\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
  \indenting[{yes,first,12pt}]
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
  \doif{\xmlattribute{#1}{reverse-sibling::p[1]}{class}}{incipit}{\noindent}
  \xmlflush{#1}\par
\stopxmlsetups

\startxmlsetups xml:p:noindent
  \noindent\xmlflush{#1}\par
\stopxmlsetups

\starttext
  \xmlprocessbuffer{main}{test}{}
\stoptext

It's the example of the original message of this thread, with the 
modifications posted in the second message.

In the \startxmlsetups section I tried to put that condition in a
\xmlsetsetup, but I commented it out because it did not work.

Here's where I found an example with reverse-sibling:
https://www.mail-archive.com/ntg-context%40ntg.nl/msg77364.html
I was searching for "sibling" in the mailing list archive to see whether
"sibling expressions" had been implemented.

Greetings,
Massi

> On 10/17/2015 11:19 AM, mf wrote:
> > "reverse-sibling" is ConTeXt specific and very useful: it's a "reversed
> > preceding-sibling", so that you find the nearest sibling at index [1].
> > I've used it successfully in a \doif statement, but I failed in
> > translating it in a \xmlsetsetup statement, to tell ConTeXt: "this
> > setup is for an element p whose nearest preceding sibling p has class
> > 'incipit'".
> 
> In that case, why don't you show the code where you've used it 
> successfully and maybe we can take it from there.
> 
> Thomas
> 
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] use of preceding-sibling in xmlsetsetup

2015-10-17 Thread mf
Thank you for your answer, Thomas.
I tried something similar (putting a \noindentation at the end of the
"incipit" paragraph, but it failed if I put a \blank after that).

The sibling part
In the book of the history of luatex (v 0.50) it is said that the
sibling functions would not be implemented soon, but at least 3 methods
have been implemented. From the release notes 8/5/2010 (http://wiki.con
textgarden.net/Context_2010.05.08):
"implement following-sibling(), preceding-sibling() and reverse-
sibling() lpath methods"

If you search for "sibling" in the mailing list archive, you find a
pair of threads. I've found no other documentation.

"reverse-sibling" is ConTeXt specific and very useful: it's a "reversed
preceding-sibling", so that you find the nearest sibling at index [1].
I've used it successfully in a \doif statement, but I failed in
translating it in a \xmlsetsetup statement, to tell ConTeXt: "this
setup is for an element p whose nearest preceding sibling p has class
'incipit'".

Massi

Il giorno gio, 15/10/2015 alle 22.27 +0200, Thomas A. Schmitz ha
scritto:
> On 10/14/2015 01:34 PM, mass...@fastwebnet.it wrote:
> > I've found a better solution:
> > 
> > \startxmlsetups xml:p
> >    \doif{\xmlattribute{#1}{reverse-
> > sibling::p[1]}{class}}{incipit}{\noindent}%
> >    \xmlflush{#1}\par
> > \stopxmlsetups
> > 
> > Still I did not manage to put that rule in a xmlsetsetup.
> > Tried this:
> > 
> > \xmlsetsetup{#1}{p[reverse-sibling::p[1]/attribute('class') ==
> > 'incipit']}{xml:p:noindent}
> > 
> > but it does not work.
> 
> I'm not sure if the "sibling" part of xpath syntax has been
> integrated 
> into context. The best I can come up with is a hack which may help:
> 
> \startbuffer[test]
> 
>    Dear list,
>    this paragraph should not be indented, because it follows the 
> “incipit”
>    of the letter.
>    This one and the following ones should be indented.
>    You may question whether “Dear list,” should be a paragraph of
> his 
> own,
>    but my text is already formatted like that and I can’t do anything
>    about it.
> 
> \stopbuffer
> 
> \startxmlsetups xml:somesetups
>    \xmlsetsetup{#1}{text}{xml:text}
>    \xmlsetsetup{#1}{p}{xml:p}
> \stopxmlsetups
> 
> \xmlregistersetup{xml:somesetups}
> 
> \startxmlsetups xml:text
>    \xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:p
>   \doifelse {\xmlatt {#1} {class}} {incipit}
>     {\noindentation \xmlflush {#1}\par \noindentation}
>     {\xmlflush {#1}\par \indentation}
> \stopxmlsetups
> 
> \starttext
>    \setupindenting [medium, yes]
>    \xmlprocessbuffer{main}{test}{}
> \stoptext
> 
> This will suppress indentation for paragraphs with class "incipit"
> and 
> the following paragraph.
> 
> Thomas
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] use of preceding-sibling in xmlsetsetup

2015-10-15 Thread Thomas A. Schmitz

On 10/14/2015 01:34 PM, mass...@fastwebnet.it wrote:

I've found a better solution:

\startxmlsetups xml:p
   \doif{\xmlattribute{#1}{reverse-sibling::p[1]}{class}}{incipit}{\noindent}%
   \xmlflush{#1}\par
\stopxmlsetups

Still I did not manage to put that rule in a xmlsetsetup.
Tried this:

\xmlsetsetup{#1}{p[reverse-sibling::p[1]/attribute('class') == 
'incipit']}{xml:p:noindent}

but it does not work.


I'm not sure if the "sibling" part of xpath syntax has been integrated 
into context. The best I can come up with is a hack which may help:


\startbuffer[test]

  Dear list,
  this paragraph should not be indented, because it follows the 
“incipit”

  of the letter.
  This one and the following ones should be indented.
  You may question whether “Dear list,” should be a paragraph of his 
own,

  but my text is already formatted like that and I can’t do anything
  about it.

\stopbuffer

\startxmlsetups xml:somesetups
  \xmlsetsetup{#1}{text}{xml:text}
  \xmlsetsetup{#1}{p}{xml:p}
\stopxmlsetups

\xmlregistersetup{xml:somesetups}

\startxmlsetups xml:text
  \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:p
\doifelse {\xmlatt {#1} {class}} {incipit}
  {\noindentation \xmlflush {#1}\par \noindentation}
  {\xmlflush {#1}\par \indentation}
\stopxmlsetups

\starttext
  \setupindenting [medium, yes]
  \xmlprocessbuffer{main}{test}{}
\stoptext

This will suppress indentation for paragraphs with class "incipit" and 
the following paragraph.


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] use of preceding-sibling in xmlsetsetup

2015-10-14 Thread massifr
I've found a better solution:

\startxmlsetups xml:p
  \doif{\xmlattribute{#1}{reverse-sibling::p[1]}{class}}{incipit}{\noindent}%
  \xmlflush{#1}\par
\stopxmlsetups

Still I did not manage to put that rule in a xmlsetsetup.
Tried this:

\xmlsetsetup{#1}{p[reverse-sibling::p[1]/attribute('class') == 
'incipit']}{xml:p:noindent}

but it does not work.

> Hello list,
> I need a lpath expression to intercept the first p (HTML paragraph) 
> after a p of class "incipit". Here's a (not) working example:
> 
> \startbuffer[test]
> 
>   Dear list,
>   this paragraph should not be indented, because it follows the “incipit”
>   of the letter.
>   This one and the following ones should be indented.
>   You may question whether “Dear list,” should be a paragraph of his own,
>   but my text is already formatted like that and I can’t do anything 
>   about it.
> 
> \stopbuffer
> 
> \startxmlsetups xml:somesetups
>   \xmlsetsetup{#1}{text}{xml:text}
>   \xmlsetsetup{#1}{p}{xml:p}
>   \xmlsetsetup{#1}{p[@class='incipit']}{xml:p:noindent}
>   % the following lpath expression does not work
>   \xmlsetsetup{#1}{p[./preceding-sibling::[-1][@class = 
> 'incipit']]}{xml:p:noindent}
> \stopxmlsetups
> 
> \xmlregistersetup{xml:somesetups}
> 
> \startxmlsetups xml:text
>   \indenting[{yes,first,12pt}]
>   \xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:p
>   \xmlflush{#1}\par
> \stopxmlsetups
> 
> \startxmlsetups xml:p:noindent
>   \noindent\xmlflush{#1}\par
> \stopxmlsetups
> 
> \starttext
>   \xmlprocessbuffer{main}{test}{}
> \stoptext
> 
> Thanks for any help.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] \reference and \setupinteraction[focus=...] not working

2015-10-08 Thread Christoph Reller
Hi everybody,

An even more minimal example

\setupinteraction[state=start,focus=standard] % <- defect
%\setupinteraction[state=start, focus=fit]% <- works
\starttext
  \reference[tuf]{Tufte}
  \input tufte
  \page
  \about[tuf].
\stoptext

The resulting PDF has an annotation that points to a named destination
"(tuf)". But "Names" in the PDF root contains then key "(#1)" and a correct
destination as value. It is only the key in the Names tree that is wrong.

Unfortunately, I cannot locate the code where this is written (maybe
strc-ref.lua?).

Any help is welcome.

Regards,
Christoph

On Fri, Sep 18, 2015 at 11:25 AM, <ntg-context-requ...@ntg.nl> wrote:

> Send ntg-context mailing list submissions to
> ntg-context@ntg.nl
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://www.ntg.nl/mailman/listinfo/ntg-context
> or, via email, send a message with subject or body 'help' to
> ntg-context-requ...@ntg.nl
>
> You can reach the person managing the list at
> ntg-context-ow...@ntg.nl
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ntg-context digest..."
>
>
> Today's Topics:
>
>1. Re: comparing strings (Wolfgang Schuster)
>2. Re: suppress header-footers (Wolfgang Schuster)
>3. Re: comparing strings (Pablo Rodriguez)
>4. Re: formatting of reference links (Henning Hraban Ramm)
>5. Re: \reference and \setupinteraction[focus=...] not   working
>   (Christoph Reller)
>6. Re: formatting of reference links (Wolfgang Schuster)
>
>
> --
>
> Message: 1
> Date: Thu, 17 Sep 2015 19:26:45 +0200
> From: Wolfgang Schuster <schuster.wolfg...@gmail.com>
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>
> Subject: Re: [NTG-context] comparing strings
> Message-ID: <55faf7d5.8080...@gmail.com>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> > Pablo Rodriguez <mailto:oi...@gmx.es>
> > 17. September 2015 18:47
> > Dear list,
> >
> > I have the following sample:
> >
> > \startluacode
> > function document.gouppercase(str)
> > tex.print(str:upper())
> > end
> > \stopluacode
> >
> > \unexpanded\def\MyUpper#1%
> > {\ctxlua{document.gouppercase("#1")}}
> >
> > \starttext
> > \doif{\MyUpper{adfalkjfaeñf}}{\MyUpper{aDFAlkjfaeñf}}{equal}{unequal}
> >
> > \ctxlua{if string.upper("adfalkjfaeñf") == string.upper("aDFAlkjfaeñf")
> > then tex.print("equal") else tex.print("unequal") end}
> > \stoptext
> >
> > Why are are the first two strings unequal?
> You can’t use a unexpandable (which you created with \unexpanded) in
> ConTeXts \doifXXX commands.
>
> PS. You need \doifelse and not \doif.
>
> Wolfgang
> -- next part --
> An HTML attachment was scrubbed...
> URL: <
> http://www.ntg.nl/pipermail/ntg-context/attachments/20150917/d9453cc7/attachment-0001.html
> >
>
> --
>
> Message: 2
> Date: Thu, 17 Sep 2015 19:29:20 +0200
> From: Wolfgang Schuster <schuster.wolfg...@gmail.com>
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>
> Subject: Re: [NTG-context] suppress header-footers
> Message-ID: <55faf870.1020...@gmail.com>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> > Pablo Rodriguez <mailto:oi...@gmx.es>
> > 17. September 2015 17:55
> >
> > Many thanks for your reply, Wolfgang.
> >
> > I thought that blank implied the how the next page would look like, but
> > not the insertion of a new page.
> The blank keyword doesn’t insert a new page, it sets only a flag which
> hides all page backgrounds
> (colors, overlays or headers) on the given page but the flag lasts only
> for a single page.
>
> Wolfgang
> -- next part --
> An HTML attachment was scrubbed...
> URL: <
> http://www.ntg.nl/pipermail/ntg-context/attachments/20150917/4381038e/attachment-0001.html
> >
>
> --
>
> Message: 3
> Date: Thu, 17 Sep 2015 19:51:14 +0200
> From: Pablo Rodriguez <oi...@gmx.es>
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>
> Subject: Re: [NTG-context] comparing strings
> Message-ID: <55fafd92.10...@gmx.es>
> Content-Type: text/plain; charset=utf-8
>
> On 09/17/2015 07:26 PM, Wolfgang Schuster wrote:
> >> Pablo Rodriguez 17. September 2015 18:47
> >> [..

[NTG-context] comparing strings

2015-09-17 Thread Pablo Rodriguez
Dear list,

I have the following sample:

\startluacode
function document.gouppercase(str)
tex.print(str:upper())
end
\stopluacode

\unexpanded\def\MyUpper#1%
{\ctxlua{document.gouppercase("#1")}}

\starttext
\doif{\MyUpper{adfalkjfaeñf}}{\MyUpper{aDFAlkjfaeñf}}{equal}{unequal}

\ctxlua{if string.upper("adfalkjfaeñf") == string.upper("aDFAlkjfaeñf")
then tex.print("equal") else tex.print("unequal") end}
\stoptext

Why are are the first two strings unequal?

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] comparing strings

2015-09-17 Thread Pablo Rodriguez
On 09/17/2015 07:26 PM, Wolfgang Schuster wrote:
>> Pablo Rodriguez 17. September 2015 18:47
>> [...]
>> \unexpanded\def\MyUpper#1%
>> {\ctxlua{document.gouppercase("#1")}}
>>
>> \starttext
>> \doif{\MyUpper{adfalkjfaeñf}}{\MyUpper{aDFAlkjfaeñf}}{equal}{unequal}
>>
>> Why are are the first two strings unequal?
>
> You can’t use a unexpandable (which you created with \unexpanded) in
> ConTeXts \doifXXX commands.

Many thanks for your reply, Wolfgang.

I see. I thought it was better to add \unexpanded before a pure \def.

Is it \unexpaded required before a \def with more than one argument?

(Sorry, but expansion is a concept which I’m not familiar with.)

> PS. You need \doifelse and not \doif.

I realized this too sending the message to the list.



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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] comparing strings

2015-09-17 Thread Wolfgang Schuster

Pablo Rodriguez <mailto:oi...@gmx.es>
17. September 2015 18:47
Dear list,

I have the following sample:

\startluacode
function document.gouppercase(str)
tex.print(str:upper())
end
\stopluacode

\unexpanded\def\MyUpper#1%
{\ctxlua{document.gouppercase("#1")}}

\starttext
\doif{\MyUpper{adfalkjfaeñf}}{\MyUpper{aDFAlkjfaeñf}}{equal}{unequal}

\ctxlua{if string.upper("adfalkjfaeñf") == string.upper("aDFAlkjfaeñf")
then tex.print("equal") else tex.print("unequal") end}
\stoptext

Why are are the first two strings unequal?
You can’t use a unexpandable (which you created with \unexpanded) in 
ConTeXts \doifXXX commands.


PS. You need \doifelse and not \doif.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Documentation: full list of commands

2015-08-09 Thread Hans Hagen

On 8/9/2015 10:26 AM, juh wrote:

Hello,

even though the commands in the autogenerated command list
(http://www.pragma-ade.com/general/qrcs/setup-en.pdf) are not commented
the document is useful to me.

In a MWE on this list I saw the command \doifoddpage which is not in the
list.

Wiki and even Google does not find anything about this command. I think
that I kind of understand the command, but I wonder how many commands
are out there I've never heard of.

So my question: Is it possible to have a complete list of all commands
used in ConTeXt?


commands come in layers:

- general low level  : you can find a list of them in mult-low.lua (i 
sometimes add to them)


- specific low level : like the one you mention, these are normally 
quite stable (read: you can use them as they will stay around), there 
are quite some \doif* ones (no list, one needs to look into the source 
code re;ated to it) ... i have no time to make a list but if someone ...


- frequently used high level commands with low level fast callers : 
\framed sits in this category


- high level commands : lots of \setup, \define, \start and so ... we 
share the systematics as much as possible (also options)


- then there are defined commands (and users can add to them) : specific 
instances of section heads, verbatim, fonts etc


(some of the more obscure commands are described in articles and 
dedicated manuals)


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] newotf definefontfeatures problem with script=hebr

2015-07-12 Thread Hans Hagen

On 7/12/2015 7:02 PM, Rik Kabel wrote:

The following code fails; however, it succeeds without newotf, and it
succeeds with newotf if the defined font feature (*hebrew) is removed
from the \definefont command. The characters that demonstrate the
problem are HEBREW LETTER LAMED combined with HEBREW POINT HOLAM,
followed by HEBREW LETTER ALEF (U05DC with combining U05B9 followed by
U05D0). I have not come across other combinations that cause the
problem, but I have not done an exhaustive search.

\usemodule [newotf]
\setupdirections   [bidi=global]
\definefontfeature [hebrew] [default] [lang=heb,ccmp=yes,script=hebr]

\definefont[Hebrew] [sileot*hebrew]
\starttext
   \startTEXpage
 This is okay:{\hfill\Hebrew לא}

 This is okay:{\hfill{\Hebrew לֹ}}

 This fails:{\hfill{\Hebrew לֹא}}
   \stopTEXpage
\stoptext

It reports:

error:
C:/ConTeXt/tex/texmf-context/tex/context/base/font-ots.lua:1586:
attempt to index a number value

tex errortex error on line 13 in file
C://Users/rik/Desktop/newotf-features.tex: ?

inserted text \par

to be read again
\vss
\pack_framed_do_bottom ...amedparameter \c!bottom
\raggedbottomcommand
to be read again \localendstrut \pack_framed_do_bottom
   \egroup
\stopfittingpage -\removeunwantedspaces \egroup
  \egroup \doif
{\fittingpage...
l.13   \stopTEXpage


fixed (i only tested siltot)

Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] newotf definefontfeatures problem with script=hebr

2015-07-12 Thread Rik Kabel
The following code fails; however, it succeeds without newotf, and it 
succeeds with newotf if the defined font feature (*hebrew) is removed 
from the \definefont command. The characters that demonstrate the 
problem are HEBREW LETTER LAMED combined with HEBREW POINT HOLAM, 
followed by HEBREW LETTER ALEF (U05DC with combining U05B9 followed by 
U05D0). I have not come across other combinations that cause the 
problem, but I have not done an exhaustive search.


   \usemodule [newotf]
   \setupdirections   [bidi=global]
   \definefontfeature [hebrew] [default] [lang=heb,ccmp=yes,script=hebr]

   \definefont[Hebrew] [sileot*hebrew]
   \starttext
  \startTEXpage
This is okay:{\hfill\Hebrew לא}

This is okay:{\hfill{\Hebrew לֹ}}

This fails:{\hfill{\Hebrew לֹא}}
  \stopTEXpage
   \stoptext

It reports:

   error:
   C:/ConTeXt/tex/texmf-context/tex/context/base/font-ots.lua:1586:
   attempt to index a number value

   tex errortex error on line 13 in file
   C://Users/rik/Desktop/newotf-features.tex: ?

   inserted text \par

   to be read again
   \vss
   \pack_framed_do_bottom ...amedparameter \c!bottom
   \raggedbottomcommand
   to be read again \localendstrut \pack_framed_do_bottom
  \egroup
   \stopfittingpage -\removeunwantedspaces \egroup
 \egroup \doif
   {\fittingpage...
   l.13   \stopTEXpage

The same problem occurs in the same way with the following fonts, most 
of which are shipped with Windows:


   Arial Regular
   Arial Bold
   Arial Narrow
   David Regular
   David Bold
   Ezra SIL Regular
   Ezra SIL SR Regular
   Keter YG Medium
   Levenim MT Regular
   Levenim MT Bold
   Taamey David CLM
   Tahoma Regular
   Tahoma Bold
   Times New Roman Regular
   Times New Roman Bold


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] embeddedxtable

2015-05-24 Thread Meer, H. van der
In this case you have to provide a working minimal example.

Wolfgang

Here an example as minimal as I could construct.
Hans van der Meer

The following example outputs show what happens with and without the \unskip's 
in the code.
[cid:E7DC008D-E8CB-4F0A-BC45-9E8E4969C8DB]
[cid:8A14737A-52AE-4B90-A03B-FA36FFF321E0]

Also I am adding two other examples made by the same code, one in 2012 and one 
just now. Note the extensions to the right of each row. They are absent in the 
older version.

[cid:1110D708-ADD3-46B8-A49B-143200704DA7][cid:539F8473-CC40-4CDB-AFC6-48AF306DD3F5]
The example code follows here:

% Switching on attribute being present (even if empty) or absent.
\def\doifexistattribute#1#2{\doifnot{\xmlattdef{#1}{#2}{__NOT__}}{__NOT__}}%{#3}
% Translate attribute: #1 = node, #2 = category #3 = attribute #4 = default 
value.
\def\xlat#1#2#3#4{\xmlvalue{#2}{\xmlatt{#1}{#3}}{#4}}
% Setup parameter to attribute.
% #1 = node, #2 = setup, #3 = param, #4 = attrib, #5 = category, #6 = default.
\def\setupToAttribute#1#2#3#4#5#6{%
% Only executed if attribute is present.
\doifexistattribute{#1}{#4}%
% Attribute is present but category can be empty.
{\doifelse{#5}{\empty}%
{\doifelse{\xmlatt{#1}{#4}}{\empty}%
{#2[#3=#6]}% attribute present but empty then take default
{#2[#3=\xmlatt{#1}{#4}]}% attribute has content
}%
{#2[#3=\xlat{#1}{#5}{#4}{#6}]}% translate from category
}%
}
% Setup flag (an TeX-if) from attribute values on,off,no,yes,true,false.
% #1=node #2=flag: execute \attributetrue or \attributefalse
\def\setFlagToAttribute#1#2{%
\doifexistattribute{#1}{#2}%
{%
\doifinset{\xmlatt{#1}{#2}}{on,yes,true}{\csname#2true\endcsname}%
\doifinset{\xmlatt{#1}{#2}}{off,no,false}{\csname#2false\endcsname}%
}%
}
\startxmlsetups xmlcommon
\xmlsetsetup{\xmldocument}{error|store|restore|include
|table|tr|td|tbody
}{xmlcommon:*}
\stopxmlsetups
\xmlregistersetup{xmlcommon}
% Place at top/middle(default)/bottom location.
\def\startlocationbox#1{%
\let\templocation\relax
\doif{\xmlatt{#1}{location}}{top}{\def\templocation{\vtop}}%
\doif{\xmlatt{#1}{location}}{middle}{\def\templocation{\vcenter}}%
\doif{\xmlatt{#1}{location}}{center}{\def\templocation{\vcenter}}%
\doif{\xmlatt{#1}{location}}{bottom}{\def\templocation{\vbox}}%
\templocation\bgroup\ifx\templocation\relax\else\vss\fi
}
\let\stoplocationbox\egroup
\def\setupframeparameters#1#2{%
% color
% Always set background to color if backgroundcolor is set.
\doifnot{\xmlatt{#1}{bgcolor}}{\empty}{#2[background=color]}%
% But it can be overridden.
\doifnot{\xmlatt{#1}{background}}{\empty}{#2[background=\xmlatt{#1}{background}]}%
\setupToAttribute{#1}{#2}{foregroundcolor}{color}{}{darkblue}%
\setupToAttribute{#1}{#2}{backgroundcolor}{bgcolor}{}{green}%
% frame
\doifnot{\xmlatt{#1}{frame}}{\empty}%
{#2[frame=off]\setframeparts{\xmlatt{#1}{frame}}{#2}}%
\setupToAttribute{#1}{#2}{framecolor}{framecolor}{}{black}%
\setupToAttribute{#1}{#2}{corner}{corner}{}{rectangular}%
\setupToAttribute{#1}{#2}{radius}{radius}{}{0.5ex}%
\setupToAttribute{#1}{#2}{backgroundcorner}{bgcorner}{}{rectangular}%
\setupToAttribute{#1}{#2}{backgroundradius}{bgradius}{}{0.5ex}%
% dimensions
\setupToAttribute{#1}{#2}{rulethickness}{rulethickness}{}{3pt}%
\doifnot{\xmlatt{#1}{height}}{\empty}%
{#2[height=\NumberCollect{\xmlattdef{#1}{height}{fit},\the\makeupheight}]}%
\doifnot{\xmlatt{#1}{width}}{\empty}%
{#2[width=\NumberCollect{\xmlattdef{#1}{width}{fit},\the\textwidth}]}%
% alignment
\setupToAttribute{#1}{#2}{strut}{strut}{}{on}%
\setupToAttribute{#1}{#2}{align}{align}{html}{normal}%
\setupToAttribute{#1}{#2}{align}{valign}{html}{lohi}%
}
% Setups for tables with xtable.
\def\setupxtableparameters#1{%
\setupframeparameters{#1}{\setupxtable}%
\setupToAttribute{#1}{\setupxtable}{foregroundstyle}{style}{style}{\tf}%
\setupToAttribute{#1}{\setupxtable}{offset}{cellpadding}{}{0pt}%
\setupToAttribute{#1}{\setupxtable}{columndistance}{cellspacing}{}{0pt}%
\setupToAttribute{#1}{\setupxtable}{spaceinbetween}{rowspacing}{}{0pt}%
\setupToAttribute{#1}{\setupxtable}{option}{option}{}{}%
}
\startxmlsetups xmlcommon:table
\bgroup
\xmlstripanywhere{#1}{.}
\setupxtable[% Setup defaults
leftmargindistance=0pt,rightmargindistance=0pt,
offset=2pt,height=fit,width=fit,
align={center,lohi},columndistance=0pt]
\setupxtableparameters{#1}
\startlocationbox{#1}
\startembeddedxtable\xmlflush{#1}\stopembeddedxtable
\stoplocationbox
\egroup
\stopxmlsetups
\startxmlsetups xmlcommon:tbody
\xmlstripanywhere{#1}{.}
\bgroup
\setupxtableparameters{#1}
\startxtablebody
\xmlflush{#1}
\stopxtablebody
\egroup
\stopxmlsetups
\startxmlsetups xmlcommon:tr
\unskip
\xmlstripanywhere{#1}{.}
\unskip
\bgroup
\unskip
\setupxtableparameters{#1}
\unskip
\startxrow
\unskip
=\xmlflush{#1}
\stopxrow
\egroup
\unskip
\stopxmlsetups

\startxmlsetups xmlcommon:td
\unskip
\xmlstrip{#1}{.}
\bgroup
\setupxtableparameters{#1}
\startxcell[nc=\xmlattdef{#1}{colspan}{1},nr=\xmlattdef{#1}{rowspan}{1}]
\xmlflush{#1}
\stopxcell
\egroup
\stopxmlsetups

\starttext

[NTG-context] Strange bug with overviewpage module.

2014-12-19 Thread Aditya Mahajan

Hi,

Some time ago, Hans had helped me to write an 'overviewpage' module, that 
makes it easy to show a overview of the important slides at the end of a 
presentation. I have tweaked this module slightly to be able to save an 
arbitrary page by using


\saveoverviewpage{reference}

and reuse the page by

\useoverviewpage{reference}

An example is:

\usemodule[overviewpage]
\setuppapersize[S4]

\setupframedtext[rulethickness=3pt]

\starttext

\startframedtext
  \input ward
\stopframedtext
\saveoverviewpage{ward}
\page

\input tufte
\page

\scale[width=0.5\textwidth]{\useoverviewpage{ward}}

\stoptext


However, when I save a page that contains a framed box (as in the above 
example), the box looses its right frame when it is displayed again (see 
page 3 of the attached pdf). It appears that the left edge is twice as 
thick.


Any idea why this is happening and how I can avoid this?

Thanks,
Aditya

test.pdf
Description: Adobe PDF document
%D \module
%D   [ file=t-overviewpage,
%D  version=2013.08.31,
%Dtitle=\CONTEXT\ User Module,
%D subtitle=Page Overviews,
%D   author=Aditya Mahajan and Hans Hagen,
%D date=\currentdate,
%Dcopyright=Aditya Mahajan,
%Demail=adityam at ieee dot org,
%D  license=Simplified BSD License]

\writestatus{loading}{Overview Page (ver: 2013.08.31)}

\startmodule [overviewpage]

\unprotect

\setupmodule
  [\c!level=]

\installnamespace{overviewpage}

\initializeboxstack{\overviewpage}

\newconditional\c_overviewpage_state

\unexpanded\def\enablesaveoverviewpage
  {\global\settrue\c_overviewpage_state}

\unexpanded\def\saveoverviewpage#1%
  {\enablesaveoverviewpage
   \setevalue{\overviewpage:page:#1}{\the\realpageno}}

\unexpanded\def\useoverviewpage#1%
  {\writestatus{overviewpage}{using page #1 
(\getvalue{\overviewpage:page:#1})}%
   
\expanded{\foundbox{\overviewpage}{\getvalue{\overviewpage:page:#1

\unexpanded\def\overviewpage_save_page#1%
  {\ifconditional\c_overviewpage_state
 \setbox\nextbox\hbox{#1}%
 \setbox\scratchbox\copy\nextbox
 \cleanupbox\scratchbox % remove nodes that should not be seen in the 
backend twice
 \writestatus{overviewpage}{saving overviewpage \the\realpageno}%
 \savebox{\overviewpage}{\the\realpageno}{\box\scratchbox}%
 \global\setfalse\c_overviewpage_state
 \page_shipouts_normal{\box\nextbox}%
   \else
 \page_shipouts_normal{#1}%
   \fi}

\appendtoks
\doif {\headparameter{option:overviewpage}} \v!yes \enablesaveoverviewpage
\to \everyheadsynchronization

\installshipoutmethod{overviewpage}\overviewpage_save_page

\unexpanded\def\overviewpage_setup_head#1%
  {\setuphead[#1][option:overviewpage=\v!yes]}

\appendtoks
\processcommacommand
  [\moduleparameter{overviewpage}\c!level]
  \overviewpage_setup_head
\to \everysetupmodule


\the\everysetupmodule

\setuppaper
  [\c!method=overviewpage]

\definelistalternative
  [overviewpage]
  [\c!renderingsetup=\??listrenderings:overview]

\setuplistalternative
  [overviewpage]
  [\c!before=\dontleavehmode,
   \c!after=\hskip\zeropoint\relax,
 % \c!width=\ctxlua{moduledata.overviewpage.calculatedwidth(\listlength)}]
   
\c!width=\ctxlua{moduledata.overviewpage.calculatedwidth(structures.lists.size())}]

\startsetups[\??listrenderings:overview]
\doifboxelse{\overviewpage}{\structurelistrealpagenumber}
   {\listalternativeparameter\c!before
\startcurrentlistentrywrapper
  \scale
[\c!width=\listalternativeparameter\c!width]
{\foundbox{\overviewpage}{\structurelistrealpagenumber}}%
\stopcurrentlistentrywrapper
\listalternativeparameter\c!after}
   {}%
\stopsetups

\definemakeup
  [overviewpage]
  [\c!align=\v!middle]

\definelayout
  [overviewpage]
  [\v!page]

\startluacode
moduledata  = moduledata  or { }
moduledata.overviewpage = moduledata.overviewpage or { }

function moduledata.overviewpage.calculatedwidth(pages)
context(%f\\textwidth,1/math.ceil(math.sqrt(pages)))
end
\stopluacode

% Ideally, we would like to simply use the definition below. 
% However, the `before` and `after` keys are not used with 
`\placecombinedlist`. 
% Therefore we use a more manual solution.
%
\definecombinedlist
[overviewpage]
[\moduleparameter{overviewpage}\c!level]
[
  %\c!before=\startoverviewpagemakeup,
  %\c!after=\stopoverviewpagemakeup,
  \c!criterium=\v!all,
  \c!alternative=overviewpage,
]

\unexpanded\def\placeoverviewpage
  {\dosingleargument\doplaceoverviewpage}

\def\doplaceoverviewpage[#1]%
  {\startoverviewpagemakeup
  \placecombinedlist[overviewpage][#1]
   \stopoverviewpagemakeup}

\protect

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg

Re: [NTG-context] problem with \processaction

2014-12-17 Thread Pablo Rodriguez
On 12/17/2014 01:18 AM, Hans Hagen wrote:
 On 12/16/2014 10:24 PM, Pablo Rodriguez wrote:
 [...]
 Is there no other way to get the text value (so that it could be
 compared with \doif) from a command that assigns values using
 \processaction?
 
 \setvalue{SomeName:foo}{one}
 \setvalue{SomeName:bar}{two}
 
 % and another 50 names
 
 \def\SomeName{foo}
 % \def\SomeName{bar}
 
 \doifelse{\getvalue{SomeName:\SomeName}}{two}
{YES}
{NOP}

Many thanks for your reply, Hans.

I didn’t know of this alternative to \processaction.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] problem with \processaction

2014-12-16 Thread Pablo Rodriguez
On 12/16/2014 09:50 PM, Hans Hagen wrote:
 On 12/16/2014 6:51 PM, Pablo Rodriguez wrote:
 Dear list,

 I have the following sample:

  \def\SystemUser{whoami}
  \def\CheckUser{\processaction[\SystemUser][whoami=whm]}

  \starttext

  \doifelse{\CheckUser}{whm}{This is the right user.}
  {This is the wrong user.}

  \doifelse{\SystemUser}{whoami}{This is the right user.}
  {This is the wrong user.}

  \SystemUser\ is \CheckUser

  \stoptext

 Why doesn’t the first \doifelse work? What am I missing there?
 
 because \processaction is not a fully expandable command

Many thanks for your reply, Hans.

Is there no other way to get the text value (so that it could be
compared with \doif) from a command that assigns values using
\processaction?

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] problem with \processaction

2014-12-16 Thread Hans Hagen

On 12/16/2014 10:24 PM, Pablo Rodriguez wrote:

On 12/16/2014 09:50 PM, Hans Hagen wrote:

On 12/16/2014 6:51 PM, Pablo Rodriguez wrote:

Dear list,

I have the following sample:

  \def\SystemUser{whoami}
  \def\CheckUser{\processaction[\SystemUser][whoami=whm]}

  \starttext

  \doifelse{\CheckUser}{whm}{This is the right user.}
  {This is the wrong user.}

  \doifelse{\SystemUser}{whoami}{This is the right user.}
  {This is the wrong user.}

  \SystemUser\ is \CheckUser

  \stoptext

Why doesn’t the first \doifelse work? What am I missing there?


because \processaction is not a fully expandable command


Many thanks for your reply, Hans.

Is there no other way to get the text value (so that it could be
compared with \doif) from a command that assigns values using
\processaction?



\setvalue{SomeName:foo}{one}
\setvalue{SomeName:bar}{two}

% and another 50 names


\def\SomeName{foo}
% \def\SomeName{bar}

\doifelse{\getvalue{SomeName:\SomeName}}{two}
  {YES}
  {NOP}


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] ConTeXt gobble my mind

2014-11-09 Thread Pierre-François Bonnefoi
Hello Wolfgang,

thank you very much for all these solutions.
Do you have any recommendations about using one over the others ?

Currently, the conditional selection of my slides works pretty good : I have 
created the following macros :
 \courseSlideList[resavi][1-10,20-30,34,37-40], this macro allows me to 
activate all the slides given by their number in a list defined in the current 
file ;
 \includeSelectionFrom{adressage_groupe_utf8}{1-100} this macro allows me to 
include some slides given by a list of number from an external file ;
 \skipSlide that can suppress the process of the following slide.

Of course, all of theses macros work beautifully recursively with files using 
them (the numbering macro work nicely on currently defined slides as included 
slides).

This is why I use only ConTeXt for all my work !

Cheers !
Pierre-François.


On 08 Nov 2014, at 12:08, Wolfgang Schuster schuster.wolfg...@gmail.com wrote:

 
 Am 08.11.2014 um 00:00 schrieb Pierre-François Bonnefoi bonne...@unilim.fr:
 
 Just before going to bed, I've found a solution with all your help and the 
 help of Taco Hoekwater through the ntg mail archive :
 
 \def\startSlide%
 {\def\stopSlide{\checkSlide\doif{\getvariable{temp}{publish}}{yes}{\page\getbuffer[Slide]}}%
 \dostartbuffer[Slide][startSlide][stopSlide]}
 
 Let me know if it's my philosopher's stone...
 I've tried it and it works so far.
 
 No more ugly gobbling, my mind is free.
 
 Below are two other methods.
 
 
 Method 1
 ===
 
 \newconditional\SkipSlide \setfalse\SkipSlide
 
 \definebuffer[Slide]
 
 \def\stopSlide
  {\ifconditional\SkipSlide \else
\page \getbuffer[\thedefinedbuffer{Slide}]%
   \fi
   \setfalse\SkipSlide}
 
 \starttext
 
 \startSlide
 First Slide
 \stopSlide
 
 \settrue\SkipSlide
 \startSlide
 Second Slide
 \stopSlide
 
 \startSlide
 Third Slide
 \stopSlide
 
 \stoptext
 
 
 Method 2
 ===
 
 \def\startSlide
  {\dosingleempty\dostartSlide}
 
 \def\dostartSlide[#1]%
  {\doifelse{#1}{-}
 {\let\stopSlide\stopSlideNop}
 {\let\stopSlide\stopSlideYes}%
   \grabbufferdata[Slide][startSlide][stopSlide]}
 
 \let\stopSlideNop\relax
 
 \def\stopSlideYes
  {\page
   \getbuffer[Slide]}
 
 \starttext
 
 \startSlide
 First Slide
 \stopSlide
 
 \startSlide[-]
 Second Slide
 \stopSlide
 
 \startSlide
 Third Slide
 \stopSlide
 
 \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://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___

-- 
Bonnefoi Pierre-Francois|E-mail : bonne...@unilim.fr 
http://libpfb.so/
Universite de Limoges, Laboratoire XLIM |   Tel : 06 28 18 03 38
123 av Albert Thomas|  Mrs. Peel, we're needed...
87060 Limoges CEDEX - FRANCE| The Avengers.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] ConTeXt gobble my mind

2014-11-09 Thread Hans Hagen

On 11/9/2014 2:34 PM, Pierre-François Bonnefoi wrote:

Hello Wolfgang,

thank you very much for all these solutions.
Do you have any recommendations about using one over the others ?

Currently, the conditional selection of my slides works pretty good : I
have created the following macros :
  \courseSlideList[resavi][1-10,20-30,34,37-40], this macro allows me to
activate all the slides given by their number in a list defined in the
current file ;
  \includeSelectionFrom{adressage_groupe_utf8}{1-100} this macro allows
me to include some slides given by a list of number from an external file ;
  \skipSlide that can suppress the process of the following slide.

Of course, all of theses macros work beautifully recursively with files
using them (the numbering macro work nicely on currently defined slides
as included slides).

This is why I use only ConTeXt for all my work !


there is also a block mechanism, see blocks in test suite ... originally 
that was made for a mix of (parallel) questions, answers, anything 
(numbered and unnumbered), selective filtering by tag etc


Hans


Cheers !
Pierre-François.


On 08 Nov 2014, at 12:08, Wolfgang Schuster schuster.wolfg...@gmail.com
mailto:schuster.wolfg...@gmail.com wrote:




Am 08.11.2014 um 00:00 schrieb Pierre-François Bonnefoi
bonne...@unilim.fr mailto:bonne...@unilim.fr:

Just before going to bed, I've found a solution with all your help
and the help of Taco Hoekwater through the ntg mail archive :

\def\startSlide%
{\def\stopSlide{\checkSlide\doif{\getvariable{temp}{publish}}{yes}{\page\getbuffer[Slide]}}%
\dostartbuffer[Slide][startSlide][stopSlide]}

Let me know if it's my philosopher's stone...
I've tried it and it works so far.

No more ugly gobbling, my mind is free.


Below are two other methods.


Method 1
===

\newconditional\SkipSlide \setfalse\SkipSlide

\definebuffer[Slide]

\def\stopSlide
 {\ifconditional\SkipSlide \else
\page \getbuffer[\thedefinedbuffer{Slide}]%
  \fi
  \setfalse\SkipSlide}

\starttext

\startSlide
First Slide
\stopSlide

\settrue\SkipSlide
\startSlide
Second Slide
\stopSlide

\startSlide
Third Slide
\stopSlide

\stoptext


Method 2
===

\def\startSlide
 {\dosingleempty\dostartSlide}

\def\dostartSlide[#1]%
 {\doifelse{#1}{-}
{\let\stopSlide\stopSlideNop}
{\let\stopSlide\stopSlideYes}%
  \grabbufferdata[Slide][startSlide][stopSlide]}

\let\stopSlideNop\relax

\def\stopSlideYes
 {\page
  \getbuffer[Slide]}

\starttext

\startSlide
First Slide
\stopSlide

\startSlide[-]
Second Slide
\stopSlide

\startSlide
Third Slide
\stopSlide

\stoptext


Wolfgang

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

maillist : ntg-context@ntg.nl mailto:ntg-context@ntg.nl /
http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


--
Bonnefoi Pierre-Francois|E-mail : bonne...@unilim.fr
mailto:bonne...@unilim.fr http://libpfb.so/
Universite de Limoges, Laboratoire XLIM |   Tel : 06 28 18 03 38
123 av Albert Thomas|  Mrs. Peel, we're needed...
87060 Limoges CEDEX - FRANCE| The Avengers.



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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___




--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] ConTeXt gobble my mind

2014-11-08 Thread Wolfgang Schuster

 Am 08.11.2014 um 00:00 schrieb Pierre-François Bonnefoi bonne...@unilim.fr:
 
 Just before going to bed, I've found a solution with all your help and the 
 help of Taco Hoekwater through the ntg mail archive :
 
 \def\startSlide%
 {\def\stopSlide{\checkSlide\doif{\getvariable{temp}{publish}}{yes}{\page\getbuffer[Slide]}}%
 \dostartbuffer[Slide][startSlide][stopSlide]}
 
 Let me know if it's my philosopher's stone...
 I've tried it and it works so far.
 
 No more ugly gobbling, my mind is free.

Below are two other methods.


Method 1
===

\newconditional\SkipSlide \setfalse\SkipSlide

\definebuffer[Slide]

\def\stopSlide
  {\ifconditional\SkipSlide \else
 \page \getbuffer[\thedefinedbuffer{Slide}]%
   \fi
   \setfalse\SkipSlide}

\starttext

\startSlide
First Slide
\stopSlide

\settrue\SkipSlide
\startSlide
Second Slide
\stopSlide

\startSlide
Third Slide
\stopSlide

\stoptext


Method 2
===

\def\startSlide
  {\dosingleempty\dostartSlide}

\def\dostartSlide[#1]%
  {\doifelse{#1}{-}
 {\let\stopSlide\stopSlideNop}
 {\let\stopSlide\stopSlideYes}%
   \grabbufferdata[Slide][startSlide][stopSlide]}

\let\stopSlideNop\relax

\def\stopSlideYes
  {\page
   \getbuffer[Slide]}

\starttext

\startSlide
First Slide
\stopSlide

\startSlide[-]
Second Slide
\stopSlide

\startSlide
Third Slide
\stopSlide

\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] ConTeXt gobble my mind

2014-11-07 Thread Pierre-François Bonnefoi
Just before going to bed, I've found a solution with all your help and the help 
of Taco Hoekwater through the ntg mail archive :

\def\startSlide%
{\def\stopSlide{\checkSlide\doif{\getvariable{temp}{publish}}{yes}{\page\getbuffer[Slide]}}%
\dostartbuffer[Slide][startSlide][stopSlide]}

Let me know if it's my philosopher's stone...
I've tried it and it works so far.

No more ugly gobbling, my mind is free.

So depressing problem and so simple and elegant solution...

On 07 Nov 2014, at 16:17, Hans Hagen pra...@wxs.nl wrote:

 On 11/7/2014 2:26 PM, Pierre-François Bonnefoi wrote:
 Hello Hans,
 
 thank you for contributing to solve my problem.
 
 I've tried your proposition : how can I get the content of the buffer
 afterward ?
 I've tried \getbuffer[Slide] with no success on MKIV beta that I've just
 updated.
 
 \starttext
 
 \definebuffer[Slide]
 
 foo
 
 \startSlide
 bla bla bla
 \starttyping
 language C code
 \stoptyping
 bla bla bla
 \stopSlide
 
 bar
 
 \getbuffer[\thedefinedbuffer{Slide}]
 
 \getSlide
 
 \stoptext
 
 
 Does a buffer work only for verbatim content ?
 
 no, for everything
 
 best regards,
 Pierre-François.
 
 On 07 Nov 2014, at 12:38, Hans Hagen pra...@wxs.nl
 mailto:pra...@wxs.nl wrote:
 
 
 \starttext
 
 \definebuffer[Slide]
 
 foo
 
 % \skipSlide
 \startSlide
 bla bla bla
 \startyping
 language C code
 \stoptyping
 bla bla bla
 \stopSlide
 
 bar
 
 \stoptext
 
 
 
 --
 Bonnefoi Pierre-Francois|E-mail : bonne...@unilim.fr
 mailto:bonne...@unilim.fr http://libpfb.so/
 Universite de Limoges, Laboratoire XLIM |   Tel : 06 28 18 03 38
 123 av Albert Thomas|  Mrs. Peel, we're needed...
 87060 Limoges CEDEX - FRANCE| The Avengers.
 
 
 
 ___
 If your question is of interest to others as well, please add an entry to 
 the Wiki!
 
 maillist : ntg-context@ntg.nl / 
 http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___
 
 
 
 -- 
 
 -
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net
 ___

-- 
Bonnefoi Pierre-Francois|E-mail : bonne...@unilim.fr 
http://libpfb.so/
Universite de Limoges, Laboratoire XLIM |   Tel : 06 28 18 03 38
123 av Albert Thomas|  Mrs. Peel, we're needed...
87060 Limoges CEDEX - FRANCE| The Avengers.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] problem with buffer

2014-09-15 Thread Kenny
I'm writing a module to typeset problems/tests. Depending on a flag, 
solutions are either displayed or not. If the solutions are not displayed, 
I want to give a certain amount of empty vertical space for the student's 
work. This is where my difficulty begins.

The typesetting works with the solutions displayed (\def\examshowsolutions}
{yes}) but not with the empty vertical space (\def\examshowsolutions{no}). 
I get an Emergency stop that I cannot figure out. Here's the code for a 
minimal example of my difficulty..

\def\setupsolutions{
  \doifelse{\examshowsolutions}{yes}
   {\defineenumeration[SOLUTION] % display the solutions
  [text=\Word{solution},number=no,
   after={\vskip1ex}]}
   {\definebuffer[SOLUTION] % hide solutions,
\setupbuffer[SOLUTION][local=yes]}
 }

\def\startsolution{\dosingleempty\dostartsolution}

\def\dostartsolution[#1]{
 \getparameters[solution][height=1em,] % set defaults (needed in case 
parameters missing)
 \iffirstargument
  \writestatus{DEBUG}{--First argument: |#1|}
  \getparameters[solution][#1,]
 \fi
 \writestatus{DEBUG}{--\solutionheight--}
 \startSOLUTION
 \writestatus{DEBUG}{--dostartsolution...finished}
 }
\def\stopsolution{
 \stopSOLUTION
 \writestatus{DEBUG}{--dostopsolution...1}
 \doif{\examshowsolutions}{no}{\godown[\solutionheight]}
 \writestatus{DEBUG}{--dostopsolution...finished}
 }
 
\starttext

\def\examshowsolutions{no} % control whether solutions are displayed
\setupsolutions
 
\startsolution % test without vertical height specified
 Here is a solution.
\stopsolution

\startsolution[height=5em] % test with vertical height specified
 Here is another solution.
\stopsolution

\stoptext

The error occurs with the \startSOLUTION command.

Here's the log file:
(/home/kenny/texlive/2013/texmf-dist/tex/context/base/cont-yes.mkiv

ConTeXt  ver: 2013.05.28 00:36 MKIV current  fmt: 2013.8.6  int: 
english/english

system   'cont-new.mkiv' loaded
(/home/kenny/texlive/2013/texmf-dist/tex/context/base/cont-new.mkiv)
system   files  jobname 'check', input './check', result 'check'
fontslatin modern fonts are not preloaded
languageslanguage 'en' is active
(/home/kenny/courses/Fall2014/phys1310/exam/check.tex{/home/kenny/texlive/2
013/texmf-dist/fonts/map/pdftex/context/mkiv-base.map}
fontspreloading latin modern fonts (second stage)
fontstypescripts  unknown library 'loc'
{/home/kenny/texlive/2013/texmf-dist/fonts/map/dvips/lm/lm-math.map}
{/home/kenny/texlive/2013/texmf-dist/fonts/map/dvips/lm/lm-rm.map}
fonts'fallback modern rm 12pt' is loaded
DEBUG--1em--
))
! Emergency stop.

system   tex  error on line 0 in file : Emergency stop ...

empty file

* cont-yes.mkiv
  
*** (job aborted, no legal \end found)

!  == Fatal error occurred, no output PDF file produced!

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] codefolding with Kate or Kwrite

2013-04-28 Thread Jan Heinen

Hello,

is someone else using the editors kate and kwrite?

Code-highlighting is working.

What I need ist code-folding for ConTeXt. Is this possible?
I have huge makros with lots of  \doif ... \else ... \fi
and it is hard to surf through the code.

What else would be nice: auto-indentation ... marking all 
the code and let kwrite/kate do the job to indent.


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Fwd: Heading in setuplayout from a variable

2013-04-26 Thread Cecil Westerhof
Send to Hans instead of to the list. :-(


-- Forwarded message --
From: Cecil Westerhof cldwester...@gmail.com
Date: 2013/4/26
Subject: Re: [NTG-context] Heading in setuplayout from a variable
To: Hans Hagen pra...@wxs.nl


2013/4/26 Hans Hagen pra...@wxs.nl:
 On 4/26/2013 1:27 PM, Cecil Westerhof wrote:

 It is a long time since I used ConTeXt. I am starting again.

 I have the following code:
 \setvariables[meta][type=cecil]

 \if\getvariable{meta}{type}=cecil
\setvariables[meta][
  name={Cecil Westerhof},
]
\setvariables[layout][
  header=0mm,
]
 \fi

 But that does not work.

 For the conditional I also tried:
 \ifx\getvariable{meta}{type}\cecil

 But that does not work either.

 What is the correct way to define the comparison?


 \doifelse {\getvariable{meta}{type}} {cecil} {
 ...
 } {
 ...
 }

Thanks. That works. In my case I use a \doif.

Is there also something like a switch statement? If not I could use a
nested \doifelse.

--
Cecil Westerhof


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] buffer identity?

2013-02-14 Thread Meer, H. van der
When one has
\startbuffer
…
\stopbuffer

or
\startbuffer[abc]
…
\stopbuffer

Is it possible to find in a redefined \stopbuffer the identity of the buffer in 
question?
For example to do \def\stopbuffer{\doif{BUFFERIDENTITY}{abc} …}

Hans van der Meer



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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] buffer identity?

2013-02-14 Thread Wolfgang Schuster

Am 14.02.2013 um 18:26 schrieb Meer, H. van der h.vanderm...@uva.nl:

 When one has
 \startbuffer
 …
 \stopbuffer
 
 or
 \startbuffer[abc]
 …
 \stopbuffer
 
 Is it possible to find in a redefined \stopbuffer the identity of the buffer 
 in question?
 For example to do \def\stopbuffer{\doif{BUFFERIDENTITY}{abc} …}

No, that’s not possible.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] \cldcommand

2012-11-29 Thread Procházka Lukáš Ing . - Pontex s . r . o .

Hello,

the following shortening \ctxlua{commands.doif to \cldcommand{doif doesn't 
work as I'd expect, although it should be equal:


\starttext
  A

  \ctxlua{commands.doif(true)}{T} % Gives T - that's OK
  \cldcommand{doif(true)}{t} % Gives nothing; why?

  B
\stoptext


Probably very basic question... What am I doing wrong?

Best regards,

Lukas


--
Ing. Lukáš Procházka [mailto:l...@pontex.cz]
Pontex s. r. o.  [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

t-CldCmd.mkiv
Description: Binary data


t-CldCmd.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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] \cldcommand

2012-11-29 Thread Hans Hagen

On 11/29/2012 9:32 AM, Procházka Lukáš Ing. - Pontex s. r. o. wrote:

Hello,

the following shortening \ctxlua{commands.doif to \cldcommand{doif
doesn't work as I'd expect, although it should be equal:


\starttext
   A

   \ctxlua{commands.doif(true)}{T} % Gives T - that's OK
   \cldcommand{doif(true)}{t} % Gives nothing; why?

   B
\stoptext


Probably very basic question... What am I doing wrong?


indeed as it's \ctxcommand

the \cldcommand does a context.doif an that one takes three arguments

so you've something to wikify: :

\starttext
  A

  \ctxlua{commands.doif(true)}{one}

  B

  \cldcommand{doif(a,a,two)}

  C

  \ctxcommand{doif(true)}{three}

  D

\stoptext


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] \cldcommand

2012-11-29 Thread Procházka Lukáš Ing . - Pontex s . r . o .

On Thu, 29 Nov 2012 10:27:36 +0100, Hans Hagen pra...@wxs.nl wrote:


On 11/29/2012 9:32 AM, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
indeed as it's \ctxcommand

the \cldcommand does a context.doif an that one takes three arguments

so you've something to wikify: :

\starttext
   A

   \ctxlua{commands.doif(true)}{one}

   B

   \cldcommand{doif(a,a,two)}

   C

   \ctxcommand{doif(true)}{three}

   D

\stoptext


Thanks for explanation - added to 
http://wiki.contextgarden.net/Command/ctxcommand

Best regards,

Lukas


--
Ing. Lukáš Procházka [mailto:l...@pontex.cz]
Pontex s. r. o.  [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] New module: pararef

2012-10-13 Thread Wolfgang Schuster

Am 13.10.2012 um 18:53 schrieb Zenlima p...@zenlima.eu:

 Hi Sietse, hi Wolfgang,
 
 thanks for your first feedback. Right now I am working on your
 suggestions.
 
 @Wolfgang: I don't understand your suggestion: add a label key to
 disable/enable the label text. Can you describe it more detaily or in
 other words? I am not sure how to implement it with the refs to a
 paragraph.


Here is a example where I used a few helpers, e.g. \installdirectcommandhandler 
creates \setupreferencecommand and \referencecommandparameter.

\unprotect

\installnamespace  {referencecommand}
\installdirectcommandhandler \referencecommand {referencecommand}

\def\referencecommand
  {\dodoubleempty\referencecommand_direct}

\def\referencecommand_direct[#1][#2]%
  {\begingroup
   \ifsecondargument
 \setupreferencecommand[#1]%
 \edef\m_reference{#2}%
   \else
 \edef\m_reference{#1}%
   \fi
   \usereferencecommandstyleandcolor\c!style\c!color
   \getreference[title][\m_reference]%
   \doif{\referencecommandparameter\c!label}\v!yes{\referencetext\v!page}%
   \referencecommandparameter\c!left
   \getreference [page][\m_reference]%
   \referencecommandparameter\c!right
   \endgroup}

\definelabelclass[reference]

\setupreferencetext[\s!en][page={ on page }]
\setupreferencetext[\s!de][page={ auf Seite }]

\setupreferencecommand
  [\c!label=\v!yes,
\c!left=(,
   \c!right=)]

\protect

\starttext

\dontleavehmode\reference[knuth]{Donald E. Knuth}%
\input knuth

\blank

\referencecommand[knuth]

\blank

\referencecommand[left={[},right={]}][knuth]

\blank

\referencecommand[style=italic,color=red][knuth]

\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] test for (negative) number

2012-08-21 Thread Procházka Lukáš


On Mon, 20 Aug 2012 20:11:32 +0200, Sietse Brouwer sbbrou...@gmail.com wrote:


Hi Peter,

I recommend using the following handy little idiom:
\ctxlua{commands.doifelse(-45  0)}{big}{small} % small

It lets you do all sorts of things that are tricky in TeX:
\ctxlua{ commands.doifelse( string.len( -45 )  5 ) }{long}{short}

Cheers,
Sietse


... Has been wikified -

http://wiki.contextgarden.net/Command/doif...;

Lukas


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] test for (negative) number

2012-08-21 Thread Wolfgang Schuster

Am 21.08.2012 um 08:32 schrieb Procházka Lukáš l...@pontex.cz:

 
 On Mon, 20 Aug 2012 20:11:32 +0200, Sietse Brouwer sbbrou...@gmail.com 
 wrote:
 
 Hi Peter,
 
 I recommend using the following handy little idiom:
 \ctxlua{commands.doifelse(-45  0)}{big}{small} % small
 
 It lets you do all sorts of things that are tricky in TeX:
 \ctxlua{ commands.doifelse( string.len( -45 )  5 ) }{long}{short}
 
 Cheers,
 Sietse
 
 ... Has been wikified -
 
 http://wiki.contextgarden.net/Command/doif…;

For functions in the commands namespace you can write e.g. 
\ctxcommand{doifelse(…)}{…}{…} instead of \ctxlua{commands.doifelse(…)}{…}{…}.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] test for (negative) number

2012-08-21 Thread Peter Rolf
Thanks for all the answers so far. The 'doifelse' should do the trick. I
was hoping for a system macro, but if there is none, I have to program
it myself. :-)

Peter

Am 21.08.2012 08:56, schrieb Wolfgang Schuster:
 
 Am 21.08.2012 um 08:32 schrieb Procházka Lukáš l...@pontex.cz:
 

 On Mon, 20 Aug 2012 20:11:32 +0200, Sietse Brouwer sbbrou...@gmail.com 
 wrote:

 Hi Peter,

 I recommend using the following handy little idiom:
 \ctxlua{commands.doifelse(-45  0)}{big}{small} % small

 It lets you do all sorts of things that are tricky in TeX:
 \ctxlua{ commands.doifelse( string.len( -45 )  5 ) }{long}{short}

 Cheers,
 Sietse

 ... Has been wikified -

 http://wiki.contextgarden.net/Command/doif…;
 
 For functions in the commands namespace you can write e.g. 
 \ctxcommand{doifelse(…)}{…}{…} instead of \ctxlua{commands.doifelse(…)}{…}{…}.
 
 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://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] bug in latest beta

2012-07-04 Thread JIN Xiao-Yong
I got the following error in the minimal example (which is all shown in the
output below)

system   tex  error on line 4 in file simpl.tex: Undefined
control sequence ...

1 \setuphead[section][before={\column}]
2 \starttext
3 \startcolumns[n=2]
4   \section{this is a section}
5 \section{another section in a new column}
6 \stopcolumns
7 \stoptext
8


\208multicolumn:yes -\par {\testrulewidth
\zeropoint \ruledvskip
\textheig...
\page_breaks_columns_process ...dle_direct \v!yes
  \fi \relax \the
\everyafte...
to be read again
   \relax
\dohandleheadpagebreakyes ...ter \c!before \relax
  \doif {\headparameter
\c!a...
\docheckheadbefore ...se \continuoussectionhead #1
  \fi
\doheadspacingbeforeyes ...handleheadpagebreakyes
  \headparameter
\c!inbetwee...
...
l.4 \section{this is a section}

Basically, the first line in the file introduces the error.  It worked a
few weeks ago.
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Broken Nightly?

2012-06-26 Thread Hans Hagen

On 26-6-2012 06:36, Kip Warner wrote:

On Tue, 2012-06-26 at 05:27 +0200, Wolfgang Schuster wrote:

grph-epd.mkiv (untested):

\startsetups system:graphics:epdf
%\ctxlua{figures.mergegoodies(\@@efinteraction)}%
 \ctxlua{figures.mergegoodies(\externalfiguresparameter\c!interaction)}%
 \reference[\figurereference]{}% todo: dest area
\stopsetups

and

\appendtoks
 \iflocation
  
%\doif\figurefiletype{pdf}{\doifnot\@@efinteraction\v!none\grph_epdf_add_overlay}%
   
\doif\figurefiletype{pdf}{\doifnot{\externalfiguresparameter\c!interaction}\v!none\grph_epdf_add_overlay}%
 \fi
\to \externalfigurepostprocessors


Hey Wolfgang. Thanks for your expeditious reply. I patched grph-epd.mkiv
as directed and got the following error on the same file / line
(Handbook.tex:42),

! Undefined control sequence.
argument \@@efinteraction


fixed in next beta
-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Broken Nightly?

2012-06-25 Thread Wolfgang Schuster

Am 26.06.2012 um 01:59 schrieb Kip Warner:

 Hey list,
 
 I'm using ConTeXt 2012.06.25 and I noticed a broken compilation of my
 book:

grph-epd.mkiv (untested):

\startsetups system:graphics:epdf
   %\ctxlua{figures.mergegoodies(\@@efinteraction)}%
\ctxlua{figures.mergegoodies(\externalfiguresparameter\c!interaction)}%
\reference[\figurereference]{}% todo: dest area
\stopsetups

and

\appendtoks
\iflocation
 
%\doif\figurefiletype{pdf}{\doifnot\@@efinteraction\v!none\grph_epdf_add_overlay}%
  
\doif\figurefiletype{pdf}{\doifnot{\externalfiguresparameter\c!interaction}\v!none\grph_epdf_add_overlay}%
\fi
\to \externalfigurepostprocessors

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Broken Nightly?

2012-06-25 Thread Kip Warner
On Tue, 2012-06-26 at 05:27 +0200, Wolfgang Schuster wrote:
 grph-epd.mkiv (untested):
 
 \startsetups system:graphics:epdf
%\ctxlua{figures.mergegoodies(\@@efinteraction)}%
 \ctxlua{figures.mergegoodies(\externalfiguresparameter\c!interaction)}%
 \reference[\figurereference]{}% todo: dest area
 \stopsetups
 
 and
 
 \appendtoks
 \iflocation
  
 %\doif\figurefiletype{pdf}{\doifnot\@@efinteraction\v!none\grph_epdf_add_overlay}%
   
 \doif\figurefiletype{pdf}{\doifnot{\externalfiguresparameter\c!interaction}\v!none\grph_epdf_add_overlay}%
 \fi
 \to \externalfigurepostprocessors

Hey Wolfgang. Thanks for your expeditious reply. I patched grph-epd.mkiv
as directed and got the following error on the same file / line
(Handbook.tex:42),

! Undefined control sequence.
argument \@@efinteraction 

\doifnot #1#2-\edef \m_syst_string_one {#1
   }\edef \m_syst_string_two
{#2}\if...
argument \doifnot \@@efinteraction \v!none 
 \grph_epdf_add_overlay 
\firstofoneargument #1-#1
  
inserted text ...v!none \grph_epdf_add_overlay }
  \fi 
\grph_include_finalize ...nalfigurepostprocessors 
  \edef \p_reset
{\externalf...
...
l.42 ...eativecommons.org/licenses/by-nc-sa/3.0/)]
  
? E
You want to edit file Handbook.tex at line 42

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com


signature.asc
Description: This is a digitally signed message part
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] parameter setting

2012-06-16 Thread Meer, H. van der
In order to be able to use attributes on xml-nodes freely, the following 
situations can arise:

The foregroundcolor parameter gets a value:
node color=red correctly sets ..[foregroundcolor=\xmlatt{#1}{color}] color 
to red.

However, in the next case the current foregroundcolor should be left as is, but 
reverts to black:
node ..[foregroundcolor=] and is apparently reset to the general default.

trying the following seemed the solution, but it does not work:
..[\doifnot{\xmlatt{#1}{color}}{\empty}{foregroundcolor=\xmlatt{#1}{color}}]
giving in the log:
{foregroundcolor=orange}' in line 16 (249:)
check   missing or ungrouped '=' after '\doifnot {}{}

Putting the above \doif inside an \expanded{} does not alter the behaviour.

How to accomplish leaving the parameter as is for an absent attribute?

Hans van der Meer



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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] parameter setting

2012-06-16 Thread Wolfgang Schuster

Am 16.06.2012 um 14:11 schrieb Meer, H. van der:

 In order to be able to use attributes on xml-nodes freely, the following 
 situations can arise:
 
 The foregroundcolor parameter gets a value:
 node color=red correctly sets ..[foregroundcolor=\xmlatt{#1}{color}] 
 color to red.
 
 However, in the next case the current foregroundcolor should be left as is, 
 but reverts to black:
 node ..[foregroundcolor=] and is apparently reset to the general default.

When you write “foregroundcolor=” you apply *nothing* to the key and the last 
setting is changed.

 trying the following seemed the solution, but it does not work:
 ..[\doifnot{\xmlatt{#1}{color}}{\empty}{foregroundcolor=\xmlatt{#1}{color}}]
 giving in the log:
 {foregroundcolor=orange}' in line 16 (249:)
 check   missing or ungrouped '=' after '\doifnot {}{}
 
 Putting the above \doif inside an \expanded{} does not alter the behaviour.
 
 How to accomplish leaving the parameter as is for an absent attribute?

You can try 
“\expdoifnot{\xmlatt{#1}{color}}{}{backgroundcolor=\xmlatt{#1}{color}}”
but I can’t say for sure without a example.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Wiki - results differ?

2012-05-04 Thread Procházka Lukáš Ing . - Pontex s . r . o .

Hello,

Wiki and a file processed on a local computer give different results -

- please compare http://wiki.contextgarden.net/Command/doif...;

and the example attached:


\starttext
  \ctxlua{test = true}

  Test is \ctxlua{commands.testcase(test)}{True}{False}.

  \ctxlua{test = false}

  Test is \ctxlua{commands.testcase(test)}{True}{False}.
\stoptext


The result should be:


Test is True.
Test is False.


which works fine on my computer.

But wiki shows (wrongly):


Test is TrueFalse.
Test is TrueFalse.


although the same code is used in the example:


context source=yes text=Gives:
\starttext
  \ctxlua{test = true}

  Test is \ctxlua{commands.testcase(test)}{True}{False}.

  \ctxlua{test = false}

  Test is \ctxlua{commands.testcase(test)}{True}{False}.
\stoptext
/context


Any idea why both results differ?

And how to make wiki show the good result?

Best regards,

Lukas


--
Ing. Lukáš Procházka [mailto:l...@pontex.cz]
Pontex s. r. o.  [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

t.log
Description: Binary data


t.mkiv
Description: Binary data


t.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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Background on the 1st page only, page numbering from the 2nd page

2012-05-02 Thread Wolfgang Schuster

Am 02.05.2012 um 09:45 schrieb Procházka Lukáš Ing. - Pontex s. r. o.:

 Hello,
 
 how to specify the page background for the first page only and how to start 
 page numbering from the second page?
 
 Here's my trial:
 
 
 \defineoverlay[Bkg][{\externalfigure[cow]}]
 \setupbackgrounds[paper][background=Bkg]
 
 %\setuppagenumbering[state=2]
 
 \starttext
  \dorecurse{5}{\input knuth}
 \stoptext
 
 
 - The background is on all pages, so is the page numbering.
 
 Any ideas?

\defineoverlay[Bkg][\doif{\pagenumber}{1}{\externalfigure[cow]}]

\setupbackgrounds[paper][background=Bkg]

\starttext \noheaderandfooterlines
\dorecurse{5}{\input knuth\par}
\stoptext

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Background on the 1st page only, page numbering from the 2nd page

2012-05-02 Thread Alan BRASLAU
On Wed, 2 May 2012 14:24:24 +0200
Wolfgang Schuster schuster.wolfg...@googlemail.com wrote:

 
 Am 02.05.2012 um 09:45 schrieb Procházka Lukáš Ing. - Pontex s. r. o.:
 
  how to specify the page background for the first page only and how
  to start page numbering from the second page?
 
 \defineoverlay[Bkg][\doif{\pagenumber}{1}{\externalfigure[cow]}]
 
 \setupbackgrounds[paper][background=Bkg]
 
 \starttext \noheaderandfooterlines
 \dorecurse{5}{\input knuth\par}
 \stoptext

If you want to create a title page (which may not be your intention),
why not simply

\definemakeup[titlepage][align=middle]
\defineoverlay[COW][\externalfigure[cow]]

\starttext
\setupbackgrounds[page][background=COW]
\starttitlepagemakeup
A title
\stoptitlepagemakeup
\setupbackgrounds[page][background=]
\setuppagenumbering[alternative=doublesided,way=bytext]
\dorecurse{5}{\input knuth\par}
\stoptext


Question (for Wolfgang):
Why did you use paper rather than page (what is the difference)?

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Background on the 1st page only, page numbering from the 2nd page

2012-05-02 Thread Procházka Lukáš Ing . - Pontex s . r . o .

Thanks for the code -

- actually, I'm not trying to create a typical book title page but just a kind of 
cover page.

But I'll keep your suggestion in mind, I may use it in the future.

Thanks anyway.

Best regards,

Lukas


On Wed, 02 May 2012 15:22:01 +0200, Alan BRASLAU alan.bras...@cea.fr wrote:


On Wed, 2 May 2012 14:24:24 +0200
Wolfgang Schuster schuster.wolfg...@googlemail.com wrote:



Am 02.05.2012 um 09:45 schrieb Procházka Lukáš Ing. - Pontex s. r. o.:

 how to specify the page background for the first page only and how
 to start page numbering from the second page?

\defineoverlay[Bkg][\doif{\pagenumber}{1}{\externalfigure[cow]}]

\setupbackgrounds[paper][background=Bkg]

\starttext \noheaderandfooterlines
\dorecurse{5}{\input knuth\par}
\stoptext


If you want to create a title page (which may not be your intention),
why not simply

\definemakeup[titlepage][align=middle]
\defineoverlay[COW][\externalfigure[cow]]

\starttext
\setupbackgrounds[page][background=COW]
\starttitlepagemakeup
A title
\stoptitlepagemakeup
\setupbackgrounds[page][background=]
\setuppagenumbering[alternative=doublesided,way=bytext]
\dorecurse{5}{\input knuth\par}
\stoptext



--
Ing. Lukáš Procházka [mailto:l...@pontex.cz]
Pontex s. r. o.  [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Changing navigation symbol

2012-04-21 Thread Wolfgang Schuster

Am 21.04.2012 um 11:07 schrieb Markus Finke:

 or switch off this feature?
 
 Yes (but it’s disabled by default)
 
 
 \setupstructure   [state=start]
 
 \setupinteraction [ state=start,
   option=bookmark,
   openaction={firstpage,FitHeight},
 menu=on,
click=yes,
contrastcolor=interactioncolor ]
 
 \setupinteractionscreen [option=bookmark]
 
 
 I’ve changed something but I can’t find the relevant option. Any idea?

When you have a problem you should make a minimal example and tell which 
version of context you’re using.

mtx-context | current version: 2012.04.17 22:37

When I run this example I don’t get the symbol unless I enable the indicator:

%\setupnote[footnote][indicator=yes]

\starttext
\dorecurse{4}{\input knuth\doif{\recurselevel}{4}{\footnote{\input 
zapf\par}}\par}
\stoptext

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Comma separating multiple footnotes

2012-04-13 Thread Wolfgang Schuster

Am 12.04.2012 um 23:34 schrieb Kip Warner:

 On Tue, 2012-04-10 at 11:21 +0200, Wolfgang Schuster wrote:
 Am 10.04.2012 um 03:14 schrieb Kip Warner:
 
 Hey list,
 
 Is there any means of setting up footnotes such that whenever they are
 tangential, they are automatically separated by a comma delimiter?
 
 No there isnt but its not hard hard to add a separator because its already 
 possible to change the distance between the numbers.
 
 Would that be done with \setupnotation or maybe \setupfootnotes? Either way, 
 I'm not sure how to do this.


I wrote a patch for the footnote code where you can set a symbol between the 
numbers with \setupnote[footnote][textseparator=…] but it’s decision to include 
it.

\unprotect

\unexpanded\def\strc_notes_inject_symbol
  {\removeunwantedspaces
   \doifitalicelse\/\donothing % Charles IV \footnote{the fourth}
   \ifdim\lastkern=\notesignal
%\kern\noteparameter\c!distance % yes or no note font? or main text
 \strc_notes_inject_separator
   \fi
   \nobreak
   \begingroup
   \currentconstructionsynchronize % this flushes the data to the list
   \strc_notes_register_note_page % this registers the symbol page number (late)
   \strc_notes_interaction_check_inline
   \strc_notes_set_style_color_inline\c!textstyle\c!textcolor
   \hbox \strc_notes_get_reference_attribute_symbol \bgroup
   \dostarttagged\t!descriptionsymbol\currentnote
   \dotagsetnotesymbol
   
\noteparameter\c!textcommand{\ctxcommand{noteprefixednumber(\currentnote,\currentnotenumber)}}%
   % the next one can cycle so we need to make sure it has no advance width
   \doif{\noteparameter\c!indicator}\v!yes\strc_notes_inject_pointer
   \dostoptagged
   \egroup
   \endgroup
   \dostoptagged % check
   \globallet\lastnotesymbol\relax}

\unexpanded\def\strc_notes_inject_dummy % temp hack
  {\removeunwantedspaces
   \doifitalicelse\/\donothing % Charles IV \footnote{the fourth}
   \ifdim\lastkern=\notesignal
%\kern\noteparameter\c!distance % yes or no note font? or main text
 \strc_notes_inject_separator
   \fi
   \nobreak
   \hbox to .5em{}%
   \globallet\lastnotesymbol\relax}

\def\strc_notes_inject_separator
  {\edef\p_textseparator{\noteparameter\c!textseparator}%
   \ifx \p_textseparator \empty
 \kern\noteparameter\c!distance
   \else
 \nobreak\hbox\bgroup
   \strc_notes_interaction_check_inline
   \strc_notes_set_style_color_inline\c!textstyle\c!textcolor
   \noteparameter\c!textcommand{\p_textseparator}%
   \kern\noteparameter\c!distance
 \egroup\nobreak
   \fi}

\protect

\setupnote
  [footnote]
  [
 textseparator={,},
 textstyle=italic,
 textcolor=red,
  distance=.5em,
  ]

\starttext
Text\footnote{One}\footnote{Two}\footnote{Three}
\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] gnuplot not working

2012-04-11 Thread John Devereux

Hi all,

Is there a problem with gnuplot? I get an error with the minimal example
on the wiki. I think the generated .plt file has an error; it works if I
manually delete the fontscale 1 bit and run context on
test-gnuplot-1.tmp.

Using latest beta, tried with current official gnuplot as well as
mojca-patched version.

Thanks,

John


==
test-gnuplot-1.plt:

# Do not modify this file - all changes will be overwritten
# Change test.tex instead.
set terminal context size 5in,3in fontscale 1 
load 'test-gnuplot-inclusions.tmp'
set output test-gnuplot-1-ctx.tex
load 'test-gnuplot-1.tmp'

==
text.tex:

\usemodule[gnuplot]

% write a script for gnuplot
\startGNUPLOTscript[sin]
   plot sin(x)
\stopGNUPLOTscript

% include the resulting graphic into the document
\useGNUPLOTgraphic[sin]

==

log:

mtx-context | run 1: luatex 
--fmt=/home/jd/context/tex/texmf-cache/luatex-cache/context/2448223e6631addb83df348d74153606/formats/cont-en
 
--lua=/home/jd/context/tex/texmf-cache/luatex-cache/context/2448223e6631addb83df348d74153606/formats/cont-en.lui
 --backend=pdf ./test.tex \stoptext
This is LuaTeX, Version beta-0.70.1-2011051923 (rev 4277) 
 \write18 enabled.
(test.tex

ConTeXt  ver: 2012.04.06 23:08 MKIV  fmt: 2012.4.7  int: english/english

system   cont-new.mkiv loaded
(/home/jd/context/tex/texmf-context/tex/context/base/cont-new.mkiv
system   beware: some patches loaded from cont-new.mkiv
)
system   test.top loaded
(test.top)
fontslatin modern fonts are not preloaded
languageslanguage en is active
resolversmodules  loaded: 'gnuplot'
(/home/jd/context/tex/texmf-modules/tex/context/third/gnuplot/t-gnuplot.tex
loading  Gnuplot module
fontstypescripts  unknown: library 'loc'
(/home/jd/context/tex/texmf-context/tex/context/base/type-imp-texgyre.mkiv)))
mtxrun  |
mtxrun  | executing: gnuplot test-gnuplot-1.plt
mtxrun  |
mtxrun  |
aaa  mtxrun --direct gnuplot test-gnuplot-1.plt
! Missing number, treated as zero.

system   tex  error on line 0 in file : Missing number, treated as 
zero ...

empty file

to be read again 
   \let 
\doprocessGNUPLOTfile ...OTnumber \zerocount \let 
  \normalstarttikzpicture =\...
argument ...NUPLOTfile [sin][\@@GNUPLOTresult ]}
  \doif {\@@GNUPLOTterminal ...
\firstofoneargument #1-#1
  
argument ...}\writeandprocessGNUPLOTscript {sin}
  \doifelse {\@@GNUPLOTtermi...
\firstoftwoarguments #1#2-#1
 
...
* ./test.tex \stoptext

? 


-- 

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


  1   2   3   >